Skip to content

Commit

Permalink
Remove now unnecessary strafe workaround (PR #2734)
Browse files Browse the repository at this point in the history
  • Loading branch information
Merlin committed Sep 11, 2022
1 parent 0160e18 commit a331072
Showing 1 changed file with 0 additions and 51 deletions.
51 changes: 0 additions & 51 deletions Client/mods/deathmatch/logic/CClientPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3266,57 +3266,6 @@ void CClientPed::ApplyControllerStateFixes(CControllerState& Current)
}
}
}

// Fix for stuck aim+move when FPS is greater than 45. This hack will raise the limit to 70 FPS
// Fix works by applying a small input pulse on the other axis, at the start of movement
pTask = m_pTaskManager->GetTaskSecondary(TASK_SECONDARY_ATTACK);
if (pTask && pTask->GetTaskType() == TASK_SIMPLE_USE_GUN)
{
// Make sure not crouching
pTask = m_pTaskManager->GetTaskSecondary(TASK_SECONDARY_DUCK);
if (!pTask || pTask->GetTaskType() != TASK_SIMPLE_DUCK)
{
eWeaponType eWeapon = GetCurrentWeaponType();
float fSkill = GetStat(g_pGame->GetStats()->GetSkillStatIndex(eWeapon));
CWeaponStat* pWeaponStat = g_pGame->GetWeaponStatManager()->GetWeaponStatsFromSkillLevel(eWeapon, fSkill);
// Apply fix for aimable weapons only
if (pWeaponStat && pWeaponStat->IsFlagSet(WEAPONTYPE_CANAIMWITHARM) == false)
{
// See which way input wants to go
const bool bInputRight = Current.LeftStickX > 6;
const bool bInputLeft = Current.LeftStickX < -6;
const bool bInputFwd = Current.LeftStickY < -6;
const bool bInputBack = Current.LeftStickY > 6;

// See which way ped is currently going
CVector vecVelocity, vecRotationRadians;
GetMoveSpeed(vecVelocity);
GetRotationRadians(vecRotationRadians);
RotateVector(vecVelocity, -vecRotationRadians);

// Calc how much to pulse other axis
short sFixY = 0;
short sFixX = 0;

if (bInputRight && vecVelocity.fX >= 0.f)
sFixY = static_cast<short>(UnlerpClamped(0.02f, vecVelocity.fX, 0.f) * 64);
else if (bInputLeft && vecVelocity.fX <= 0.f)
sFixY = static_cast<short>(UnlerpClamped(-0.02f, vecVelocity.fX, 0.f) * -64);

if (bInputFwd && vecVelocity.fY >= 0.f)
sFixX = static_cast<short>(UnlerpClamped(0.02f, vecVelocity.fY, 0.f) * 64);
else if (bInputBack && vecVelocity.fY <= 0.f)
sFixX = static_cast<short>(UnlerpClamped(-0.02f, vecVelocity.fY, 0.f) * -64);

// Apply pulse if bigger than existing input value
if (abs(sFixY) > abs(Current.LeftStickY))
Current.LeftStickY = sFixY;

if (abs(sFixX) > abs(Current.LeftStickX))
Current.LeftStickX = sFixX;
}
}
}
}

float CClientPed::GetCurrentRotation()
Expand Down

0 comments on commit a331072

Please sign in to comment.