Make gamepad scoreboard toggable and scrollable
This commit is contained in:
parent
ac57df648e
commit
cb2e24a52f
@ -1042,6 +1042,32 @@ namespace Components
|
|||||||
// Game::UI_KeyEvent(gamePadIndex, key, down);
|
// Game::UI_KeyEvent(gamePadIndex, key, down);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Gamepad::Scoreboard_HandleInput(int gamePadIndex, int key)
|
||||||
|
{
|
||||||
|
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||||
|
auto& keyState = Game::playerKeys[gamePadIndex];
|
||||||
|
|
||||||
|
if (keyState.keys[key].binding && strcmp(keyState.keys[key].binding, "togglescores") == 0)
|
||||||
|
{
|
||||||
|
Game::Cbuf_AddText(gamePadIndex, "togglescores\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case Game::K_DPAD_UP:
|
||||||
|
Game::CG_ScrollScoreboardUp(Game::cgArray);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case Game::K_DPAD_DOWN:
|
||||||
|
Game::CG_ScrollScoreboardDown(Game::cgArray);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Gamepad::CL_CheckForIgnoreDueToRepeat(const int gamePadIndex, const int key, const int repeatCount, const unsigned time)
|
bool Gamepad::CL_CheckForIgnoreDueToRepeat(const int gamePadIndex, const int key, const int repeatCount, const unsigned time)
|
||||||
{
|
{
|
||||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||||
@ -1113,6 +1139,13 @@ namespace Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto activeMenu = Game::UI_GetActiveMenu(gamePadIndex);
|
||||||
|
if(activeMenu == Game::UIMENU_SCOREBOARD)
|
||||||
|
{
|
||||||
|
if (buttonEvent == Game::GPAD_BUTTON_PRESSED && Scoreboard_HandleInput(gamePadIndex, key))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
keyState.locSelInputState = Game::LOC_SEL_INPUT_NONE;
|
keyState.locSelInputState = Game::LOC_SEL_INPUT_NONE;
|
||||||
|
|
||||||
const auto* keyBinding = keyState.keys[key].binding;
|
const auto* keyBinding = keyState.keys[key].binding;
|
||||||
@ -1663,6 +1696,17 @@ namespace Components
|
|||||||
Game::Cbuf_AddText(0, Utils::String::VA("exec %s\n", buttonConfigName));
|
Game::Cbuf_AddText(0, Utils::String::VA("exec %s\n", buttonConfigName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Gamepad::Scores_Toggle_f(Command::Params*)
|
||||||
|
{
|
||||||
|
if(Game::cgArray[0].nextSnap)
|
||||||
|
{
|
||||||
|
if (Game::UI_GetActiveMenu(0) != Game::UIMENU_SCOREBOARD)
|
||||||
|
Game::CG_ScoresDown_f();
|
||||||
|
else
|
||||||
|
Game::CG_ScoresUp_f();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Gamepad::InitDvars()
|
void Gamepad::InitDvars()
|
||||||
{
|
{
|
||||||
gpad_enabled = Dvar::Register<bool>("gpad_enabled", false, Game::DVAR_FLAG_SAVED, "Game pad enabled");
|
gpad_enabled = Dvar::Register<bool>("gpad_enabled", false, Game::DVAR_FLAG_SAVED, "Game pad enabled");
|
||||||
@ -1851,6 +1895,7 @@ namespace Components
|
|||||||
Command::Add("unbindallaxis", Axis_Unbindall_f);
|
Command::Add("unbindallaxis", Axis_Unbindall_f);
|
||||||
Command::Add("bindgpsticksconfigs", Bind_GP_SticksConfigs_f);
|
Command::Add("bindgpsticksconfigs", Bind_GP_SticksConfigs_f);
|
||||||
Command::Add("bindgpbuttonsconfigs", Bind_GP_ButtonsConfigs_f);
|
Command::Add("bindgpbuttonsconfigs", Bind_GP_ButtonsConfigs_f);
|
||||||
|
Command::Add("togglescores", Scores_Toggle_f);
|
||||||
|
|
||||||
if (Dedicated::IsEnabled())
|
if (Dedicated::IsEnabled())
|
||||||
return;
|
return;
|
||||||
|
@ -364,6 +364,7 @@ namespace Components
|
|||||||
|
|
||||||
static bool Key_IsValidGamePadChar(int key);
|
static bool Key_IsValidGamePadChar(int key);
|
||||||
static void CL_GamepadResetMenuScrollTime(int gamePadIndex, int key, bool down, unsigned int time);
|
static void CL_GamepadResetMenuScrollTime(int gamePadIndex, int key, bool down, unsigned int time);
|
||||||
|
static bool Scoreboard_HandleInput(int gamePadIndex, int key);
|
||||||
static bool CL_CheckForIgnoreDueToRepeat(int gamePadIndex, int key, int repeatCount, unsigned int time);
|
static bool CL_CheckForIgnoreDueToRepeat(int gamePadIndex, int key, int repeatCount, unsigned int time);
|
||||||
static void UI_GamepadKeyEvent(int gamePadIndex, int key, bool down);
|
static void UI_GamepadKeyEvent(int gamePadIndex, int key, bool down);
|
||||||
static void CL_GamepadGenerateAPad(int gamePadIndex, Game::GamepadPhysicalAxis physicalAxis, unsigned time);
|
static void CL_GamepadGenerateAPad(int gamePadIndex, Game::GamepadPhysicalAxis physicalAxis, unsigned time);
|
||||||
@ -401,6 +402,7 @@ namespace Components
|
|||||||
static void Axis_Unbindall_f(Command::Params* params);
|
static void Axis_Unbindall_f(Command::Params* params);
|
||||||
static void Bind_GP_SticksConfigs_f(Command::Params* params);
|
static void Bind_GP_SticksConfigs_f(Command::Params* params);
|
||||||
static void Bind_GP_ButtonsConfigs_f(Command::Params* params);
|
static void Bind_GP_ButtonsConfigs_f(Command::Params* params);
|
||||||
|
static void Scores_Toggle_f(Command::Params* params);
|
||||||
|
|
||||||
static void InitDvars();
|
static void InitDvars();
|
||||||
static void IN_Init_Hk();
|
static void IN_Init_Hk();
|
||||||
|
@ -39,6 +39,10 @@ namespace Game
|
|||||||
CG_GetClientNum_t CG_GetClientNum = CG_GetClientNum_t(0x433700);
|
CG_GetClientNum_t CG_GetClientNum = CG_GetClientNum_t(0x433700);
|
||||||
CG_PlayBoltedEffect_t CG_PlayBoltedEffect = CG_PlayBoltedEffect_t(0x00430E10);
|
CG_PlayBoltedEffect_t CG_PlayBoltedEffect = CG_PlayBoltedEffect_t(0x00430E10);
|
||||||
CG_GetBoneIndex_t CG_GetBoneIndex = CG_GetBoneIndex_t(0x00504F20);
|
CG_GetBoneIndex_t CG_GetBoneIndex = CG_GetBoneIndex_t(0x00504F20);
|
||||||
|
CG_ScoresDown_f_t CG_ScoresDown_f = CG_ScoresDown_f_t(0x580370);
|
||||||
|
CG_ScoresUp_f_t CG_ScoresUp_f = CG_ScoresUp_f_t(0x5802C0);
|
||||||
|
CG_ScrollScoreboardUp_t CG_ScrollScoreboardUp = CG_ScrollScoreboardUp_t(0x47A5C0);
|
||||||
|
CG_ScrollScoreboardDown_t CG_ScrollScoreboardDown = CG_ScrollScoreboardDown_t(0x493B50);
|
||||||
|
|
||||||
CL_GetClientName_t CL_GetClientName = CL_GetClientName_t(0x4563D0);
|
CL_GetClientName_t CL_GetClientName = CL_GetClientName_t(0x4563D0);
|
||||||
CL_IsCgameInitialized_t CL_IsCgameInitialized = CL_IsCgameInitialized_t(0x43EB20);
|
CL_IsCgameInitialized_t CL_IsCgameInitialized = CL_IsCgameInitialized_t(0x43EB20);
|
||||||
|
@ -60,6 +60,18 @@ namespace Game
|
|||||||
|
|
||||||
typedef std::int32_t(__cdecl* CG_GetBoneIndex_t)(std::int32_t, std::uint32_t name, char* index);
|
typedef std::int32_t(__cdecl* CG_GetBoneIndex_t)(std::int32_t, std::uint32_t name, char* index);
|
||||||
extern CG_GetBoneIndex_t CG_GetBoneIndex;
|
extern CG_GetBoneIndex_t CG_GetBoneIndex;
|
||||||
|
|
||||||
|
typedef void(__cdecl * CG_ScoresDown_f_t)();
|
||||||
|
extern CG_ScoresDown_f_t CG_ScoresDown_f;
|
||||||
|
|
||||||
|
typedef void(__cdecl * CG_ScoresUp_f_t)();
|
||||||
|
extern CG_ScoresUp_f_t CG_ScoresUp_f;
|
||||||
|
|
||||||
|
typedef void(__cdecl * CG_ScrollScoreboardUp_t)(cg_s* cgameGlob);
|
||||||
|
extern CG_ScrollScoreboardUp_t CG_ScrollScoreboardUp;
|
||||||
|
|
||||||
|
typedef void(__cdecl * CG_ScrollScoreboardDown_t)(cg_s* cgameGlob);
|
||||||
|
extern CG_ScrollScoreboardDown_t CG_ScrollScoreboardDown;
|
||||||
|
|
||||||
typedef char*(__cdecl * CL_GetClientName_t)(int localClientNum, int index, char *buf, size_t size);
|
typedef char*(__cdecl * CL_GetClientName_t)(int localClientNum, int index, char *buf, size_t size);
|
||||||
extern CL_GetClientName_t CL_GetClientName;
|
extern CL_GetClientName_t CL_GetClientName;
|
||||||
|
@ -6169,21 +6169,22 @@ namespace Game
|
|||||||
struct __declspec(align(8)) cg_s
|
struct __declspec(align(8)) cg_s
|
||||||
{
|
{
|
||||||
playerState_s predictedPlayerState;
|
playerState_s predictedPlayerState;
|
||||||
char _pad0[0x67638];
|
char _pad0[0x254];
|
||||||
|
void* snap;
|
||||||
|
void* nextSnap;
|
||||||
|
char _pad1[0x673DC];
|
||||||
int frametime; // + 0x6A754
|
int frametime; // + 0x6A754
|
||||||
char _pad1[0x960C]; // + 0x6A758
|
char _pad2[0x960C]; // + 0x6A758
|
||||||
float compassMapWorldSize[2]; // + 0x73D64
|
float compassMapWorldSize[2]; // + 0x73D64
|
||||||
char _pad2[0x74]; // + 0x73D6C
|
char _pad3[0x74]; // + 0x73D6C
|
||||||
float selectedLocation[2]; // + 0x73DE0
|
float selectedLocation[2]; // + 0x73DE0
|
||||||
float selectedLocationAngle;
|
float selectedLocationAngle;
|
||||||
float selectedAngleLocation[2];
|
float selectedAngleLocation[2];
|
||||||
float selectedLocationPrev[2];
|
float selectedLocationPrev[2];
|
||||||
float selectedLocationAnglePrev;
|
float selectedLocationAnglePrev;
|
||||||
char _pad3[0x89740];
|
char _pad4[0x89740];
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr auto aaaaaaa1 = sizeof(cg_s);
|
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#ifndef IDA
|
#ifndef IDA
|
||||||
|
Loading…
Reference in New Issue
Block a user