diff --git a/sc2/src/sc2code/confirm.c b/sc2/src/sc2code/confirm.c index 254206b45..02300f0fa 100644 --- a/sc2/src/sc2code/confirm.c +++ b/sc2/src/sc2code/confirm.c @@ -142,8 +142,7 @@ DoConfirmExit (void) if (PulsedInputState.key[KEY_MENU_SELECT]) { done = TRUE; - PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 1), - 0, NotPositional (), NULL, GAME_SOUND_PRIORITY); + PlayMenuSound (MENU_SOUND_SUCCESS); } else if (PulsedInputState.key[KEY_MENU_CANCEL]) { @@ -154,9 +153,7 @@ DoConfirmExit (void) { response = !response; DrawConfirmationWindow (response); - PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 0), - 0, NotPositional (), NULL, GAME_SOUND_PRIORITY); - + PlayMenuSound (MENU_SOUND_MOVE); } TaskSwitch (); } while (!done); diff --git a/sc2/src/sc2code/gameinp.c b/sc2/src/sc2code/gameinp.c index 8a6832314..a0d58d273 100644 --- a/sc2/src/sc2code/gameinp.c +++ b/sc2/src/sc2code/gameinp.c @@ -289,7 +289,7 @@ DoInput (PVOID pInputState, BOOLEAN resetInput) S = MenuSounds; if (input & sound_1) - S = SetAbsSoundIndex (S, 1); + S = SetAbsSoundIndex (S, MENU_SOUND_SUCCESS); PlaySoundEffect (S, 0, NotPositional (), NULL, 0); } diff --git a/sc2/src/sc2code/getchar.c b/sc2/src/sc2code/getchar.c index c0085d18b..d17d7bab5 100644 --- a/sc2/src/sc2code/getchar.c +++ b/sc2/src/sc2code/getchar.c @@ -402,8 +402,7 @@ DoTextEntry (PTEXTENTRY_STATE pTES) pTES->InsPt = CacheInsPt; pTES->CursorPos = CacheCursorPos; - PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2), - 0, NotPositional (), NULL, 0); + PlayMenuSound (MENU_SOUND_FAILURE); } } diff --git a/sc2/src/sc2code/melee.c b/sc2/src/sc2code/melee.c index 5bdba0fce..d9987dda5 100644 --- a/sc2/src/sc2code/melee.c +++ b/sc2/src/sc2code/melee.c @@ -1712,8 +1712,7 @@ DoMelee (PMELEE_STATE pMS) case START_MELEE: if (pMS->star_bucks[0] == 0 || pMS->star_bucks[1] == 0) { - PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2), - 0, NotPositional (), NULL, GAME_SOUND_PRIORITY); + PlayMenuSound (MENU_SOUND_FAILURE); break; } @@ -1781,8 +1780,7 @@ DoMelee (PMELEE_STATE pMS) if (pMS->star_bucks[pMS->side]) DoSaveTeam (pMS); else - PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2), - 0, NotPositional (), NULL, GAME_SOUND_PRIORITY); + PlayMenuSound (MENU_SOUND_FAILURE); break; case CONTROLS_TOP: case CONTROLS_BOT: diff --git a/sc2/src/sc2code/outfit.c b/sc2/src/sc2code/outfit.c index ae64ff111..aff19f3cc 100644 --- a/sc2/src/sc2code/outfit.c +++ b/sc2/src/sc2code/outfit.c @@ -244,7 +244,10 @@ DoInstallModule (PMENU_STATE pMS) if (GLOBAL_SIS (ResUnits) < (DWORD)(GLOBAL (ModuleCost[new_slot_piece]) * MODULE_COST_SCALE)) + { // not enough RUs to build + PlayMenuSound (MENU_SOUND_FAILURE); return (TRUE); + } } else if (new_slot_piece == EMPTY_SLOT + 2) { @@ -252,7 +255,10 @@ DoInstallModule (PMENU_STATE pMS) { if (GLOBAL_SIS (CrewEnlisted) > CREW_POD_CAPACITY * (CountSISPieces (CREW_POD) - 1)) + { // crew pod still needed for crew recruited + PlayMenuSound (MENU_SOUND_FAILURE); return (TRUE); + } } else if (old_slot_piece == FUEL_TANK || old_slot_piece == HIGHEFF_FUELSYS) @@ -266,13 +272,19 @@ DoInstallModule (PMENU_STATE pMS) volume -= (old_slot_piece == FUEL_TANK ? FUEL_TANK_CAPACITY : HEFUEL_TANK_CAPACITY); if (GLOBAL_SIS (FuelOnBoard) > volume + FUEL_RESERVE) + { // fuel tank still needed for the fuel on board + PlayMenuSound (MENU_SOUND_FAILURE); return (TRUE); + } } else if (old_slot_piece == STORAGE_BAY) { if (GLOBAL_SIS (TotalElementMass) > STORAGE_BAY_CAPACITY * (CountSISPieces (STORAGE_BAY) - 1)) + { // storage bay still needed for the cargo + PlayMenuSound (MENU_SOUND_FAILURE); return (TRUE); + } } } } @@ -552,6 +564,10 @@ ChangeFuelQuantity (void) GetGaugeRect (&r, FALSE); SetFlashRect (&r, (FRAME)0); } + else + { // no more room for fuel or not enough RUs + PlayMenuSound (MENU_SOUND_FAILURE); + } UnlockMutex (GraphicsLock); } else if (PulsedInputState.key[KEY_MENU_DOWN]) @@ -571,6 +587,10 @@ ChangeFuelQuantity (void) DrawFilledRectangle (&r); } } + else + { // no fuel left to drain + PlayMenuSound (MENU_SOUND_FAILURE); + } SetContext (StatusContext); GetGaugeRect (&r, FALSE); SetFlashRect (&r, (FRAME)0); diff --git a/sc2/src/sc2code/pickmele.c b/sc2/src/sc2code/pickmele.c index ee364b305..8a056c6d8 100644 --- a/sc2/src/sc2code/pickmele.c +++ b/sc2/src/sc2code/pickmele.c @@ -151,7 +151,7 @@ DoGetMelee (GETMELEE_STATE *gms) gms->row = new_row; gms->col = new_col; - PlaySoundEffect (MenuSounds, 0, NotPositional (), NULL, 0); + PlayMenuSound (MENU_SOUND_MOVE); ChangeSelection: LockMutex (GraphicsLock); gms->flash_rect.corner.x = PICK_X_OFFS @@ -363,8 +363,7 @@ GetMeleeStarShip (STARSHIPPTR LastStarShipPtr, COUNT which_player) StarShipPtr->captains_name_index = 0; UnlockStarShip (&race_q[which_player], gmstate.hBattleShip); - PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 1), 0, - NotPositional (), NULL, 0); + PlayMenuSound (MENU_SOUND_SUCCESS); WaitForSoundEnd (0); } diff --git a/sc2/src/sc2code/pickship.c b/sc2/src/sc2code/pickship.c index ffe43f0f1..cbcfccfc7 100644 --- a/sc2/src/sc2code/pickship.c +++ b/sc2/src/sc2code/pickship.c @@ -63,8 +63,7 @@ DoPickBattleShip (PMENU_STATE pMS) { if ((HSTARSHIP)pMS->CurFrame) { - PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 1), - 0, NotPositional (), NULL, GAME_SOUND_PRIORITY); + PlayMenuSound (MENU_SOUND_SUCCESS); return (FALSE); } } @@ -99,8 +98,7 @@ DoPickBattleShip (PMENU_STATE pMS) else if (new_row == NUM_PICK_SHIP_ROWS) new_row = 0; - PlaySoundEffect (MenuSounds, 0, NotPositional (), - NULL, GAME_SOUND_PRIORITY); + PlayMenuSound (MENU_SOUND_MOVE); LockMutex (GraphicsLock); diff --git a/sc2/src/sc2code/restart.c b/sc2/src/sc2code/restart.c index 83fd67bba..53116fffc 100644 --- a/sc2/src/sc2code/restart.c +++ b/sc2/src/sc2code/restart.c @@ -196,8 +196,6 @@ else if (InputState & DEVICE_EXIT) return (FALSE); UnbatchGraphics (); return TRUE; case QUIT_GAME: - PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 1), - 0, NotPositional (), NULL, GAME_SOUND_PRIORITY); fade_buf[0] = FadeAllToBlack; SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND / 2)); diff --git a/sc2/src/sc2code/shipyard.c b/sc2/src/sc2code/shipyard.c index 882257bb9..12bbf7089 100644 --- a/sc2/src/sc2code/shipyard.c +++ b/sc2/src/sc2code/shipyard.c @@ -767,6 +767,10 @@ DoModifyShips (PMENU_STATE pMS) SetFlashRect (&r, (FRAME)0); UnlockMutex (GraphicsLock); } + else + { // not enough RUs to build + PlayMenuSound (MENU_SOUND_FAILURE); + } SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT | MENU_SOUND_CANCEL); @@ -890,6 +894,10 @@ DoModifyShips (PMENU_STATE pMS) SetFlashRect (&r, (FRAME)0); SetContext (SpaceContext); } + else + { // at capacity or not enough RUs + PlayMenuSound (MENU_SOUND_FAILURE); + } } else { @@ -925,6 +933,10 @@ DoModifyShips (PMENU_STATE pMS) SetContext (SpaceContext); SetFlashRect (&r, (FRAME)0); } + else + { // at capacity or not enough RUs + PlayMenuSound (MENU_SOUND_FAILURE); + } UnlockStarShip (&GLOBAL (avail_race_q), hTemplate); } @@ -952,6 +964,10 @@ DoModifyShips (PMENU_STATE pMS) SetFlashRect (&r, (FRAME)0); SetContext (SpaceContext); } + else + { // no crew to dismiss + PlayMenuSound (MENU_SOUND_FAILURE); + } } else { @@ -967,6 +983,10 @@ DoModifyShips (PMENU_STATE pMS) crew_delta = -1; --StarShipPtr->ShipInfo.crew_level; } + else + { // no crew to dismiss + PlayMenuSound (MENU_SOUND_FAILURE); + } ShowShipCrew (StarShipPtr, &pMS->flash_rect0); r.corner.x = pMS->flash_rect0.corner.x; r.corner.y = pMS->flash_rect0.corner.y