Fix all killstreaks (but thermal on ac/cg)

This commit is contained in:
rackover 2021-05-09 01:24:37 +02:00
parent 9f6b5c6214
commit 7f8995cf3e
6 changed files with 60 additions and 6 deletions

View File

@ -546,7 +546,7 @@ namespace Components
{
int developer = Dvar::Var("developer").get<int>();
if (developer > 0)
if (developer > 0 && Dedicated::IsEnabled())
Utils::Hook::Set<BYTE>(0x48D8C7, 0x75);
});

View File

@ -92,8 +92,6 @@ namespace Components
{
if (XInput::xiPlayerNum != -1)
{
Game::clientActive_t* clientActive = reinterpret_cast<Game::clientActive_t*>(0xB2C698);
XINPUT_STATE* xiState = &xiStates[xiPlayerNum];
// Deadzones
@ -122,10 +120,12 @@ namespace Components
bool pressingRightTrigger = xiState->Gamepad.bRightTrigger > XINPUT_GAMEPAD_TRIGGER_THRESHOLD ? true : false;
if (pressingRightTrigger != XInput::lastXiState.Gamepad.bRightTrigger > XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
{
if (pressingRightTrigger)
if (pressingRightTrigger) {
Command::Execute("+attack");
else
}
else {
Command::Execute("-attack");
}
}
// Buttons (on/off) mappings
@ -330,6 +330,29 @@ namespace Components
}
}
int XInput::unk_CheckKeyHook(int localClientNum, Game::keyNum_t keyCode) {
if (XInput::xiPlayerNum != -1)
{
XINPUT_STATE* xiState = &xiStates[xiPlayerNum];
if (keyCode == Game::keyNum_t::K_MOUSE2) {
bool pressingLeftTrigger = xiState->Gamepad.bLeftTrigger > XINPUT_GAMEPAD_TRIGGER_THRESHOLD ? true : false;
if (pressingLeftTrigger != XInput::lastXiState.Gamepad.bLeftTrigger > XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
{
if (pressingLeftTrigger) {
return 1;
}
else {
return 0;
}
}
}
}
Utils::Hook::Call<int(int, Game::keyNum_t)>(0x48B2D0)(localClientNum, keyCode);
}
void XInput::MouseOverride(Game::clientActive_t* clientActive, float* mx, float* my) {
XInput::CL_GetMouseMovementCl(clientActive, mx, my);
@ -384,6 +407,23 @@ namespace Components
*(my) = viewStickX * viewSensitivityMultiplier * generalXSensitivityMultiplier * adsMultiplier;
*(mx) = -viewStickY * viewSensitivityMultiplier * generalYSensitivityMultiplier * adsMultiplier;
}
// Handling killstreaks
bool pressingRightTrigger = xiState->Gamepad.bRightTrigger > XINPUT_GAMEPAD_TRIGGER_THRESHOLD ? true : false;
if (pressingRightTrigger != XInput::lastXiState.Gamepad.bRightTrigger > XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
{
bool* isInPredator = reinterpret_cast<bool*>(0x8EE3B8);
if (pressingRightTrigger) {
Utils::Hook::Set(0xA1C4F4, Game::LOC_SEL_INPUT_CONFIRM);
if (*isInPredator) {
// Yea, that's how we boost
// Command::execute is sync by default so the predator event gets fired properly
Command::Execute("+attack");
Command::Execute("-attack");
}
}
}
}
}
@ -441,8 +481,10 @@ namespace Components
// make sure to parse the movement data properly and apply it
Utils::Hook(0x492127, XInput::MSG_ReadDeltaUsercmdKeyStub, HOOK_JUMP).install()->quick();
Utils::Hook(0x492009, XInput::MSG_ReadDeltaUsercmdKeyStub2, HOOK_JUMP).install()->quick();
Utils::Hook(0x5A617D, CL_GetMouseMovementStub, HOOK_CALL).install()->quick();
Utils::Hook(0x5A6816, CL_GetMouseMovementStub, HOOK_CALL).install()->quick();
Utils::Hook(0x5A6829, unk_CheckKeyHook, HOOK_CALL).install()->quick();
Game::Dvar_RegisterFloat("xpad_sensitivity", 1.0f, 0.1f, 10.0f, Game::DVAR_FLAG_SAVED, "View sensitivity for XInput-compatible gamepads");
Game::Dvar_RegisterInt("xpad_early_time", 350, 0, 1000, Game::DVAR_FLAG_SAVED, "Time (in milliseconds) of reduced view sensitivity");

View File

@ -49,6 +49,7 @@ namespace Components
static float lastMenuNavigationDirection;
static void CL_GetMouseMovementCl(Game::clientActive_t* result, float* mx, float* my);
static int unk_CheckKeyHook(int localClientNum, Game::keyNum_t keyCode);
static void MouseOverride(Game::clientActive_t* clientActive, float* my, float* mx);
static char MovementOverride(int a1, Game::usercmd_s* cmd);

View File

@ -148,6 +148,7 @@ namespace Game
Info_ValueForKey_t Info_ValueForKey = Info_ValueForKey_t(0x47C820);
Key_SetCatcher_t Key_SetCatcher = Key_SetCatcher_t(0x43BD00);
Key_IsKeyCatcherActive_t Key_IsKeyCatcherActive = Key_IsKeyCatcherActive_t(0x4DA010);
LargeLocalInit_t LargeLocalInit = LargeLocalInit_t(0x4A62A0);

View File

@ -342,6 +342,9 @@ namespace Game
typedef void(__cdecl * Key_SetCatcher_t)(int localClientNum, int catcher);
extern Key_SetCatcher_t Key_SetCatcher;
typedef bool(__cdecl* Key_IsKeyCatcherActive_t)(int localClientNum, int catcher);
extern Key_IsKeyCatcherActive_t Key_IsKeyCatcherActive;
typedef void(__cdecl * LargeLocalInit_t)();
extern LargeLocalInit_t LargeLocalInit;

View File

@ -1097,6 +1097,13 @@ namespace Game
int stunTime;
};
enum LocSelInputState
{
LOC_SEL_INPUT_NONE = 0x0,
LOC_SEL_INPUT_CONFIRM = 0x1,
LOC_SEL_INPUT_CANCEL = 0x2,
};
struct clSnapshot_t
{
playerState_s ps;