From a5ee23215de87edf91132a37b325f28a68b86aa0 Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 17 Nov 2012 16:47:53 +0000 Subject: [PATCH] Minor cleanups in MACT control.c git-svn-id: https://svn.eduke32.com/eduke32@3196 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/jmact/control.c | 31 +++++--------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/polymer/eduke32/source/jmact/control.c b/polymer/eduke32/source/jmact/control.c index ce375ad73..87ef416c7 100644 --- a/polymer/eduke32/source/jmact/control.c +++ b/polymer/eduke32/source/jmact/control.c @@ -18,6 +18,7 @@ #include "osd.h" #include "pragmas.h" +#define CONTROL_CheckRange(which) ((uint32_t)which >= (uint32_t)CONTROL_NUM_FLAGS) int32_t CONTROL_JoyPresent = FALSE; int32_t CONTROL_JoystickEnabled = FALSE; @@ -81,20 +82,6 @@ static void CONTROL_GetMouseDelta(void) CONTROL_MouseAxes[1].analog = (int32_t)((y * 4.0f * CONTROL_MouseSensitivity) * 2.0f); } -static void CONTROL_GetJoyDelta(void) -{ - int32_t i; - - for (i=0; i> 5; -} - -static int32_t CONTROL_StartJoy(int32_t joy) -{ - UNREFERENCED_PARAMETER(joy); - return (inputdevices & 4) == 4; -} - static int32_t CONTROL_GetTime(void) { static int32_t t = 0; @@ -102,14 +89,6 @@ static int32_t CONTROL_GetTime(void) return t; } -static inline int32_t CONTROL_CheckRange(int32_t which) -{ - if ((uint32_t)which >= (uint32_t)CONTROL_NUM_FLAGS) return TRUE; - //Error("CONTROL_CheckRange: Index %d out of valid range for %d control flags.", - // which, CONTROL_NUM_FLAGS); - return FALSE; -} - static void CONTROL_SetFlag(int32_t which, int32_t active) { if (CONTROL_CheckRange(which)) return; @@ -619,11 +598,12 @@ static void CONTROL_PollDevices(ControlInfo *info) if (CONTROL_JoystickEnabled) { - int32_t i = MAXJOYAXES-1; + int32_t i = joynumaxes-1; - CONTROL_GetJoyDelta(); for (; i>=0; i--) { + CONTROL_JoyAxes[i].analog = joyaxis[i]; + CONTROL_DigitizeAxis(i, controldevice_joystick); CONTROL_ScaleAxis(i, controldevice_joystick); LIMITCONTROL(&CONTROL_JoyAxes[i].analog); @@ -824,8 +804,7 @@ int32_t CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t // case controltype_keyboardandjoystick: CONTROL_NumJoyAxes = min(MAXJOYAXES,joynumaxes); CONTROL_NumJoyButtons = min(MAXJOYBUTTONS,joynumbuttons + 4*(joynumhats>0)); - CONTROL_JoyPresent = CONTROL_StartJoy(0); - CONTROL_JoystickEnabled = CONTROL_JoyPresent; + CONTROL_JoystickEnabled = CONTROL_JoyPresent = (inputdevices&4)>>2; // break; //}