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 ();
UnlockMutex (GraphicsLock);
}
else
{ // no element left in cargo hold
PlayMenuSound (MENU_SOUND_FAILURE);
}
}
else
{
+3 -6
View File
@@ -211,8 +211,7 @@ DeviceFailed (BYTE which_device)
{
BYTE fade_buf[1];
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 3),
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
PlayMenuSound (MENU_SOUND_INVOKED);
fade_buf[0] = FadeAllToWhite;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND * 1)
+ (ONE_SECOND * 2));
@@ -458,11 +457,9 @@ DoManipulateDevices (PMENU_STATE pMS)
);
NewState = LOBYTE (status);
if (NewState)
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2),
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
PlayMenuSound (MENU_SOUND_FAILURE);
else if (HIBYTE (status) == 0)
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 3),
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
PlayMenuSound (MENU_SOUND_INVOKED);
UnlockMutex (GraphicsLock);
return ((BOOLEAN)NewState);
+3 -6
View File
@@ -1140,8 +1140,7 @@ OnStarNameFrame (PTEXTENTRY_STATE pTES)
if (pSS->CurIndex < 0)
{ // nothing found
if (PulsedInputState.key[KEY_MENU_NEXT])
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2),
0, NotPositional (), NULL, 0);
PlayMenuSound (MENU_SOUND_FAILURE);
return TRUE;
}
@@ -1242,8 +1241,7 @@ DoMoveCursor (PMENU_STATE pMS)
#ifdef DEBUG
if (instantMove)
{
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 3), 0,
NotPositional (), NULL, GAME_SOUND_PRIORITY);
PlayMenuSound (MENU_SOUND_INVOKED);
if (pMS->flash_task)
{
ConcludeTask (pMS->flash_task);
@@ -1290,8 +1288,7 @@ DoMoveCursor (PMENU_STATE pMS)
}
else
{ // no search in QuasiSpace
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2),
0, NotPositional (), NULL, 0);
PlayMenuSound (MENU_SOUND_FAILURE);
}
}
else
+26 -13
View File
@@ -96,9 +96,10 @@ MatchSupportShip (PMENU_STATE pMS)
return 0;
}
static void
static BOOLEAN
DeltaSupportCrew (SIZE crew_delta)
{
BOOLEAN ret = FALSE;
UNICODE buf[40];
HSTARSHIP hTemplate;
SHIP_FRAGMENTPTR StarShipPtr, TemplatePtr;
@@ -141,10 +142,13 @@ DeltaSupportCrew (SIZE crew_delta)
SetContext (StatusContext);
SetFlashRect (&r, (FRAME)0);
}
ret = TRUE;
}
UnlockStarShip (&GLOBAL (avail_race_q), hTemplate);
UnlockStarShip (&GLOBAL (built_ship_q), (HSTARSHIP)pMenuState->CurFrame);
return ret;
}
#define SHIP_TOGGLE ((BYTE)(1 << 7))
@@ -260,26 +264,35 @@ DoModifyRoster (PMENU_STATE pMS)
}
else if (pMS->CurState & SHIP_TOGGLE)
{
SIZE delta = 0;
BOOLEAN failed = FALSE;
if (up)
{
sy = -1;
if (GLOBAL_SIS (CrewEnlisted))
{
LockMutex (GraphicsLock);
DeltaSupportCrew (1);
UnlockMutex (GraphicsLock);
}
delta = 1;
else
failed = TRUE;
}
else if (down)
{
sy = 1;
if (GLOBAL_SIS (CrewEnlisted)
< GetCPodCapacity (NULL_PTR))
{
LockMutex (GraphicsLock);
DeltaSupportCrew (-1);
UnlockMutex (GraphicsLock);
}
if (GLOBAL_SIS (CrewEnlisted) < GetCPodCapacity (NULL_PTR))
delta = -1;
else
failed = TRUE;
}
if (delta != 0)
{
LockMutex (GraphicsLock);
failed = !DeltaSupportCrew (delta);
UnlockMutex (GraphicsLock);
}
if (failed)
{ // not enough room or crew
PlayMenuSound (MENU_SOUND_FAILURE);
}
}
else
+3 -6
View File
@@ -990,8 +990,7 @@ DoScan (PMENU_STATE pMS)
|| (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity ==
GAS_GIANT_ATMOSPHERE))
{ // cannot dispatch to shielded planets or gas giants
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2),
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
PlayMenuSound (MENU_SOUND_FAILURE);
return (TRUE);
}
@@ -1005,8 +1004,7 @@ DoScan (PMENU_STATE pMS)
|| GLOBAL_SIS (NumLanders) == 0
|| GLOBAL_SIS (CrewEnlisted) == 0)
{
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2),
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
PlayMenuSound (MENU_SOUND_FAILURE);
return (TRUE);
}
@@ -1034,8 +1032,7 @@ DoScan (PMENU_STATE pMS)
// Various scans
if (pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED)
{ // cannot scan shielded planets
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2),
0, NotPositional (), NULL, GAME_SOUND_PRIORITY);
PlayMenuSound (MENU_SOUND_FAILURE);
return (TRUE);
}