From c429f3fbc4c076fab859dee6f0afbfd1358e6ac3 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Tue, 6 Nov 2012 23:06:34 +0000 Subject: [PATCH] Clean up control.c. - Remove everything using CONTROL_KeyMapping, which was only written to. - Remove unused functions, make local ones static. - Remove private function declarations in _control.h. git-svn-id: https://svn.eduke32.com/eduke32@3124 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/config.c | 3 +- polymer/eduke32/source/jmact/_control.h | 15 -------- polymer/eduke32/source/jmact/control.c | 50 ++++++++----------------- polymer/eduke32/source/jmact/control.h | 2 +- polymer/eduke32/source/osdcmds.c | 4 +- 5 files changed, 21 insertions(+), 53 deletions(-) diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 5c1645b45..8509d0591 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -407,7 +407,8 @@ void CONFIG_MapKey(int32_t which, kb_scancode key1, kb_scancode oldkey1, kb_scan int32_t ii[] = { key1, key2, oldkey1, oldkey2 }; char buf[64]; - CONTROL_MapKey(which, key1, key2); + UNREFERENCED_PARAMETER(which); +// CONTROL_MapKey(which, key1, key2); for (k = 0; (unsigned)k < (sizeof(ii) / sizeof(ii[0])); k++) { diff --git a/polymer/eduke32/source/jmact/_control.h b/polymer/eduke32/source/jmact/_control.h index 45329d033..4850b32cf 100644 --- a/polymer/eduke32/source/jmact/_control.h +++ b/polymer/eduke32/source/jmact/_control.h @@ -208,21 +208,6 @@ typedef struct // //*************************************************************************** -void CONTROL_GetMouseDelta( void ); -uint8_t CONTROL_GetMouseButtons( void ); -int32_t CONTROL_StartMouse( void ); -//void CONTROL_GetJoyAbs( void ); -void CONTROL_GetJoyDelta( void ); -int32_t CONTROL_StartJoy( int32_t joy ); -void CONTROL_ShutJoy( int32_t joy ); -void CONTROL_SetFlag( int32_t which, int32_t active ); -void CONTROL_ButtonFunctionState( int32_t * state ); -int32_t CONTROL_KeyboardFunctionPressed( int32_t whichfunction ); -static inline int32_t CONTROL_CheckRange( int32_t which ); -static int32_t CONTROL_GetTime( void ); -void CONTROL_AxisFunctionState( int32_t * state ); -void CONTROL_GetJoyMovement( ControlInfo * info ); - #ifdef EXTERNC }; #endif diff --git a/polymer/eduke32/source/jmact/control.c b/polymer/eduke32/source/jmact/control.c index 458bc5ef7..b05cdc481 100644 --- a/polymer/eduke32/source/jmact/control.c +++ b/polymer/eduke32/source/jmact/control.c @@ -35,7 +35,7 @@ static int32_t CONTROL_NumJoyAxes = 0; static controlflags CONTROL_Flags[CONTROL_NUM_FLAGS]; static controlbuttontype CONTROL_MouseButtonMapping[MAXMOUSEBUTTONS], CONTROL_JoyButtonMapping[MAXJOYBUTTONS]; -static controlkeymaptype CONTROL_KeyMapping[CONTROL_NUM_FLAGS]; +//static controlkeymaptype CONTROL_KeyMapping[CONTROL_NUM_FLAGS]; static controlaxismaptype CONTROL_MouseAxesMap[MAXMOUSEAXES], // maps physical axes onto virtual ones CONTROL_JoyAxesMap[MAXJOYAXES]; static controlaxistype CONTROL_MouseAxes[MAXMOUSEAXES], // physical axes @@ -59,7 +59,7 @@ keybind KeyBindings[MAXBOUNDKEYS], MouseBindings[MAXMOUSEBUTTONS]; int32_t bindsenabled = 0; int32_t control_smoothmouse = 0; -void CONTROL_GetMouseDelta(void) +static void CONTROL_GetMouseDelta(void) { int32_t x,y; @@ -80,23 +80,7 @@ void CONTROL_GetMouseDelta(void) CONTROL_MouseAxes[1].analog = (int32_t)((y * 4.0f * CONTROL_MouseSensitivity) * 2.0f); } -int32_t CONTROL_StartMouse(void) -{ - CONTROL_NumMouseButtons = MAXMOUSEBUTTONS; - return Mouse_Init(); -} - -#if 0 -void CONTROL_GetJoyAbs(void) -{ -} - -void CONTROL_FilterJoyDelta(void) -{ -} -#endif - -void CONTROL_GetJoyDelta(void) +static void CONTROL_GetJoyDelta(void) { int32_t i; @@ -104,18 +88,12 @@ void CONTROL_GetJoyDelta(void) CONTROL_JoyAxes[i].analog = joyaxis[i]; // >> 5; } -int32_t CONTROL_StartJoy(int32_t joy) +static int32_t CONTROL_StartJoy(int32_t joy) { UNREFERENCED_PARAMETER(joy); return (inputdevices & 4) == 4; } -void CONTROL_ShutJoy(int32_t joy) -{ - UNREFERENCED_PARAMETER(joy); - CONTROL_JoyPresent = FALSE; -} - static int32_t CONTROL_GetTime(void) { static int32_t t = 0; @@ -131,7 +109,7 @@ static inline int32_t CONTROL_CheckRange(int32_t which) return FALSE; } -void CONTROL_SetFlag(int32_t which, int32_t active) +static void CONTROL_SetFlag(int32_t which, int32_t active) { if (CONTROL_CheckRange(which)) return; @@ -151,6 +129,7 @@ void CONTROL_SetFlag(int32_t which, int32_t active) } } +#if 0 int32_t CONTROL_KeyboardFunctionPressed(int32_t which) { int32_t key1 = 0, key2 = 0; @@ -180,6 +159,7 @@ void CONTROL_ClearKeyboardFunction(int32_t which) if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED) KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] = 0; } +#endif void CONTROL_DefineFlag(int32_t which, int32_t toggle) { @@ -199,6 +179,7 @@ int32_t CONTROL_FlagActive(int32_t which) return CONTROL_Flags[which].used; } +#if 0 void CONTROL_MapKey(int32_t which, kb_scancode key1, kb_scancode key2) { if (CONTROL_CheckRange(which)) return; @@ -217,6 +198,7 @@ void CONTROL_PrintKeyMap(void) i, CONTROL_KeyMapping[i].key1, CONTROL_KeyMapping[i].key2); } } +#endif void CONTROL_PrintControlFlag(int32_t which) { @@ -421,7 +403,7 @@ void CONTROL_ClearAssignments(void) memset(CONTROL_MouseButtonMapping, BUTTONUNDEFINED, sizeof(CONTROL_MouseButtonMapping)); memset(CONTROL_JoyButtonMapping, BUTTONUNDEFINED, sizeof(CONTROL_JoyButtonMapping)); - memset(CONTROL_KeyMapping, KEYUNDEFINED, sizeof(CONTROL_KeyMapping)); +// memset(CONTROL_KeyMapping, KEYUNDEFINED, sizeof(CONTROL_KeyMapping)); memset(CONTROL_MouseAxesMap, AXISUNDEFINED, sizeof(CONTROL_MouseAxesMap)); memset(CONTROL_JoyAxesMap, AXISUNDEFINED, sizeof(CONTROL_JoyAxesMap)); memset(CONTROL_MouseAxes, 0, sizeof(CONTROL_MouseAxes)); @@ -486,7 +468,7 @@ static void DoGetDeviceButtons( } } -void CONTROL_GetDeviceButtons(void) +static void CONTROL_GetDeviceButtons(void) { int32_t t = GetTime(); @@ -525,7 +507,7 @@ void CONTROL_GetDeviceButtons(void) } } -void CONTROL_DigitizeAxis(int32_t axis, controldevice device) +static void CONTROL_DigitizeAxis(int32_t axis, controldevice device) { controlaxistype *set, *lastset; @@ -556,7 +538,7 @@ void CONTROL_DigitizeAxis(int32_t axis, controldevice device) } } -void CONTROL_ScaleAxis(int32_t axis, controldevice device) +static void CONTROL_ScaleAxis(int32_t axis, controldevice device) { controlaxistype *set; int32_t *scale; @@ -579,7 +561,7 @@ void CONTROL_ScaleAxis(int32_t axis, controldevice device) set[axis].analog = mulscale16(set[axis].analog, scale[axis]); } -void CONTROL_ApplyAxis(int32_t axis, ControlInfo *info, controldevice device) +static void CONTROL_ApplyAxis(int32_t axis, ControlInfo *info, controldevice device) { controlaxistype *set; controlaxismaptype *map; @@ -651,7 +633,7 @@ static void CONTROL_PollDevices(ControlInfo *info) CONTROL_GetDeviceButtons(); } -void CONTROL_AxisFunctionState(int32_t *p1) +static void CONTROL_AxisFunctionState(int32_t *p1) { if (CONTROL_NumMouseAxes) { @@ -692,7 +674,7 @@ void CONTROL_AxisFunctionState(int32_t *p1) } } -void CONTROL_ButtonFunctionState(int32_t *p1) +static void CONTROL_ButtonFunctionState(int32_t *p1) { if (CONTROL_NumMouseButtons) { diff --git a/polymer/eduke32/source/jmact/control.h b/polymer/eduke32/source/jmact/control.h index 8a23f9c05..217b24db0 100644 --- a/polymer/eduke32/source/jmact/control.h +++ b/polymer/eduke32/source/jmact/control.h @@ -147,7 +147,7 @@ extern uint64_t CONTROL_ButtonHeldState; // //*************************************************************************** -void CONTROL_MapKey( int32_t which, kb_scancode key1, kb_scancode key2 ); +//void CONTROL_MapKey( int32_t which, kb_scancode key1, kb_scancode key2 ); void CONTROL_MapButton ( int32_t whichfunction, diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 11214d33f..dfd82d443 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -1021,7 +1021,7 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm) { ud.config.KeyboardKeys[j][1] = ud.config.KeyboardKeys[j][0]; ud.config.KeyboardKeys[j][0] = ConsoleKeys[i].id; - CONTROL_MapKey(j, ConsoleKeys[i].id, ud.config.KeyboardKeys[j][0]); +// CONTROL_MapKey(j, ConsoleKeys[i].id, ud.config.KeyboardKeys[j][0]); } } @@ -1048,7 +1048,7 @@ static int32_t osdcmd_unbindall(const osdfuncparm_t *parm) for (i=0; i