diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 16d060bbe..2174db9d1 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -681,9 +681,10 @@ int32_t initinput(void) SDL_JoystickEventState(SDL_ENABLE); inputdevices |= 4; - joynumaxes = SDL_JoystickNumAxes(joydev); + // KEEPINSYNC source/gamedefs.h, source/jmact/_control.h + joynumaxes = min(9, SDL_JoystickNumAxes(joydev)); joynumbuttons = min(32, SDL_JoystickNumButtons(joydev)); - joynumhats = SDL_JoystickNumHats(joydev); + joynumhats = min((36-joynumbuttons)/4,SDL_JoystickNumHats(joydev)); initprintf("Joystick 1 has %d axes, %d buttons, and %d hat(s).\n", joynumaxes, joynumbuttons, joynumhats); joyaxis = (int32_t *)Bcalloc(joynumaxes, sizeof(int32_t)); diff --git a/polymer/eduke32/source/_functio.h b/polymer/eduke32/source/_functio.h index 4a4b60f68..3cef22f19 100644 --- a/polymer/eduke32/source/_functio.h +++ b/polymer/eduke32/source/_functio.h @@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // default button assignments and game function names // axis defaults are also included +#include "_control.h" +#include "control.h" #ifndef function_private_h_ #define function_private_h_ @@ -218,7 +220,7 @@ const char oldkeydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] = "Dpad_Aiming", "", "", }; -static const char * mousedefaults[] = +static const char * mousedefaults[MAXMOUSEBUTTONS] = { "Fire", "MedKit", @@ -226,45 +228,27 @@ static const char * mousedefaults[] = "", "Previous_Weapon", "Next_Weapon", - "", - "", - "", - "" }; -static const char * mouseclickeddefaults[] = +static const char * mouseclickeddefaults[MAXMOUSEBUTTONS] = { - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" }; -static const char * mouseanalogdefaults[] = +static const char * mouseanalogdefaults[MAXMOUSEAXES] = { "analog_turning", "analog_moving", }; -static const char * mousedigitaldefaults[] = +static const char * mousedigitaldefaults[MAXMOUSEDIGITAL] = { - "", - "", - "", - "", }; #if defined(GEKKO) -static const char * joystickdefaults[] = +static const char * joystickdefaults[MAXJOYBUTTONSANDHATS] = { "Open", // A "Fire", // B @@ -285,27 +269,10 @@ static const char * joystickdefaults[] = "Inventory_Right", // D-Pad Right "Inventory", // D-Pad Down "Inventory_Left", // D-Pad Left - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", }; -static const char * joystickclickeddefaults[] = +static const char * joystickclickeddefaults[MAXJOYBUTTONSANDHATS] = { "", "", @@ -320,74 +287,23 @@ static const char * joystickclickeddefaults[] = "", "", "Inventory", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", }; -static const char * joystickanalogdefaults[] = +static const char * joystickanalogdefaults[MAXJOYAXES] = { "analog_strafing", "analog_moving", "analog_turning", "analog_lookingupanddown", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", }; -static const char * joystickdigitaldefaults[] = +static const char * joystickdigitaldefaults[MAXJOYDIGITAL] = { - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", }; #else -static const char * joystickdefaults[] = +static const char * joystickdefaults[MAXJOYBUTTONSANDHATS] = { "Fire", "Strafe", @@ -428,61 +344,24 @@ static const char * joystickdefaults[] = }; -static const char * joystickclickeddefaults[] = +static const char * joystickclickeddefaults[MAXJOYBUTTONSANDHATS] = { "", "Inventory", "Jump", "Crouch", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", }; -static const char * joystickanalogdefaults[] = +static const char * joystickanalogdefaults[MAXJOYAXES] = { "analog_turning", "analog_moving", "analog_strafing", - "", - "", - "", - "", - "", }; -static const char * joystickdigitaldefaults[] = +static const char * joystickdigitaldefaults[MAXJOYDIGITAL] = { "", "", @@ -491,15 +370,6 @@ static const char * joystickdigitaldefaults[] = "", "", "Run", - "", - "", - "", - "", - "", - "", - "", - "", - "", }; #endif diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 0cdaf651f..42110a675 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -64,6 +64,9 @@ int32_t CONFIG_FunctionNameToNum(const char *func) { int32_t i; + if (!func) + return -1; + i = hash_find(&h_gamefuncs,func); if (i < 0) @@ -104,6 +107,8 @@ char *CONFIG_FunctionNumToName(int32_t func) int32_t CONFIG_AnalogNameToNum(const char *func) { + if (!func) + return -1; if (!Bstrcasecmp(func,"analog_turning")) { diff --git a/polymer/eduke32/source/gamedefs.h b/polymer/eduke32/source/gamedefs.h index 4eeb9ed9a..13d3ee54d 100644 --- a/polymer/eduke32/source/gamedefs.h +++ b/polymer/eduke32/source/gamedefs.h @@ -46,18 +46,18 @@ extern "C" { #define SETUPFILENAME "eduke32.cfg" // Number of JOY buttons -// KEEPINSYNC jmact/_control.h +// KEEPINSYNC source/jmact/_control.h, build/src/sdlayer.c #define MAXJOYBUTTONS 32 #define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4) // Number of Mouse Axes -// KEEPINSYNC jmact/_control.h +// KEEPINSYNC source/jmact/_control.h, build/src/sdlayer.c #define MAXMOUSEAXES 2 #define MAXMOUSEDIGITAL (MAXMOUSEAXES*2) // Number of JOY axes -// KEEPINSYNC jmact/_control.h -#define MAXJOYAXES 8 +// KEEPINSYNC source/jmact/_control.h, build/src/sdlayer.c +#define MAXJOYAXES 9 #define MAXJOYDIGITAL (MAXJOYAXES*2) // DEFAULT mouse sensitivity scale diff --git a/polymer/eduke32/source/jmact/_control.h b/polymer/eduke32/source/jmact/_control.h index 8622e30e6..2349c756f 100644 --- a/polymer/eduke32/source/jmact/_control.h +++ b/polymer/eduke32/source/jmact/_control.h @@ -64,18 +64,18 @@ extern "C" { //#define MAXMOUSEBUTTONS 10 // Number of Mouse Axes -// KEEPINSYNC gamedefs.h +// KEEPINSYNC source/gamedefs.h, build/src/sdlayer.c #define MAXMOUSEAXES 2 #define MAXMOUSEDIGITAL (MAXMOUSEAXES*2) // Number of JOY buttons -// KEEPINSYNC gamedefs.h +// KEEPINSYNC source/gamedefs.h, build/src/sdlayer.c #define MAXJOYBUTTONS 32 #define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4) // Number of JOY axes -// KEEPINSYNC gamedefs.h -#define MAXJOYAXES 8 +// KEEPINSYNC source/gamedefs.h, build/src/sdlayer.c +#define MAXJOYAXES 9 #define MAXJOYDIGITAL (MAXJOYAXES*2) // NORMAL axis scale