Fix the MAXJOYBUTTONS discrepancy between _control.h and gamedefs.h.

git-svn-id: https://svn.eduke32.com/eduke32@4826 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-12-18 18:15:51 +00:00
parent 0869194b60
commit eca33954db
6 changed files with 21 additions and 14 deletions

View file

@ -322,7 +322,7 @@ void CONFIG_SetDefaults(void)
CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY; CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY;
memset(ud.config.JoystickFunctions, -1, sizeof(ud.config.JoystickFunctions)); memset(ud.config.JoystickFunctions, -1, sizeof(ud.config.JoystickFunctions));
for (i=0; i<MAXJOYBUTTONS; i++) for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
{ {
ud.config.JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdefaults[i]); ud.config.JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdefaults[i]);
ud.config.JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]); ud.config.JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]);
@ -489,7 +489,7 @@ void CONFIG_SetupJoystick(void)
if (ud.config.scripthandle < 0) return; if (ud.config.scripthandle < 0) return;
for (i=0; i<MAXJOYBUTTONS; i++) for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
{ {
Bsprintf(str,"JoystickButton%d",i); Bsprintf(str,"JoystickButton%d",i);
temp[0] = 0; temp[0] = 0;
@ -539,7 +539,7 @@ void CONFIG_SetupJoystick(void)
ud.config.JoystickAnalogueSaturate[i] = scale; ud.config.JoystickAnalogueSaturate[i] = scale;
} }
for (i=0; i<MAXJOYBUTTONS; i++) for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
{ {
CONTROL_MapButton(ud.config.JoystickFunctions[i][0], i, 0, controldevice_joystick); CONTROL_MapButton(ud.config.JoystickFunctions[i][0], i, 0, controldevice_joystick);
CONTROL_MapButton(ud.config.JoystickFunctions[i][1], i, 1, controldevice_joystick); CONTROL_MapButton(ud.config.JoystickFunctions[i][1], i, 1, controldevice_joystick);
@ -908,7 +908,7 @@ void CONFIG_WriteSetup(uint32_t flags)
Bsprintf(tempbuf,"%.2f",CONTROL_MouseSensitivity); Bsprintf(tempbuf,"%.2f",CONTROL_MouseSensitivity);
SCRIPT_PutString(ud.config.scripthandle, "Controls","Mouse_Sensitivity",tempbuf); SCRIPT_PutString(ud.config.scripthandle, "Controls","Mouse_Sensitivity",tempbuf);
for (dummy=0; dummy<MAXJOYBUTTONS; dummy++) for (dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
{ {
if (CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][0])) if (CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][0]))
{ {

View file

@ -188,7 +188,7 @@ typedef struct {
int32_t MouseDigitalFunctions[MAXMOUSEAXES][2]; int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
int32_t MouseAnalogueAxes[MAXMOUSEAXES]; int32_t MouseAnalogueAxes[MAXMOUSEAXES];
int32_t MouseAnalogueScale[MAXMOUSEAXES]; int32_t MouseAnalogueScale[MAXMOUSEAXES];
int32_t JoystickFunctions[MAXJOYBUTTONS][2]; int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
int32_t JoystickDigitalFunctions[MAXJOYAXES][2]; int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
int32_t JoystickAnalogueAxes[MAXJOYAXES]; int32_t JoystickAnalogueAxes[MAXJOYAXES];
int32_t JoystickAnalogueScale[MAXJOYAXES]; int32_t JoystickAnalogueScale[MAXJOYAXES];

View file

@ -46,16 +46,19 @@ extern "C" {
#define SETUPFILENAME "eduke32.cfg" #define SETUPFILENAME "eduke32.cfg"
// Number of JOY buttons // Number of JOY buttons
// XXX: out of sync with jmact/_control.h // KEEPINSYNC jmact/_control.h
#define MAXJOYBUTTONS (32+4) #define MAXJOYBUTTONS 32
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
// Number of Mouse Axes // Number of Mouse Axes
// KEEPINSYNC jmact/_control.h // KEEPINSYNC jmact/_control.h
#define MAXMOUSEAXES 2 #define MAXMOUSEAXES 2
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
// Number of JOY axes // Number of JOY axes
// KEEPINSYNC jmact/_control.h // KEEPINSYNC jmact/_control.h
#define MAXJOYAXES 8 #define MAXJOYAXES 8
#define MAXJOYDIGITAL (MAXJOYAXES*2)
// DEFAULT mouse sensitivity scale // DEFAULT mouse sensitivity scale
#define DEFAULTMOUSESENSITIVITY 7 #define DEFAULTMOUSESENSITIVITY 7

View file

@ -66,14 +66,17 @@ extern "C" {
// Number of Mouse Axes // Number of Mouse Axes
// KEEPINSYNC gamedefs.h // KEEPINSYNC gamedefs.h
#define MAXMOUSEAXES 2 #define MAXMOUSEAXES 2
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
// Number of JOY buttons // Number of JOY buttons
// XXX: out of sync with gamedefs.h // KEEPINSYNC gamedefs.h
#define MAXJOYBUTTONS 32 #define MAXJOYBUTTONS 32
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
// Number of JOY axes // Number of JOY axes
// KEEPINSYNC gamedefs.h // KEEPINSYNC gamedefs.h
#define MAXJOYAXES 8 #define MAXJOYAXES 8
#define MAXJOYDIGITAL (MAXJOYAXES*2)
// NORMAL axis scale // NORMAL axis scale
#define NORMALAXISSCALE 65536 #define NORMALAXISSCALE 65536

View file

@ -478,7 +478,8 @@ enum
{ {
MAXMOUSEBUTTONS = 10, MAXMOUSEBUTTONS = 10,
MAXMOUSEAXES = 2, MAXMOUSEAXES = 2,
MAXJOYBUTTONS = (32+4), MAXJOYBUTTONS = 32,
MAXJOYBUTTONSANDHATS = (32+4),
MAXJOYAXES = 8, MAXJOYAXES = 8,
NUMGAMEFUNCTIONS = 56, NUMGAMEFUNCTIONS = 56,
MAXRIDECULE = 10, MAXRIDECULE = 10,
@ -528,7 +529,7 @@ typedef struct {
int32_t MouseDigitalFunctions[MAXMOUSEAXES][2]; int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
int32_t MouseAnalogueAxes[MAXMOUSEAXES]; int32_t MouseAnalogueAxes[MAXMOUSEAXES];
int32_t MouseAnalogueScale[MAXMOUSEAXES]; int32_t MouseAnalogueScale[MAXMOUSEAXES];
int32_t JoystickFunctions[MAXJOYBUTTONS][2]; int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
int32_t JoystickDigitalFunctions[MAXJOYAXES][2]; int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
int32_t JoystickAnalogueAxes[MAXJOYAXES]; int32_t JoystickAnalogueAxes[MAXJOYAXES];
int32_t JoystickAnalogueScale[MAXJOYAXES]; int32_t JoystickAnalogueScale[MAXJOYAXES];

View file

@ -672,11 +672,11 @@ static MenuEntry_t *MEL_JOYSTICKSETUP[] = {
#define MAXJOYBUTTONSTRINGLENGTH 32 #define MAXJOYBUTTONSTRINGLENGTH 32
static char MenuJoystickNames[MAXJOYBUTTONS<<1][MAXJOYBUTTONSTRINGLENGTH]; static char MenuJoystickNames[MAXJOYBUTTONSANDHATS*2][MAXJOYBUTTONSTRINGLENGTH];
static MenuOption_t MEO_JOYSTICKBTNS[MAXJOYBUTTONS<<1]; static MenuOption_t MEO_JOYSTICKBTNS[MAXJOYBUTTONSANDHATS*2];
static MenuEntry_t ME_JOYSTICKBTNS[MAXJOYBUTTONS<<1]; static MenuEntry_t ME_JOYSTICKBTNS[MAXJOYBUTTONSANDHATS*2];
static MenuEntry_t *MEL_JOYSTICKBTNS[MAXJOYBUTTONS<<1]; static MenuEntry_t *MEL_JOYSTICKBTNS[MAXJOYBUTTONSANDHATS*2];
static MenuLink_t MEO_JOYSTICKAXES = { MENU_JOYSTICKAXIS, MA_Advance, }; static MenuLink_t MEO_JOYSTICKAXES = { MENU_JOYSTICKAXIS, MA_Advance, };
static MenuEntry_t ME_JOYSTICKAXES_TEMPLATE = MAKE_MENUENTRY( NULL, &MF_Redfont, &MEF_BigSliders, &MEO_JOYSTICKAXES, Link ); static MenuEntry_t ME_JOYSTICKAXES_TEMPLATE = MAKE_MENUENTRY( NULL, &MF_Redfont, &MEF_BigSliders, &MEO_JOYSTICKAXES, Link );