Cleanups.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2943 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+38
-19
@@ -225,9 +225,7 @@ UpdateInputState (void)
|
|||||||
PauseGame ();
|
PauseGame ();
|
||||||
|
|
||||||
if (ExitRequested)
|
if (ExitRequested)
|
||||||
{
|
|
||||||
ConfirmExit ();
|
ConfirmExit ();
|
||||||
}
|
|
||||||
|
|
||||||
CurrentInputState = ImmediateInputState;
|
CurrentInputState = ImmediateInputState;
|
||||||
OldInputState = CachedInputState;
|
OldInputState = CachedInputState;
|
||||||
@@ -294,17 +292,48 @@ FlushInputState (void)
|
|||||||
_clear_menu_state ();
|
_clear_menu_state ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MENU_SOUND_FLAGS
|
||||||
|
MenuKeysToSoundFlags (const CONTROLLER_INPUT_STATE *state)
|
||||||
|
{
|
||||||
|
MENU_SOUND_FLAGS soundFlags;
|
||||||
|
|
||||||
|
soundFlags = MENU_SOUND_NONE;
|
||||||
|
if (PulsedInputState.menu[KEY_MENU_UP])
|
||||||
|
soundFlags |= MENU_SOUND_UP;
|
||||||
|
if (PulsedInputState.menu[KEY_MENU_DOWN])
|
||||||
|
soundFlags |= MENU_SOUND_DOWN;
|
||||||
|
if (PulsedInputState.menu[KEY_MENU_LEFT])
|
||||||
|
soundFlags |= MENU_SOUND_LEFT;
|
||||||
|
if (PulsedInputState.menu[KEY_MENU_RIGHT])
|
||||||
|
soundFlags |= MENU_SOUND_RIGHT;
|
||||||
|
if (PulsedInputState.menu[KEY_MENU_SELECT])
|
||||||
|
soundFlags |= MENU_SOUND_SELECT;
|
||||||
|
if (PulsedInputState.menu[KEY_MENU_CANCEL])
|
||||||
|
soundFlags |= MENU_SOUND_CANCEL;
|
||||||
|
if (PulsedInputState.menu[KEY_MENU_SPECIAL])
|
||||||
|
soundFlags |= MENU_SOUND_SPECIAL;
|
||||||
|
if (PulsedInputState.menu[KEY_MENU_PAGE_UP])
|
||||||
|
soundFlags |= MENU_SOUND_PAGEUP;
|
||||||
|
if (PulsedInputState.menu[KEY_MENU_PAGE_DOWN])
|
||||||
|
soundFlags |= MENU_SOUND_PAGEDOWN;
|
||||||
|
if (PulsedInputState.menu[KEY_MENU_DELETE])
|
||||||
|
soundFlags |= MENU_SOUND_DELETE;
|
||||||
|
if (PulsedInputState.menu[KEY_MENU_BACKSPACE])
|
||||||
|
soundFlags |= MENU_SOUND_DELETE;
|
||||||
|
|
||||||
|
return soundFlags;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DoInput (void *pInputState, BOOLEAN resetInput)
|
DoInput (void *pInputState, BOOLEAN resetInput)
|
||||||
{
|
{
|
||||||
SetMenuRepeatDelay (ACCELERATION_INCREMENT, MENU_REPEAT_DELAY, ACCELERATION_INCREMENT, FALSE);
|
SetMenuRepeatDelay (ACCELERATION_INCREMENT, MENU_REPEAT_DELAY, ACCELERATION_INCREMENT, FALSE);
|
||||||
if (resetInput)
|
if (resetInput)
|
||||||
{
|
|
||||||
TFB_ResetControls ();
|
TFB_ResetControls ();
|
||||||
}
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
MENU_SOUND_FLAGS input;
|
MENU_SOUND_FLAGS soundFlags;
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
|
|
||||||
UpdateInputState ();
|
UpdateInputState ();
|
||||||
@@ -321,25 +350,14 @@ DoInput (void *pInputState, BOOLEAN resetInput)
|
|||||||
if (CurrentInputState.menu[KEY_EXIT])
|
if (CurrentInputState.menu[KEY_EXIT])
|
||||||
ExitState = ConfirmExit ();
|
ExitState = ConfirmExit ();
|
||||||
|
|
||||||
input = MENU_SOUND_NONE;
|
soundFlags = MenuKeysToSoundFlags (&PulsedInputState);
|
||||||
if (PulsedInputState.menu[KEY_MENU_UP]) input |= MENU_SOUND_UP;
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_DOWN]) input |= MENU_SOUND_DOWN;
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_LEFT]) input |= MENU_SOUND_LEFT;
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_RIGHT]) input |= MENU_SOUND_RIGHT;
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_SELECT]) input |= MENU_SOUND_SELECT;
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_CANCEL]) input |= MENU_SOUND_CANCEL;
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_SPECIAL]) input |= MENU_SOUND_SPECIAL;
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_PAGE_UP]) input |= MENU_SOUND_PAGEUP;
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_PAGE_DOWN]) input |= MENU_SOUND_PAGEDOWN;
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_DELETE]) input |= MENU_SOUND_DELETE;
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_BACKSPACE]) input |= MENU_SOUND_DELETE;
|
|
||||||
|
|
||||||
if (MenuSounds
|
if (MenuSounds
|
||||||
&& (pSolarSysState == 0
|
&& (pSolarSysState == 0
|
||||||
/* see if in menu */
|
/* see if in menu */
|
||||||
|| pSolarSysState->MenuState.CurState
|
|| pSolarSysState->MenuState.CurState
|
||||||
|| pSolarSysState->MenuState.Initialized > 2)
|
|| pSolarSysState->MenuState.Initialized > 2)
|
||||||
&& (input & (sound_0 | sound_1))
|
&& (soundFlags & (sound_0 | sound_1))
|
||||||
#ifdef NEVER
|
#ifdef NEVER
|
||||||
&& !PLRPlaying ((MUSIC_REF)~0)
|
&& !PLRPlaying ((MUSIC_REF)~0)
|
||||||
#endif /* NEVER */
|
#endif /* NEVER */
|
||||||
@@ -348,12 +366,13 @@ DoInput (void *pInputState, BOOLEAN resetInput)
|
|||||||
SOUND S;
|
SOUND S;
|
||||||
|
|
||||||
S = MenuSounds;
|
S = MenuSounds;
|
||||||
if (input & sound_1)
|
if (soundFlags & sound_1)
|
||||||
S = SetAbsSoundIndex (S, MENU_SOUND_SUCCESS);
|
S = SetAbsSoundIndex (S, MENU_SOUND_SUCCESS);
|
||||||
|
|
||||||
PlaySoundEffect (S, 0, NotPositional (), NULL, 0);
|
PlaySoundEffect (S, 0, NotPositional (), NULL, 0);
|
||||||
}
|
}
|
||||||
} while (((INPUT_STATE_DESC*)pInputState)->InputFunc (pInputState));
|
} while (((INPUT_STATE_DESC*)pInputState)->InputFunc (pInputState));
|
||||||
|
|
||||||
if (resetInput)
|
if (resetInput)
|
||||||
{
|
{
|
||||||
TFB_ResetControls ();
|
TFB_ResetControls ();
|
||||||
|
|||||||
@@ -307,7 +307,8 @@ RestartMenu (MENU_STATE *pMS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LastActivity = NextActivity = 0;
|
LastActivity = 0;
|
||||||
|
NextActivity = 0;
|
||||||
|
|
||||||
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)black_buf, TimeOut));
|
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)black_buf, TimeOut));
|
||||||
if (TimeOut == ONE_SECOND / 8)
|
if (TimeOut == ONE_SECOND / 8)
|
||||||
|
|||||||
Reference in New Issue
Block a user