From 1d99e0758acf9ff5ab5033b0ea5d8dedc09805a3 Mon Sep 17 00:00:00 2001 From: Wizzard <25581244+Wizzard@users.noreply.toomuchslop.com> Date: Wed, 20 Sep 2023 20:37:29 -0400 Subject: [PATCH] Fix non silent aim missing it's first shot --- src/features/aim.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/features/aim.c b/src/features/aim.c index 5a9e1ee..1dc1b89 100644 --- a/src/features/aim.c +++ b/src/features/aim.c @@ -91,6 +91,7 @@ static vec3_t get_closest_delta(vec3_t viewangles) { void aimbot(usercmd_t* cmd) { static bool shouldShootNextFrame = false; + static bool hasAdjustedView = false; if (!CVAR_ON(aim_aimbot) || !can_shoot()) return; @@ -107,23 +108,20 @@ void aimbot(usercmd_t* cmd) { if (CVAR_ON(aim_aimbot_silent)) { vec_copy(cmd->viewangles, engine_viewangles); if (cmd->buttons & IN_ATTACK) { - if (shouldShootNextFrame) { - cmd->buttons |= IN_ATTACK; - shouldShootNextFrame = false; - } else { - cmd->buttons &= ~IN_ATTACK; - shouldShootNextFrame = true; - } + cmd->buttons |= IN_ATTACK; } } else { - if (cmd->buttons & IN_ATTACK) { // Ensure left click is pressed before adjusting aim for non-silent - i_engine->SetViewAngles(engine_viewangles); + if (cmd->buttons & IN_ATTACK) { + if (hasAdjustedView) { + hasAdjustedView = false; // Reset flag + } else { + i_engine->SetViewAngles(engine_viewangles); + hasAdjustedView = true; + cmd->buttons &= ~IN_ATTACK; // Defer the shot to the next frame + } } } - } else if (CVAR_ON(aim_autoshoot) && (cmd->buttons & IN_ATTACK)) { cmd->buttons &= ~IN_ATTACK; - } else { - shouldShootNextFrame = false; // Reset } }