- fix compilation

This commit is contained in:
Christoph Oelckers 2019-10-28 17:50:08 +01:00
parent 21f6178ade
commit a72863112b
9 changed files with 50 additions and 84 deletions

View file

@ -70,11 +70,6 @@ int32_t GetTime(void)
void ctrlInit(void)
{
KB_ClearKeysDown();
KB_FlushKeyboardQueue();
KB_FlushKeyboardQueueScans();
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
}
void ctrlTerm(void)

View file

@ -10,6 +10,8 @@
#include "gamecvars.h"
#include "build.h"
#include "inputstate.h"
#include "_control.h"
#include "control.h"
InputState inputState;
@ -343,41 +345,6 @@ 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";
}
}
//==========================================================================
//
//
@ -1007,8 +974,47 @@ 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 "";
}
// 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";
}
}
void CONFIG_InitMouseAndController()
{
@ -1041,8 +1047,12 @@ void CONFIG_InitMouseAndController()
}
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
KB_ClearKeysDown();
KB_FlushKeyboardQueue();
KB_FlushKeyboardQueueScans();
}
void CONFIG_PutNumber(const char* key, int number)
{
FStringf str("%d", number);

View file

@ -27,6 +27,7 @@ enum
};
extern consolekeybind_t CONTROL_KeyBinds[NUMKEYS + MAXMOUSEBUTTONS];
extern int32_t CONTROL_ButtonFlags[NUMKEYS];
extern bool CONTROL_BindsEnabled;
// Order is that of EDuke32 by necessity because it exposes the key binds to scripting by index instead of by name.
@ -130,7 +131,7 @@ class InputState
struct ButtonStateFlags
{
bool ButtonActive; // Button currently reports being active to the client
bool ButtonCleared;, // Button has been cleared by the client, i.e. do not set to active until no input for this button is active anymore.
bool ButtonCleared; // Button has been cleared by the client, i.e. do not set to active until no input for this button is active anymore.
};
ButtonStateFlags ButtonState[NUMGAMEFUNCTIONS];

View file

@ -6482,12 +6482,6 @@ int app_main(int argc, const char * const*argv)
OSD_SetParameters(0, 0, 0, 12, 2, 12, OSD_ERROR, OSDTEXT_RED, 0);
registerosdcommands();
if (g_networkMode != NET_DEDICATED_SERVER)
{
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
}
#ifdef HAVE_CLIPSHAPE_FEATURE
int const clipMapError = engineLoadClipMaps();
if (clipMapError > 0)

View file

@ -181,7 +181,6 @@ int CONTROL_FlagActive( int which );
void CONTROL_ClearAssignments( void );
// void CONTROL_GetFunctionInput( void );
void CONTROL_GetInput( ControlInfo *info );
void CONTROL_ClearButton( int whichbutton );
extern float CONTROL_MouseSensitivity;
bool CONTROL_Startup(controltype which, int32_t ( *TimeFunction )( void ), int32_t ticspersecond);
void CONTROL_Shutdown( void );

View file

@ -59,12 +59,12 @@ static int32_t(*ExtGetTime)(void);
//static int32_t ticrate;
static uint8_t CONTROL_DoubleClickSpeed;
int32_t CONTROL_ButtonFlags[CONTROL_NUM_FLAGS];
int32_t CONTROL_ButtonFlags[NUMKEYS];
consolekeybind_t CONTROL_KeyBinds[NUMKEYS + MAXMOUSEBUTTONS];
bool CONTROL_BindsEnabled = 0;
bool CONTROL_SmoothMouse = 0;
#define CONTROL_CheckRange(which) ((unsigned)which >= (unsigned)CONTROL_NUM_FLAGS)
#define CONTROL_CheckRange(which) ((unsigned)which >= (unsigned)NUMKEYS)
#define BIND(x, s, r, k) do { Xfree(x.cmdstr); x.cmdstr = s; x.repeat = r; x.key = k; } while (0)
void CONTROL_ClearAllBinds(void)
@ -615,18 +615,6 @@ static void CONTROL_ButtonFunctionState(int32_t *p1)
}
}
void CONTROL_ClearButton(int whichbutton)
{
if (CONTROL_CheckRange(whichbutton)) return;
#ifdef __ANDROID__
CONTROL_Android_ClearButton(whichbutton);
#endif
inputState.ClearButton(whichbutton);
CONTROL_Flags[whichbutton].cleared = TRUE;
}
int32_t CONTROL_GetGameControllerDigitalAxisPos(int32_t axis)
{
if (!joystick.isGameController)

View file

@ -7865,12 +7865,6 @@ int app_main(int argc, char const * const * argv)
OSD_SetParameters(0, 0, 0, 12, 2, 12, OSD_ERROR, OSDTEXT_RED, 0);
registerosdcommands();
//if (g_networkMode != NET_DEDICATED_SERVER)
{
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
}
#ifdef HAVE_CLIPSHAPE_FEATURE
int const clipMapError = engineLoadClipMaps();
if (clipMapError > 0)

View file

@ -888,8 +888,6 @@ InitGame(int32_t argc, char const * const * argv)
SW_FatalEngineError();
//initgroupfile(G_GrpFile()); // JBF: moving this close to start of program to detect shareware
InitSetup();
InitAutoNet();
timerInit(120);

View file

@ -85,18 +85,5 @@ int32_t GetTime(void)
//return timert++;
}
void InitSetup(void)
{
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
}
#if 0
void TermSetup(void)
{
//FreeKeyDefList();
}
#endif
END_SW_NS