diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h index 399f87d1d..3fe960aa1 100644 --- a/source/build/include/baselayer.h +++ b/source/build/include/baselayer.h @@ -234,12 +234,12 @@ static FORCE_INLINE void keyBufferInsert(char code) void keyFlushChars(void); -int32_t mouseInit(void); +void mouseInit(void); void mouseUninit(void); int32_t mouseReadAbs(vec2_t *pResult, vec2_t const *pInput); void mouseGrabInput(bool grab); void mouseLockToWindow(char a); -void mouseReadButtons(int32_t *pResult); +int32_t mouseReadButtons(void); void mouseReadPos(int32_t *x, int32_t *y); void joyReadButtons(int32_t *pResult); diff --git a/source/build/src/baselayer.cpp b/source/build/src/baselayer.cpp index dd48f5441..33b9f6743 100644 --- a/source/build/src/baselayer.cpp +++ b/source/build/src/baselayer.cpp @@ -121,9 +121,9 @@ int32_t mouseReadAbs(vec2_t * const pResult, vec2_t const * const pInput) return 1; } -void mouseReadButtons(int32_t *pResult) +int32_t mouseReadButtons(void) { - *pResult = (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || (osd && osd->flags & OSD_CAPTURE)) ? 0 : g_mouseBits; + return (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || (osd && osd->flags & OSD_CAPTURE)) ? 0 : g_mouseBits; } controllerinput_t joystick; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 1ad1f016a..0bf809a29 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -11530,8 +11530,8 @@ void rotatepoint(vec2_t const pivot, vec2_t p, int16_t daang, vec2_t *p2) void mouseGetValues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) { - mouseReadPos(mousx,mousy); - mouseReadButtons(bstatus); + mouseReadPos(mousx, mousy); + *bstatus = mouseReadButtons(); } diff --git a/source/build/src/rawinput.cpp b/source/build/src/rawinput.cpp index 0892573f9..e83e03b64 100644 --- a/source/build/src/rawinput.cpp +++ b/source/build/src/rawinput.cpp @@ -279,11 +279,10 @@ void RI_PollDevices(BOOL loop) } } -int32_t mouseInit(void) +void mouseInit(void) { - if (g_mouseEnabled) return 0; - mouseGrabInput(g_mouseEnabled = g_mouseLockedToWindow); - return 0; + if (!g_mouseEnabled) + mouseGrabInput(g_mouseEnabled = g_mouseLockedToWindow); } void mouseUninit(void) diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index 2ff9952d7..23df5dcf4 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -898,11 +898,9 @@ const char *joyGetName(int32_t what, int32_t num) // // initmouse() -- init mouse input // -int32_t mouseInit(void) +void mouseInit(void) { - g_mouseEnabled=g_mouseLockedToWindow; - mouseGrabInput(g_mouseLockedToWindow); // FIXME - SA - return 0; + mouseGrabInput(g_mouseEnabled = g_mouseLockedToWindow); // FIXME - SA } // diff --git a/source/duke3d/src/astub.cpp b/source/duke3d/src/astub.cpp index 9e341189a..ec0557e0c 100644 --- a/source/duke3d/src/astub.cpp +++ b/source/duke3d/src/astub.cpp @@ -10899,7 +10899,7 @@ void ExtCheckKeys(void) } lastbstatus = bstatus; - mouseReadButtons(&bstatus); + bstatus = mouseReadButtons(); Keys2d3d(); diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index 286415886..4fb1bf77a 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -140,10 +140,8 @@ void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN]) void CONFIG_SetDefaults(void) { - // JBF 20031211 - int32_t i; - ud.config.scripthandle = -1; + #ifdef __ANDROID__ droidinput.forward_sens = 5.f; droidinput.gameControlsAlpha = 0.5; @@ -194,15 +192,9 @@ void CONFIG_SetDefaults(void) #if defined GEKKO || defined __OPENDINGUX__ ud.config.NumVoices = 32; + ud.camera_time = 11; #else ud.config.NumVoices = 64; -#endif - -#if defined GEKKO || defined __OPENDINGUX__ - ud.camera_time = 11; -#elif defined(__ANDROID__) - ud.camera_time = 7; -#else ud.camera_time = 4; #endif @@ -316,7 +308,7 @@ void CONFIG_SetDefaults(void) CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY; - for (i=0; iname+9; // skip "gamefunc_" + static char const s_gamefunc_[] = "gamefunc_"; + int constexpr strlen_gamefunc_ = ARRAY_SIZE(s_gamefunc_) - 1; + + char const *p = parm->name + strlen_gamefunc_; + // if (g_player[myconnectindex].ps->gm == MODE_GAME) // only trigger these if in game - CONTROL_OSDInput[CONFIG_FunctionNameToNum(p)] = 1; // FIXME + CONTROL_ButtonFlags[CONFIG_FunctionNameToNum(p)] = 1; // FIXME + return OSDCMD_OK; } diff --git a/source/mact/include/control.h b/source/mact/include/control.h index cf2180063..558cf8acd 100644 --- a/source/mact/include/control.h +++ b/source/mact/include/control.h @@ -48,15 +48,12 @@ extern "C" { #define MAXGAMEBUTTONS 64 -#define BUTTON(x) ((CONTROL_ButtonState>> ((uint64_t)(x)) ) & 1) -#define BUTTONHELD(x) ((CONTROL_ButtonHeldState>> ((uint64_t)(x)) ) & 1) +#define BUTTON(x) ((CONTROL_ButtonState >> ((uint64_t)(x))) & 1) +#define BUTTONHELD(x) ((CONTROL_ButtonHeldState >> ((uint64_t)(x))) & 1) -#define BUTTONJUSTPRESSED(x) \ - ( BUTTON( x ) && !BUTTONHELD( x ) ) -#define BUTTONRELEASED(x) \ - ( !BUTTON( x ) && BUTTONHELD( x ) ) -#define BUTTONSTATECHANGED(x) \ - ( BUTTON( x ) != BUTTONHELD( x ) ) +#define BUTTONJUSTPRESSED(x) (BUTTON(x) && !BUTTONHELD(x)) +#define BUTTONRELEASED(x) (!BUTTON(x) && BUTTONHELD(x)) +#define BUTTONSTATECHANGED(x) (BUTTON(x) != BUTTONHELD(x)) //*************************************************************************** @@ -134,13 +131,14 @@ typedef enum // //*************************************************************************** -extern int32_t CONTROL_Started; -extern int32_t CONTROL_MousePresent; -extern int32_t CONTROL_JoyPresent; -extern int32_t CONTROL_MouseEnabled; -extern int32_t CONTROL_JoystickEnabled; -extern uint64_t CONTROL_ButtonState; -extern uint64_t CONTROL_ButtonHeldState; +extern bool CONTROL_Started; +extern bool CONTROL_MousePresent; +extern bool CONTROL_JoyPresent; +extern bool CONTROL_MouseEnabled; +extern bool CONTROL_JoystickEnabled; + +extern uint64_t CONTROL_ButtonState; +extern uint64_t CONTROL_ButtonHeldState; //*************************************************************************** @@ -156,14 +154,11 @@ int CONTROL_FlagActive( int which ); void CONTROL_ClearAssignments( void ); // void CONTROL_GetFunctionInput( void ); void CONTROL_GetInput( ControlInfo *info ); -void CONTROL_ClearButton( int32_t whichbutton ); +void CONTROL_ClearButton( int whichbutton ); extern float CONTROL_MouseSensitivity; -int32_t CONTROL_Startup(controltype which, int32_t ( *TimeFunction )( void ), int32_t ticspersecond); +bool CONTROL_Startup(controltype which, int32_t ( *TimeFunction )( void ), int32_t ticspersecond); void CONTROL_Shutdown( void ); -void CONTROL_SetDoubleClickDelay(int32_t delay); -int32_t CONTROL_GetDoubleClickDelay(void); - void CONTROL_MapAnalogAxis(int whichaxis, int whichanalog, controldevice device); void CONTROL_MapDigitalAxis(int32_t whichaxis, int32_t whichfunction, int32_t direction, controldevice device); void CONTROL_SetAnalogAxisScale(int32_t whichaxis, int32_t axisscale, controldevice device); @@ -178,16 +173,18 @@ void CONTROL_SetAnalogAxisScale(int32_t whichaxis, int32_t axisscale, controldev #define MAXBOUNDKEYS MAXKEYBOARDSCAN #define MAXMOUSEBUTTONS 10 -typedef struct binding { - const char *key; // always set to const char * - char *cmdstr; // alloc'd +typedef struct +{ + const char *key; + char *cmdstr; char repeat; char laststate; -} keybind; +} +consolekeybind_t; // Direct use DEPRECATED: -extern keybind CONTROL_KeyBinds[MAXBOUNDKEYS+MAXMOUSEBUTTONS]; -extern int32_t CONTROL_BindsEnabled; +extern consolekeybind_t CONTROL_KeyBinds[MAXBOUNDKEYS+MAXMOUSEBUTTONS]; +extern bool CONTROL_BindsEnabled; void CONTROL_ClearAllBinds(void); void CONTROL_BindKey(int i, char const * cmd, int repeat, char const * keyname); @@ -195,9 +192,10 @@ void CONTROL_BindMouse(int i, char const * cmd, int repeat, char const * keyname void CONTROL_FreeKeyBind(int i); void CONTROL_FreeMouseBind(int i); -static inline int32_t CONTROL_KeyIsBound(int32_t i) +static inline int CONTROL_KeyIsBound(int const key) { - return (CONTROL_KeyBinds[i].cmdstr && CONTROL_KeyBinds[i].key); + auto &bind = CONTROL_KeyBinds[key]; + return bind.cmdstr && bind.key; } void CONTROL_ProcessBinds(void); @@ -205,8 +203,8 @@ void CONTROL_ProcessBinds(void); //////////////////// #define CONTROL_NUM_FLAGS 64 -extern int32_t CONTROL_OSDInput[CONTROL_NUM_FLAGS]; -extern int32_t CONTROL_SmoothMouse; +extern int32_t CONTROL_ButtonFlags[CONTROL_NUM_FLAGS]; +extern bool CONTROL_SmoothMouse; #ifdef __cplusplus } diff --git a/source/mact/include/mouse.h b/source/mact/include/mouse.h index 45b36ba19..76ea74e63 100644 --- a/source/mact/include/mouse.h +++ b/source/mact/include/mouse.h @@ -46,29 +46,16 @@ extern "C" { #include "baselayer.h" -static inline int32_t Mouse_Init(void) +static inline bool Mouse_Init(void) { mouseInit(); return ((inputdevices & 2) == 2); } - static inline void MOUSE_Shutdown(void) { mouseUninit(); } - -#if 0 -static inline void MOUSE_ShowCursor(void) {} -static inline void MOUSE_HideCursor(void) {} -#endif - -static inline int32_t MOUSE_GetButtons(void) -{ - int32_t buttons; - mouseReadButtons(&buttons); - return buttons; -} - -#define MOUSE_ClearButton(b) (g_mouseBits &= ~b) -#define MOUSE_ClearAllButtons() g_mouseBits = 0 +static inline int32_t MOUSE_GetButtons(void) { return mouseReadButtons(); } +static inline void MOUSE_ClearButton(int32_t b) { g_mouseBits &= ~b; } +static inline void MOUSE_ClearAllButtons(void) { g_mouseBits = 0; } #ifdef __cplusplus } diff --git a/source/mact/src/control.cpp b/source/mact/src/control.cpp index 82348f073..79ece946f 100644 --- a/source/mact/src/control.cpp +++ b/source/mact/src/control.cpp @@ -22,10 +22,12 @@ #include "android.h" #endif -int32_t CONTROL_JoyPresent = FALSE; -int32_t CONTROL_JoystickEnabled = FALSE; -int32_t CONTROL_MousePresent = FALSE; -int32_t CONTROL_MouseEnabled = FALSE; +bool CONTROL_Started = false; +bool CONTROL_JoyPresent = false; +bool CONTROL_JoystickEnabled = false; +bool CONTROL_MousePresent = false; +bool CONTROL_MouseEnabled = false; + uint64_t CONTROL_ButtonState = 0; uint64_t CONTROL_ButtonHeldState = 0; @@ -52,7 +54,6 @@ static controlaxistype CONTROL_LastJoyAxes[MAXJOYAXES]; static int32_t CONTROL_MouseAxesScale[MAXMOUSEAXES]; static int32_t CONTROL_JoyAxesScale[MAXJOYAXES]; -#ifndef __ANDROID__ static int32_t CONTROL_MouseButtonState[MAXMOUSEBUTTONS]; static int32_t CONTROL_MouseButtonClickedTime[MAXMOUSEBUTTONS]; static int32_t CONTROL_MouseButtonClickedState[MAXMOUSEBUTTONS]; @@ -64,27 +65,24 @@ static int32_t CONTROL_JoyButtonClickedTime[MAXJOYBUTTONS]; static int32_t CONTROL_JoyButtonClickedState[MAXJOYBUTTONS]; static int32_t CONTROL_JoyButtonClicked[MAXJOYBUTTONS]; static uint8_t CONTROL_JoyButtonClickedCount[MAXJOYBUTTONS]; -#endif static int32_t(*ExtGetTime)(void); -int32_t CONTROL_Started = FALSE; //static int32_t ticrate; -static int32_t CONTROL_DoubleClickSpeed; +static uint8_t CONTROL_DoubleClickSpeed; -int32_t CONTROL_OSDInput[CONTROL_NUM_FLAGS]; -keybind CONTROL_KeyBinds[MAXBOUNDKEYS + MAXMOUSEBUTTONS]; -int32_t CONTROL_BindsEnabled = 0; -int32_t CONTROL_SmoothMouse = 0; +int32_t CONTROL_ButtonFlags[CONTROL_NUM_FLAGS]; +consolekeybind_t CONTROL_KeyBinds[MAXBOUNDKEYS + MAXMOUSEBUTTONS]; +bool CONTROL_BindsEnabled = 0; +bool CONTROL_SmoothMouse = 0; #define CONTROL_CheckRange(which) ((unsigned)which >= (unsigned)CONTROL_NUM_FLAGS) #define BIND(x, s, r, k) do { Bfree(x.cmdstr); x.cmdstr = s; x.repeat = r; x.key = k; } while (0) void CONTROL_ClearAllBinds(void) { - int32_t i; - for (i=0; i=0; i--) { - int32_t bs = (buttons >> i) & 1; + int const bs = (buttons >> i) & 1; - DeviceButtonState[i] = bs; + DeviceButtonState[i] = bs; ButtonClickedState[i] = FALSE; if (bs) @@ -471,7 +464,7 @@ static void DoGetDeviceButtons( if (ButtonClickedCount[i] == 0 || tm > ButtonClickedTime[i]) { - ButtonClickedTime[i] = tm + CONTROL_DoubleClickSpeed; + ButtonClickedTime[i] = tm + CONTROL_DoubleClickSpeed; ButtonClickedCount[i] = 1; } else if (tm < ButtonClickedTime[i]) @@ -498,7 +491,7 @@ static void DoGetDeviceButtons( static void CONTROL_GetDeviceButtons(void) { - int32_t t = ExtGetTime(); + int32_t const t = ExtGetTime(); if (CONTROL_MouseEnabled) { @@ -527,7 +520,7 @@ static void CONTROL_GetDeviceButtons(void) } } -static void CONTROL_DigitizeAxis(int32_t axis, controldevice device) +static void CONTROL_DigitizeAxis(int axis, controldevice device) { controlaxistype *set, *lastset; @@ -558,7 +551,7 @@ static void CONTROL_DigitizeAxis(int32_t axis, controldevice device) } } -static void CONTROL_ScaleAxis(int32_t axis, controldevice device) +static void CONTROL_ScaleAxis(int axis, controldevice device) { controlaxistype *set; int32_t *scale; @@ -581,7 +574,7 @@ static void CONTROL_ScaleAxis(int32_t axis, controldevice device) set[axis].analog = mulscale16(set[axis].analog, scale[axis]); } -static void CONTROL_ApplyAxis(int32_t axis, ControlInfo *info, controldevice device) +static void CONTROL_ApplyAxis(int axis, ControlInfo *info, controldevice device) { controlaxistype *set; controlaxismaptype *map; @@ -623,13 +616,11 @@ static void CONTROL_PollDevices(ControlInfo *info) if (CONTROL_MouseEnabled) { - int32_t i = MAXMOUSEAXES-1; - Bmemcpy(CONTROL_LastMouseAxes, CONTROL_MouseAxes, sizeof(CONTROL_MouseAxes)); memset(CONTROL_MouseAxes, 0, sizeof(CONTROL_MouseAxes)); CONTROL_GetMouseDelta(); - for (; i>=0; i--) + for (int i=MAXMOUSEAXES-1; i>=0; i--) { CONTROL_DigitizeAxis(i, controldevice_mouse); CONTROL_ScaleAxis(i, controldevice_mouse); @@ -640,12 +631,10 @@ static void CONTROL_PollDevices(ControlInfo *info) if (CONTROL_JoystickEnabled) { - int32_t i = joystick.numAxes-1; - Bmemcpy(CONTROL_LastJoyAxes, CONTROL_JoyAxes, sizeof(CONTROL_JoyAxes)); memset(CONTROL_JoyAxes, 0, sizeof(CONTROL_JoyAxes)); - for (; i>=0; i--) + for (int i=joystick.numAxes-1; i>=0; i--) { CONTROL_JoyAxes[i].analog = joystick.pAxis[i]; @@ -659,52 +648,37 @@ static void CONTROL_PollDevices(ControlInfo *info) CONTROL_GetDeviceButtons(); } +static void CONTROL_HandleAxisFunction(int32_t *p1, controlaxistype *axes, controlaxismaptype *axismap, int numAxes) +{ + int axis = numAxes - 1; + + do + { + if (!axes[axis].digital) + continue; + + int const j = (axes[axis].digital < 0) ? axismap[axis].minmap : axismap[axis].maxmap; + + if (j != AXISUNDEFINED) + p1[j] = 1; + } + while (axis--); +} + static void CONTROL_AxisFunctionState(int32_t *p1) { if (CONTROL_NumMouseAxes) - { - int32_t j, i = CONTROL_NumMouseAxes-1; - - do - { - if (!CONTROL_MouseAxes[i].digital) continue; - - if (CONTROL_MouseAxes[i].digital < 0) - j = CONTROL_MouseAxesMap[i].minmap; - else - j = CONTROL_MouseAxesMap[i].maxmap; - - if (j != AXISUNDEFINED) - p1[j] = 1; - } - while (i--); - } + CONTROL_HandleAxisFunction(p1, CONTROL_MouseAxes, CONTROL_MouseAxesMap, CONTROL_NumMouseAxes); if (CONTROL_NumJoyAxes) - { - int32_t j, i = CONTROL_NumJoyAxes-1; - - do - { - if (!CONTROL_JoyAxes[i].digital) continue; - - if (CONTROL_JoyAxes[i].digital < 0) - j = CONTROL_JoyAxesMap[i].minmap; - else - j = CONTROL_JoyAxesMap[i].maxmap; - - if (j != AXISUNDEFINED) - p1[j] = 1; - } - while (i--); - } + CONTROL_HandleAxisFunction(p1, CONTROL_JoyAxes, CONTROL_JoyAxesMap, CONTROL_NumJoyAxes); } static void CONTROL_ButtonFunctionState(int32_t *p1) { if (CONTROL_NumMouseButtons) { - int32_t i = CONTROL_NumMouseButtons-1, j; + int i = CONTROL_NumMouseButtons-1, j; do { @@ -734,7 +708,7 @@ static void CONTROL_ButtonFunctionState(int32_t *p1) if (CONTROL_NumJoyButtons) { - int32_t i=CONTROL_NumJoyButtons-1, j; + int i=CONTROL_NumJoyButtons-1, j; do { @@ -749,9 +723,8 @@ static void CONTROL_ButtonFunctionState(int32_t *p1) while (i--); } } -#endif -void CONTROL_ClearButton(int32_t whichbutton) +void CONTROL_ClearButton(int whichbutton) { if (CONTROL_CheckRange(whichbutton)) return; @@ -765,11 +738,11 @@ void CONTROL_ClearButton(int32_t whichbutton) void CONTROL_ProcessBinds(void) { - int32_t i=MAXBOUNDKEYS-1; - if (!CONTROL_BindsEnabled) return; + int i = MAXBOUNDKEYS-1; + do { if (CONTROL_KeyBinds[i].cmdstr) @@ -783,89 +756,70 @@ void CONTROL_ProcessBinds(void) while (i--); } -#ifndef __ANDROID__ static void CONTROL_GetFunctionInput(void) { - int32_t periphs[CONTROL_NUM_FLAGS]; - int32_t i = CONTROL_NUM_FLAGS-1; - - memset(periphs, 0, sizeof(periphs)); - CONTROL_ButtonFunctionState(periphs); - CONTROL_AxisFunctionState(periphs); + CONTROL_ButtonFunctionState(CONTROL_ButtonFlags); + CONTROL_AxisFunctionState(CONTROL_ButtonFlags); CONTROL_ButtonHeldState = CONTROL_ButtonState; CONTROL_ButtonState = 0; + int i = CONTROL_NUM_FLAGS-1; + do { - CONTROL_SetFlag(i, /*CONTROL_KeyboardFunctionPressed(i) | */periphs[i] | CONTROL_OSDInput[i]); + CONTROL_SetFlag(i, /*CONTROL_KeyboardFunctionPressed(i) | */CONTROL_ButtonFlags[i]); if (CONTROL_Flags[i].cleared == FALSE) BUTTONSET(i, CONTROL_Flags[i].active); else if (CONTROL_Flags[i].active == FALSE) CONTROL_Flags[i].cleared = 0; } while (i--); - memset(CONTROL_OSDInput, 0, sizeof(CONTROL_OSDInput)); + memset(CONTROL_ButtonFlags, 0, sizeof(CONTROL_ButtonFlags)); } -#endif void CONTROL_GetInput(ControlInfo *info) { #ifdef __ANDROID__ CONTROL_Android_PollDevices(info); -#else +#endif CONTROL_PollDevices(info); CONTROL_GetFunctionInput(); inputchecked = 1; -#endif } -int32_t CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t ticspersecond) +bool CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t ticspersecond) { - int32_t i; - UNREFERENCED_PARAMETER(which); - if (CONTROL_Started) return FALSE; + if (CONTROL_Started) return false; - if (TimeFunction) ExtGetTime = TimeFunction; - else ExtGetTime = CONTROL_GetTime; + ExtGetTime = TimeFunction ? TimeFunction : CONTROL_GetTime; -// ticrate = ticspersecond; + // what the fuck??? + CONTROL_DoubleClickSpeed = (ticspersecond * 57) / 100; - CONTROL_DoubleClickSpeed = (ticspersecond*57)/100; if (CONTROL_DoubleClickSpeed <= 0) CONTROL_DoubleClickSpeed = 1; - if (initinput()) return TRUE; + if (initinput()) + return true; - CONTROL_MousePresent = CONTROL_MouseEnabled = FALSE; - CONTROL_JoyPresent = CONTROL_JoystickEnabled = FALSE; - CONTROL_NumMouseButtons = CONTROL_NumJoyButtons = 0; - CONTROL_NumMouseAxes = CONTROL_NumJoyAxes = 0; KB_Startup(); - //switch (which) { - // case controltype_keyboard: - // break; + CONTROL_NumMouseAxes = MAXMOUSEAXES; + CONTROL_NumMouseButtons = MAXMOUSEBUTTONS; + CONTROL_MousePresent = Mouse_Init(); + CONTROL_MouseEnabled = CONTROL_MousePresent; - // case controltype_keyboardandmouse: - CONTROL_NumMouseAxes = MAXMOUSEAXES; - CONTROL_NumMouseButtons = MAXMOUSEBUTTONS; - CONTROL_MousePresent = Mouse_Init(); - CONTROL_MouseEnabled = CONTROL_MousePresent; - // break; - - // case controltype_keyboardandjoystick: - CONTROL_NumJoyAxes = min(MAXJOYAXES,joystick.numAxes); - CONTROL_NumJoyButtons = min(MAXJOYBUTTONS,joystick.numButtons + 4*(joystick.numHats>0)); - CONTROL_JoystickEnabled = CONTROL_JoyPresent = (inputdevices&4)>>2; - // break; - //} + CONTROL_NumJoyAxes = min(MAXJOYAXES, joystick.numAxes); + CONTROL_NumJoyButtons = min(MAXJOYBUTTONS, joystick.numButtons + 4 * (joystick.numHats > 0)); + CONTROL_JoystickEnabled = CONTROL_JoyPresent = !!((inputdevices & 4) >> 2); #ifdef GEKKO if (CONTROL_MousePresent) initprintf("CONTROL_Startup: Mouse Present\n"); + if (CONTROL_JoyPresent) initprintf("CONTROL_Startup: Joystick Present\n"); #endif @@ -873,12 +827,12 @@ int32_t CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t CONTROL_ButtonState = 0; CONTROL_ButtonHeldState = 0; - for (i=0; i