diff options
author | Simon Howard | 2008-09-28 17:16:51 +0000 |
---|---|---|
committer | Simon Howard | 2008-09-28 17:16:51 +0000 |
commit | 18a8d8a3b2ab7eeade733bd587531b4dac830a29 (patch) | |
tree | 5e96101e4d692a200f437ee5377cb8bfed7e7021 | |
parent | 0c74071858b7dc8df708519b1efffbf18d6ad954 (diff) | |
download | chocolate-doom-18a8d8a3b2ab7eeade733bd587531b4dac830a29.tar.gz chocolate-doom-18a8d8a3b2ab7eeade733bd587531b4dac830a29.tar.bz2 chocolate-doom-18a8d8a3b2ab7eeade733bd587531b4dac830a29.zip |
Expand number of joystick buttons supported by Heretic to the number
supported by Chocolate Doom.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1304
-rw-r--r-- | src/heretic/g_game.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c index 364d25ea..54218087 100644 --- a/src/heretic/g_game.c +++ b/src/heretic/g_game.c @@ -164,7 +164,7 @@ int dclicktime2, dclickstate2, dclicks2; #define MAX_JOY_BUTTONS 20 int joyxmove, joyymove; // joystick values are repeated -boolean joyarray[5]; +boolean joyarray[MAX_JOY_BUTTONS + 1]; boolean *joybuttons = &joyarray[1]; // allow [-1] int savegameslot; @@ -774,6 +774,15 @@ void G_DoLoadLevel(void) memset(joybuttons, 0, sizeof(joybuttons)); } +static void SetJoyButtons(unsigned int buttons_mask) +{ + int i; + + for (i=0; i<MAX_JOY_BUTTONS; ++i) + { + joybuttons[i] = (buttons_mask & (1 << i)) != 0; + } +} /* =============================================================================== @@ -911,10 +920,7 @@ boolean G_Responder(event_t * ev) return (true); // eat events case ev_joystick: - joybuttons[0] = ev->data1 & 1; - joybuttons[1] = ev->data1 & 2; - joybuttons[2] = ev->data1 & 4; - joybuttons[3] = ev->data1 & 8; + SetJoyButtons(ev->data1); joyxmove = ev->data2; joyymove = ev->data3; return (true); // eat events |