Swap kbm keybinds for gamepad commands when trying to displayed localized button string and using controller

This commit is contained in:
Jan 2021-08-24 11:37:53 +02:00
parent 2c3bfbe62a
commit eaa6e6fb8c
2 changed files with 12 additions and 0 deletions

View File

@ -1377,12 +1377,23 @@ namespace Components
InitDvars();
}
const char* Gamepad::GetGamePadCommand(const char* command)
{
if (strcmp(command, "+activate") == 0 || strcmp(command, "+reload") == 0)
return "+usereload";
if (strcmp(command, "+melee_breath") == 0)
return "+holdbreath";
return command;
}
int Gamepad::Key_GetCommandAssignmentInternal_Hk(const char* cmd, int (*keys)[2])
{
auto keyCount = 0;
if (gamePads[0].inUse)
{
cmd = GetGamePadCommand(cmd);
for (auto keyNum = 0; keyNum < Game::K_LAST_KEY; keyNum++)
{
if (!Key_IsValidGamePadChar(keyNum))

View File

@ -353,6 +353,7 @@ namespace Components
static void InitDvars();
static void IN_Init_Hk();
static const char* GetGamePadCommand(const char* command);
static int Key_GetCommandAssignmentInternal_Hk(const char* cmd, int(*keys)[2]);
static bool IsGamePadInUse();
static void CL_KeyEvent_Hk(int localClientNum, int key, int down, unsigned int time);