Merge pull request #848 from diamante0018/develop

[General]: Fix knife lounge with gamepad
This commit is contained in:
Edo 2023-03-18 14:38:27 +00:00 committed by GitHub
commit b766d5c5b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ namespace Components
{Game::GPAD_UP, Game::K_DPAD_UP}, {Game::GPAD_UP, Game::K_DPAD_UP},
{Game::GPAD_DOWN, Game::K_DPAD_DOWN}, {Game::GPAD_DOWN, Game::K_DPAD_DOWN},
{Game::GPAD_LEFT, Game::K_DPAD_LEFT}, {Game::GPAD_LEFT, Game::K_DPAD_LEFT},
{Game::GPAD_RIGHT, Game::K_DPAD_RIGHT} {Game::GPAD_RIGHT, Game::K_DPAD_RIGHT},
}; };
Game::StickToCodeMap_t Gamepad::analogStickList[4] Game::StickToCodeMap_t Gamepad::analogStickList[4]
@ -712,6 +712,8 @@ namespace Components
void Gamepad::AimAssist_UpdateGamePadInput(const Game::AimInput* input, Game::AimOutput* output) void Gamepad::AimAssist_UpdateGamePadInput(const Game::AimInput* input, Game::AimOutput* output)
{ {
assert(input);
assert(output);
AssertIn(input->localClientNum, Game::STATIC_MAX_LOCAL_CLIENTS); AssertIn(input->localClientNum, Game::STATIC_MAX_LOCAL_CLIENTS);
auto& aaGlob = Game::aaGlobArray[input->localClientNum]; auto& aaGlob = Game::aaGlobArray[input->localClientNum];
@ -724,14 +726,12 @@ namespace Components
Game::AimAssist_UpdateTweakables(input->localClientNum); Game::AimAssist_UpdateTweakables(input->localClientNum);
Game::AimAssist_UpdateAdsLerp(input); Game::AimAssist_UpdateAdsLerp(input);
AimAssist_ApplyTurnRates(input, output); AimAssist_ApplyTurnRates(input, output);
Game::AimAssist_ApplyAutoMelee(input, output);
// Automelee has already been done by keyboard so don't do it again
AimAssist_ApplyLockOn(input, output); AimAssist_ApplyLockOn(input, output);
}
aaGlob.prevButtons = input->buttons; aaGlob.prevButtons = input->buttons;
} }
}
void Gamepad::CL_RemoteControlMove_GamePad(const int localClientNum, Game::usercmd_s* cmd) void Gamepad::CL_RemoteControlMove_GamePad(const int localClientNum, Game::usercmd_s* cmd)
{ {
@ -960,6 +960,10 @@ namespace Components
aimInput.forwardAxis = forward; aimInput.forwardAxis = forward;
aimInput.rightAxis = side; aimInput.rightAxis = side;
AimAssist_UpdateGamePadInput(&aimInput, &aimOutput); AimAssist_UpdateGamePadInput(&aimInput, &aimOutput);
cmd->meleeChargeDist = aimOutput.meleeChargeDist;
cmd->meleeChargeYaw = aimOutput.meleeChargeYaw;
clientActive.clViewangles[0] = aimOutput.pitch; clientActive.clViewangles[0] = aimOutput.pitch;
clientActive.clViewangles[1] = aimOutput.yaw; clientActive.clViewangles[1] = aimOutput.yaw;
} }