Control schema shift to Menus + Control Templates.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2308 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2006-04-11 07:20:14 +00:00
parent 6f050cc7bd
commit 223d701322
34 changed files with 547 additions and 439 deletions
+2
View File
@@ -1,4 +1,6 @@
Changes towards version 0.6: Changes towards version 0.6:
- Control scheme shifted to Menus + Control Templates in preparation for
the online keyconfig - Michael
- Fixes to logic in the Utwig conversations (Bugs 327, 647), from Nic - Fixes to logic in the Utwig conversations (Bugs 327, 647), from Nic
and Michael and Michael
- Removed unused and invalid lander font chars - Alex - Removed unused and invalid lander font chars - Alex
+103 -92
View File
@@ -1,7 +1,7 @@
# Default UQM input configuration file. # Default UQM input configuration file.
# This is a VCONTROL version 2 config file (UQM 0.5 or later). # This is a VCONTROL version 3 config file (UQM 0.5.1 or later).
version 2 version 3
# Keyboard control definitions follow this point. Most keys can be # Keyboard control definitions follow this point. Most keys can be
# described in a straightforward manner; consult the name table in # described in a straightforward manner; consult the name table in
@@ -56,51 +56,34 @@ Menu-Delete: key Keypad-.
# Melee and the player in the full game. Again, the player has the # Melee and the player in the full game. Again, the player has the
# option of using either the number pad or the arrow keys. # option of using either the number pad or the arrow keys.
Player-1-Thrust: key Up Keyboard-1-Up: key Up
Player-1-Left: key Left Keyboard-1-Down: key Down
Player-1-Right: key Right Keyboard-1-Left: key Left
Player-1-Weapon: key Return Keyboard-1-Right: key Right
Player-1-Weapon: key RightControl Keyboard-1-Weapon: key Return
Player-1-Special: key RightShift Keyboard-1-Weapon: key RightControl
Player-1-Escape: key Escape Keyboard-1-Special: key RightShift
Keyboard-1-Escape: key Escape
Player-1-Thrust: key Keypad-8 Keyboard-1-Up: key Keypad-8
Player-1-Left: key Keypad-4 Keyboard-1-Down: key Keypad-2
Player-1-Right: key Keypad-6 Keyboard-1-Left: key Keypad-4
Player-1-Weapon: key Keypad-Enter Keyboard-1-Right: key Keypad-6
Player-1-Special: key Keypad-0 Keyboard-1-Weapon: key Keypad-Enter
Keyboard-1-Special: key Keypad-0
Player-1-Weapon: key ] Keyboard-1-Weapon: key ]
Player-1-Special: key [ Keyboard-1-Special: key [
# Lander controls. These map mostly to Player 1's controls.
Lander-Thrust: key Up
Lander-Left: key Left
Lander-Right: key Right
Lander-Weapon: key Return
Lander-Weapon: key RightControl
Lander-Escape: key RightShift
Lander-Escape: key Space
Lander-Thrust: key Keypad-8
Lander-Left: key Keypad-4
Lander-Right: key Keypad-6
Lander-Weapon: key Keypad-Enter
Lander-Escape: key Keypad-0
Lander-Weapon: key ]
Lander-Escape: key [
Lander-Escape: key Escape
# Player 2's flight controls. We add the key 'd' to let him # Player 2's flight controls. We add the key 'd' to let him
# move down in the super-melee ship selection. # move down in the super-melee ship selection.
Player-2-Thrust: key e Keyboard-2-Up: key e
Player-2-Left: key s Keyboard-2-Down: key d
Player-2-Right: key f Keyboard-2-Left: key s
Player-2-Down: key d Keyboard-2-Right: key f
Player-2-Weapon: key q Keyboard-2-Weapon: key q
Player-2-Special: key a Keyboard-2-Special: key a
Keyboard-2-Escape: key Escape
# System utility keys. # System utility keys.
Pause: key Pause Pause: key Pause
@@ -116,73 +99,101 @@ Exit: key F10
# that UQM can handle. # that UQM can handle.
joystick 0 threshold 10000 # How far to move before it counts; 0-30000 joystick 0 threshold 10000 # How far to move before it counts; 0-30000
Menu-Left: joystick 0 axis 0 negative
Player-1-Left: joystick 0 axis 0 negative Joystick-1-Up: joystick 0 axis 1 negative
Lander-Left: joystick 0 axis 0 negative Joystick-1-Down: joystick 0 axis 1 positive
Menu-Right: joystick 0 axis 0 positive Joystick-1-Left: joystick 0 axis 0 negative
Player-1-Right: joystick 0 axis 0 positive Joystick-1-Right: joystick 0 axis 0 positive
Lander-Right: joystick 0 axis 0 positive
Joystick-1-Up: joystick 0 hat 0 up
Joystick-1-Down: joystick 0 hat 0 down
Joystick-1-Left: joystick 0 hat 0 left
Joystick-1-Right: joystick 0 hat 0 right
Joystick-1-Weapon: joystick 0 button 1
Joystick-1-Special: joystick 0 button 0
Joystick-1-Escape: joystick 0 button 6
Menu-Up: joystick 0 axis 1 negative Menu-Up: joystick 0 axis 1 negative
Player-1-Thrust: joystick 0 axis 1 negative
Lander-Thrust: joystick 0 axis 1 negative
Menu-Down: joystick 0 axis 1 positive Menu-Down: joystick 0 axis 1 positive
Menu-Left: joystick 0 axis 0 negative
Menu-Right: joystick 0 axis 0 positive
Menu-Up: joystick 0 hat 0 up
Menu-Down: joystick 0 hat 0 down
Menu-Left: joystick 0 hat 0 left
Menu-Right: joystick 0 hat 0 right
Menu-Cancel: joystick 0 button 0 Menu-Cancel: joystick 0 button 0
Player-1-Special: joystick 0 button 0
Menu-Select: joystick 0 button 1 Menu-Select: joystick 0 button 1
Player-1-Weapon: joystick 0 button 1
Lander-Weapon: joystick 0 button 1
Menu-Page-Up: joystick 0 button 4 Menu-Page-Up: joystick 0 button 4
Menu-Page-Down: joystick 0 button 5 Menu-Page-Down: joystick 0 button 5
Menu-Zoom-In: joystick 0 button 6 Menu-Zoom-In: joystick 0 button 6
Player-1-Escape: joystick 0 button 6
Lander-Escape: joystick 0 button 6
Menu-Zoom-Out: joystick 0 button 7 Menu-Zoom-Out: joystick 0 button 7
# And now the POV hat controls.
Menu-Left: joystick 0 hat 0 left
Player-1-Left: joystick 0 hat 0 left
Lander-Left: joystick 0 hat 0 left
Menu-Right: joystick 0 hat 0 right
Player-1-Right: joystick 0 hat 0 right
Lander-Right: joystick 0 hat 0 right
Menu-Up: joystick 0 hat 0 up
Player-1-Thrust: joystick 0 hat 0 up
Lander-Thrust: joystick 0 hat 0 up
Menu-Down: joystick 0 hat 0 down
# Second joystick
joystick 1 threshold 10000 # How far to move before it counts; 0-30000 joystick 1 threshold 10000 # How far to move before it counts; 0-30000
Menu-Left: joystick 1 axis 0 negative
Player-1-Left: joystick 1 axis 0 negative Joystick-2-Up: joystick 1 axis 1 negative
Lander-Left: joystick 1 axis 0 negative Joystick-2-Down: joystick 1 axis 1 positive
Menu-Right: joystick 1 axis 0 positive Joystick-2-Left: joystick 1 axis 0 negative
Player-1-Right: joystick 1 axis 0 positive Joystick-2-Right: joystick 1 axis 0 positive
Lander-Right: joystick 1 axis 0 positive
Joystick-2-Up: joystick 1 hat 0 up
Joystick-2-Down: joystick 1 hat 0 down
Joystick-2-Left: joystick 1 hat 0 left
Joystick-2-Right: joystick 1 hat 0 right
Joystick-2-Weapon: joystick 1 button 1
Joystick-2-Special: joystick 1 button 0
Joystick-2-Escape: joystick 1 button 6
Menu-Up: joystick 1 axis 1 negative Menu-Up: joystick 1 axis 1 negative
Player-1-Thrust: joystick 1 axis 1 negative
Lander-Thrust: joystick 1 axis 1 negative
Menu-Down: joystick 1 axis 1 positive Menu-Down: joystick 1 axis 1 positive
Menu-Left: joystick 1 axis 0 negative
Menu-Right: joystick 1 axis 0 positive
Menu-Up: joystick 1 hat 0 up
Menu-Down: joystick 1 hat 0 down
Menu-Left: joystick 1 hat 0 left
Menu-Right: joystick 1 hat 0 right
Menu-Cancel: joystick 1 button 0 Menu-Cancel: joystick 1 button 0
Player-1-Special: joystick 1 button 0
Menu-Select: joystick 1 button 1 Menu-Select: joystick 1 button 1
Player-1-Weapon: joystick 1 button 1
Lander-Weapon: joystick 1 button 1
Menu-Page-Up: joystick 1 button 4 Menu-Page-Up: joystick 1 button 4
Menu-Page-Down: joystick 1 button 5 Menu-Page-Down: joystick 1 button 5
Menu-Zoom-In: joystick 1 button 6 Menu-Zoom-In: joystick 1 button 6
Player-1-Escape: joystick 1 button 6
Lander-Escape: joystick 1 button 6
Menu-Zoom-Out: joystick 1 button 7 Menu-Zoom-Out: joystick 1 button 7
# POV hat controls for the second joystick joystick 2 threshold 10000 # How far to move before it counts; 0-30000
Menu-Left: joystick 1 hat 0 left
Player-1-Left: joystick 1 hat 0 left Joystick-3-Up: joystick 2 axis 1 negative
Lander-Left: joystick 1 hat 0 left Joystick-3-Down: joystick 2 axis 1 positive
Menu-Right: joystick 1 hat 0 right Joystick-3-Left: joystick 2 axis 0 negative
Player-1-Right: joystick 1 hat 0 right Joystick-3-Right: joystick 2 axis 0 positive
Lander-Right: joystick 1 hat 0 right
Menu-Up: joystick 1 hat 0 up Joystick-3-Up: joystick 2 hat 0 up
Player-1-Thrust: joystick 1 hat 0 up Joystick-3-Down: joystick 2 hat 0 down
Lander-Thrust: joystick 1 hat 0 up Joystick-3-Left: joystick 2 hat 0 left
Menu-Down: joystick 1 hat 0 down Joystick-3-Right: joystick 2 hat 0 right
Joystick-3-Weapon: joystick 2 button 1
Joystick-3-Special: joystick 2 button 0
Joystick-3-Escape: joystick 2 button 6
Menu-Up: joystick 2 axis 1 negative
Menu-Down: joystick 2 axis 1 positive
Menu-Left: joystick 2 axis 0 negative
Menu-Right: joystick 2 axis 0 positive
Menu-Up: joystick 2 hat 0 up
Menu-Down: joystick 2 hat 0 down
Menu-Left: joystick 2 hat 0 left
Menu-Right: joystick 2 hat 0 right
Menu-Cancel: joystick 2 button 0
Menu-Select: joystick 2 button 1
Menu-Page-Up: joystick 2 button 4
Menu-Page-Down: joystick 2 button 5
Menu-Zoom-In: joystick 2 button 6
Menu-Zoom-Out: joystick 2 button 7
+11 -11
View File
@@ -1203,7 +1203,7 @@ SpewPhrases (COUNT wait_track)
#endif #endif
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
if (PulsedInputState.key[KEY_MENU_CANCEL]) if (PulsedInputState.menu[KEY_MENU_CANCEL])
{ {
SetSliderImage (SetAbsFrameIndex (ActivityFrame, 8)); SetSliderImage (SetAbsFrameIndex (ActivityFrame, 8));
JumpTrack (); JumpTrack ();
@@ -1217,13 +1217,13 @@ SpewPhrases (COUNT wait_track)
BOOLEAN left=FALSE, right=FALSE; BOOLEAN left=FALSE, right=FALSE;
if (optSmoothScroll == OPT_PC) if (optSmoothScroll == OPT_PC)
{ {
left = PulsedInputState.key[KEY_MENU_LEFT]; left = PulsedInputState.menu[KEY_MENU_LEFT];
right = PulsedInputState.key[KEY_MENU_RIGHT]; right = PulsedInputState.menu[KEY_MENU_RIGHT];
} }
else if (optSmoothScroll == OPT_3DO) else if (optSmoothScroll == OPT_3DO)
{ {
left = ImmediateInputState.key[KEY_MENU_LEFT]; left = ImmediateInputState.menu[KEY_MENU_LEFT];
right = ImmediateInputState.key[KEY_MENU_RIGHT]; right = ImmediateInputState.menu[KEY_MENU_RIGHT];
} }
if (right) if (right)
{ {
@@ -1460,7 +1460,7 @@ DoCommunication (PENCOUNTER_STATE pES)
TimeIn = GetTimeCounter (); TimeIn = GetTimeCounter ();
// Warning! This used to re-gather input data to check for rewind. // Warning! This used to re-gather input data to check for rewind.
UpdateInputState (); UpdateInputState ();
if (PulsedInputState.key[KEY_MENU_LEFT]) if (PulsedInputState.menu[KEY_MENU_LEFT])
{ {
FadeMusic (BACKGROUND_VOL, ONE_SECOND); FadeMusic (BACKGROUND_VOL, ONE_SECOND);
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
@@ -1491,7 +1491,7 @@ DoCommunication (PENCOUNTER_STATE pES)
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
} }
if (PulsedInputState.key[KEY_MENU_SELECT]) if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
const unsigned char *end; const unsigned char *end;
PTEXT response_text = PTEXT response_text =
@@ -1516,7 +1516,7 @@ DoCommunication (PENCOUNTER_STATE pES)
(*pES->response_list[pES->cur_response].response_func) (*pES->response_list[pES->cur_response].response_func)
(pES->response_list[pES->cur_response].response_ref); (pES->response_list[pES->cur_response].response_ref);
} }
else if (PulsedInputState.key[KEY_MENU_CANCEL] && else if (PulsedInputState.menu[KEY_MENU_CANCEL] &&
LOBYTE (GLOBAL (CurrentActivity)) != WON_LAST_BATTLE) LOBYTE (GLOBAL (CurrentActivity)) != WON_LAST_BATTLE)
{ {
TFB_SoundChain *curr; TFB_SoundChain *curr;
@@ -1675,7 +1675,7 @@ DoCommunication (PENCOUNTER_STATE pES)
else else
{ {
response = pES->cur_response; response = pES->cur_response;
if (PulsedInputState.key[KEY_MENU_LEFT]) if (PulsedInputState.menu[KEY_MENU_LEFT])
{ {
FadeMusic (BACKGROUND_VOL, ONE_SECOND); FadeMusic (BACKGROUND_VOL, ONE_SECOND);
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
@@ -1696,10 +1696,10 @@ DoCommunication (PENCOUNTER_STATE pES)
CommData.AlienTransitionDesc.AnimFlags |= TALK_DONE; CommData.AlienTransitionDesc.AnimFlags |= TALK_DONE;
} }
else if (PulsedInputState.key[KEY_MENU_UP]) else if (PulsedInputState.menu[KEY_MENU_UP])
response = (BYTE)((response + (BYTE)(pES->num_responses - 1)) response = (BYTE)((response + (BYTE)(pES->num_responses - 1))
% pES->num_responses); % pES->num_responses);
else if (PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_DOWN])
response = (BYTE)((BYTE)(response + 1) response = (BYTE)((BYTE)(response + 1)
% pES->num_responses); % pES->num_responses);
+3 -3
View File
@@ -139,17 +139,17 @@ DoConfirmExit (void)
ExitRequested = FALSE; ExitRequested = FALSE;
GamePaused = FALSE; GamePaused = FALSE;
UpdateInputState (); UpdateInputState ();
if (PulsedInputState.key[KEY_MENU_SELECT]) if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
done = TRUE; done = TRUE;
PlayMenuSound (MENU_SOUND_SUCCESS); PlayMenuSound (MENU_SOUND_SUCCESS);
} }
else if (PulsedInputState.key[KEY_MENU_CANCEL]) else if (PulsedInputState.menu[KEY_MENU_CANCEL])
{ {
done = TRUE; done = TRUE;
response = FALSE; response = FALSE;
} }
else if (PulsedInputState.key[KEY_MENU_LEFT] || PulsedInputState.key[KEY_MENU_RIGHT]) else if (PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_RIGHT])
{ {
response = !response; response = !response;
DrawConfirmationWindow (response); DrawConfirmationWindow (response);
+24 -21
View File
@@ -25,24 +25,16 @@
// Enumerated type for controls // Enumerated type for controls
enum { enum {
KEY_P1_THRUST, KEY_UP,
KEY_P1_LEFT, KEY_DOWN,
KEY_P1_RIGHT, KEY_LEFT,
KEY_P1_DOWN, KEY_RIGHT,
KEY_P1_WEAPON, KEY_WEAPON,
KEY_P1_SPECIAL, KEY_SPECIAL,
KEY_P1_ESCAPE, KEY_ESCAPE,
KEY_P2_THRUST, NUM_KEYS
KEY_P2_LEFT, };
KEY_P2_RIGHT, enum {
KEY_P2_DOWN,
KEY_P2_WEAPON,
KEY_P2_SPECIAL,
KEY_LANDER_THRUST,
KEY_LANDER_LEFT,
KEY_LANDER_RIGHT,
KEY_LANDER_WEAPON,
KEY_LANDER_ESCAPE,
KEY_PAUSE, KEY_PAUSE,
KEY_EXIT, KEY_EXIT,
KEY_ABORT, KEY_ABORT,
@@ -65,12 +57,23 @@ enum {
KEY_MENU_EDIT_CANCEL, KEY_MENU_EDIT_CANCEL,
KEY_MENU_SEARCH, KEY_MENU_SEARCH,
KEY_MENU_NEXT, KEY_MENU_NEXT,
KEY_CHARACTER, /* abstract char key */ KEY_MENU_ANY, /* abstract char key */
NUM_KEYS NUM_MENU_KEYS
};
enum {
CONTROL_TEMPLATE_KB_1,
CONTROL_TEMPLATE_KB_2,
CONTROL_TEMPLATE_KB_3,
CONTROL_TEMPLATE_JOY_1,
CONTROL_TEMPLATE_JOY_2,
CONTROL_TEMPLATE_JOY_3,
NUM_TEMPLATES
}; };
typedef struct _controller_input_state { typedef struct _controller_input_state {
int key[NUM_KEYS]; int key[NUM_TEMPLATES][NUM_KEYS];
int menu[NUM_MENU_KEYS];
} CONTROLLER_INPUT_STATE; } CONTROLLER_INPUT_STATE;
typedef UBYTE BATTLE_INPUT_STATE; typedef UBYTE BATTLE_INPUT_STATE;
+8 -8
View File
@@ -651,23 +651,23 @@ DoCreditsInput (PVOID pIS)
if ((GLOBAL (CurrentActivity) & CHECK_ABORT) if ((GLOBAL (CurrentActivity) & CHECK_ABORT)
|| (pCIS->AllowCancel && || (pCIS->AllowCancel &&
(PulsedInputState.key[KEY_MENU_SELECT] || (PulsedInputState.menu[KEY_MENU_SELECT] ||
PulsedInputState.key[KEY_MENU_CANCEL])) PulsedInputState.menu[KEY_MENU_CANCEL]))
) )
{ // aborted { // aborted
return FALSE; return FALSE;
} }
if (pCIS->AllowSpeedChange if (pCIS->AllowSpeedChange
&& (PulsedInputState.key[KEY_MENU_UP] && (PulsedInputState.menu[KEY_MENU_UP]
|| PulsedInputState.key[KEY_MENU_DOWN])) || PulsedInputState.menu[KEY_MENU_DOWN]))
{ // speed adjustment { // speed adjustment
int newrate = CreditsRate; int newrate = CreditsRate;
int step = abs (CreditsRate) / 5 + 1; int step = abs (CreditsRate) / 5 + 1;
if (PulsedInputState.key[KEY_MENU_DOWN]) if (PulsedInputState.menu[KEY_MENU_DOWN])
newrate += step; newrate += step;
else if (PulsedInputState.key[KEY_MENU_UP]) else if (PulsedInputState.menu[KEY_MENU_UP])
newrate -= step; newrate -= step;
if (newrate < -CREDITS_MAX_RATE) if (newrate < -CREDITS_MAX_RATE)
newrate = -CREDITS_MAX_RATE; newrate = -CREDITS_MAX_RATE;
@@ -695,8 +695,8 @@ DoCreditsInput (PVOID pIS)
} }
if (!CreditsRunning if (!CreditsRunning
&& (PulsedInputState.key[KEY_MENU_SELECT] && (PulsedInputState.menu[KEY_MENU_SELECT]
|| PulsedInputState.key[KEY_MENU_CANCEL])) || PulsedInputState.menu[KEY_MENU_CANCEL]))
{ // credits finished and exit requested { // credits finished and exit requested
return FALSE; return FALSE;
} }
+4 -4
View File
@@ -55,7 +55,7 @@ DoSelectAction (PMENU_STATE pMS)
pMS->Initialized = TRUE; pMS->Initialized = TRUE;
pMS->InputFunc = DoSelectAction; pMS->InputFunc = DoSelectAction;
} }
else if (PulsedInputState.key[KEY_MENU_SELECT]) else if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
switch (pMS->CurState) switch (pMS->CurState)
{ {
@@ -652,10 +652,10 @@ UninitEncounter (void)
while (!(AnyButtonPress (TRUE)) && GetTimeCounter () < Time) while (!(AnyButtonPress (TRUE)) && GetTimeCounter () < Time)
TaskSwitch (); TaskSwitch ();
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
if (!CurrentInputState.key[KEY_P1_ESCAPE]) if (!CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_ESCAPE])
{ {
DrawFadeText (str1, str2, FALSE, &scavenge_r); DrawFadeText (str1, str2, FALSE, &scavenge_r);
if (!CurrentInputState.key[KEY_P1_ESCAPE]) if (!CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_ESCAPE])
{ {
SetContextForeGroundColor (BLACK_COLOR); SetContextForeGroundColor (BLACK_COLOR);
r.corner.x = scavenge_r.corner.x + 10; r.corner.x = scavenge_r.corner.x + 10;
@@ -681,7 +681,7 @@ UninitEncounter (void)
&& GetTimeCounter () < Time) && GetTimeCounter () < Time)
TaskSwitch (); TaskSwitch ();
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
if (!CurrentInputState.key[KEY_P1_ESCAPE]) if (!CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_ESCAPE])
DrawFadeText (str1, str2, FALSE, &scavenge_r); DrawFadeText (str1, str2, FALSE, &scavenge_r);
} }
} }
+122 -54
View File
@@ -44,7 +44,8 @@ typedef INPUT_STATE_DESC *PINPUT_STATE_DESC;
typedef struct typedef struct
{ {
DWORD key [NUM_KEYS]; DWORD key [NUM_TEMPLATES][NUM_KEYS];
DWORD menu [NUM_MENU_KEYS];
} MENU_ANNOTATIONS; } MENU_ANNOTATIONS;
@@ -64,11 +65,19 @@ volatile CONTROLLER_INPUT_STATE ImmediateInputState;
static void static void
_clear_menu_state (void) _clear_menu_state (void)
{ {
int i; int i, j;
for (i = 0; i < NUM_KEYS; i++) for (i = 0; i < NUM_TEMPLATES; i++)
{ {
PulsedInputState.key[i] = 0; for (j = 0; j < NUM_KEYS; j++)
CachedInputState.key[i] = 0; {
PulsedInputState.key[i][j] = 0;
CachedInputState.key[i][j] = 0;
}
}
for (i = 0; i < NUM_MENU_KEYS; i++)
{
PulsedInputState.menu[i] = 0;
CachedInputState.menu[i] = 0;
} }
CachedGestalt = FALSE; CachedGestalt = FALSE;
} }
@@ -77,11 +86,19 @@ void
ResetKeyRepeat (void) ResetKeyRepeat (void)
{ {
DWORD initTime = GetTimeCounter (); DWORD initTime = GetTimeCounter ();
int i; int i, j;
for (i = 0; i < NUM_KEYS; i++) for (i = 0; i < NUM_TEMPLATES; i++)
{ {
RepeatDelays.key[i] = _max_accel; for (j = 0; j < NUM_KEYS; j++)
Times.key[i] = initTime; {
RepeatDelays.key[i][j] = _max_accel;
Times.key[i][j] = initTime;
}
}
for (i = 0; i < NUM_MENU_KEYS; i++)
{
RepeatDelays.menu[i] = _max_accel;
Times.menu[i] = initTime;
} }
GestaltRepeatDelay = _max_accel; GestaltRepeatDelay = _max_accel;
GestaltTime = initTime; GestaltTime = initTime;
@@ -114,35 +131,61 @@ _check_for_pulse (int *current, int *cached, int *old, DWORD *accel, DWORD *newt
} }
} }
/* BUG: If a key from a currently unused control template is held,
* this will affect the gestalt repeat rate. This isn't a problem
* *yet*, but it will be once the user gets to define control
* templates on his own --McM */
static void static void
_check_gestalt (DWORD NewTime) _check_gestalt (DWORD NewTime)
{ {
BOOLEAN CurrentGestalt; BOOLEAN CurrentGestalt;
int i; int i,j;
OldGestalt = CachedGestalt; OldGestalt = CachedGestalt;
CachedGestalt = 0; CachedGestalt = 0;
CurrentGestalt = 0; CurrentGestalt = 0;
for (i = 0; i < NUM_KEYS; i++) for (i = 0; i < NUM_TEMPLATES; i++)
{ {
CachedGestalt |= ImmediateInputState.key[i]; for (j = 0; j < NUM_KEYS; j++)
CurrentGestalt |= PulsedInputState.key[i]; {
CachedGestalt |= ImmediateInputState.key[i][j];
CurrentGestalt |= PulsedInputState.key[i][j];
}
}
for (i = 0; i < NUM_MENU_KEYS; i++)
{
CachedGestalt |= ImmediateInputState.menu[i];
CurrentGestalt |= PulsedInputState.menu[i];
} }
if (OldGestalt && CachedGestalt) if (OldGestalt && CachedGestalt)
{ {
if (NewTime - GestaltTime < GestaltRepeatDelay) if (NewTime - GestaltTime < GestaltRepeatDelay)
{ {
for (i = 0; i < NUM_KEYS; i++) for (i = 0; i < NUM_TEMPLATES; i++)
{ {
PulsedInputState.key[i] = 0; for (j = 0; j < NUM_KEYS; j++)
{
PulsedInputState.key[i][j] = 0;
}
}
for (i = 0; i < NUM_MENU_KEYS; i++)
{
PulsedInputState.menu[i] = 0;
} }
} }
else else
{ {
for (i = 0; i < NUM_KEYS; i++) for (i = 0; i < NUM_TEMPLATES; i++)
{ {
PulsedInputState.key[i] = CachedInputState.key[i]; for (j = 0; j < NUM_KEYS; j++)
{
PulsedInputState.key[i][j] = CachedInputState.key[i][j];
}
}
for (i = 0; i < NUM_MENU_KEYS; i++)
{
PulsedInputState.menu[i] = CachedInputState.menu[i];
} }
if (GestaltRepeatDelay > _min_accel) if (GestaltRepeatDelay > _min_accel)
GestaltRepeatDelay -= _step_accel; GestaltRepeatDelay -= _step_accel;
@@ -153,9 +196,16 @@ _check_gestalt (DWORD NewTime)
} }
else else
{ {
for (i = 0; i < NUM_KEYS; i++) for (i = 0; i < NUM_TEMPLATES; i++)
{ {
PulsedInputState.key[i] = CachedInputState.key[i]; for (j = 0; j < NUM_KEYS; j++)
{
PulsedInputState.key[i][j] = CachedInputState.key[i][j];
}
}
for (i = 0; i < NUM_MENU_KEYS; i++)
{
PulsedInputState.menu[i] = CachedInputState.menu[i];
} }
GestaltTime = NewTime; GestaltTime = NewTime;
GestaltRepeatDelay = _max_accel; GestaltRepeatDelay = _max_accel;
@@ -189,19 +239,28 @@ UpdateInputState (void)
} }
else else
{ {
int i; int i, j;
for (i = 0; i < NUM_KEYS; i++) for (i = 0; i < NUM_TEMPLATES; i++)
{ {
_check_for_pulse (&PulsedInputState.key[i], for (j = 0; j < NUM_KEYS; j++)
&CachedInputState.key[i], &OldInputState.key[i], {
&RepeatDelays.key[i], &NewTime, &Times.key[i]); _check_for_pulse (&PulsedInputState.key[i][j],
&CachedInputState.key[i][j], &OldInputState.key[i][j],
&RepeatDelays.key[i][j], &NewTime, &Times.key[i][j]);
}
}
for (i = 0; i < NUM_MENU_KEYS; i++)
{
_check_for_pulse (&PulsedInputState.menu[i],
&CachedInputState.menu[i], &OldInputState.menu[i],
&RepeatDelays.menu[i], &NewTime, &Times.menu[i]);
} }
} }
if (CurrentInputState.key[KEY_PAUSE]) if (CurrentInputState.menu[KEY_PAUSE])
GamePaused = TRUE; GamePaused = TRUE;
if (CurrentInputState.key[KEY_EXIT]) if (CurrentInputState.menu[KEY_EXIT])
ExitRequested = TRUE; ExitRequested = TRUE;
} }
@@ -258,21 +317,21 @@ DoInput (PVOID pInputState, BOOLEAN resetInput)
#endif /* CREATE_JOURNAL */ #endif /* CREATE_JOURNAL */
} }
if (CurrentInputState.key[KEY_EXIT]) if (CurrentInputState.menu[KEY_EXIT])
ExitState = ConfirmExit (); ExitState = ConfirmExit ();
input = MENU_SOUND_NONE; input = MENU_SOUND_NONE;
if (PulsedInputState.key[KEY_MENU_UP]) input |= MENU_SOUND_UP; if (PulsedInputState.menu[KEY_MENU_UP]) input |= MENU_SOUND_UP;
if (PulsedInputState.key[KEY_MENU_DOWN]) input |= MENU_SOUND_DOWN; if (PulsedInputState.menu[KEY_MENU_DOWN]) input |= MENU_SOUND_DOWN;
if (PulsedInputState.key[KEY_MENU_LEFT]) input |= MENU_SOUND_LEFT; if (PulsedInputState.menu[KEY_MENU_LEFT]) input |= MENU_SOUND_LEFT;
if (PulsedInputState.key[KEY_MENU_RIGHT]) input |= MENU_SOUND_RIGHT; if (PulsedInputState.menu[KEY_MENU_RIGHT]) input |= MENU_SOUND_RIGHT;
if (PulsedInputState.key[KEY_MENU_SELECT]) input |= MENU_SOUND_SELECT; if (PulsedInputState.menu[KEY_MENU_SELECT]) input |= MENU_SOUND_SELECT;
if (PulsedInputState.key[KEY_MENU_CANCEL]) input |= MENU_SOUND_CANCEL; if (PulsedInputState.menu[KEY_MENU_CANCEL]) input |= MENU_SOUND_CANCEL;
if (PulsedInputState.key[KEY_MENU_SPECIAL]) input |= MENU_SOUND_SPECIAL; if (PulsedInputState.menu[KEY_MENU_SPECIAL]) input |= MENU_SOUND_SPECIAL;
if (PulsedInputState.key[KEY_MENU_PAGE_UP]) input |= MENU_SOUND_PAGEUP; if (PulsedInputState.menu[KEY_MENU_PAGE_UP]) input |= MENU_SOUND_PAGEUP;
if (PulsedInputState.key[KEY_MENU_PAGE_DOWN]) input |= MENU_SOUND_PAGEDOWN; if (PulsedInputState.menu[KEY_MENU_PAGE_DOWN]) input |= MENU_SOUND_PAGEDOWN;
if (PulsedInputState.key[KEY_MENU_DELETE]) input |= MENU_SOUND_DELETE; if (PulsedInputState.menu[KEY_MENU_DELETE]) input |= MENU_SOUND_DELETE;
if (PulsedInputState.key[KEY_MENU_BACKSPACE]) input |= MENU_SOUND_DELETE; if (PulsedInputState.menu[KEY_MENU_BACKSPACE]) input |= MENU_SOUND_DELETE;
if (MenuSounds if (MenuSounds
&& (pSolarSysState == 0 && (pSolarSysState == 0
@@ -316,24 +375,25 @@ GetMenuSounds (MENU_SOUND_FLAGS *s0, MENU_SOUND_FLAGS *s1)
*s1 = sound_1; *s1 = sound_1;
} }
/* These can really be refactored */
BATTLE_INPUT_STATE BATTLE_INPUT_STATE
p1_combat_summary (void) p1_combat_summary (void)
{ {
BATTLE_INPUT_STATE InputState = 0; BATTLE_INPUT_STATE InputState = 0;
if (CurrentInputState.key[KEY_P1_THRUST]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_UP])
InputState |= BATTLE_THRUST; InputState |= BATTLE_THRUST;
if (CurrentInputState.key[KEY_P1_LEFT]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_LEFT])
InputState |= BATTLE_LEFT; InputState |= BATTLE_LEFT;
if (CurrentInputState.key[KEY_P1_RIGHT]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_RIGHT])
InputState |= BATTLE_RIGHT; InputState |= BATTLE_RIGHT;
if (CurrentInputState.key[KEY_P1_WEAPON]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_WEAPON])
InputState |= BATTLE_WEAPON; InputState |= BATTLE_WEAPON;
if (CurrentInputState.key[KEY_P1_SPECIAL]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_SPECIAL])
InputState |= BATTLE_SPECIAL; InputState |= BATTLE_SPECIAL;
if (CurrentInputState.key[KEY_P1_ESCAPE]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_ESCAPE])
InputState |= BATTLE_ESCAPE; InputState |= BATTLE_ESCAPE;
if (CurrentInputState.key[KEY_P1_DOWN]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_DOWN])
InputState |= BATTLE_DOWN; InputState |= BATTLE_DOWN;
return InputState; return InputState;
} }
@@ -342,17 +402,17 @@ BATTLE_INPUT_STATE
p2_combat_summary (void) p2_combat_summary (void)
{ {
BATTLE_INPUT_STATE InputState = 0; BATTLE_INPUT_STATE InputState = 0;
if (CurrentInputState.key[KEY_P2_THRUST]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_2][KEY_UP])
InputState |= BATTLE_THRUST; InputState |= BATTLE_THRUST;
if (CurrentInputState.key[KEY_P2_LEFT]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_2][KEY_LEFT])
InputState |= BATTLE_LEFT; InputState |= BATTLE_LEFT;
if (CurrentInputState.key[KEY_P2_RIGHT]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_2][KEY_RIGHT])
InputState |= BATTLE_RIGHT; InputState |= BATTLE_RIGHT;
if (CurrentInputState.key[KEY_P2_WEAPON]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_2][KEY_WEAPON])
InputState |= BATTLE_WEAPON; InputState |= BATTLE_WEAPON;
if (CurrentInputState.key[KEY_P2_SPECIAL]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_2][KEY_SPECIAL])
InputState |= BATTLE_SPECIAL; InputState |= BATTLE_SPECIAL;
if (CurrentInputState.key[KEY_P2_DOWN]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_2][KEY_DOWN])
InputState |= BATTLE_DOWN; InputState |= BATTLE_DOWN;
return InputState; return InputState;
} }
@@ -360,12 +420,20 @@ p2_combat_summary (void)
BOOLEAN BOOLEAN
AnyButtonPress (BOOLEAN CheckSpecial) AnyButtonPress (BOOLEAN CheckSpecial)
{ {
int i; int i, j;
(void) CheckSpecial; // Ignored (void) CheckSpecial; // Ignored
UpdateInputState (); UpdateInputState ();
for (i = 0; i < NUM_KEYS; i++) for (i = 0; i < NUM_TEMPLATES; i++)
{ {
if (CurrentInputState.key[i]) for (j = 0; j < NUM_KEYS; j++)
{
if (CurrentInputState.key[i][j])
return TRUE;
}
}
for (i = 0; i < NUM_MENU_KEYS; i++)
{
if (CurrentInputState.menu[i])
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
+15 -15
View File
@@ -442,8 +442,8 @@ DoSettings (PMENU_STATE pMS)
pMS->Initialized = TRUE; pMS->Initialized = TRUE;
pMS->InputFunc = DoSettings; pMS->InputFunc = DoSettings;
} }
else if (PulsedInputState.key[KEY_MENU_CANCEL] else if (PulsedInputState.menu[KEY_MENU_CANCEL]
|| (PulsedInputState.key[KEY_MENU_SELECT] || (PulsedInputState.menu[KEY_MENU_SELECT]
&& pMS->CurState == EXIT_MENU_SETTING)) && pMS->CurState == EXIT_MENU_SETTING))
{ {
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
@@ -454,7 +454,7 @@ DoSettings (PMENU_STATE pMS)
pMS->InputFunc = DoGameOptions; pMS->InputFunc = DoGameOptions;
pMS->Initialized = 0; pMS->Initialized = 0;
} }
else if (PulsedInputState.key[KEY_MENU_SELECT]) else if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
switch (pMS->CurState) switch (pMS->CurState)
{ {
@@ -513,8 +513,8 @@ DoQuitMenu (PMENU_STATE pMS)
pMS->Initialized = TRUE; pMS->Initialized = TRUE;
pMS->InputFunc = DoQuitMenu; pMS->InputFunc = DoQuitMenu;
} }
else if (PulsedInputState.key[KEY_MENU_CANCEL] else if (PulsedInputState.menu[KEY_MENU_CANCEL]
|| (PulsedInputState.key[KEY_MENU_SELECT] || (PulsedInputState.menu[KEY_MENU_SELECT]
&& pMS->CurState == NO_QUIT_MENU)) && pMS->CurState == NO_QUIT_MENU))
{ {
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
@@ -525,7 +525,7 @@ DoQuitMenu (PMENU_STATE pMS)
pMS->InputFunc = DoGameOptions; pMS->InputFunc = DoGameOptions;
pMS->Initialized = 0; pMS->Initialized = 0;
} }
else if (PulsedInputState.key[KEY_MENU_SELECT]) else if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
switch (pMS->CurState) switch (pMS->CurState)
{ {
@@ -946,7 +946,7 @@ Restart:
pMS->Initialized = TRUE; pMS->Initialized = TRUE;
goto ChangeGameSelection; goto ChangeGameSelection;
} }
else if (PulsedInputState.key[KEY_MENU_CANCEL]) else if (PulsedInputState.menu[KEY_MENU_CANCEL])
{ {
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
SetFlashRect (SFR_MENU_3DO, (FRAME)0); SetFlashRect (SFR_MENU_3DO, (FRAME)0);
@@ -967,7 +967,7 @@ Restart:
} }
return (FALSE); return (FALSE);
} }
else if (PulsedInputState.key[KEY_MENU_SELECT]) else if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
pSD = &((SUMMARY_DESC *)pMS->Extra)[pMS->CurState]; pSD = &((SUMMARY_DESC *)pMS->Extra)[pMS->CurState];
prev_save = pMS->CurState; prev_save = pMS->CurState;
@@ -1029,7 +1029,7 @@ Restart:
else else
{ {
NewState = pMS->CurState; NewState = pMS->CurState;
if (PulsedInputState.key[KEY_MENU_LEFT] || PulsedInputState.key[KEY_MENU_PAGE_UP]) if (PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_PAGE_UP])
{ {
if (NewState == 0) if (NewState == 0)
NewState = MAX_SAVED_GAMES - 1; NewState = MAX_SAVED_GAMES - 1;
@@ -1038,7 +1038,7 @@ Restart:
else else
NewState = 0; NewState = 0;
} }
else if (PulsedInputState.key[KEY_MENU_RIGHT] || PulsedInputState.key[KEY_MENU_PAGE_DOWN]) else if (PulsedInputState.menu[KEY_MENU_RIGHT] || PulsedInputState.menu[KEY_MENU_PAGE_DOWN])
{ {
if (NewState == MAX_SAVED_GAMES - 1) if (NewState == MAX_SAVED_GAMES - 1)
NewState = 0; NewState = 0;
@@ -1047,14 +1047,14 @@ Restart:
else else
NewState = MAX_SAVED_GAMES - 1; NewState = MAX_SAVED_GAMES - 1;
} }
else if (PulsedInputState.key[KEY_MENU_UP]) else if (PulsedInputState.menu[KEY_MENU_UP])
{ {
if (NewState == 0) if (NewState == 0)
NewState = MAX_SAVED_GAMES - 1; NewState = MAX_SAVED_GAMES - 1;
else else
NewState--; NewState--;
} }
else if (PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_DOWN])
{ {
if (NewState == MAX_SAVED_GAMES - 1) if (NewState == MAX_SAVED_GAMES - 1)
NewState = 0; NewState = 0;
@@ -1300,14 +1300,14 @@ DoGameOptions (PMENU_STATE pMS)
pMS->Initialized = 1; pMS->Initialized = 1;
pMS->InputFunc = DoGameOptions; pMS->InputFunc = DoGameOptions;
} }
else if (PulsedInputState.key[KEY_MENU_CANCEL] else if (PulsedInputState.menu[KEY_MENU_CANCEL]
|| (PulsedInputState.key[KEY_MENU_SELECT] || (PulsedInputState.menu[KEY_MENU_SELECT]
&& pMS->CurState == SETTINGS + 1)) && pMS->CurState == SETTINGS + 1))
{ {
pMS->CurState = SETTINGS + 1; pMS->CurState = SETTINGS + 1;
return (FALSE); return (FALSE);
} }
else if (PulsedInputState.key[KEY_MENU_SELECT] || force_select) else if (PulsedInputState.menu[KEY_MENU_SELECT] || force_select)
{ {
switch (pMS->CurState) switch (pMS->CurState)
{ {
+17 -17
View File
@@ -194,7 +194,7 @@ DoTextEntry (PTEXTENTRY_STATE pTES)
// process the pending character buffer // process the pending character buffer
ch = GetNextCharacter (); ch = GetNextCharacter ();
if (!ch && PulsedInputState.key[KEY_CHARACTER]) if (!ch && PulsedInputState.menu[KEY_MENU_ANY])
{ // keyboard repeat, but only when buffer empty { // keyboard repeat, but only when buffer empty
ch = GetLastCharacter (); ch = GetLastCharacter ();
} }
@@ -218,7 +218,7 @@ DoTextEntry (PTEXTENTRY_STATE pTES)
ch = GetNextCharacter (); ch = GetNextCharacter ();
} }
if (PulsedInputState.key[KEY_MENU_DELETE]) if (PulsedInputState.menu[KEY_MENU_DELETE])
{ {
if (len) if (len)
{ {
@@ -230,7 +230,7 @@ DoTextEntry (PTEXTENTRY_STATE pTES)
changed = TRUE; changed = TRUE;
} }
} }
else if (PulsedInputState.key[KEY_MENU_BACKSPACE]) else if (PulsedInputState.menu[KEY_MENU_BACKSPACE])
{ {
if (pStr > pTES->BaseStr) if (pStr > pTES->BaseStr)
{ {
@@ -243,7 +243,7 @@ DoTextEntry (PTEXTENTRY_STATE pTES)
changed = TRUE; changed = TRUE;
} }
} }
else if (PulsedInputState.key[KEY_MENU_LEFT]) else if (PulsedInputState.menu[KEY_MENU_LEFT])
{ {
if (pStr > pTES->BaseStr) if (pStr > pTES->BaseStr)
{ {
@@ -256,7 +256,7 @@ DoTextEntry (PTEXTENTRY_STATE pTES)
changed = TRUE; changed = TRUE;
} }
} }
else if (PulsedInputState.key[KEY_MENU_RIGHT]) else if (PulsedInputState.menu[KEY_MENU_RIGHT])
{ {
if (len > 0) if (len > 0)
{ {
@@ -269,7 +269,7 @@ DoTextEntry (PTEXTENTRY_STATE pTES)
changed = TRUE; changed = TRUE;
} }
} }
else if (PulsedInputState.key[KEY_MENU_HOME]) else if (PulsedInputState.menu[KEY_MENU_HOME])
{ {
if (pStr > pTES->BaseStr) if (pStr > pTES->BaseStr)
{ {
@@ -279,7 +279,7 @@ DoTextEntry (PTEXTENTRY_STATE pTES)
changed = TRUE; changed = TRUE;
} }
} }
else if (PulsedInputState.key[KEY_MENU_END]) else if (PulsedInputState.menu[KEY_MENU_END])
{ {
if (len > 0) if (len > 0)
{ {
@@ -291,10 +291,10 @@ DoTextEntry (PTEXTENTRY_STATE pTES)
} }
if (pTES->JoyAlpha && ( if (pTES->JoyAlpha && (
PulsedInputState.key[KEY_MENU_UP] || PulsedInputState.menu[KEY_MENU_UP] ||
PulsedInputState.key[KEY_MENU_DOWN] || PulsedInputState.menu[KEY_MENU_DOWN] ||
PulsedInputState.key[KEY_MENU_PAGE_UP] || PulsedInputState.menu[KEY_MENU_PAGE_UP] ||
PulsedInputState.key[KEY_MENU_PAGE_DOWN]) ) PulsedInputState.menu[KEY_MENU_PAGE_DOWN]) )
{ // do joystick text { // do joystick text
joy_char_t ch; joy_char_t ch;
joy_char_t newch; joy_char_t newch;
@@ -314,14 +314,14 @@ DoTextEntry (PTEXTENTRY_STATE pTES)
// find current char in the alphabet // find current char in the alphabet
i = JoyCharFindIn (&cmpch, pTES->JoyAlpha, pTES->JoyAlphaLength); i = JoyCharFindIn (&cmpch, pTES->JoyAlpha, pTES->JoyAlphaLength);
if (PulsedInputState.key[KEY_MENU_UP]) if (PulsedInputState.menu[KEY_MENU_UP])
{ {
--i; --i;
if (i < 0) if (i < 0)
i = pTES->JoyAlphaLength - 1; i = pTES->JoyAlphaLength - 1;
newch = pTES->JoyAlpha[i]; newch = pTES->JoyAlpha[i];
} }
else if (PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_DOWN])
{ {
++i; ++i;
if (i >= pTES->JoyAlphaLength) if (i >= pTES->JoyAlphaLength)
@@ -329,8 +329,8 @@ DoTextEntry (PTEXTENTRY_STATE pTES)
newch = pTES->JoyAlpha[i]; newch = pTES->JoyAlpha[i];
} }
if (PulsedInputState.key[KEY_MENU_PAGE_UP] || if (PulsedInputState.menu[KEY_MENU_PAGE_UP] ||
PulsedInputState.key[KEY_MENU_PAGE_DOWN]) PulsedInputState.menu[KEY_MENU_PAGE_DOWN])
{ {
if (len) if (len)
{ // single char change { // single char change
@@ -381,12 +381,12 @@ DoTextEntry (PTEXTENTRY_STATE pTES)
} }
} }
if (PulsedInputState.key[KEY_MENU_SELECT]) if (PulsedInputState.menu[KEY_MENU_SELECT])
{ // done entering { // done entering
pTES->Success = TRUE; pTES->Success = TRUE;
return FALSE; return FALSE;
} }
else if (PulsedInputState.key[KEY_MENU_EDIT_CANCEL]) else if (PulsedInputState.menu[KEY_MENU_EDIT_CANCEL])
{ // canceled entering { // canceled entering
pTES->Success = FALSE; pTES->Success = FALSE;
return FALSE; return FALSE;
+4 -4
View File
@@ -276,7 +276,7 @@ DoPresentation (PVOID pIS)
{ {
PRESENTATION_INPUT_STATE* pPIS = (PRESENTATION_INPUT_STATE*) pIS; PRESENTATION_INPUT_STATE* pPIS = (PRESENTATION_INPUT_STATE*) pIS;
if (PulsedInputState.key[KEY_MENU_CANCEL] if (PulsedInputState.menu[KEY_MENU_CANCEL]
|| (GLOBAL (CurrentActivity) & CHECK_ABORT)) || (GLOBAL (CurrentActivity) & CHECK_ABORT))
return FALSE; /* abort requested - we are done */ return FALSE; /* abort requested - we are done */
@@ -289,9 +289,9 @@ DoPresentation (PVOID pIS)
} }
if (pPIS->TimeOutOnSkip && if (pPIS->TimeOutOnSkip &&
(PulsedInputState.key[KEY_MENU_SELECT] (PulsedInputState.menu[KEY_MENU_SELECT]
|| PulsedInputState.key[KEY_MENU_SPECIAL] || PulsedInputState.menu[KEY_MENU_SPECIAL]
|| PulsedInputState.key[KEY_MENU_RIGHT]) ) || PulsedInputState.menu[KEY_MENU_RIGHT]) )
{ /* skip requested - continue normal ops */ { /* skip requested - continue normal ops */
pPIS->TimeOut = 0; pPIS->TimeOut = 0;
return TRUE; return TRUE;
@@ -190,10 +190,10 @@ TFB_ProcessEvents ()
break; break;
} }
} }
if (ImmediateInputState.key[KEY_ABORT] || abortFlag) if (ImmediateInputState.menu[KEY_ABORT] || abortFlag)
exit (0); exit (0);
#if defined(DEBUG) || defined(USE_DEBUG_KEY) #if defined(DEBUG) || defined(USE_DEBUG_KEY)
if (ImmediateInputState.key[KEY_DEBUG]) if (ImmediateInputState.menu[KEY_DEBUG])
{ {
FlushInput (); FlushInput ();
debugKeyPressed (); debugKeyPressed ();
+70 -46
View File
@@ -38,49 +38,73 @@ static BOOLEAN InputInitialized = FALSE;
static BOOLEAN _in_character_mode = FALSE; static BOOLEAN _in_character_mode = FALSE;
#define VCONTROL_VERSION 2 #define VCONTROL_VERSION 3
static VControl_NameBinding control_names[] = { static VControl_NameBinding control_names[] = {
{ "Menu-Up", (int *)&ImmediateInputState.key[KEY_MENU_UP] }, { "Menu-Up", (int *)&ImmediateInputState.menu[KEY_MENU_UP] },
{ "Menu-Down", (int *)&ImmediateInputState.key[KEY_MENU_DOWN] }, { "Menu-Down", (int *)&ImmediateInputState.menu[KEY_MENU_DOWN] },
{ "Menu-Left", (int *)&ImmediateInputState.key[KEY_MENU_LEFT] }, { "Menu-Left", (int *)&ImmediateInputState.menu[KEY_MENU_LEFT] },
{ "Menu-Right", (int *)&ImmediateInputState.key[KEY_MENU_RIGHT] }, { "Menu-Right", (int *)&ImmediateInputState.menu[KEY_MENU_RIGHT] },
{ "Menu-Select", (int *)&ImmediateInputState.key[KEY_MENU_SELECT] }, { "Menu-Select", (int *)&ImmediateInputState.menu[KEY_MENU_SELECT] },
{ "Menu-Cancel", (int *)&ImmediateInputState.key[KEY_MENU_CANCEL] }, { "Menu-Cancel", (int *)&ImmediateInputState.menu[KEY_MENU_CANCEL] },
{ "Menu-Special", (int *)&ImmediateInputState.key[KEY_MENU_SPECIAL] }, { "Menu-Special", (int *)&ImmediateInputState.menu[KEY_MENU_SPECIAL] },
{ "Menu-Page-Up", (int *)&ImmediateInputState.key[KEY_MENU_PAGE_UP] }, { "Menu-Page-Up", (int *)&ImmediateInputState.menu[KEY_MENU_PAGE_UP] },
{ "Menu-Page-Down", (int *)&ImmediateInputState.key[KEY_MENU_PAGE_DOWN] }, { "Menu-Page-Down", (int *)&ImmediateInputState.menu[KEY_MENU_PAGE_DOWN] },
{ "Menu-Home", (int *)&ImmediateInputState.key[KEY_MENU_HOME] }, { "Menu-Home", (int *)&ImmediateInputState.menu[KEY_MENU_HOME] },
{ "Menu-End", (int *)&ImmediateInputState.key[KEY_MENU_END] }, { "Menu-End", (int *)&ImmediateInputState.menu[KEY_MENU_END] },
{ "Menu-Zoom-In", (int *)&ImmediateInputState.key[KEY_MENU_ZOOM_IN] }, { "Menu-Zoom-In", (int *)&ImmediateInputState.menu[KEY_MENU_ZOOM_IN] },
{ "Menu-Zoom-Out", (int *)&ImmediateInputState.key[KEY_MENU_ZOOM_OUT] }, { "Menu-Zoom-Out", (int *)&ImmediateInputState.menu[KEY_MENU_ZOOM_OUT] },
{ "Menu-Delete", (int *)&ImmediateInputState.key[KEY_MENU_DELETE] }, { "Menu-Delete", (int *)&ImmediateInputState.menu[KEY_MENU_DELETE] },
{ "Menu-Backspace", (int *)&ImmediateInputState.key[KEY_MENU_BACKSPACE] }, { "Menu-Backspace", (int *)&ImmediateInputState.menu[KEY_MENU_BACKSPACE] },
{ "Menu-Edit-Cancel", (int *)&ImmediateInputState.key[KEY_MENU_EDIT_CANCEL] }, { "Menu-Edit-Cancel", (int *)&ImmediateInputState.menu[KEY_MENU_EDIT_CANCEL] },
{ "Menu-Search", (int *)&ImmediateInputState.key[KEY_MENU_SEARCH] }, { "Menu-Search", (int *)&ImmediateInputState.menu[KEY_MENU_SEARCH] },
{ "Menu-Next", (int *)&ImmediateInputState.key[KEY_MENU_NEXT] }, { "Menu-Next", (int *)&ImmediateInputState.menu[KEY_MENU_NEXT] },
{ "Player-1-Thrust", (int *)&ImmediateInputState.key[KEY_P1_THRUST] }, { "Keyboard-1-Up", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_1][KEY_UP] },
{ "Player-1-Left", (int *)&ImmediateInputState.key[KEY_P1_LEFT] }, { "Keyboard-1-Down", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_1][KEY_DOWN] },
{ "Player-1-Right", (int *)&ImmediateInputState.key[KEY_P1_RIGHT] }, { "Keyboard-1-Left", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_1][KEY_LEFT] },
{ "Player-1-Down", (int *)&ImmediateInputState.key[KEY_P1_DOWN] }, { "Keyboard-1-Right", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_1][KEY_RIGHT] },
{ "Player-1-Weapon", (int *)&ImmediateInputState.key[KEY_P1_WEAPON] }, { "Keyboard-1-Weapon", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_1][KEY_WEAPON] },
{ "Player-1-Special", (int *)&ImmediateInputState.key[KEY_P1_SPECIAL] }, { "Keyboard-1-Special", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_1][KEY_SPECIAL] },
{ "Player-1-Escape", (int *)&ImmediateInputState.key[KEY_P1_ESCAPE] }, { "Keyboard-1-Escape", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_1][KEY_ESCAPE] },
{ "Player-2-Thrust", (int *)&ImmediateInputState.key[KEY_P2_THRUST] }, { "Keyboard-2-Up", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_2][KEY_UP] },
{ "Player-2-Left", (int *)&ImmediateInputState.key[KEY_P2_LEFT] }, { "Keyboard-2-Down", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_2][KEY_DOWN] },
{ "Player-2-Right", (int *)&ImmediateInputState.key[KEY_P2_RIGHT] }, { "Keyboard-2-Left", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_2][KEY_LEFT] },
{ "Player-2-Down", (int *)&ImmediateInputState.key[KEY_P2_DOWN] }, { "Keyboard-2-Right", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_2][KEY_RIGHT] },
{ "Player-2-Weapon", (int *)&ImmediateInputState.key[KEY_P2_WEAPON] }, { "Keyboard-2-Weapon", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_2][KEY_WEAPON] },
{ "Player-2-Special", (int *)&ImmediateInputState.key[KEY_P2_SPECIAL] }, { "Keyboard-2-Special", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_2][KEY_SPECIAL] },
{ "Lander-Thrust", (int *)&ImmediateInputState.key[KEY_LANDER_THRUST] }, { "Keyboard-2-Escape", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_2][KEY_ESCAPE] },
{ "Lander-Left", (int *)&ImmediateInputState.key[KEY_LANDER_LEFT] }, { "Keyboard-3-Up", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_3][KEY_UP] },
{ "Lander-Right", (int *)&ImmediateInputState.key[KEY_LANDER_RIGHT] }, { "Keyboard-3-Down", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_3][KEY_DOWN] },
{ "Lander-Weapon", (int *)&ImmediateInputState.key[KEY_LANDER_WEAPON] }, { "Keyboard-3-Left", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_3][KEY_LEFT] },
{ "Lander-Escape", (int *)&ImmediateInputState.key[KEY_LANDER_ESCAPE] }, { "Keyboard-3-Right", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_3][KEY_RIGHT] },
{ "Pause", (int *)&ImmediateInputState.key[KEY_PAUSE] }, { "Keyboard-3-Weapon", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_3][KEY_WEAPON] },
{ "Exit", (int *)&ImmediateInputState.key[KEY_EXIT] }, { "Keyboard-3-Special", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_3][KEY_SPECIAL] },
{ "Abort", (int *)&ImmediateInputState.key[KEY_ABORT] }, { "Keyboard-3-Escape", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_KB_3][KEY_ESCAPE] },
{ "Debug", (int *)&ImmediateInputState.key[KEY_DEBUG] }, { "Joystick-1-Up", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_1][KEY_UP] },
{ "Joystick-1-Down", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_1][KEY_DOWN] },
{ "Joystick-1-Left", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_1][KEY_LEFT] },
{ "Joystick-1-Right", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_1][KEY_RIGHT] },
{ "Joystick-1-Weapon", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_1][KEY_WEAPON] },
{ "Joystick-1-Special", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_1][KEY_SPECIAL] },
{ "Joystick-1-Escape", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_1][KEY_ESCAPE] },
{ "Joystick-2-Up", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_2][KEY_UP] },
{ "Joystick-2-Down", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_2][KEY_DOWN] },
{ "Joystick-2-Left", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_2][KEY_LEFT] },
{ "Joystick-2-Right", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_2][KEY_RIGHT] },
{ "Joystick-2-Weapon", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_2][KEY_WEAPON] },
{ "Joystick-2-Special", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_2][KEY_SPECIAL] },
{ "Joystick-2-Escape", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_2][KEY_ESCAPE] },
{ "Joystick-3-Up", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_3][KEY_UP] },
{ "Joystick-3-Down", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_3][KEY_DOWN] },
{ "Joystick-3-Left", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_3][KEY_LEFT] },
{ "Joystick-3-Right", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_3][KEY_RIGHT] },
{ "Joystick-3-Weapon", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_3][KEY_WEAPON] },
{ "Joystick-3-Special", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_3][KEY_SPECIAL] },
{ "Joystick-3-Escape", (int *)&ImmediateInputState.key[CONTROL_TEMPLATE_JOY_3][KEY_ESCAPE] },
{ "Pause", (int *)&ImmediateInputState.menu[KEY_PAUSE] },
{ "Exit", (int *)&ImmediateInputState.menu[KEY_EXIT] },
{ "Abort", (int *)&ImmediateInputState.menu[KEY_ABORT] },
{ "Debug", (int *)&ImmediateInputState.menu[KEY_DEBUG] },
{ "Illegal", NULL}}; { "Illegal", NULL}};
@@ -163,7 +187,7 @@ static void
resetKeyboardState (void) resetKeyboardState (void)
{ {
memset (kbdstate, 0, sizeof (kbdstate)); memset (kbdstate, 0, sizeof (kbdstate));
ImmediateInputState.key[KEY_CHARACTER] = 0; ImmediateInputState.menu[KEY_MENU_ANY] = 0;
} }
int int
@@ -295,7 +319,7 @@ ProcessInputEvent (const SDL_Event *Event)
return; return;
kbdstate[k]++; kbdstate[k]++;
ImmediateInputState.key[KEY_CHARACTER]++; ImmediateInputState.menu[KEY_MENU_ANY]++;
lastchar = map_key; lastchar = map_key;
kbdbuf[kbdtail] = map_key; kbdbuf[kbdtail] = map_key;
@@ -308,13 +332,13 @@ ProcessInputEvent (const SDL_Event *Event)
if (kbdstate[k] == 0) if (kbdstate[k] == 0)
{ // something is fishy -- better to reset the { // something is fishy -- better to reset the
// repeatable state to avoid big problems // repeatable state to avoid big problems
ImmediateInputState.key[KEY_CHARACTER] = 0; ImmediateInputState.menu[KEY_MENU_ANY] = 0;
} }
else else
{ {
kbdstate[k]--; kbdstate[k]--;
if (ImmediateInputState.key[KEY_CHARACTER] > 0) if (ImmediateInputState.menu[KEY_MENU_ANY] > 0)
ImmediateInputState.key[KEY_CHARACTER]--; ImmediateInputState.menu[KEY_MENU_ANY]--;
} }
} }
} }
+6 -6
View File
@@ -406,15 +406,15 @@ TFB_DoVideoInput (PVOID pIS)
if (!pVIS->CurVideo || !TFB_VideoPlaying (pVIS->CurVideo)) if (!pVIS->CurVideo || !TFB_VideoPlaying (pVIS->CurVideo))
return FALSE; return FALSE;
if (PulsedInputState.key[KEY_MENU_SELECT] if (PulsedInputState.menu[KEY_MENU_SELECT]
|| PulsedInputState.key[KEY_MENU_CANCEL] || PulsedInputState.menu[KEY_MENU_CANCEL]
|| PulsedInputState.key[KEY_MENU_SPECIAL] || PulsedInputState.menu[KEY_MENU_SPECIAL]
|| (GLOBAL (CurrentActivity) & CHECK_ABORT)) || (GLOBAL (CurrentActivity) & CHECK_ABORT))
{ // abort movie { // abort movie
TFB_StopVideo (pVIS->CurVideo); TFB_StopVideo (pVIS->CurVideo);
return FALSE; return FALSE;
} }
else if (PulsedInputState.key[KEY_MENU_LEFT] || PulsedInputState.key[KEY_MENU_RIGHT]) else if (PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_RIGHT])
{ {
if (vid->decoder->audio_synced) if (vid->decoder->audio_synced)
{ {
@@ -424,9 +424,9 @@ TFB_DoVideoInput (PVOID pIS)
newpos = vid->decoder->pos; newpos = vid->decoder->pos;
UnlockMutex (vid->guard); UnlockMutex (vid->guard);
if (PulsedInputState.key[KEY_MENU_LEFT]) if (PulsedInputState.menu[KEY_MENU_LEFT])
newpos -= 2; newpos -= 2;
else if (PulsedInputState.key[KEY_MENU_RIGHT]) else if (PulsedInputState.menu[KEY_MENU_RIGHT])
newpos += 1; newpos += 1;
if (newpos < 0) if (newpos < 0)
newpos = 0; newpos = 0;
+29 -29
View File
@@ -920,10 +920,10 @@ DoLoadTeam (PMELEE_STATE pMS)
pMS->InputFunc = DoLoadTeam; pMS->InputFunc = DoLoadTeam;
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
} }
else if (PulsedInputState.key[KEY_MENU_SELECT] | else if (PulsedInputState.menu[KEY_MENU_SELECT] |
PulsedInputState.key[KEY_MENU_CANCEL]) PulsedInputState.menu[KEY_MENU_CANCEL])
{ {
if (!PulsedInputState.key[KEY_MENU_CANCEL]) if (!PulsedInputState.menu[KEY_MENU_CANCEL])
{ {
pMS->TeamImage[pMS->side] = pMS->FileList[ pMS->TeamImage[pMS->side] = pMS->FileList[
pMS->CurIndex - pMS->TopTeamIndex]; pMS->CurIndex - pMS->TopTeamIndex];
@@ -948,7 +948,7 @@ DoLoadTeam (PMELEE_STATE pMS)
NewTop = pMS->TopTeamIndex; NewTop = pMS->TopTeamIndex;
index = old_index = pMS->CurIndex; index = old_index = pMS->CurIndex;
if (PulsedInputState.key[KEY_MENU_UP]) if (PulsedInputState.menu[KEY_MENU_UP])
{ {
if (index-- == 0) if (index-- == 0)
index = 0; index = 0;
@@ -956,7 +956,7 @@ DoLoadTeam (PMELEE_STATE pMS)
if (index < NewTop && (NewTop -= MAX_VIS_TEAMS) < 0) if (index < NewTop && (NewTop -= MAX_VIS_TEAMS) < 0)
NewTop = 0; NewTop = 0;
} }
else if (PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_DOWN])
{ {
if ((int)index < (int)GetDirEntryTableCount (pMS->TeamDE) + if ((int)index < (int)GetDirEntryTableCount (pMS->TeamDE) +
NUM_PREBUILT - 1) NUM_PREBUILT - 1)
@@ -965,7 +965,7 @@ DoLoadTeam (PMELEE_STATE pMS)
if ((int)index > (int)pMS->BotTeamIndex) if ((int)index > (int)pMS->BotTeamIndex)
NewTop = index; NewTop = index;
} }
else if (PulsedInputState.key[KEY_MENU_PAGE_UP]) else if (PulsedInputState.menu[KEY_MENU_PAGE_UP])
{ {
index -= MAX_VIS_TEAMS; index -= MAX_VIS_TEAMS;
if (index < 0) if (index < 0)
@@ -980,7 +980,7 @@ DoLoadTeam (PMELEE_STATE pMS)
NewTop = 0; NewTop = 0;
} }
} }
else if (PulsedInputState.key[KEY_MENU_PAGE_DOWN]) else if (PulsedInputState.menu[KEY_MENU_PAGE_DOWN])
{ {
index += MAX_VIS_TEAMS; index += MAX_VIS_TEAMS;
if ((int) index < if ((int) index <
@@ -1194,8 +1194,8 @@ DoEdit (PMELEE_STATE pMS)
pMS->InputFunc = DoEdit; pMS->InputFunc = DoEdit;
} }
else if ((pMS->row < NUM_MELEE_ROWS || pMS->CurIndex == (BYTE)~0) else if ((pMS->row < NUM_MELEE_ROWS || pMS->CurIndex == (BYTE)~0)
&& (PulsedInputState.key[KEY_MENU_CANCEL] && (PulsedInputState.menu[KEY_MENU_CANCEL]
|| (PulsedInputState.key[KEY_MENU_RIGHT] || (PulsedInputState.menu[KEY_MENU_RIGHT]
&& (pMS->col == NUM_MELEE_COLUMNS - 1 || pMS->row == NUM_MELEE_ROWS)))) && (pMS->col == NUM_MELEE_COLUMNS - 1 || pMS->row == NUM_MELEE_ROWS))))
{ {
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
@@ -1207,16 +1207,16 @@ DoEdit (PMELEE_STATE pMS)
InTime = GetTimeCounter (); InTime = GetTimeCounter ();
} }
else if (pMS->row < NUM_MELEE_ROWS else if (pMS->row < NUM_MELEE_ROWS
&& (PulsedInputState.key[KEY_MENU_SELECT] || PulsedInputState.key[KEY_MENU_SPECIAL])) && (PulsedInputState.menu[KEY_MENU_SELECT] || PulsedInputState.menu[KEY_MENU_SPECIAL]))
{ {
if (PulsedInputState.key[KEY_MENU_SELECT]) if (PulsedInputState.menu[KEY_MENU_SELECT])
pMS->Initialized = 0; pMS->Initialized = 0;
else else
pMS->Initialized = -1; pMS->Initialized = -1;
TFB_ResetControls (); TFB_ResetControls ();
DoPickShip (pMS); DoPickShip (pMS);
} }
else if (pMS->row < NUM_MELEE_ROWS && PulsedInputState.key[KEY_MENU_DELETE]) else if (pMS->row < NUM_MELEE_ROWS && PulsedInputState.menu[KEY_MENU_DELETE])
{ {
DeleteCurrentShip (pMS); DeleteCurrentShip (pMS);
AdvanceCursor (pMS); AdvanceCursor (pMS);
@@ -1231,7 +1231,7 @@ DoEdit (PMELEE_STATE pMS)
if (row == NUM_MELEE_ROWS) if (row == NUM_MELEE_ROWS)
{ {
if (PulsedInputState.key[KEY_MENU_SELECT]) if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
TEXTENTRY_STATE tes; TEXTENTRY_STATE tes;
@@ -1264,18 +1264,18 @@ DoEdit (PMELEE_STATE pMS)
} }
{ {
if (PulsedInputState.key[KEY_MENU_LEFT]) if (PulsedInputState.menu[KEY_MENU_LEFT])
{ {
if (col-- == 0) if (col-- == 0)
col = 0; col = 0;
} }
else if (PulsedInputState.key[KEY_MENU_RIGHT]) else if (PulsedInputState.menu[KEY_MENU_RIGHT])
{ {
if (++col == NUM_MELEE_COLUMNS) if (++col == NUM_MELEE_COLUMNS)
col = NUM_MELEE_COLUMNS - 1; col = NUM_MELEE_COLUMNS - 1;
} }
if (PulsedInputState.key[KEY_MENU_UP]) if (PulsedInputState.menu[KEY_MENU_UP])
{ {
if (row-- == 0) if (row-- == 0)
{ {
@@ -1288,7 +1288,7 @@ DoEdit (PMELEE_STATE pMS)
} }
} }
} }
else if (PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_DOWN])
{ {
if (row++ == NUM_MELEE_ROWS) if (row++ == NUM_MELEE_ROWS)
{ {
@@ -1363,11 +1363,11 @@ DoPickShip (PMELEE_STATE pMS)
DrawMeleeShipStrings (pMS, (BYTE)(pMS->CurIndex)); DrawMeleeShipStrings (pMS, (BYTE)(pMS->CurIndex));
} }
} }
else if (PulsedInputState.key[KEY_MENU_SELECT] || PulsedInputState.key[KEY_MENU_CANCEL]) else if (PulsedInputState.menu[KEY_MENU_SELECT] || PulsedInputState.menu[KEY_MENU_CANCEL])
{ {
pMS->InputFunc = 0; /* disable ship flashing */ pMS->InputFunc = 0; /* disable ship flashing */
if (!PulsedInputState.key[KEY_MENU_CANCEL]) if (!PulsedInputState.menu[KEY_MENU_CANCEL])
{ {
HSTARSHIP hStarShip; HSTARSHIP hStarShip;
@@ -1401,7 +1401,7 @@ DoPickShip (PMELEE_STATE pMS)
return (TRUE); return (TRUE);
} }
else if (PulsedInputState.key[KEY_MENU_SPECIAL]) else if (PulsedInputState.menu[KEY_MENU_SPECIAL])
{ {
DoShipSpin (pMS->CurIndex, (MUSIC_REF)0); DoShipSpin (pMS->CurIndex, (MUSIC_REF)0);
@@ -1413,25 +1413,25 @@ DoPickShip (PMELEE_STATE pMS)
NewStarShip = pMS->CurIndex; NewStarShip = pMS->CurIndex;
if (PulsedInputState.key[KEY_MENU_LEFT]) if (PulsedInputState.menu[KEY_MENU_LEFT])
{ {
if (NewStarShip-- % NUM_PICK_COLS == 0) if (NewStarShip-- % NUM_PICK_COLS == 0)
NewStarShip += NUM_PICK_COLS; NewStarShip += NUM_PICK_COLS;
} }
else if (PulsedInputState.key[KEY_MENU_RIGHT]) else if (PulsedInputState.menu[KEY_MENU_RIGHT])
{ {
if (++NewStarShip % NUM_PICK_COLS == 0) if (++NewStarShip % NUM_PICK_COLS == 0)
NewStarShip -= NUM_PICK_COLS; NewStarShip -= NUM_PICK_COLS;
} }
if (PulsedInputState.key[KEY_MENU_UP]) if (PulsedInputState.menu[KEY_MENU_UP])
{ {
if (NewStarShip >= NUM_PICK_COLS) if (NewStarShip >= NUM_PICK_COLS)
NewStarShip -= NUM_PICK_COLS; NewStarShip -= NUM_PICK_COLS;
else else
NewStarShip += NUM_PICK_COLS * (NUM_PICK_ROWS - 1); NewStarShip += NUM_PICK_COLS * (NUM_PICK_ROWS - 1);
} }
else if (PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_DOWN])
{ {
if (NewStarShip < NUM_PICK_COLS * (NUM_PICK_ROWS - 1)) if (NewStarShip < NUM_PICK_COLS * (NUM_PICK_ROWS - 1))
NewStarShip += NUM_PICK_COLS; NewStarShip += NUM_PICK_COLS;
@@ -1649,7 +1649,7 @@ DoMelee (PMELEE_STATE pMS)
} }
InTime = GetTimeCounter (); InTime = GetTimeCounter ();
} }
else if (PulsedInputState.key[KEY_MENU_CANCEL] || PulsedInputState.key[KEY_MENU_LEFT]) else if (PulsedInputState.menu[KEY_MENU_CANCEL] || PulsedInputState.menu[KEY_MENU_LEFT])
{ {
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
InTime = GetTimeCounter (); InTime = GetTimeCounter ();
@@ -1657,7 +1657,7 @@ DoMelee (PMELEE_STATE pMS)
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
pMS->MeleeOption = EDIT_MELEE; pMS->MeleeOption = EDIT_MELEE;
pMS->Initialized = FALSE; pMS->Initialized = FALSE;
if (PulsedInputState.key[KEY_MENU_CANCEL]) if (PulsedInputState.menu[KEY_MENU_CANCEL])
{ {
pMS->side = 0; pMS->side = 0;
pMS->row = 0; pMS->row = 0;
@@ -1676,13 +1676,13 @@ DoMelee (PMELEE_STATE pMS)
MELEE_OPTIONS NewMeleeOption; MELEE_OPTIONS NewMeleeOption;
NewMeleeOption = pMS->MeleeOption; NewMeleeOption = pMS->MeleeOption;
if (PulsedInputState.key[KEY_MENU_UP]) if (PulsedInputState.menu[KEY_MENU_UP])
{ {
InTime = GetTimeCounter (); InTime = GetTimeCounter ();
if (NewMeleeOption-- == CONTROLS_TOP) if (NewMeleeOption-- == CONTROLS_TOP)
NewMeleeOption = CONTROLS_TOP; NewMeleeOption = CONTROLS_TOP;
} }
else if (PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_DOWN])
{ {
InTime = GetTimeCounter (); InTime = GetTimeCounter ();
if (NewMeleeOption++ == CONTROLS_BOT) if (NewMeleeOption++ == CONTROLS_BOT)
@@ -1705,7 +1705,7 @@ DoMelee (PMELEE_STATE pMS)
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
} }
if (PulsedInputState.key[KEY_MENU_SELECT] || force_select) if (PulsedInputState.menu[KEY_MENU_SELECT] || force_select)
{ {
switch (pMS->MeleeOption) switch (pMS->MeleeOption)
{ {
+3 -3
View File
@@ -398,11 +398,11 @@ DoMenuChooser (PMENU_STATE pMS, BYTE BaseState)
BOOLEAN useAltMenu = FALSE; BOOLEAN useAltMenu = FALSE;
if (optWhichMenu == OPT_PC) if (optWhichMenu == OPT_PC)
useAltMenu = GetAlternateMenu (&BaseState, &NewState); useAltMenu = GetAlternateMenu (&BaseState, &NewState);
if (PulsedInputState.key[KEY_MENU_LEFT] || PulsedInputState.key[KEY_MENU_UP]) if (PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_UP])
NewState = PreviousMenuState (BaseState, NewState); NewState = PreviousMenuState (BaseState, NewState);
else if (PulsedInputState.key[KEY_MENU_RIGHT] || PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_RIGHT] || PulsedInputState.menu[KEY_MENU_DOWN])
NewState = NextMenuState (BaseState, NewState); NewState = NextMenuState (BaseState, NewState);
else if (useAltMenu && PulsedInputState.key[KEY_MENU_SELECT]) else if (useAltMenu && PulsedInputState.menu[KEY_MENU_SELECT])
{ {
NewState = ConvertAlternateMenu (BaseState, NewState); NewState = ConvertAlternateMenu (BaseState, NewState);
if (NewState == ALT_MANIFEST) if (NewState == ALT_MANIFEST)
+2 -2
View File
@@ -113,8 +113,8 @@ DoMouseError (PMOUSE_ERROR_STATE pInputState)
UnbatchGraphics (); UnbatchGraphics ();
SleepThreadUntil (pInputState->NextTime + MENU_FRAME_RATE); SleepThreadUntil (pInputState->NextTime + MENU_FRAME_RATE);
pInputState->NextTime = GetTimeCounter (); pInputState->NextTime = GetTimeCounter ();
return !(PulsedInputState.key[KEY_MENU_CANCEL] || return !(PulsedInputState.menu[KEY_MENU_CANCEL] ||
PulsedInputState.key[KEY_MENU_SELECT]); PulsedInputState.menu[KEY_MENU_SELECT]);
} }
void void
+18 -18
View File
@@ -179,12 +179,12 @@ DoInstallModule (PMENU_STATE pMS)
return (TRUE); return (TRUE);
} }
select = PulsedInputState.key[KEY_MENU_SELECT]; select = PulsedInputState.menu[KEY_MENU_SELECT];
cancel = PulsedInputState.key[KEY_MENU_CANCEL]; cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
motion = PulsedInputState.key[KEY_MENU_LEFT] || motion = PulsedInputState.menu[KEY_MENU_LEFT] ||
PulsedInputState.key[KEY_MENU_RIGHT] || PulsedInputState.menu[KEY_MENU_RIGHT] ||
PulsedInputState.key[KEY_MENU_UP] || PulsedInputState.menu[KEY_MENU_UP] ||
PulsedInputState.key[KEY_MENU_DOWN]; PulsedInputState.menu[KEY_MENU_DOWN];
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
@@ -391,9 +391,9 @@ DoInstallModule (PMENU_STATE pMS)
NewItem = NewState < EMPTY_SLOT ? pMS->CurState : pMS->delta_item; NewItem = NewState < EMPTY_SLOT ? pMS->CurState : pMS->delta_item;
do do
{ {
if (NewState >= EMPTY_SLOT && (PulsedInputState.key[KEY_MENU_UP] || PulsedInputState.key[KEY_MENU_DOWN])) if (NewState >= EMPTY_SLOT && (PulsedInputState.menu[KEY_MENU_UP] || PulsedInputState.menu[KEY_MENU_DOWN]))
{ {
if (PulsedInputState.key[KEY_MENU_UP]) if (PulsedInputState.menu[KEY_MENU_UP])
{ {
if (NewState-- == EMPTY_SLOT) if (NewState-- == EMPTY_SLOT)
NewState = EMPTY_SLOT + 3; NewState = EMPTY_SLOT + 3;
@@ -407,21 +407,21 @@ DoInstallModule (PMENU_STATE pMS)
if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 3) if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 3)
{ {
if (NewState == EMPTY_SLOT + 3) if (NewState == EMPTY_SLOT + 3)
NewState = PulsedInputState.key[KEY_MENU_UP] ? NewState = PulsedInputState.menu[KEY_MENU_UP] ?
EMPTY_SLOT + 2 : EMPTY_SLOT; EMPTY_SLOT + 2 : EMPTY_SLOT;
if (NewState == EMPTY_SLOT + 2) if (NewState == EMPTY_SLOT + 2)
NewItem = NUM_BOMB_MODULES; NewItem = NUM_BOMB_MODULES;
} }
pMS->delta_item = NewItem; pMS->delta_item = NewItem;
} }
else if (PulsedInputState.key[KEY_MENU_LEFT] || else if (PulsedInputState.menu[KEY_MENU_LEFT] ||
PulsedInputState.key[KEY_MENU_UP]) PulsedInputState.menu[KEY_MENU_UP])
{ {
if (NewItem-- == FirstItem) if (NewItem-- == FirstItem)
NewItem = LastItem; NewItem = LastItem;
} }
else if (PulsedInputState.key[KEY_MENU_RIGHT] || else if (PulsedInputState.menu[KEY_MENU_RIGHT] ||
PulsedInputState.key[KEY_MENU_DOWN]) PulsedInputState.menu[KEY_MENU_DOWN])
{ {
if (NewItem++ == LastItem) if (NewItem++ == LastItem)
NewItem = FirstItem; NewItem = FirstItem;
@@ -544,7 +544,7 @@ ChangeFuelQuantity (void)
r.extent.height = 1; r.extent.height = 1;
if (PulsedInputState.key[KEY_MENU_UP]) if (PulsedInputState.menu[KEY_MENU_UP])
{ {
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
SetContext (SpaceContext); SetContext (SpaceContext);
@@ -574,7 +574,7 @@ ChangeFuelQuantity (void)
} }
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
} }
else if (PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_DOWN])
{ {
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
SetContext (SpaceContext); SetContext (SpaceContext);
@@ -718,8 +718,8 @@ DoOutfit (PMENU_STATE pMS)
SetContext (StatusContext); SetContext (StatusContext);
} }
else if (PulsedInputState.key[KEY_MENU_CANCEL] else if (PulsedInputState.menu[KEY_MENU_CANCEL]
|| (PulsedInputState.key[KEY_MENU_SELECT] || (PulsedInputState.menu[KEY_MENU_SELECT]
&& pMS->CurState == OUTFIT_EXIT)) && pMS->CurState == OUTFIT_EXIT))
{ {
if (pMS->CurState == OUTFIT_DOFUEL) if (pMS->CurState == OUTFIT_DOFUEL)
@@ -740,7 +740,7 @@ ExitOutfit:
return (FALSE); return (FALSE);
} }
} }
else if (PulsedInputState.key[KEY_MENU_SELECT]) else if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
switch (pMS->CurState) switch (pMS->CurState)
{ {
+24 -24
View File
@@ -76,29 +76,29 @@ DoGetMelee (GETMELEE_STATE *gms)
} }
else if (which_player == 0) else if (which_player == 0)
{ {
left = PulsedInputState.key[KEY_P1_LEFT] || left = PulsedInputState.key[CONTROL_TEMPLATE_KB_1][KEY_LEFT] ||
PulsedInputState.key[KEY_MENU_LEFT]; PulsedInputState.menu[KEY_MENU_LEFT];
right = PulsedInputState.key[KEY_P1_RIGHT] || right = PulsedInputState.key[CONTROL_TEMPLATE_KB_1][KEY_RIGHT] ||
PulsedInputState.key[KEY_MENU_RIGHT]; PulsedInputState.menu[KEY_MENU_RIGHT];
up = PulsedInputState.key[KEY_P1_THRUST] || up = PulsedInputState.key[CONTROL_TEMPLATE_KB_1][KEY_UP] ||
PulsedInputState.key[KEY_MENU_UP]; PulsedInputState.menu[KEY_MENU_UP];
down = PulsedInputState.key[KEY_P1_DOWN] || down = PulsedInputState.key[CONTROL_TEMPLATE_KB_1][KEY_DOWN] ||
PulsedInputState.key[KEY_MENU_DOWN]; PulsedInputState.menu[KEY_MENU_DOWN];
select = PulsedInputState.key[KEY_P1_WEAPON] || select = PulsedInputState.key[CONTROL_TEMPLATE_KB_1][KEY_WEAPON] ||
PulsedInputState.key[KEY_MENU_SELECT]; PulsedInputState.menu[KEY_MENU_SELECT];
} }
else else
{ {
left = PulsedInputState.key[KEY_P2_LEFT] || left = PulsedInputState.key[CONTROL_TEMPLATE_KB_2][KEY_LEFT] ||
PulsedInputState.key[KEY_MENU_LEFT]; PulsedInputState.menu[KEY_MENU_LEFT];
right = PulsedInputState.key[KEY_P2_RIGHT] || right = PulsedInputState.key[CONTROL_TEMPLATE_KB_2][KEY_RIGHT] ||
PulsedInputState.key[KEY_MENU_RIGHT]; PulsedInputState.menu[KEY_MENU_RIGHT];
up = PulsedInputState.key[KEY_P2_THRUST] || up = PulsedInputState.key[CONTROL_TEMPLATE_KB_2][KEY_UP] ||
PulsedInputState.key[KEY_MENU_UP]; PulsedInputState.menu[KEY_MENU_UP];
down = PulsedInputState.key[KEY_P2_DOWN] || down = PulsedInputState.key[CONTROL_TEMPLATE_KB_2][KEY_DOWN] ||
PulsedInputState.key[KEY_MENU_DOWN]; PulsedInputState.menu[KEY_MENU_DOWN];
select = PulsedInputState.key[KEY_P2_WEAPON] || select = PulsedInputState.key[CONTROL_TEMPLATE_KB_2][KEY_WEAPON] ||
PulsedInputState.key[KEY_MENU_SELECT]; PulsedInputState.menu[KEY_MENU_SELECT];
} }
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
@@ -303,13 +303,13 @@ GetMeleeStarShip (STARSHIPPTR LastStarShipPtr, COUNT which_player)
SetContext (OldContext); SetContext (OldContext);
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
PressState = PulsedInputState.key[KEY_MENU_SELECT] || PressState = PulsedInputState.menu[KEY_MENU_SELECT] ||
PulsedInputState.key[KEY_MENU_CANCEL]; PulsedInputState.menu[KEY_MENU_CANCEL];
do do
{ {
UpdateInputState (); UpdateInputState ();
ButtonState = PulsedInputState.key[KEY_MENU_SELECT] || ButtonState = PulsedInputState.menu[KEY_MENU_SELECT] ||
PulsedInputState.key[KEY_MENU_CANCEL]; PulsedInputState.menu[KEY_MENU_CANCEL];
if (PressState) if (PressState)
{ {
PressState = ButtonState; PressState = ButtonState;
+5 -5
View File
@@ -59,7 +59,7 @@ DoPickBattleShip (PMENU_STATE pMS)
goto ChangeSelection; goto ChangeSelection;
} }
else if (PulsedInputState.key[KEY_MENU_SELECT]) else if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
if ((HSTARSHIP)pMS->CurFrame) if ((HSTARSHIP)pMS->CurFrame)
{ {
@@ -71,10 +71,10 @@ DoPickBattleShip (PMENU_STATE pMS)
{ {
COORD new_row, new_col; COORD new_row, new_col;
int dx = 0, dy = 0; int dx = 0, dy = 0;
if (PulsedInputState.key[KEY_MENU_RIGHT]) dx = 1; if (PulsedInputState.menu[KEY_MENU_RIGHT]) dx = 1;
if (PulsedInputState.key[KEY_MENU_LEFT]) dx = -1; if (PulsedInputState.menu[KEY_MENU_LEFT]) dx = -1;
if (PulsedInputState.key[KEY_MENU_UP]) dy = -1; if (PulsedInputState.menu[KEY_MENU_UP]) dy = -1;
if (PulsedInputState.key[KEY_MENU_DOWN]) dy = 1; if (PulsedInputState.menu[KEY_MENU_DOWN]) dy = 1;
new_col = pMS->first_item.x + dx; new_col = pMS->first_item.x + dx;
new_row = pMS->first_item.y + dy; new_row = pMS->first_item.y + dy;
+4 -4
View File
@@ -279,10 +279,10 @@ DoDiscardCargo (PMENU_STATE pMS)
{ {
BYTE NewState; BYTE NewState;
BOOLEAN select, cancel, back, forward; BOOLEAN select, cancel, back, forward;
select = PulsedInputState.key[KEY_MENU_SELECT]; select = PulsedInputState.menu[KEY_MENU_SELECT];
cancel = PulsedInputState.key[KEY_MENU_CANCEL]; cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
back = PulsedInputState.key[KEY_MENU_UP] || PulsedInputState.key[KEY_MENU_LEFT]; back = PulsedInputState.menu[KEY_MENU_UP] || PulsedInputState.menu[KEY_MENU_LEFT];
forward = PulsedInputState.key[KEY_MENU_DOWN] || PulsedInputState.key[KEY_MENU_RIGHT]; forward = PulsedInputState.menu[KEY_MENU_DOWN] || PulsedInputState.menu[KEY_MENU_RIGHT];
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
return (FALSE); return (FALSE);
+4 -4
View File
@@ -426,10 +426,10 @@ DoManipulateDevices (PMENU_STATE pMS)
{ {
BYTE NewState; BYTE NewState;
BOOLEAN select, cancel, back, forward; BOOLEAN select, cancel, back, forward;
select = PulsedInputState.key[KEY_MENU_SELECT]; select = PulsedInputState.menu[KEY_MENU_SELECT];
cancel = PulsedInputState.key[KEY_MENU_CANCEL]; cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
back = PulsedInputState.key[KEY_MENU_UP] || PulsedInputState.key[KEY_MENU_LEFT]; back = PulsedInputState.menu[KEY_MENU_UP] || PulsedInputState.menu[KEY_MENU_LEFT];
forward = PulsedInputState.key[KEY_MENU_DOWN] || PulsedInputState.key[KEY_MENU_RIGHT]; forward = PulsedInputState.menu[KEY_MENU_DOWN] || PulsedInputState.menu[KEY_MENU_RIGHT];
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
return (FALSE); return (FALSE);
+6 -6
View File
@@ -1625,7 +1625,7 @@ SetVelocityComponents (
} }
else if (pMS->delta_item == 0 else if (pMS->delta_item == 0
|| (HIBYTE (pMS->delta_item) || (HIBYTE (pMS->delta_item)
&& (CurrentInputState.key[KEY_LANDER_ESCAPE] && (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_ESCAPE]
|| ((PPLANETSIDE_DESC)pMenuState->ModuleFrame)->InTransit))) || ((PPLANETSIDE_DESC)pMenuState->ModuleFrame)->InTransit)))
{ {
if (pMS->delta_item || pMS->CurState > EXPLOSION_LIFE + 60) if (pMS->delta_item || pMS->CurState > EXPLOSION_LIFE + 60)
@@ -1686,9 +1686,9 @@ SetVelocityComponents (
index = GetFrameIndex (LanderFrame[0]); index = GetFrameIndex (LanderFrame[0]);
if (LONIBBLE (pMS->CurState)) if (LONIBBLE (pMS->CurState))
pMS->CurState -= MAKE_BYTE (1, 0); pMS->CurState -= MAKE_BYTE (1, 0);
else if (CurrentInputState.key[KEY_LANDER_LEFT] || CurrentInputState.key[KEY_LANDER_RIGHT]) else if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_LEFT] || CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_RIGHT])
{ {
if (CurrentInputState.key[KEY_LANDER_LEFT]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_LEFT])
{ {
dx = -1; dx = -1;
--index; --index;
@@ -1728,7 +1728,7 @@ SetVelocityComponents (
); );
} }
if (!CurrentInputState.key[KEY_LANDER_THRUST]) if (!CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_UP])
dx = dy = 0; dx = dy = 0;
else else
GetNextVelocityComponents ( GetNextVelocityComponents (
@@ -1737,7 +1737,7 @@ SetVelocityComponents (
if (HINIBBLE (pMS->CurState)) if (HINIBBLE (pMS->CurState))
pMS->CurState -= MAKE_BYTE (0, 1); pMS->CurState -= MAKE_BYTE (0, 1);
else if (CurrentInputState.key[KEY_LANDER_WEAPON]) else if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_WEAPON])
{ {
HELEMENT hWeaponElement; HELEMENT hWeaponElement;
@@ -1766,7 +1766,7 @@ SetVelocityComponents (
index + ANGLE_TO_FACING (FULL_CIRCLE) index + ANGLE_TO_FACING (FULL_CIRCLE)
); );
if (!CurrentInputState.key[KEY_LANDER_THRUST]) if (!CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_UP])
wdx = wdy = 0; wdx = wdy = 0;
else else
GetCurrentVelocityComponents ( GetCurrentVelocityComponents (
+12 -12
View File
@@ -1131,7 +1131,7 @@ OnStarNameFrame (PTEXTENTRY_STATE pTES)
STAR_SEARCH_STATE *pSS = (STAR_SEARCH_STATE *) pTES->CbParam; STAR_SEARCH_STATE *pSS = (STAR_SEARCH_STATE *) pTES->CbParam;
PMENU_STATE pMS = pSS->pMS; PMENU_STATE pMS = pSS->pMS;
if (PulsedInputState.key[KEY_MENU_NEXT]) if (PulsedInputState.menu[KEY_MENU_NEXT])
{ // search for next match { // search for next match
STAR_DESCPTR SDPtr; STAR_DESCPTR SDPtr;
@@ -1139,7 +1139,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.menu[KEY_MENU_NEXT])
PlayMenuSound (MENU_SOUND_FAILURE); PlayMenuSound (MENU_SOUND_FAILURE);
return TRUE; return TRUE;
} }
@@ -1225,7 +1225,7 @@ DoMoveCursor (PMENU_STATE pMS)
return TRUE; return TRUE;
} }
else if (PulsedInputState.key[KEY_MENU_CANCEL]) else if (PulsedInputState.menu[KEY_MENU_CANCEL])
{ {
if (pMS->flash_task) if (pMS->flash_task)
{ {
@@ -1235,7 +1235,7 @@ DoMoveCursor (PMENU_STATE pMS)
return (FALSE); return (FALSE);
} }
else if (PulsedInputState.key[KEY_MENU_SELECT]) else if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
GLOBAL (autopilot) = pMS->first_item; GLOBAL (autopilot) = pMS->first_item;
#ifdef DEBUG #ifdef DEBUG
@@ -1267,7 +1267,7 @@ DoMoveCursor (PMENU_STATE pMS)
#endif #endif
DrawStarMap (0, NULL_PTR); DrawStarMap (0, NULL_PTR);
} }
else if (PulsedInputState.key[KEY_MENU_SEARCH]) else if (PulsedInputState.menu[KEY_MENU_SEARCH])
{ {
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1) if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
{ // HyperSpace search { // HyperSpace search
@@ -1297,18 +1297,18 @@ DoMoveCursor (PMENU_STATE pMS)
SIZE ZoomIn, ZoomOut; SIZE ZoomIn, ZoomOut;
ZoomIn = ZoomOut = 0; ZoomIn = ZoomOut = 0;
if (PulsedInputState.key[KEY_MENU_ZOOM_IN]) if (PulsedInputState.menu[KEY_MENU_ZOOM_IN])
ZoomIn = 1; ZoomIn = 1;
else if (PulsedInputState.key[KEY_MENU_ZOOM_OUT]) else if (PulsedInputState.menu[KEY_MENU_ZOOM_OUT])
ZoomOut = 1; ZoomOut = 1;
ZoomStarMap (ZoomIn - ZoomOut); ZoomStarMap (ZoomIn - ZoomOut);
sx = sy = 0; sx = sy = 0;
if (PulsedInputState.key[KEY_MENU_LEFT]) sx = -1; if (PulsedInputState.menu[KEY_MENU_LEFT]) sx = -1;
if (PulsedInputState.key[KEY_MENU_RIGHT]) sx = 1; if (PulsedInputState.menu[KEY_MENU_RIGHT]) sx = 1;
if (PulsedInputState.key[KEY_MENU_UP]) sy = -1; if (PulsedInputState.menu[KEY_MENU_UP]) sy = -1;
if (PulsedInputState.key[KEY_MENU_DOWN]) sy = 1; if (PulsedInputState.menu[KEY_MENU_DOWN]) sy = 1;
if (sx != 0 || sy != 0) if (sx != 0 || sy != 0)
{ {
@@ -1665,7 +1665,7 @@ DoFlagshipCommands (PMENU_STATE pMS)
} }
else else
{ {
BOOLEAN select = PulsedInputState.key[KEY_MENU_SELECT]; BOOLEAN select = PulsedInputState.menu[KEY_MENU_SELECT];
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
if (*(volatile BYTE *)&pMS->CurState == 0 if (*(volatile BYTE *)&pMS->CurState == 0
&& (*(volatile SIZE *)&pMS->Initialized & 1) && (*(volatile SIZE *)&pMS->Initialized & 1)
+6 -6
View File
@@ -205,12 +205,12 @@ DoModifyRoster (PMENU_STATE pMS)
return FALSE; return FALSE;
} }
select = PulsedInputState.key[KEY_MENU_SELECT]; select = PulsedInputState.menu[KEY_MENU_SELECT];
cancel = PulsedInputState.key[KEY_MENU_CANCEL]; cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
up = PulsedInputState.key[KEY_MENU_UP]; up = PulsedInputState.menu[KEY_MENU_UP];
down = PulsedInputState.key[KEY_MENU_DOWN]; down = PulsedInputState.menu[KEY_MENU_DOWN];
horiz = PulsedInputState.key[KEY_MENU_LEFT] || horiz = PulsedInputState.menu[KEY_MENU_LEFT] ||
PulsedInputState.key[KEY_MENU_RIGHT]; PulsedInputState.menu[KEY_MENU_RIGHT];
if (pMS->Initialized && (pMS->CurState & SHIP_TOGGLE)) if (pMS->Initialized && (pMS->CurState & SHIP_TOGGLE))
{ {
+8 -8
View File
@@ -666,8 +666,8 @@ static BOOLEAN
PickPlanetSide (PMENU_STATE pMS) PickPlanetSide (PMENU_STATE pMS)
{ {
BOOLEAN select, cancel; BOOLEAN select, cancel;
select = PulsedInputState.key[KEY_MENU_SELECT]; select = PulsedInputState.menu[KEY_MENU_SELECT];
cancel = PulsedInputState.key[KEY_MENU_CANCEL]; cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
{ {
if (pMenuState->flash_task) if (pMenuState->flash_task)
@@ -819,10 +819,10 @@ ExitPlanetSide:
new_pt = pSolarSysState->MenuState.first_item; new_pt = pSolarSysState->MenuState.first_item;
if (PulsedInputState.key[KEY_MENU_LEFT]) dx = -1; if (PulsedInputState.menu[KEY_MENU_LEFT]) dx = -1;
if (PulsedInputState.key[KEY_MENU_RIGHT]) dx = 1; if (PulsedInputState.menu[KEY_MENU_RIGHT]) dx = 1;
if (PulsedInputState.key[KEY_MENU_UP]) dy = -1; if (PulsedInputState.menu[KEY_MENU_UP]) dy = -1;
if (PulsedInputState.key[KEY_MENU_DOWN]) dy = 1; if (PulsedInputState.menu[KEY_MENU_DOWN]) dy = 1;
dx = dx << MAG_SHIFT; dx = dx << MAG_SHIFT;
if (dx) if (dx)
@@ -951,8 +951,8 @@ DoScan (PMENU_STATE pMS)
DWORD TimeIn, WaitTime; DWORD TimeIn, WaitTime;
BOOLEAN select, cancel; BOOLEAN select, cancel;
select = PulsedInputState.key[KEY_MENU_SELECT]; select = PulsedInputState.menu[KEY_MENU_SELECT];
cancel = PulsedInputState.key[KEY_MENU_CANCEL]; cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
return (FALSE); return (FALSE);
+5 -5
View File
@@ -810,15 +810,15 @@ ProcessShipControls (void)
ClockTick (); ClockTick ();
if (CurrentInputState.key[KEY_P1_THRUST]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_UP])
delta_y = -1; delta_y = -1;
else else
delta_y = 0; delta_y = 0;
delta_x = 0; delta_x = 0;
if (CurrentInputState.key[KEY_P1_LEFT]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_LEFT])
delta_x -= 1; delta_x -= 1;
if (CurrentInputState.key[KEY_P1_RIGHT]) if (CurrentInputState.key[CONTROL_TEMPLATE_KB_1][KEY_RIGHT])
delta_x += 1; delta_x += 1;
if (delta_x || delta_y < 0) if (delta_x || delta_y < 0)
@@ -1215,8 +1215,8 @@ IP_frame (void)
* DoFlagshipCommands, which is running in * DoFlagshipCommands, which is running in
* parallel with us */ * parallel with us */
// UpdateInputState (); // UpdateInputState ();
cancel = PulsedInputState.key[KEY_MENU_CANCEL]; cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
select = PulsedInputState.key[KEY_MENU_SELECT]; select = PulsedInputState.menu[KEY_MENU_SELECT];
IP_input_state = (cancel << 1) | select; IP_input_state = (cancel << 1) | select;
} }
// JournalInput (InputState); // JournalInput (InputState);
+6 -6
View File
@@ -149,9 +149,9 @@ else if (InputState & DEVICE_EXIT) return (FALSE);
{ {
return (FALSE); return (FALSE);
} }
else if (!(PulsedInputState.key[KEY_MENU_UP] || PulsedInputState.key[KEY_MENU_DOWN] || else if (!(PulsedInputState.menu[KEY_MENU_UP] || PulsedInputState.menu[KEY_MENU_DOWN] ||
PulsedInputState.key[KEY_MENU_LEFT] || PulsedInputState.key[KEY_MENU_RIGHT] || PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_RIGHT] ||
PulsedInputState.key[KEY_MENU_SELECT] || MouseButtonDown)) PulsedInputState.menu[KEY_MENU_SELECT] || MouseButtonDown))
{ {
if (GetTimeCounter () - InTime < InactTimeOut) if (GetTimeCounter () - InTime < InactTimeOut)
@@ -164,7 +164,7 @@ else if (InputState & DEVICE_EXIT) return (FALSE);
GLOBAL (CurrentActivity) = (ACTIVITY)~0; GLOBAL (CurrentActivity) = (ACTIVITY)~0;
return (FALSE); return (FALSE);
} }
else if (PulsedInputState.key[KEY_MENU_SELECT]) else if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
BYTE fade_buf[1]; BYTE fade_buf[1];
@@ -214,12 +214,12 @@ else if (InputState & DEVICE_EXIT) return (FALSE);
BYTE NewState; BYTE NewState;
NewState = pMS->CurState; NewState = pMS->CurState;
if (PulsedInputState.key[KEY_MENU_UP]) if (PulsedInputState.menu[KEY_MENU_UP])
{ {
if (NewState-- == START_NEW_GAME) if (NewState-- == START_NEW_GAME)
NewState = QUIT_GAME; NewState = QUIT_GAME;
} }
else if (PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_DOWN])
{ {
if (NewState++ == QUIT_GAME) if (NewState++ == QUIT_GAME)
NewState = START_NEW_GAME; NewState = START_NEW_GAME;
+2 -2
View File
@@ -280,8 +280,8 @@ SaveProblem (void)
{ {
TaskSwitch (); TaskSwitch ();
UpdateInputState (); UpdateInputState ();
} while (!(PulsedInputState.key[KEY_MENU_SELECT] || } while (!(PulsedInputState.menu[KEY_MENU_SELECT] ||
PulsedInputState.key[KEY_MENU_SPECIAL] || PulsedInputState.menu[KEY_MENU_SPECIAL] ||
(GLOBAL (CurrentActivity) & CHECK_ABORT))); (GLOBAL (CurrentActivity) & CHECK_ABORT)));
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
+6 -6
View File
@@ -359,27 +359,27 @@ DoSetupMenu (PSETUP_MENU_STATE pInputState)
UnbatchGraphics (); UnbatchGraphics ();
if (PulsedInputState.key[KEY_MENU_UP]) if (PulsedInputState.menu[KEY_MENU_UP])
{ {
Widget_Event (WIDGET_EVENT_UP); Widget_Event (WIDGET_EVENT_UP);
} }
else if (PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_DOWN])
{ {
Widget_Event (WIDGET_EVENT_DOWN); Widget_Event (WIDGET_EVENT_DOWN);
} }
else if (PulsedInputState.key[KEY_MENU_LEFT]) else if (PulsedInputState.menu[KEY_MENU_LEFT])
{ {
Widget_Event (WIDGET_EVENT_LEFT); Widget_Event (WIDGET_EVENT_LEFT);
} }
else if (PulsedInputState.key[KEY_MENU_RIGHT]) else if (PulsedInputState.menu[KEY_MENU_RIGHT])
{ {
Widget_Event (WIDGET_EVENT_RIGHT); Widget_Event (WIDGET_EVENT_RIGHT);
} }
if (PulsedInputState.key[KEY_MENU_SELECT]) if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
Widget_Event (WIDGET_EVENT_SELECT); Widget_Event (WIDGET_EVENT_SELECT);
} }
if (PulsedInputState.key[KEY_MENU_CANCEL]) if (PulsedInputState.menu[KEY_MENU_CANCEL])
{ {
Widget_Event (WIDGET_EVENT_CANCEL); Widget_Event (WIDGET_EVENT_CANCEL);
} }
+1 -1
View File
@@ -286,7 +286,7 @@ sis_hyper_postprocess (PELEMENT ElementPtr)
GetElementStarShip (ElementPtr, &StarShipPtr); GetElementStarShip (ElementPtr, &StarShipPtr);
if (((StarShipPtr->cur_status_flags & WEAPON) || if (((StarShipPtr->cur_status_flags & WEAPON) ||
PulsedInputState.key[KEY_MENU_CANCEL]) PulsedInputState.menu[KEY_MENU_CANCEL])
&& StarShipPtr->special_counter == 0) && StarShipPtr->special_counter == 0)
{ {
#define MENU_DELAY 10 #define MENU_DELAY 10
+9 -9
View File
@@ -575,10 +575,10 @@ DoModifyShips (PMENU_STATE pMS)
#ifdef WANT_SHIP_SPINS #ifdef WANT_SHIP_SPINS
BOOLEAN special; BOOLEAN special;
special = PulsedInputState.key[KEY_MENU_SPECIAL]; special = PulsedInputState.menu[KEY_MENU_SPECIAL];
#endif /* WANT_SHIP_SPINS */ #endif /* WANT_SHIP_SPINS */
select = PulsedInputState.key[KEY_MENU_SELECT]; select = PulsedInputState.menu[KEY_MENU_SELECT];
cancel = PulsedInputState.key[KEY_MENU_CANCEL]; cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
{ {
@@ -608,10 +608,10 @@ DoModifyShips (PMENU_STATE pMS)
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
} }
if (PulsedInputState.key[KEY_MENU_RIGHT]) dx = 1; if (PulsedInputState.menu[KEY_MENU_RIGHT]) dx = 1;
if (PulsedInputState.key[KEY_MENU_LEFT]) dx = -1; if (PulsedInputState.menu[KEY_MENU_LEFT]) dx = -1;
if (PulsedInputState.key[KEY_MENU_UP]) dy = -1; if (PulsedInputState.menu[KEY_MENU_UP]) dy = -1;
if (PulsedInputState.key[KEY_MENU_DOWN]) dy = 1; if (PulsedInputState.menu[KEY_MENU_DOWN]) dy = 1;
NewState = pMS->CurState; NewState = pMS->CurState;
if (pMS->delta_item & MODIFY_CREW_FLAG) if (pMS->delta_item & MODIFY_CREW_FLAG)
{ {
@@ -1204,8 +1204,8 @@ DoShipyard (PMENU_STATE pMS)
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
goto ExitShipyard; goto ExitShipyard;
select = PulsedInputState.key[KEY_MENU_SELECT]; select = PulsedInputState.menu[KEY_MENU_SELECT];
cancel = PulsedInputState.key[KEY_MENU_CANCEL]; cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
if (!pMS->Initialized) if (!pMS->Initialized)
+3 -3
View File
@@ -349,7 +349,7 @@ s.origin.x = SAFE_X, s.origin.y = SAFE_Y + 4;
"rotate starbase"); "rotate starbase");
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
} }
else if (PulsedInputState.key[KEY_MENU_SELECT] else if (PulsedInputState.menu[KEY_MENU_SELECT]
|| GET_GAME_STATE (MOONBASE_ON_SHIP) || GET_GAME_STATE (MOONBASE_ON_SHIP)
|| GET_GAME_STATE (CHMMR_BOMB_STATE) == 2) || GET_GAME_STATE (CHMMR_BOMB_STATE) == 2)
{ {
@@ -411,12 +411,12 @@ ExitStarBase:
STARBASE_STATE NewState; STARBASE_STATE NewState;
NewState = pMS->CurState; NewState = pMS->CurState;
if (PulsedInputState.key[KEY_MENU_LEFT] || PulsedInputState.key[KEY_MENU_UP]) if (PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_UP])
{ {
if (NewState-- == TALK_COMMANDER) if (NewState-- == TALK_COMMANDER)
NewState = DEPART_BASE; NewState = DEPART_BASE;
} }
else if (PulsedInputState.key[KEY_MENU_RIGHT] || PulsedInputState.key[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_RIGHT] || PulsedInputState.menu[KEY_MENU_DOWN])
{ {
if (NewState++ == DEPART_BASE) if (NewState++ == DEPART_BASE)
NewState = TALK_COMMANDER; NewState = TALK_COMMANDER;
+3 -3
View File
@@ -186,13 +186,13 @@ PauseGame (void)
FlushGraphics (); FlushGraphics ();
//LockMutex (GraphicsLock); //LockMutex (GraphicsLock);
while (ImmediateInputState.key[KEY_PAUSE]) while (ImmediateInputState.menu[KEY_PAUSE])
TaskSwitch (); TaskSwitch ();
while (!ImmediateInputState.key[KEY_PAUSE]) while (!ImmediateInputState.menu[KEY_PAUSE])
TaskSwitch (); TaskSwitch ();
while (ImmediateInputState.key[KEY_PAUSE]) while (ImmediateInputState.menu[KEY_PAUSE])
TaskSwitch (); TaskSwitch ();
GamePaused = FALSE; GamePaused = FALSE;