Added a 4th button DEVICE_BUTTON4 currently assigned as 'Esc' which

executes an emergency-escape (the old chord still works too)


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@678 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
ghaushe
2003-02-05 03:52:50 +00:00
parent acfdfa9eda
commit 224593e705
9 changed files with 46 additions and 30 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.2:
- Added a 4th button to starcon.key 'Esc' now emergency-escapes -PBlue
- Biadapt and biadv scalers now work in OpenGL mode too -Mika
- Fixed lockup when fastforwarding through orz comm -PBlue
- A new windows installer is now in builds/win32_install -PBlue
+6 -2
View File
@@ -1,7 +1,7 @@
# File format:
# Three lines for Pause Key, Exit Key, Abort Key
# 9 lines for player 1, 9 lines for player 2 in the following order:
# Left, Right, Up, Down, Button 1, Button 2, Button 3,
# 10 lines for player 1, 10 lines for player 2 in the following order:
# Left, Right, Up, Down, Button 1, Button 2, Button 3, Button 4,
# Left Shift, Right Shift
#
# Each player's key listing can begin with an optional joystick declaration
@@ -42,6 +42,7 @@
"Enter"
" "
"RCtrl"
"Esc"
"LShift"
"RShift"
#
@@ -55,6 +56,7 @@
#"Enter" <Joy-B0>
#" " <Joy-B1>
#"RCtrl" <Joy-C0,1>
#"Esc"
#"LShift"
#"RShift"
#
@@ -68,6 +70,7 @@
#"Enter" <Joy-B2>
#" " <Joy-B3>
#"RCtrl" <Joy-B4>
#"Esc"
#"LShift" <Joy-B0>
#"RShift" <Joy-B1>
#
@@ -82,3 +85,4 @@
"a"
""
""
""
+3 -1
View File
@@ -467,7 +467,9 @@ UP or ENTER: Thrust
LEFT and RIGHT: Steer
SPACE: Fire Primary Weapon
CONTROL: Fire Secondary Weapon
SPACE with RIGHT SHIFT: Emergency Warp Escape
SPACE with RIGHT SHIFT
OR
ESCAPE: Emergency Warp Escape
Planet Exploration
+3 -2
View File
@@ -89,8 +89,9 @@ if ((InputState & DEVICE_BUTTON3)
&& cur_player == 0
&& ((PlayerControl[cur_player] & HUMAN_CONTROL)
|| (InputState = GetInputState (NormalInput)))
&& (InputState & (DEVICE_BUTTON2 | DEVICE_RIGHTSHIFT))
== (DEVICE_BUTTON2 | DEVICE_RIGHTSHIFT))
&& ((InputState & (DEVICE_BUTTON2 | DEVICE_RIGHTSHIFT))
== (DEVICE_BUTTON2 | DEVICE_RIGHTSHIFT)
|| (InputState & DEVICE_BUTTON4)))
{
ELEMENTPTR ElementPtr;
+7 -6
View File
@@ -82,10 +82,11 @@ typedef enum
#define DEVICE_BUTTON1 ((INPUT_STATE)1 << 19)
#define DEVICE_BUTTON2 ((INPUT_STATE)1 << 20)
#define DEVICE_BUTTON3 ((INPUT_STATE)1 << 21)
#define DEVICE_PAUSE ((INPUT_STATE)1 << 22)
#define DEVICE_EXIT ((INPUT_STATE)1 << 23)
#define DEVICE_LEFTSHIFT ((INPUT_STATE)1 << 24)
#define DEVICE_RIGHTSHIFT ((INPUT_STATE)1 << 25)
#define DEVICE_BUTTON4 ((INPUT_STATE)1 << 22)
#define DEVICE_PAUSE ((INPUT_STATE)1 << 23)
#define DEVICE_EXIT ((INPUT_STATE)1 << 24)
#define DEVICE_LEFTSHIFT ((INPUT_STATE)1 << 25)
#define DEVICE_RIGHTSHIFT ((INPUT_STATE)1 << 26)
extern BOOLEAN InitInput (BOOLEAN (*PauseFunc) (void), UNICODE Pause,
UNICODE Exit, UNICODE Abort);
@@ -93,10 +94,10 @@ extern BOOLEAN UninitInput (void);
extern INPUT_DEVICE CreateSerialKeyboardDevice (void);
extern INPUT_DEVICE CreateJoystickKeyboardDevice (UWORD lfkey, UWORD
rtkey, UWORD topkey, UWORD botkey, UWORD but1key, UWORD
but2key, UWORD but3key, UWORD shift1key, UWORD shift2key);
but2key, UWORD but3key, UWORD but4key, UWORD shift1key, UWORD shift2key);
extern INPUT_DEVICE CreateJoystickDevice (COUNT port, UWORD threshold,
UWORD left, UWORD right, UWORD up, UWORD down,
UWORD but1, UWORD but2, UWORD but3, UWORD s1, UWORD s2);
UWORD but1, UWORD but2, UWORD but3, UWORD but4, UWORD s1, UWORD s2);
extern INPUT_DEVICE CreateInternalDevice (INPUT_STATE (*input_func)
(INPUT_REF InputRef, INPUT_STATE InputState));
extern BOOLEAN DestroyInputDevice (INPUT_DEVICE InputDevice);
+12 -9
View File
@@ -21,7 +21,7 @@
#include "inplib.h"
#define NUM_INPUTS 9
#define NUM_INPUTS 10
/*
* Inputs
* 0 - Left
@@ -31,8 +31,9 @@
* 4 - Button 1
* 5 - Button 2
* 6 - Button 3
* 7 - Left shift
* 8 - Right shift
* 7 - Button 4
* 8 - Left shift
* 9 - Right shift
*/
typedef struct inp_dev
@@ -73,7 +74,7 @@ typedef PBYTE BYTEPTR;
#define SetInputDeviceHandle(i,h) \
((INPUT_DESCPTR)(i))->ThisDevice = (h)
#define SetInputDeviceKeyEquivalents(i,l,r,t,b,b1,b2,b3,s1,s2) \
#define SetInputDeviceKeyEquivalents(i,l,r,t,b,b1,b2,b3,b4,s1,s2) \
(((INPUT_DESCPTR)(i))->device.key_equivalent[0] = (l), \
((INPUT_DESCPTR)(i))->device.key_equivalent[1] = (r), \
((INPUT_DESCPTR)(i))->device.key_equivalent[2] = (t), \
@@ -81,9 +82,10 @@ typedef PBYTE BYTEPTR;
((INPUT_DESCPTR)(i))->device.key_equivalent[4] = (b1), \
((INPUT_DESCPTR)(i))->device.key_equivalent[5] = (b2), \
((INPUT_DESCPTR)(i))->device.key_equivalent[6] = (b3), \
((INPUT_DESCPTR)(i))->device.key_equivalent[7] = (s1), \
((INPUT_DESCPTR)(i))->device.key_equivalent[8] = (s2))
#define SetInputDeviceJoystickButtons(i,l,r,t,b,b1,b2,b3,s1,s2) \
((INPUT_DESCPTR)(i))->device.key_equivalent[7] = (b4), \
((INPUT_DESCPTR)(i))->device.key_equivalent[8] = (s1), \
((INPUT_DESCPTR)(i))->device.key_equivalent[9] = (s2))
#define SetInputDeviceJoystickButtons(i,l,r,t,b,b1,b2,b3,b4,s1,s2) \
(((INPUT_DESCPTR)(i))->device.joystick_info.joystick_buttons[0] = l, \
((INPUT_DESCPTR)(i))->device.joystick_info.joystick_buttons[1] = r, \
((INPUT_DESCPTR)(i))->device.joystick_info.joystick_buttons[2] = t, \
@@ -91,8 +93,9 @@ typedef PBYTE BYTEPTR;
((INPUT_DESCPTR)(i))->device.joystick_info.joystick_buttons[4] = b1, \
((INPUT_DESCPTR)(i))->device.joystick_info.joystick_buttons[5] = b2, \
((INPUT_DESCPTR)(i))->device.joystick_info.joystick_buttons[6] = b3, \
((INPUT_DESCPTR)(i))->device.joystick_info.joystick_buttons[7] = s1, \
((INPUT_DESCPTR)(i))->device.joystick_info.joystick_buttons[8] = s2)
((INPUT_DESCPTR)(i))->device.joystick_info.joystick_buttons[7] = b4, \
((INPUT_DESCPTR)(i))->device.joystick_info.joystick_buttons[8] = s1, \
((INPUT_DESCPTR)(i))->device.joystick_info.joystick_buttons[9] = s2)
#define SetInputDeviceJoystickPort(i,p) \
((INPUT_DESCPTR)(i))->device.joystick_info.joystick_port = (p)
#define SetInputDeviceJoystickThreshold(i,t) \
+5 -5
View File
@@ -49,7 +49,7 @@ CreateSerialKeyboardDevice (void)
INPUT_DEVICE
CreateJoystickKeyboardDevice (UWORD lfkey, UWORD rtkey, UWORD
topkey, UWORD botkey, UWORD but1key, UWORD but2key, UWORD
but3key, UWORD shift1key, UWORD shift2key)
but3key, UWORD but4key, UWORD shift1key, UWORD shift2key)
{
INPUT_DEVICE InputDevice;
@@ -69,7 +69,7 @@ CreateJoystickKeyboardDevice (UWORD lfkey, UWORD rtkey, UWORD
SetInputDeviceInputFunc (InputPtr, _get_joystick_keyboard_state);
SetInputDeviceKeyEquivalents (InputPtr,
lfkey, rtkey, topkey, botkey,
but1key, but2key, but3key,
but1key, but2key, but3key, but4key,
shift1key, shift2key);
UnlockInputDevice (InputDevice);
@@ -81,8 +81,8 @@ CreateJoystickKeyboardDevice (UWORD lfkey, UWORD rtkey, UWORD
INPUT_DEVICE
CreateJoystickDevice (COUNT port, UWORD threshold, UWORD left, UWORD right,
UWORD top, UWORD bottom, UWORD but1, UWORD but2, UWORD but3, UWORD s1,
UWORD s2)
UWORD top, UWORD bottom, UWORD but1, UWORD but2, UWORD but3, UWORD but4,
UWORD s1, UWORD s2)
{
INPUT_DEVICE InputDevice;
@@ -104,7 +104,7 @@ CreateJoystickDevice (COUNT port, UWORD threshold, UWORD left, UWORD right,
SetInputDeviceInputFunc (InputPtr, _get_joystick_state);
SetInputDeviceJoystickPort (InputPtr, port);
SetInputDeviceJoystickButtons (InputPtr, left, right, top, bottom,
but1, but2, but3, s1, s2);
but1, but2, but3, but4, s1, s2);
SetInputDeviceJoystickThreshold(InputPtr, threshold);
UnlockInputDevice (InputDevice);
+2
View File
@@ -469,6 +469,8 @@ _get_joystick_keyboard_state (INPUT_REF InputRef, INPUT_STATE InputState)
InputState |= DEVICE_BUTTON2;
if (GetKeyboardDown (*KeyEquivalentPtr++))
InputState |= DEVICE_BUTTON3;
if (GetKeyboardDown (*KeyEquivalentPtr++))
InputState |= DEVICE_BUTTON4;
if (GetKeyboardDown (*KeyEquivalentPtr++))
InputState |= DEVICE_LEFTSHIFT;
+7 -5
View File
@@ -126,6 +126,8 @@ static UWORD ParseKeyString(char* line)
return SK_KEYPAD_PLUS;
else if (!strcmp(key, "KP-"))
return SK_KEYPAD_MINUS;
else if (!strcmp(key, "Esc"))
return 27; //Escape is stadard ASCII 27
else
return key[0];
}
@@ -133,7 +135,7 @@ static UWORD ParseKeyString(char* line)
static MEM_HANDLE
LoadKeyConfig (FILE *fp, DWORD length)
{
UWORD buf[18];
UWORD buf[20];
int p;
int i;
char line[256];
@@ -166,7 +168,7 @@ LoadKeyConfig (FILE *fp, DWORD length)
int joyThresh = 0;
memset(buf, 0xFF, sizeof(buf));
// Read in 9 inputs
for (i = 0; i < 9; ++i)
for (i = 0; i < 10; ++i)
{
// Look for valid lines
for (;;)
@@ -243,13 +245,13 @@ LoadKeyConfig (FILE *fp, DWORD length)
}
KeyboardInput[p] = CaptureInputDevice (
CreateJoystickKeyboardDevice(buf[0], buf[1], buf[2], buf[3], buf[4],
buf[5], buf[6], buf[7], buf[8])
buf[5], buf[6], buf[7], buf[8], buf[9])
);
if (joyN != -1)
{
JoystickInput[p] = CaptureInputDevice (
CreateJoystickDevice(joyN, joyThresh, buf[9], buf[10], buf[11],
buf[12], buf[13], buf[14], buf[15], buf[16], buf[17])
CreateJoystickDevice(joyN, joyThresh, buf[10], buf[11], buf[12],
buf[13], buf[14], buf[15], buf[16], buf[17], buf[18], buf[19])
);
}
else