diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index 9b8b42431..a3d9b0d0d 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -75,14 +75,6 @@ void ctrlInit(void) KB_FlushKeyboardQueueScans(); CONFIG_SetupMouse(); CONFIG_SetupJoystick(); - - CONTROL_JoystickEnabled = (in_joystick && CONTROL_JoyPresent); - CONTROL_MouseEnabled = (in_mouse && CONTROL_MousePresent); - CONTROL_SmoothMouse = in_mousesmoothing; - - // JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too - for (int i = 0; i < joystick.numAxes; i++) - joySetDeadZone(i, JoystickAnalogueDead[i], JoystickAnalogueSaturate[i]); } void ctrlTerm(void) diff --git a/source/common/gamecontrol.cpp b/source/common/gamecontrol.cpp index 2a99fc7ae..161e4800b 100644 --- a/source/common/gamecontrol.cpp +++ b/source/common/gamecontrol.cpp @@ -343,6 +343,41 @@ void CONFIG_SetDefaultKeys(const char *defbinds, bool lazy/*=false*/) } } +// FIXME: Consider the mouse as well! +FString CONFIG_GetBoundKeyForLastInput(int gameFunc) +{ + if (CONTROL_LastSeenInput == LastSeenInput::Joystick) + { + char const * joyname = CONFIG_GetGameFuncOnJoystick(gameFunc); + if (joyname != nullptr && joyname[0] != '\0') + { + return joyname; + } + + char const * keyname = CONFIG_GetGameFuncOnKeyboard(gameFunc); + if (keyname != nullptr && keyname[0] != '\0') + { + return keyname; + } + } + else + { + char const * keyname = CONFIG_GetGameFuncOnKeyboard(gameFunc); + if (keyname != nullptr && keyname[0] != '\0') + { + return keyname; + } + + char const * joyname = CONFIG_GetGameFuncOnJoystick(gameFunc); + if (joyname != nullptr && joyname[0] != '\0') + { + return joyname; + } + + return "UNBOUND"; + } + +} //========================================================================== // // @@ -633,6 +668,7 @@ void CONFIG_SetupMouse(void) CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1, controldevice_mouse); CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse); } + CONTROL_MouseEnabled = (in_mouse && CONTROL_MousePresent); } @@ -707,6 +743,13 @@ void CONFIG_SetupJoystick(void) CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick); CONTROL_SetAnalogAxisInvert(i, JoystickAnalogueInvert[i], controldevice_joystick); } + + CONTROL_JoystickEnabled = (in_joystick && CONTROL_JoyPresent); + + // JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too + for (int i=0; izoom); -#else if (!ud.pause_on) { ud.fola += ud.folavel>>3; ud.folx += (ud.folfvel*sintable[(512+2048-ud.fola)&2047])>>14; ud.foly += (ud.folfvel*sintable[(512+1024-512-ud.fola)&2047])>>14; } -#endif cposx = ud.folx; cposy = ud.foly; cang = ud.fola; diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 2d3d9ec38..f9f6030e3 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -7869,13 +7869,6 @@ int app_main(int argc, char const * const * argv) { CONFIG_SetupMouse(); CONFIG_SetupJoystick(); - - CONTROL_JoystickEnabled = (in_joystick && CONTROL_JoyPresent); - CONTROL_MouseEnabled = (in_mouse && CONTROL_MousePresent); - - // JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too - for (bssize_t i=0; izoom); -#else if (!ud.pause_on) { ud.fola += ud.folavel>>3; ud.folx += (ud.folfvel*sintable[(512+2048-ud.fola)&2047])>>14; ud.foly += (ud.folfvel*sintable[(512+1024-512-ud.fola)&2047])>>14; } -#endif cposx = ud.folx; cposy = ud.foly; cang = ud.fola; diff --git a/source/sw/src/console.cpp b/source/sw/src/console.cpp index 82bfe2dd1..abf541044 100644 --- a/source/sw/src/console.cpp +++ b/source/sw/src/console.cpp @@ -1128,35 +1128,6 @@ void CON_MultiNameChange(void) void CON_LoadSetup(void) { - /* - char base[80],command[80]; - - // Format: showuser [SpriteNum] - if (sscanf(MessageInputString,"%s %s",base,command) < 2) - { - strcpy(MessageInputString,"help config"); - CON_GetHelp(); - return; - } - - if (!SafeFileExists(command)) - { - CON_ConMessage("CON_LoadSetup: %s does not exist.",command); - return; - } else - { - strcpy(setupfilename,command); - } - initkeys(); - CONFIG_ReadSetup(); - - if (CONTROL_JoystickEnabled) - { - CONTROL_CenterJoystick(CenterCenter, UpperLeft, LowerRight, CenterThrottle, - CenterRudder); - } - CON_ConMessage("Loaded new config file."); - */ CON_ConMessage("JonoF: Maybe later"); } @@ -1194,8 +1165,6 @@ void CON_DamageData(void) char base[80],field[80]; int16_t op1=0; unsigned int op2, i; - SPRITEp sp; - USERp u; // Format: damage [field] [item] [value] if (sscanf(MessageInputString,"%s %s %hd %u",base,field,&op1,&op2) < 3) diff --git a/source/sw/src/setup.cpp b/source/sw/src/setup.cpp index 5e1c54f4f..0d727820b 100644 --- a/source/sw/src/setup.cpp +++ b/source/sw/src/setup.cpp @@ -87,27 +87,8 @@ int32_t GetTime(void) void InitSetup(void) { - int i; - //RegisterShutdownFunction( ShutDown ); - - //StartWindows(); - //initkeys(); - //CONFIG_GetSetupFilename(); - //InitializeKeyDefList(); - //CONFIG_ReadSetup(); CONFIG_SetupMouse(); CONFIG_SetupJoystick(); - - CONTROL_JoystickEnabled = (UseJoystick && CONTROL_JoyPresent); - CONTROL_MouseEnabled = (UseMouse && CONTROL_MousePresent); - - /*{ - int i; - CONTROL_PrintKeyMap(); - for(i=0;i