diff options
author | Simon Howard | 2014-04-19 01:12:13 -0400 |
---|---|---|
committer | Simon Howard | 2014-04-19 01:12:13 -0400 |
commit | 74e1b8b7548e6d14eb9be748279e8100a766cf04 (patch) | |
tree | ed10a7eb0605d8fd58e4bd8974a2994eb839976b /src/heretic | |
parent | 64cdaabd292d54fe3637b4530eb610af2d46c647 (diff) | |
download | chocolate-doom-74e1b8b7548e6d14eb9be748279e8100a766cf04.tar.gz chocolate-doom-74e1b8b7548e6d14eb9be748279e8100a766cf04.tar.bz2 chocolate-doom-74e1b8b7548e6d14eb9be748279e8100a766cf04.zip |
joystick: Add an axis to allow strafing.
Modern gamepads typically have 2-3 D-pads and joysticks. This means
that it's desirable to be able to use one joystick for turning and
another for strafing. Add another axis in addition to the current X
and y axes that performs strafe movement.
Diffstat (limited to 'src/heretic')
-rw-r--r-- | src/heretic/g_game.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c index 64186769..3b86fa6b 100644 --- a/src/heretic/g_game.c +++ b/src/heretic/g_game.c @@ -195,6 +195,7 @@ int dclicktime2, dclickstate2, dclicks2; #define MAX_JOY_BUTTONS 20 int joyxmove, joyymove; // joystick values are repeated +int joystrafemove; boolean joyarray[MAX_JOY_BUTTONS + 1]; boolean *joybuttons = &joyarray[1]; // allow [-1] @@ -379,10 +380,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic) if (joyymove > 0) forward -= forwardmove[speed]; if (gamekeydown[key_straferight] || mousebuttons[mousebstraferight] - || joybuttons[joybstraferight]) + || joybuttons[joybstraferight] || joystrafemove > 0) side += sidemove[speed]; if (gamekeydown[key_strafeleft] || mousebuttons[mousebstrafeleft] - || joybuttons[joybstrafeleft]) + || joybuttons[joybstrafeleft] || joystrafemove < 0) side -= sidemove[speed]; // Look up/down/center keys @@ -663,7 +664,7 @@ void G_DoLoadLevel(void) // memset(gamekeydown, 0, sizeof(gamekeydown)); - joyxmove = joyymove = 0; + joyxmove = joyymove = joystrafemove = 0; mousex = mousey = 0; sendpause = sendsave = paused = false; memset(mousearray, 0, sizeof(mousearray)); @@ -879,6 +880,7 @@ boolean G_Responder(event_t * ev) SetJoyButtons(ev->data1); joyxmove = ev->data2; joyymove = ev->data3; + joystrafemove = ev->data4; return (true); // eat events default: |