From 0db2b30a778af4529e4df8f44e409efead9e3b99 Mon Sep 17 00:00:00 2001 From: rtldg <55846624+rtldg@users.noreply.github.com> Date: Tue, 7 Dec 2021 08:27:05 +0000 Subject: [PATCH] base strafe count on input vel instead of buttons --- addons/sourcemod/scripting/include/shavit/core.inc | 1 + addons/sourcemod/scripting/shavit-core.sp | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/sourcemod/scripting/include/shavit/core.inc b/addons/sourcemod/scripting/include/shavit/core.inc index 89a11192..1cb712ae 100644 --- a/addons/sourcemod/scripting/include/shavit/core.inc +++ b/addons/sourcemod/scripting/include/shavit/core.inc @@ -135,6 +135,7 @@ enum struct timer_snapshot_t int iLandingTick; MoveType iLastMoveType; float fStrafeWarning; + float fLastInputVel[2]; } stock void Shavit_LogQuery(const char[] query) diff --git a/addons/sourcemod/scripting/shavit-core.sp b/addons/sourcemod/scripting/shavit-core.sp index 4cf3f2d6..e42abd52 100644 --- a/addons/sourcemod/scripting/shavit-core.sp +++ b/addons/sourcemod/scripting/shavit-core.sp @@ -3034,7 +3034,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float if (GetStyleSettingBool(gA_Timers[client].bsStyle, "strafe_count_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++; @@ -3042,7 +3042,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float if (GetStyleSettingBool(gA_Timers[client].bsStyle, "strafe_count_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++; @@ -3050,8 +3050,8 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float if (GetStyleSettingBool(gA_Timers[client].bsStyle, "strafe_count_a") && !GetStyleSettingBool(gA_Timers[client].bsStyle, "block_a") - && (gA_Timers[client].iLastButtons & IN_MOVELEFT) == 0 && (buttons & IN_MOVELEFT) > 0 - && (GetStyleSettingInt(gA_Timers[client].bsStyle, "force_hsw") > 0 || ((buttons & IN_FORWARD) == 0 && (buttons & IN_BACK) == 0)) + && (gA_Timers[client].fLastInputVel[1] >= 0.0) && (vel[1] < 0.0) + && (GetStyleSettingInt(gA_Timers[client].bsStyle, "force_hsw") > 0 || vel[0] == 0.0) ) { 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") && !GetStyleSettingBool(gA_Timers[client].bsStyle, "block_d") - && (gA_Timers[client].iLastButtons & IN_MOVERIGHT) == 0 && (buttons & IN_MOVERIGHT) > 0 - && (GetStyleSettingInt(gA_Timers[client].bsStyle, "force_hsw") > 0 || ((buttons & IN_FORWARD) == 0 && (buttons & IN_BACK) == 0)) + && (gA_Timers[client].fLastInputVel[1] <= 0.0) && (vel[1] > 0.0) + && (GetStyleSettingInt(gA_Timers[client].bsStyle, "force_hsw") > 0 || vel[0] == 0.0) ) { 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].bJumped = false; 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])