diff --git a/sc2/ChangeLog b/sc2/ChangeLog index e6c33e07a..ea8318ab4 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,6 @@ Changes towards version 0.4: +- Fine-grained control of menu sounds, "MenuSounds" global now + guaranteed to always be non-null -Michael - Added support for stdio file access through temporary files to uio. added uio_copyFile to uio - SvdB - Added uio_getFileLocation() and uio_getMountFileSystemType() to uio. diff --git a/sc2/src/sc2code/comm.c b/sc2/src/sc2code/comm.c index 641a2740a..b3d0a3487 100644 --- a/sc2/src/sc2code/comm.c +++ b/sc2/src/sc2code/comm.c @@ -1557,6 +1557,8 @@ AlienTalkSegue (COUNT wait_track) static BOOLEAN DoCommunication (PENCOUNTER_STATE pES) { + SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT); + if (!(CommData.AlienTransitionDesc.AnimFlags & (TALK_INTRO | TALK_DONE))) { AlienTalkSegue ((COUNT)~0); diff --git a/sc2/src/sc2code/confirm.c b/sc2/src/sc2code/confirm.c index 27cd1b291..0b72f3ea9 100644 --- a/sc2/src/sc2code/confirm.c +++ b/sc2/src/sc2code/confirm.c @@ -150,6 +150,8 @@ DoConfirmExit (void) if (CurrentMenuState.select) { done = TRUE; + PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 1), + 0, NotPositional (), NULL, GAME_SOUND_PRIORITY); } else if (CurrentMenuState.cancel) { @@ -160,6 +162,9 @@ DoConfirmExit (void) { response = !response; DrawConfirmationWindow (response); + PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 0), + 0, NotPositional (), NULL, GAME_SOUND_PRIORITY); + } TaskSwitch (); } while (!done); diff --git a/sc2/src/sc2code/encount.c b/sc2/src/sc2code/encount.c index ae6d02128..532474e3f 100644 --- a/sc2/src/sc2code/encount.c +++ b/sc2/src/sc2code/encount.c @@ -23,6 +23,7 @@ static BOOLEAN DoSelectAction (PMENU_STATE pMS) { + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); if (GLOBAL (CurrentActivity) & CHECK_ABORT) { pMS->CurState = ATTACK + 1; diff --git a/sc2/src/sc2code/gameinp.c b/sc2/src/sc2code/gameinp.c index 527c4c726..d09dfad9e 100644 --- a/sc2/src/sc2code/gameinp.c +++ b/sc2/src/sc2code/gameinp.c @@ -50,6 +50,8 @@ static DWORD _max_accel, _min_accel, _step_accel; static BOOLEAN _gestalt_keys; int ExitState; +static MENU_SOUND_FLAGS sound_0, sound_1; + volatile CONTROLLER_INPUT_STATE ImmediateInputState; volatile MENU_INPUT_STATE ImmediateMenuState; @@ -269,6 +271,7 @@ DoInput (PVOID pInputState, BOOLEAN resetInput) } do { + MENU_SOUND_FLAGS input; TaskSwitch (); UpdateInputState (); @@ -284,17 +287,25 @@ DoInput (PVOID pInputState, BOOLEAN resetInput) if (CurrentInputState.exit) ExitState = ConfirmExit (); + + input = MENU_SOUND_NONE; + if (CurrentMenuState.up) input |= MENU_SOUND_UP; + if (CurrentMenuState.down) input |= MENU_SOUND_DOWN; + if (CurrentMenuState.left) input |= MENU_SOUND_LEFT; + if (CurrentMenuState.right) input |= MENU_SOUND_RIGHT; + if (CurrentMenuState.select) input |= MENU_SOUND_SELECT; + if (CurrentMenuState.cancel) input |= MENU_SOUND_CANCEL; + if (CurrentMenuState.special) input |= MENU_SOUND_SPECIAL; + if (CurrentMenuState.page_up) input |= MENU_SOUND_PAGEUP; + if (CurrentMenuState.page_down) input |= MENU_SOUND_PAGEDOWN; + if (CurrentMenuState.del) input |= MENU_SOUND_DELETE; if (MenuSounds && (pSolarSysState == 0 /* see if in menu */ || pSolarSysState->MenuState.CurState || pSolarSysState->MenuState.Initialized > 2) - && (CurrentMenuState.select - || CurrentMenuState.up - || CurrentMenuState.down - || CurrentMenuState.left - || CurrentMenuState.right) + && (input & (sound_0 | sound_1)) #ifdef NEVER && !PLRPlaying ((MUSIC_REF)~0) #endif /* NEVER */ @@ -303,7 +314,7 @@ DoInput (PVOID pInputState, BOOLEAN resetInput) SOUND S; S = MenuSounds; - if (CurrentMenuState.select) + if (input & sound_1) S = SetAbsSoundIndex (S, 1); PlaySoundEffect (S, 0, NotPositional (), NULL, 0); @@ -317,6 +328,21 @@ DoInput (PVOID pInputState, BOOLEAN resetInput) } +void +SetMenuSounds (MENU_SOUND_FLAGS s0, MENU_SOUND_FLAGS s1) +{ + sound_0 = s0; + sound_1 = s1; +} + +void +GetMenuSounds (MENU_SOUND_FLAGS *s0, MENU_SOUND_FLAGS *s1) +{ + *s0 = sound_0; + *s1 = sound_1; +} + + BATTLE_INPUT_STATE p1_combat_summary (void) { diff --git a/sc2/src/sc2code/gameopt.c b/sc2/src/sc2code/gameopt.c index 8f53234f9..be30fbfb3 100644 --- a/sc2/src/sc2code/gameopt.c +++ b/sc2/src/sc2code/gameopt.c @@ -444,6 +444,8 @@ DoNaming (PMENU_STATE pMS) DoInput (pMS, TRUE); DisableCharacterMode (); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + pMS->InputFunc = DoSettings; pMS->CurState = (BYTE)pMS->delta_item; pMS->delta_item = 0; @@ -502,6 +504,7 @@ DoSettings (PMENU_STATE pMS) return (FALSE); cur_speed = (BYTE)(GLOBAL (glob_flags) & COMBAT_SPEED_MASK) >> COMBAT_SPEED_SHIFT; + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); if (!pMS->Initialized) { DrawMenuStateStrings (PM_SOUND_ON, pMS->CurState); @@ -571,6 +574,8 @@ DoQuitMenu (PMENU_STATE pMS) if (GLOBAL (CurrentActivity) & CHECK_ABORT) return (FALSE); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + if (!pMS->Initialized) { DrawMenuStateStrings (PM_NO_QUIT, pMS->CurState); @@ -984,6 +989,7 @@ DoPickGame (PMENU_STATE pMS) return (FALSE); } first_time = (BOOLEAN)(pMS->Initialized == 0); + SetMenuSounds (MENU_SOUND_ARROWS | MENU_SOUND_PAGEUP | MENU_SOUND_PAGEDOWN, MENU_SOUND_SELECT); if (!pMS->Initialized) { @@ -1288,8 +1294,7 @@ PickGame (PMENU_STATE pMS) pMS->CurString = (STRING)&desc_array[0]; UnlockMutex (GraphicsLock); - DoInput (pMS, TRUE); - + DoInput (pMS, TRUE); LockMutex (GraphicsLock); pMS->Initialized = -1; pMS->InputFunc = DoGameOptions; @@ -1357,6 +1362,8 @@ DoGameOptions (PMENU_STATE pMS) if (LastActivity == CHECK_LOAD) force_select = TRUE; + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + if (pMS->Initialized <= 0) { if (LastActivity == CHECK_LOAD) @@ -1410,6 +1417,7 @@ GameOptions (void) MenuState.InputFunc = DoGameOptions; MenuState.CurState = SAVE_GAME; + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); DoInput ((PVOID)&MenuState, TRUE); pLocMenuState = 0; diff --git a/sc2/src/sc2code/hyper.c b/sc2/src/sc2code/hyper.c index 57d9f486c..92294377a 100644 --- a/sc2/src/sc2code/hyper.c +++ b/sc2/src/sc2code/hyper.c @@ -1614,6 +1614,7 @@ UnbatchGraphics (); SetFlashRect ((PRECT)~0L, (FRAME)0); UnlockMutex (GraphicsLock); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); DoInput ((PVOID)&MenuState, TRUE); LockMutex (GraphicsLock); diff --git a/sc2/src/sc2code/libs/video/vidplayer.c b/sc2/src/sc2code/libs/video/vidplayer.c index 659b77738..ff97ffcb7 100644 --- a/sc2/src/sc2code/libs/video/vidplayer.c +++ b/sc2/src/sc2code/libs/video/vidplayer.c @@ -445,6 +445,7 @@ TFB_VideoInput (VIDEO_REF VidRef) vis.InputFunc = TFB_DoVideoInput; vis.CurVideo = VidRef; + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); DoInput (&vis, TRUE); } diff --git a/sc2/src/sc2code/melee.c b/sc2/src/sc2code/melee.c index bfadf4886..3892ed4c3 100644 --- a/sc2/src/sc2code/melee.c +++ b/sc2/src/sc2code/melee.c @@ -844,6 +844,8 @@ DoLoadTeam (PMELEE_STATE pMS) if (GLOBAL (CurrentActivity) & CHECK_ABORT) return (FALSE); + SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN | MENU_SOUND_PAGEUP | MENU_SOUND_PAGEDOWN, MENU_SOUND_SELECT); + if (!pMS->Initialized) { LockMutex (GraphicsLock); @@ -1164,6 +1166,7 @@ DoEdit (PMELEE_STATE pMS) { if (GLOBAL (CurrentActivity) & CHECK_ABORT) return (FALSE); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT | MENU_SOUND_DELETE); if (!pMS->Initialized) { pMS->CurIndex = pMS->TeamImage[pMS->side].ShipList[pMS->row][pMS->col]; @@ -1308,6 +1311,8 @@ DoPickShip (PMELEE_STATE pMS) if (GLOBAL (CurrentActivity) & CHECK_ABORT) return (FALSE); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + if (pMS->Initialized <= 0) { if (pMS->CurIndex == (BYTE)~0 && pMS->Initialized == 0) @@ -1585,6 +1590,7 @@ DoMelee (PMELEE_STATE pMS) if (GLOBAL (CurrentActivity) & CHECK_ABORT) return (FALSE); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); if (!pMS->Initialized) { pMS->Initialized = TRUE; @@ -2049,6 +2055,7 @@ Melee (void) MenuState.side = 0; MenuState.star_bucks[0] = GetTeamValue (&MenuState.TeamImage[0]); MenuState.star_bucks[1] = GetTeamValue (&MenuState.TeamImage[1]); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); DoInput ((PVOID)&MenuState, TRUE); WaitForSoundEnd (TFBSOUND_WAIT_ALL); diff --git a/sc2/src/sc2code/outfit.c b/sc2/src/sc2code/outfit.c index 15fb527a5..6567a6f41 100644 --- a/sc2/src/sc2code/outfit.c +++ b/sc2/src/sc2code/outfit.c @@ -181,6 +181,8 @@ DoInstallModule (PMENU_STATE pMS) cancel = CurrentMenuState.cancel; motion = CurrentMenuState.left || CurrentMenuState.right || CurrentMenuState.up || CurrentMenuState.down; + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + FirstItem = 0; switch (NewState = pMS->CurState) { @@ -754,6 +756,16 @@ ExitOutfit: } else { + switch (pMS->CurState) + { + case OUTFIT_DOFUEL: + SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT | MENU_SOUND_CANCEL); + break; + default: + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + break; + } + if (pMS->CurState == OUTFIT_DOFUEL) ChangeFuelQuantity (); else diff --git a/sc2/src/sc2code/pickship.c b/sc2/src/sc2code/pickship.c index b42f1a6e5..33cf59112 100644 --- a/sc2/src/sc2code/pickship.c +++ b/sc2/src/sc2code/pickship.c @@ -249,6 +249,7 @@ OldContext = SetContext (SpaceContext); UnlockMutex (GraphicsLock); pMenuState = &MenuState; + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); DoInput ((PVOID)&MenuState, TRUE); pMenuState = 0; LockMutex (GraphicsLock); diff --git a/sc2/src/sc2code/planets/cargo.c b/sc2/src/sc2code/planets/cargo.c index b8b826331..892a553b0 100644 --- a/sc2/src/sc2code/planets/cargo.c +++ b/sc2/src/sc2code/planets/cargo.c @@ -358,6 +358,7 @@ Cargo (PMENU_STATE pMS) DrawStatusMessage ((UNICODE *)~0); UnlockMutex (GraphicsLock); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); DoInput ((PVOID)pMS, TRUE); pMS->InputFunc = DoFlagshipCommands; diff --git a/sc2/src/sc2code/planets/devices.c b/sc2/src/sc2code/planets/devices.c index 3c032a9d3..22b76afee 100644 --- a/sc2/src/sc2code/planets/devices.c +++ b/sc2/src/sc2code/planets/devices.c @@ -625,6 +625,7 @@ Devices (PMENU_STATE pMS) pMS->CurFrame = (FRAME)DeviceMap; TFB_ResetControls (); DoManipulateDevices (pMS); /* to make sure it's initialized */ + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); DoInput ((PVOID)pMS, TRUE); pMS->CurFrame = 0; diff --git a/sc2/src/sc2code/planets/genorz.c b/sc2/src/sc2code/planets/genorz.c index 89b714b0e..cd679be60 100644 --- a/sc2/src/sc2code/planets/genorz.c +++ b/sc2/src/sc2code/planets/genorz.c @@ -69,7 +69,7 @@ GenerateAndrosynth (BYTE control) pPSD = (PPLANETSIDE_DESC)pMenuState->ModuleFrame; UnbatchGraphics (); - DoDiscoveryReport (pPSD->OldMenuSounds); + DoDiscoveryReport (MenuSounds); BatchGraphics (); pSolarSysState->SysInfo.PlanetInfo.DiscoveryString = SetRelStringTableIndex ( diff --git a/sc2/src/sc2code/planets/genvux.c b/sc2/src/sc2code/planets/genvux.c index 3a0e5215f..fcc72d5f8 100644 --- a/sc2/src/sc2code/planets/genvux.c +++ b/sc2/src/sc2code/planets/genvux.c @@ -315,7 +315,7 @@ GenerateVUX (BYTE control) pPSD = (PPLANETSIDE_DESC)pMenuState->ModuleFrame; UnbatchGraphics (); - DoDiscoveryReport (pPSD->OldMenuSounds); + DoDiscoveryReport (MenuSounds); BatchGraphics (); pPSD->InTransit = TRUE; diff --git a/sc2/src/sc2code/planets/lander.c b/sc2/src/sc2code/planets/lander.c index 71abc91de..072a59a7d 100644 --- a/sc2/src/sc2code/planets/lander.c +++ b/sc2/src/sc2code/planets/lander.c @@ -611,7 +611,7 @@ CheckObjectCollision (COUNT index) && CurStarDescPtr->Index != ANDROSYNTH_DEFINED) { UnbatchGraphics (); - DoDiscoveryReport (pPSD->OldMenuSounds); + DoDiscoveryReport (MenuSounds); BatchGraphics (); } if (ElementPtr->mass_points == 0) @@ -1890,8 +1890,6 @@ PlanetSide (PMENU_STATE pMS) memset ((PPLANETSIDE_DESC)&PSD, 0, sizeof (PSD)); PSD.InTransit = TRUE; - PSD.OldMenuSounds = MenuSounds; - MenuSounds = 0; PSD.TectonicsChance = TectonicsChanceTab[pSolarSysState->SysInfo.PlanetInfo.Tectonics]; @@ -1973,6 +1971,7 @@ PlanetSide (PMENU_STATE pMS) pMS->Initialized = FALSE; pMS->InputFunc = DoPlanetSide; + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); DoInput ((PVOID)pMS, FALSE); if (!(GLOBAL (CurrentActivity) & CHECK_ABORT)) @@ -2079,7 +2078,7 @@ PlanetSide (PMENU_STATE pMS) } ZeroVelocityComponents (&GLOBAL (velocity)); - MenuSounds = PSD.OldMenuSounds; + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); pSolarSysState->MenuState.Initialized -= 4; pSolarSysState->PauseRotate = 0; diff --git a/sc2/src/sc2code/planets/pstarmap.c b/sc2/src/sc2code/planets/pstarmap.c index 2fe5d48cd..e8f9d7e41 100644 --- a/sc2/src/sc2code/planets/pstarmap.c +++ b/sc2/src/sc2code/planets/pstarmap.c @@ -1078,7 +1078,6 @@ DoneSphereGrowth: static BOOLEAN DoStarMap (void) { - SOUND OldMenuSounds; MENU_STATE MenuState; POINT universe; //FRAME OldFrame; @@ -1134,11 +1133,9 @@ DoStarMap (void) UnbatchGraphics (); UnlockMutex (GraphicsLock); - OldMenuSounds = MenuSounds; - MenuSounds = 0; - + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); DoInput ((PVOID)&MenuState, FALSE); - MenuSounds = OldMenuSounds; + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); pMenuState = 0; diff --git a/sc2/src/sc2code/planets/roster.c b/sc2/src/sc2code/planets/roster.c index ae1cdff50..faf4beffa 100644 --- a/sc2/src/sc2code/planets/roster.c +++ b/sc2/src/sc2code/planets/roster.c @@ -225,6 +225,15 @@ DoModifyRoster (PMENU_STATE pMS) down = CurrentMenuState.down; horiz = CurrentMenuState.left || CurrentMenuState.right; + if (pMS->Initialized && (pMS->CurState & SHIP_TOGGLE)) + { + SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT | MENU_SOUND_CANCEL); + } + else + { + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + } + if (!pMS->Initialized) { pMS->InputFunc = DoModifyRoster; @@ -436,6 +445,7 @@ Roster (void) MenuState.flash_frame0 = (FRAME)ship_pos; MenuState.flash_frame1 = (FRAME)modified_ship_pos; + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); DoInput ((PVOID)&MenuState, TRUE); pMenuState = pOldMenuState; diff --git a/sc2/src/sc2code/planets/scan.c b/sc2/src/sc2code/planets/scan.c index ab597d8ec..2c4317c3e 100644 --- a/sc2/src/sc2code/planets/scan.c +++ b/sc2/src/sc2code/planets/scan.c @@ -669,11 +669,7 @@ PickPlanetSide (PMENU_STATE pMS) { pMS->InputFunc = PickPlanetSide; SetMenuRepeatDelay (0, 0, 0, FALSE); - if (pMS->CurFrame == 0) - { - pMS->CurFrame = (FRAME)MenuSounds; - MenuSounds = 0; - } + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); if (!select) { RECT r; @@ -706,8 +702,7 @@ PickPlanetSide (PMENU_STATE pMS) { STAMP s; - MenuSounds = (SOUND)pMS->CurFrame; - pMS->CurFrame = 0; + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); LockMutex (GraphicsLock); DrawStatusMessage (NULL_PTR); @@ -801,15 +796,12 @@ PickPlanetSide (PMENU_STATE pMS) UnlockMutex (GraphicsLock); ExitPlanetSide: - if (pMS->CurFrame) - { - MenuSounds = (SOUND)pMS->CurFrame; - pMS->CurFrame = 0; - } + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); pMS->InputFunc = DoScan; pMS->CurState = DISPATCH_SHUTTLE; SetDefaultMenuRepeatDelay (); + return (FALSE); } else { @@ -1019,7 +1011,7 @@ DoScan (PMENU_STATE pMS) pMS->Initialized = FALSE; pMS->CurFrame = 0; - return (PickPlanetSide (pMS)); + return PickPlanetSide (pMS); } pSolarSysState->MenuState.Initialized += 4; @@ -1235,6 +1227,7 @@ ScanSystem (void) PrintCoarseScan3DO (); pMenuState = &MenuState; + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); DoInput ((PVOID)&MenuState, FALSE); pMenuState = 0; diff --git a/sc2/src/sc2code/planets/solarsys.c b/sc2/src/sc2code/planets/solarsys.c index e01825df8..e54fdf618 100644 --- a/sc2/src/sc2code/planets/solarsys.c +++ b/sc2/src/sc2code/planets/solarsys.c @@ -1926,6 +1926,7 @@ ExploreSolarSys (void) SolarSysState.GenFunc = GenerateIP (CurStarDescPtr->Index); InitSolarSys (); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); DoInput ((PVOID)&SolarSysState.MenuState, FALSE); UninitSolarSys (); pSolarSysState = 0; diff --git a/sc2/src/sc2code/restart.c b/sc2/src/sc2code/restart.c index 93740c9c6..43e8d7fa5 100644 --- a/sc2/src/sc2code/restart.c +++ b/sc2/src/sc2code/restart.c @@ -289,6 +289,7 @@ LastActivity = WON_LAST_BATTLE; FlushInput (); GLOBAL (CurrentActivity) &= ~CHECK_ABORT; + SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT); DoInput ((PVOID)&MenuState, TRUE); LockMutex (GraphicsLock); diff --git a/sc2/src/sc2code/shipyard.c b/sc2/src/sc2code/shipyard.c index 38da9d81d..57f57e1d8 100644 --- a/sc2/src/sc2code/shipyard.c +++ b/sc2/src/sc2code/shipyard.c @@ -643,6 +643,11 @@ DoModifyShips (PMENU_STATE pMS) SBYTE dx = 0, dy = 0; BYTE NewState; + if (!(pMS->delta_item & MODIFY_CREW_FLAG)) + { + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + } + if (CurrentMenuState.right) dx = 1; if (CurrentMenuState.left) dx = -1; if (CurrentMenuState.up) dy = -1; @@ -709,7 +714,15 @@ DoModifyShips (PMENU_STATE pMS) &GLOBAL (built_ship_q), hStarShip ); } - + if ((pMS->delta_item & MODIFY_CREW_FLAG) && (hStarShip)) + { + SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT | MENU_SOUND_CANCEL); + } + else + { + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + } + LockMutex (GraphicsLock); #ifdef WANT_SHIP_SPINS @@ -759,6 +772,7 @@ DoModifyShips (PMENU_STATE pMS) SetFlashRect ((PRECT)~0L, (FRAME)0); UnlockMutex (GraphicsLock); DrawMenuStateStrings (PM_CREW, SHIPYARD_CREW); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); } else if (select) { @@ -845,7 +859,9 @@ DoModifyShips (PMENU_STATE pMS) } if (!(pMS->delta_item ^= MODIFY_CREW_FLAG)) + { goto ChangeFlashRect; + } else if (hStarShip == 0) { SetContext (StatusContext); @@ -1201,6 +1217,7 @@ DoShipyard (PMENU_STATE pMS) select = CurrentMenuState.select; cancel = CurrentMenuState.cancel; + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); if (!pMS->Initialized) { pMS->InputFunc = DoShipyard; diff --git a/sc2/src/sc2code/starbase.c b/sc2/src/sc2code/starbase.c index 06fdb908c..825745b07 100644 --- a/sc2/src/sc2code/starbase.c +++ b/sc2/src/sc2code/starbase.c @@ -279,6 +279,7 @@ DoStarBase (PMENU_STATE pMS) pMS->CurState = DEPART_BASE; goto ExitStarBase; } + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); if (!pMS->Initialized) { @@ -385,6 +386,7 @@ ExitStarBase: break; } + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); DoInput ((PVOID)pMS, TRUE); pMS->Initialized = FALSE; diff --git a/sc2/src/sc2code/starcon.h b/sc2/src/sc2code/starcon.h index a5c1ab7a9..8f0912153 100644 --- a/sc2/src/sc2code/starcon.h +++ b/sc2/src/sc2code/starcon.h @@ -171,6 +171,21 @@ extern void Introduction (void); int initIO (void); void uninitIO (void); +/* Constants for DoInput */ +typedef UWORD MENU_SOUND_FLAGS; +#define MENU_SOUND_UP ((MENU_SOUND_FLAGS)(1 << 0)) +#define MENU_SOUND_DOWN ((MENU_SOUND_FLAGS)(1 << 1)) +#define MENU_SOUND_LEFT ((MENU_SOUND_FLAGS)(1 << 2)) +#define MENU_SOUND_RIGHT ((MENU_SOUND_FLAGS)(1 << 3)) +#define MENU_SOUND_SELECT ((MENU_SOUND_FLAGS)(1 << 4)) +#define MENU_SOUND_CANCEL ((MENU_SOUND_FLAGS)(1 << 5)) +#define MENU_SOUND_SPECIAL ((MENU_SOUND_FLAGS)(1 << 6)) +#define MENU_SOUND_PAGEUP ((MENU_SOUND_FLAGS)(1 << 7)) +#define MENU_SOUND_PAGEDOWN ((MENU_SOUND_FLAGS)(1 << 8)) +#define MENU_SOUND_DELETE ((MENU_SOUND_FLAGS)(1 << 9)) +#define MENU_SOUND_ARROWS (MENU_SOUND_UP | MENU_SOUND_DOWN | MENU_SOUND_LEFT | MENU_SOUND_RIGHT) +#define MENU_SOUND_NONE ((MENU_SOUND_FLAGS)0) + extern void SetFlashRect (PRECT pRect, FRAME f); extern void DrawStarConBox (PRECT pRect, SIZE BorderWidth, COLOR @@ -179,6 +194,8 @@ extern void DrawStarConBox (PRECT pRect, SIZE BorderWidth, COLOR extern BOOLEAN ConfirmExit (void); extern DWORD SeedRandomNumbers (void); extern void DoInput (PVOID pInputState, BOOLEAN resetInput); +void SetMenuSounds (MENU_SOUND_FLAGS sound_0, MENU_SOUND_FLAGS sound_1); +void GetMenuSounds (MENU_SOUND_FLAGS *sound_0, MENU_SOUND_FLAGS *sound_1); extern BOOLEAN Battle (void); extern void EncounterBattle (void); extern void SetPlayerInput (void);