From 5aa5e1fed5f7245a942bbfee43935d58a990deb5 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 14 Jun 2007 21:15:52 +0000 Subject: Support up to 20 joystick buttons. Justification: most modern joysticks and joypads have many more than four buttons. Keeping the limit at four buttons restricts the player into using the first four buttons on his joystick/pad, which could be any arbitrary four set of buttons. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 905 --- src/g_game.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/g_game.c b/src/g_game.c index dd2c2669..0a2d5862 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -220,10 +220,12 @@ static int dclicktime2; static boolean dclickstate2; static int dclicks2; +#define MAX_JOY_BUTTONS 20 + // joystick values are repeated static int joyxmove; static int joyymove; -static boolean joyarray[5]; +static boolean joyarray[MAX_JOY_BUTTONS + 1]; static boolean *joybuttons = &joyarray[1]; // allow [-1] static int savegameslot; @@ -392,7 +394,7 @@ void G_BuildTiccmd (ticcmd_t* cmd) // allowed an autorun effect speed = key_speed >= NUMKEYS - || joybspeed >= 20 + || joybspeed >= MAX_JOY_BUTTONS || gamekeydown[key_speed] || joybuttons[joybspeed]; @@ -657,6 +659,16 @@ void G_DoLoadLevel (void) } } + +static void SetJoyButtons(unsigned int buttons_mask) +{ + int i; + + for (i=0; idata1 & 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 -- cgit v1.2.3