Cleanup of key repeat set functions usage
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3388 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define ACCELERATION_INCREMENT (ONE_SECOND / 12)
|
#define ACCELERATION_INCREMENT (ONE_SECOND / 12)
|
||||||
#define MENU_REPEAT_DELAY (ONE_SECOND >> 1)
|
#define MENU_REPEAT_DELAY (ONE_SECOND / 2)
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -283,18 +283,18 @@ SetMenuRepeatDelay (DWORD min, DWORD max, DWORD step, BOOLEAN gestalt)
|
|||||||
_max_accel = max;
|
_max_accel = max;
|
||||||
_step_accel = step;
|
_step_accel = step;
|
||||||
_gestalt_keys = gestalt;
|
_gestalt_keys = gestalt;
|
||||||
_clear_menu_state ();
|
//_clear_menu_state ();
|
||||||
ResetKeyRepeat ();
|
ResetKeyRepeat ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SetDefaultMenuRepeatDelay ()
|
SetDefaultMenuRepeatDelay (void)
|
||||||
{
|
{
|
||||||
_min_accel = ACCELERATION_INCREMENT;
|
_min_accel = ACCELERATION_INCREMENT;
|
||||||
_max_accel = MENU_REPEAT_DELAY;
|
_max_accel = MENU_REPEAT_DELAY;
|
||||||
_step_accel = ACCELERATION_INCREMENT;
|
_step_accel = ACCELERATION_INCREMENT;
|
||||||
_gestalt_keys = FALSE;
|
_gestalt_keys = FALSE;
|
||||||
_clear_menu_state ();
|
//_clear_menu_state ();
|
||||||
ResetKeyRepeat ();
|
ResetKeyRepeat ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,8 +340,6 @@ MenuKeysToSoundFlags (const CONTROLLER_INPUT_STATE *state)
|
|||||||
void
|
void
|
||||||
DoInput (void *pInputState, BOOLEAN resetInput)
|
DoInput (void *pInputState, BOOLEAN resetInput)
|
||||||
{
|
{
|
||||||
SetMenuRepeatDelay (ACCELERATION_INCREMENT, MENU_REPEAT_DELAY,
|
|
||||||
ACCELERATION_INCREMENT, FALSE);
|
|
||||||
if (resetInput)
|
if (resetInput)
|
||||||
FlushInput ();
|
FlushInput ();
|
||||||
|
|
||||||
|
|||||||
@@ -1655,7 +1655,6 @@ DoHyperspaceMenu (MENU_STATE *pMS)
|
|||||||
break;
|
break;
|
||||||
case STARMAP:
|
case STARMAP:
|
||||||
StarMap ();
|
StarMap ();
|
||||||
SetDefaultMenuRepeatDelay ();
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
case NAVIGATION:
|
case NAVIGATION:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -618,7 +618,7 @@ GetMeleeStarShips (COUNT playerMask, HSTARSHIP *ships)
|
|||||||
SetContext (OffScreenContext);
|
SetContext (OffScreenContext);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
ResetKeyRepeat ();
|
|
||||||
DoInput (&gmstate, FALSE);
|
DoInput (&gmstate, FALSE);
|
||||||
WaitForSoundEnd (0);
|
WaitForSoundEnd (0);
|
||||||
|
|
||||||
|
|||||||
@@ -424,7 +424,6 @@ DoPlanetOrbit (MENU_STATE *pMS)
|
|||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
|
|
||||||
AutoPilotSet = StarMap ();
|
AutoPilotSet = StarMap ();
|
||||||
SetDefaultMenuRepeatDelay ();
|
|
||||||
|
|
||||||
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -1216,6 +1216,7 @@ DoStarSearch (MENU_STATE *pMS)
|
|||||||
tes.FrameCallback = OnStarNameFrame;
|
tes.FrameCallback = OnStarNameFrame;
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
|
SetDefaultMenuRepeatDelay ();
|
||||||
success = DoTextEntry (&tes);
|
success = DoTextEntry (&tes);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
@@ -1243,9 +1244,6 @@ DoMoveCursor (MENU_STATE *pMS)
|
|||||||
pMS->Initialized = TRUE;
|
pMS->Initialized = TRUE;
|
||||||
pMS->InputFunc = DoMoveCursor;
|
pMS->InputFunc = DoMoveCursor;
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
|
||||||
SetMenuRepeatDelay (MIN_ACCEL_DELAY, MAX_ACCEL_DELAY, STEP_ACCEL_DELAY, TRUE);
|
|
||||||
|
|
||||||
if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
|
if (LOBYTE (GLOBAL (CurrentActivity)) != IN_HYPERSPACE)
|
||||||
universe = CurStarDescPtr->star_pt;
|
universe = CurStarDescPtr->star_pt;
|
||||||
else
|
else
|
||||||
@@ -1636,8 +1634,12 @@ StarMap (void)
|
|||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
|
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
||||||
|
SetMenuRepeatDelay (MIN_ACCEL_DELAY, MAX_ACCEL_DELAY, STEP_ACCEL_DELAY,
|
||||||
|
TRUE);
|
||||||
DoInput (&MenuState, FALSE);
|
DoInput (&MenuState, FALSE);
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
|
SetDefaultMenuRepeatDelay ();
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
DrawHyperCoords (universe);
|
DrawHyperCoords (universe);
|
||||||
|
|||||||
@@ -656,7 +656,6 @@ PickPlanetSide (MENU_STATE *pMS)
|
|||||||
if (!pMS->Initialized)
|
if (!pMS->Initialized)
|
||||||
{
|
{
|
||||||
pMS->InputFunc = PickPlanetSide;
|
pMS->InputFunc = PickPlanetSide;
|
||||||
SetMenuRepeatDelay (0, 0, 0, FALSE);
|
|
||||||
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
||||||
if (!select)
|
if (!select)
|
||||||
{
|
{
|
||||||
@@ -756,7 +755,6 @@ ExitPlanetSide:
|
|||||||
|
|
||||||
pMS->InputFunc = DoScan;
|
pMS->InputFunc = DoScan;
|
||||||
pMS->CurState = DISPATCH_SHUTTLE;
|
pMS->CurState = DISPATCH_SHUTTLE;
|
||||||
SetDefaultMenuRepeatDelay ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -766,13 +764,13 @@ ExitPlanetSide:
|
|||||||
|
|
||||||
new_pt = planetLoc;
|
new_pt = planetLoc;
|
||||||
|
|
||||||
if (PulsedInputState.menu[KEY_MENU_LEFT])
|
if (CurrentInputState.menu[KEY_MENU_LEFT])
|
||||||
dx = -1;
|
dx = -1;
|
||||||
if (PulsedInputState.menu[KEY_MENU_RIGHT])
|
if (CurrentInputState.menu[KEY_MENU_RIGHT])
|
||||||
dx = 1;
|
dx = 1;
|
||||||
if (PulsedInputState.menu[KEY_MENU_UP])
|
if (CurrentInputState.menu[KEY_MENU_UP])
|
||||||
dy = -1;
|
dy = -1;
|
||||||
if (PulsedInputState.menu[KEY_MENU_DOWN])
|
if (CurrentInputState.menu[KEY_MENU_DOWN])
|
||||||
dy = 1;
|
dy = 1;
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
|
|||||||
@@ -1960,8 +1960,6 @@ DoSolarSysMenu (MENU_STATE *pMS)
|
|||||||
break;
|
break;
|
||||||
case STARMAP:
|
case STARMAP:
|
||||||
StarMap ();
|
StarMap ();
|
||||||
SetDefaultMenuRepeatDelay ();
|
|
||||||
|
|
||||||
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|||||||
@@ -318,6 +318,7 @@ RestartMenu (MENU_STATE *pMS)
|
|||||||
DrawRestartMenuGraphic (pMS);
|
DrawRestartMenuGraphic (pMS);
|
||||||
GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
|
GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
|
||||||
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
|
||||||
|
SetDefaultMenuRepeatDelay ();
|
||||||
DoInput (pMS, TRUE);
|
DoInput (pMS, TRUE);
|
||||||
|
|
||||||
StopMusic ();
|
StopMusic ();
|
||||||
|
|||||||
Reference in New Issue
Block a user