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