mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- more cleanup
Moving init code and key binding getter to backend
This commit is contained in:
parent
4f4fc1a8d4
commit
901b86577e
10 changed files with 49 additions and 125 deletions
|
@ -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)
|
||||
|
|
|
@ -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; i<joystick.numAxes; i++)
|
||||
joySetDeadZone(i,JoystickAnalogueDead[i],JoystickAnalogueSaturate[i]);
|
||||
|
||||
}
|
||||
|
||||
static void CONFIG_SetJoystickButtonFunction(int i, int j, int function)
|
||||
|
@ -964,10 +1007,7 @@ char const* CONFIG_GetGameFuncOnJoystick(int gameFunc)
|
|||
for (int i = 0; i < joystick.numAxes; ++i)
|
||||
for (int j = 0; j < 2; ++j)
|
||||
if (JoystickDigitalFunctions[i][j] == gameFunc)
|
||||
return joyGetName(0, i);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_InitMouseAndController()
|
||||
|
|
|
@ -58,8 +58,8 @@ void CONFIG_InitMouseAndController();
|
|||
void CONFIG_SetGameControllerDefaultsStandard();
|
||||
void CONFIG_SetGameControllerDefaultsPro();
|
||||
void CONFIG_SetGameControllerDefaultsClear();
|
||||
char const* CONFIG_GetGameFuncOnJoystick(int gameFunc);
|
||||
char const* CONFIG_GetGameFuncOnKeyboard(int gameFunc);
|
||||
|
||||
FString CONFIG_GetBoundKeyForLastInput(int gameFunc);
|
||||
|
||||
int osdcmd_bind(osdcmdptr_t parm);
|
||||
int osdcmd_unbindall(osdcmdptr_t);
|
||||
|
|
|
@ -6486,13 +6486,6 @@ int app_main(int argc, const char * 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 (int i=0; i<joystick.numAxes; i++)
|
||||
joySetDeadZone(i,JoystickAnalogueDead[i],JoystickAnalogueSaturate[i]);
|
||||
}
|
||||
|
||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||
|
|
|
@ -3682,45 +3682,9 @@ badindex:
|
|||
|
||||
static char const s_KeyboardFormat[] = "[%s]";
|
||||
static char const s_JoystickFormat[] = "(%s)";
|
||||
static char const s_Unbound[] = "UNBOUND";
|
||||
|
||||
if (CONTROL_LastSeenInput == LastSeenInput::Joystick)
|
||||
{
|
||||
char const * joyname = CONFIG_GetGameFuncOnJoystick(gameFunc);
|
||||
if (joyname != nullptr && joyname[0] != '\0')
|
||||
{
|
||||
snprintf(apStrings[quoteIndex], MAXQUOTELEN, s_JoystickFormat, joyname);
|
||||
dispatch();
|
||||
}
|
||||
|
||||
char const * keyname = CONFIG_GetGameFuncOnKeyboard(gameFunc);
|
||||
if (keyname != nullptr && keyname[0] != '\0')
|
||||
{
|
||||
snprintf(apStrings[quoteIndex], MAXQUOTELEN, s_KeyboardFormat, keyname);
|
||||
dispatch();
|
||||
}
|
||||
|
||||
snprintf(apStrings[quoteIndex], MAXQUOTELEN, s_JoystickFormat, s_Unbound);
|
||||
}
|
||||
else
|
||||
{
|
||||
char const * keyname = CONFIG_GetGameFuncOnKeyboard(gameFunc);
|
||||
if (keyname != nullptr && keyname[0] != '\0')
|
||||
{
|
||||
snprintf(apStrings[quoteIndex], MAXQUOTELEN, s_KeyboardFormat, keyname);
|
||||
dispatch();
|
||||
}
|
||||
|
||||
char const * joyname = CONFIG_GetGameFuncOnJoystick(gameFunc);
|
||||
if (joyname != nullptr && joyname[0] != '\0')
|
||||
{
|
||||
snprintf(apStrings[quoteIndex], MAXQUOTELEN, s_JoystickFormat, joyname);
|
||||
dispatch();
|
||||
}
|
||||
|
||||
snprintf(apStrings[quoteIndex], MAXQUOTELEN, s_KeyboardFormat, s_Unbound);
|
||||
}
|
||||
|
||||
auto binding = CONFIG_GetBoundKeyForLastInput(gameFunc);
|
||||
if (binding.Len()) snprintf(apStrings[quoteIndex], MAXQUOTELEN, "(%s)", binding.GetChars());
|
||||
dispatch();
|
||||
}
|
||||
|
||||
|
|
|
@ -997,16 +997,12 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
CONTROL_Android_ScrollMap(&ud.fola, &ud.folx, &ud.foly, &pp->zoom);
|
||||
#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;
|
||||
|
|
|
@ -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; i<joystick.numAxes; i++)
|
||||
joySetDeadZone(i,JoystickAnalogueDead[i],JoystickAnalogueSaturate[i]);
|
||||
}
|
||||
|
||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||
|
|
|
@ -1030,16 +1030,12 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
CONTROL_Android_ScrollMap(&ud.fola, &ud.folx, &ud.foly, &pp->zoom);
|
||||
#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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<NUMGAMEFUNCTIONS;i++) CONTROL_PrintControlFlag(i);
|
||||
CONTROL_PrintAxes();
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
Loading…
Reference in a new issue