Fix gamepad use hold time by checking for used buttons from gentity instead of local player keys to work on dedicated servers
This commit is contained in:
parent
aa3c6d79c6
commit
a07a00da93
@ -878,10 +878,10 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Gamepad::Gamepad_ShouldUse(const unsigned useTime)
|
bool Gamepad::Gamepad_ShouldUse(const Game::gentity_s* playerEnt, const unsigned useTime)
|
||||||
{
|
{
|
||||||
// Only apply hold time to +usereload keybind
|
// Only apply hold time to +usereload keybind
|
||||||
return !Game::playersKb[Game::KB_USE_RELOAD].active || useTime >= static_cast<unsigned>(gpad_use_hold_time.get<int>());
|
return !(playerEnt->client->buttons & Game::CMD_BUTTON_USE_RELOAD) || useTime >= static_cast<unsigned>(gpad_use_hold_time.get<int>());
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(naked) void Gamepad::Player_UseEntity_Stub()
|
__declspec(naked) void Gamepad::Player_UseEntity_Stub()
|
||||||
@ -896,8 +896,9 @@ namespace Components
|
|||||||
push eax
|
push eax
|
||||||
pushad
|
pushad
|
||||||
push eax
|
push eax
|
||||||
|
push edi
|
||||||
call Gamepad_ShouldUse
|
call Gamepad_ShouldUse
|
||||||
add esp,4
|
add esp,8
|
||||||
mov [esp + 0x20],eax
|
mov [esp + 0x20],eax
|
||||||
popad
|
popad
|
||||||
pop eax
|
pop eax
|
||||||
|
@ -355,7 +355,7 @@ namespace Components
|
|||||||
static void CL_GamepadMove(int gamePadIndex, Game::usercmd_s* cmd, float frameTimeBase);
|
static void CL_GamepadMove(int gamePadIndex, Game::usercmd_s* cmd, float frameTimeBase);
|
||||||
static void CL_MouseMove_Stub();
|
static void CL_MouseMove_Stub();
|
||||||
|
|
||||||
static bool Gamepad_ShouldUse(unsigned useTime);
|
static bool Gamepad_ShouldUse(const Game::gentity_s* playerEnt, unsigned useTime);
|
||||||
static void Player_UseEntity_Stub();
|
static void Player_UseEntity_Stub();
|
||||||
|
|
||||||
static bool Key_IsValidGamePadChar(int key);
|
static bool Key_IsValidGamePadChar(int key);
|
||||||
|
@ -5262,7 +5262,13 @@ namespace Game
|
|||||||
unsigned int team;
|
unsigned int team;
|
||||||
char pad2[436];
|
char pad2[436];
|
||||||
int flags;
|
int flags;
|
||||||
char pad3[724];
|
int spectatorClient;
|
||||||
|
int lastCmdTime;
|
||||||
|
int buttons;
|
||||||
|
int oldbuttons;
|
||||||
|
int latched_buttons;
|
||||||
|
int buttonsSinceLastFrame;
|
||||||
|
char pad3[700];
|
||||||
} gclient_t;
|
} gclient_t;
|
||||||
|
|
||||||
struct EntHandle
|
struct EntHandle
|
||||||
|
Loading…
Reference in New Issue
Block a user