base strafe count on input vel instead of buttons

This commit is contained in:
rtldg 2021-12-07 08:27:05 +00:00
parent 8830035af5
commit 0db2b30a77
2 changed files with 9 additions and 6 deletions

View File

@ -135,6 +135,7 @@ enum struct timer_snapshot_t
int iLandingTick; int iLandingTick;
MoveType iLastMoveType; MoveType iLastMoveType;
float fStrafeWarning; float fStrafeWarning;
float fLastInputVel[2];
} }
stock void Shavit_LogQuery(const char[] query) stock void Shavit_LogQuery(const char[] query)

View File

@ -3034,7 +3034,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
if (GetStyleSettingBool(gA_Timers[client].bsStyle, "strafe_count_w") if (GetStyleSettingBool(gA_Timers[client].bsStyle, "strafe_count_w")
&& !GetStyleSettingBool(gA_Timers[client].bsStyle, "block_w") && !GetStyleSettingBool(gA_Timers[client].bsStyle, "block_w")
&& (gA_Timers[client].iLastButtons & IN_FORWARD) == 0 && (buttons & IN_FORWARD) > 0 && (gA_Timers[client].fLastInputVel[0] <= 0.0) && (vel[0] > 0.0)
) )
{ {
gA_Timers[client].iStrafes++; gA_Timers[client].iStrafes++;
@ -3042,7 +3042,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
if (GetStyleSettingBool(gA_Timers[client].bsStyle, "strafe_count_s") if (GetStyleSettingBool(gA_Timers[client].bsStyle, "strafe_count_s")
&& !GetStyleSettingBool(gA_Timers[client].bsStyle, "block_s") && !GetStyleSettingBool(gA_Timers[client].bsStyle, "block_s")
&& (gA_Timers[client].iLastButtons & IN_BACK) == 0 && (buttons & IN_BACK) > 0 && (gA_Timers[client].fLastInputVel[0] >= 0.0) && (vel[0] < 0.0)
) )
{ {
gA_Timers[client].iStrafes++; gA_Timers[client].iStrafes++;
@ -3050,8 +3050,8 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
if (GetStyleSettingBool(gA_Timers[client].bsStyle, "strafe_count_a") if (GetStyleSettingBool(gA_Timers[client].bsStyle, "strafe_count_a")
&& !GetStyleSettingBool(gA_Timers[client].bsStyle, "block_a") && !GetStyleSettingBool(gA_Timers[client].bsStyle, "block_a")
&& (gA_Timers[client].iLastButtons & IN_MOVELEFT) == 0 && (buttons & IN_MOVELEFT) > 0 && (gA_Timers[client].fLastInputVel[1] >= 0.0) && (vel[1] < 0.0)
&& (GetStyleSettingInt(gA_Timers[client].bsStyle, "force_hsw") > 0 || ((buttons & IN_FORWARD) == 0 && (buttons & IN_BACK) == 0)) && (GetStyleSettingInt(gA_Timers[client].bsStyle, "force_hsw") > 0 || vel[0] == 0.0)
) )
{ {
gA_Timers[client].iStrafes++; gA_Timers[client].iStrafes++;
@ -3059,8 +3059,8 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
if (GetStyleSettingBool(gA_Timers[client].bsStyle, "strafe_count_d") if (GetStyleSettingBool(gA_Timers[client].bsStyle, "strafe_count_d")
&& !GetStyleSettingBool(gA_Timers[client].bsStyle, "block_d") && !GetStyleSettingBool(gA_Timers[client].bsStyle, "block_d")
&& (gA_Timers[client].iLastButtons & IN_MOVERIGHT) == 0 && (buttons & IN_MOVERIGHT) > 0 && (gA_Timers[client].fLastInputVel[1] <= 0.0) && (vel[1] > 0.0)
&& (GetStyleSettingInt(gA_Timers[client].bsStyle, "force_hsw") > 0 || ((buttons & IN_FORWARD) == 0 && (buttons & IN_BACK) == 0)) && (GetStyleSettingInt(gA_Timers[client].bsStyle, "force_hsw") > 0 || vel[0] == 0.0)
) )
{ {
gA_Timers[client].iStrafes++; gA_Timers[client].iStrafes++;
@ -3127,6 +3127,8 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
gA_Timers[client].fLastAngle = angles[1]; gA_Timers[client].fLastAngle = angles[1];
gA_Timers[client].bJumped = false; gA_Timers[client].bJumped = false;
gA_Timers[client].bOnGround = bOnGround; gA_Timers[client].bOnGround = bOnGround;
gA_Timers[client].fLastInputVel[0] = vel[0];
gA_Timers[client].fLastInputVel[1] = vel[1];
} }
void TestAngles(int client, float dirangle, float yawdelta, const float vel[3]) void TestAngles(int client, float dirangle, float yawdelta, const float vel[3])