Clear menu sound interface; added missing failure sounds to Cargo and Roster (bug #842)

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2288 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2006-03-24 20:35:20 +00:00
parent 1dc2801c7f
commit dc09f3f8fd
5 changed files with 39 additions and 31 deletions
+4
View File
@@ -316,6 +316,10 @@ DoDiscardCargo (PMENU_STATE pMS)
ShowRemainingCapacity (); ShowRemainingCapacity ();
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
} }
else
{ // no element left in cargo hold
PlayMenuSound (MENU_SOUND_FAILURE);
}
} }
else else
{ {
+3 -6
View File
@@ -211,8 +211,7 @@ DeviceFailed (BYTE which_device)
{ {
BYTE fade_buf[1]; BYTE fade_buf[1];
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 3), PlayMenuSound (MENU_SOUND_INVOKED);
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
fade_buf[0] = FadeAllToWhite; fade_buf[0] = FadeAllToWhite;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND * 1) SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND * 1)
+ (ONE_SECOND * 2)); + (ONE_SECOND * 2));
@@ -458,11 +457,9 @@ DoManipulateDevices (PMENU_STATE pMS)
); );
NewState = LOBYTE (status); NewState = LOBYTE (status);
if (NewState) if (NewState)
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2), PlayMenuSound (MENU_SOUND_FAILURE);
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
else if (HIBYTE (status) == 0) else if (HIBYTE (status) == 0)
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 3), PlayMenuSound (MENU_SOUND_INVOKED);
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
return ((BOOLEAN)NewState); return ((BOOLEAN)NewState);
+3 -6
View File
@@ -1140,8 +1140,7 @@ OnStarNameFrame (PTEXTENTRY_STATE pTES)
if (pSS->CurIndex < 0) if (pSS->CurIndex < 0)
{ // nothing found { // nothing found
if (PulsedInputState.key[KEY_MENU_NEXT]) if (PulsedInputState.key[KEY_MENU_NEXT])
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2), PlayMenuSound (MENU_SOUND_FAILURE);
0, NotPositional (), NULL, 0);
return TRUE; return TRUE;
} }
@@ -1242,8 +1241,7 @@ DoMoveCursor (PMENU_STATE pMS)
#ifdef DEBUG #ifdef DEBUG
if (instantMove) if (instantMove)
{ {
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 3), 0, PlayMenuSound (MENU_SOUND_INVOKED);
NotPositional (), NULL, GAME_SOUND_PRIORITY);
if (pMS->flash_task) if (pMS->flash_task)
{ {
ConcludeTask (pMS->flash_task); ConcludeTask (pMS->flash_task);
@@ -1290,8 +1288,7 @@ DoMoveCursor (PMENU_STATE pMS)
} }
else else
{ // no search in QuasiSpace { // no search in QuasiSpace
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2), PlayMenuSound (MENU_SOUND_FAILURE);
0, NotPositional (), NULL, 0);
} }
} }
else else
+22 -9
View File
@@ -96,9 +96,10 @@ MatchSupportShip (PMENU_STATE pMS)
return 0; return 0;
} }
static void static BOOLEAN
DeltaSupportCrew (SIZE crew_delta) DeltaSupportCrew (SIZE crew_delta)
{ {
BOOLEAN ret = FALSE;
UNICODE buf[40]; UNICODE buf[40];
HSTARSHIP hTemplate; HSTARSHIP hTemplate;
SHIP_FRAGMENTPTR StarShipPtr, TemplatePtr; SHIP_FRAGMENTPTR StarShipPtr, TemplatePtr;
@@ -141,10 +142,13 @@ DeltaSupportCrew (SIZE crew_delta)
SetContext (StatusContext); SetContext (StatusContext);
SetFlashRect (&r, (FRAME)0); SetFlashRect (&r, (FRAME)0);
} }
ret = TRUE;
} }
UnlockStarShip (&GLOBAL (avail_race_q), hTemplate); UnlockStarShip (&GLOBAL (avail_race_q), hTemplate);
UnlockStarShip (&GLOBAL (built_ship_q), (HSTARSHIP)pMenuState->CurFrame); UnlockStarShip (&GLOBAL (built_ship_q), (HSTARSHIP)pMenuState->CurFrame);
return ret;
} }
#define SHIP_TOGGLE ((BYTE)(1 << 7)) #define SHIP_TOGGLE ((BYTE)(1 << 7))
@@ -260,26 +264,35 @@ DoModifyRoster (PMENU_STATE pMS)
} }
else if (pMS->CurState & SHIP_TOGGLE) else if (pMS->CurState & SHIP_TOGGLE)
{ {
SIZE delta = 0;
BOOLEAN failed = FALSE;
if (up) if (up)
{ {
sy = -1; sy = -1;
if (GLOBAL_SIS (CrewEnlisted)) if (GLOBAL_SIS (CrewEnlisted))
{ delta = 1;
LockMutex (GraphicsLock); else
DeltaSupportCrew (1); failed = TRUE;
UnlockMutex (GraphicsLock);
}
} }
else if (down) else if (down)
{ {
sy = 1; sy = 1;
if (GLOBAL_SIS (CrewEnlisted) if (GLOBAL_SIS (CrewEnlisted) < GetCPodCapacity (NULL_PTR))
< GetCPodCapacity (NULL_PTR)) delta = -1;
else
failed = TRUE;
}
if (delta != 0)
{ {
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
DeltaSupportCrew (-1); failed = !DeltaSupportCrew (delta);
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
} }
if (failed)
{ // not enough room or crew
PlayMenuSound (MENU_SOUND_FAILURE);
} }
} }
else else
+3 -6
View File
@@ -990,8 +990,7 @@ DoScan (PMENU_STATE pMS)
|| (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == || (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity ==
GAS_GIANT_ATMOSPHERE)) GAS_GIANT_ATMOSPHERE))
{ // cannot dispatch to shielded planets or gas giants { // cannot dispatch to shielded planets or gas giants
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2), PlayMenuSound (MENU_SOUND_FAILURE);
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
return (TRUE); return (TRUE);
} }
@@ -1005,8 +1004,7 @@ DoScan (PMENU_STATE pMS)
|| GLOBAL_SIS (NumLanders) == 0 || GLOBAL_SIS (NumLanders) == 0
|| GLOBAL_SIS (CrewEnlisted) == 0) || GLOBAL_SIS (CrewEnlisted) == 0)
{ {
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2), PlayMenuSound (MENU_SOUND_FAILURE);
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
return (TRUE); return (TRUE);
} }
@@ -1034,8 +1032,7 @@ DoScan (PMENU_STATE pMS)
// Various scans // Various scans
if (pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED) if (pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED)
{ // cannot scan shielded planets { // cannot scan shielded planets
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2), PlayMenuSound (MENU_SOUND_FAILURE);
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
return (TRUE); return (TRUE);
} }