Add movement features (auto-strafe, jumpbug, edgejump, longjump, fast-stop, slow walk)

This commit is contained in:
2026-08-05 17:28:50 +02:00
parent d249ce94f0
commit d6895ac3f3
5 changed files with 160 additions and 0 deletions
@@ -477,6 +477,8 @@ auto CMisc::OnCreateMove( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void
} }
} }
RunMovement( pInput , pUserCmd );
if ( Settings::Misc::FOVChanger ) if ( Settings::Misc::FOVChanger )
{ {
auto* pLocalPawn = GetCL_Players()->GetLocalPlayerPawn(); auto* pLocalPawn = GetCL_Players()->GetLocalPlayerPawn();
@@ -489,6 +491,144 @@ auto CMisc::OnCreateMove( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void
} }
} }
auto CMisc::RunMovement( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void
{
auto* pLocalPawn = GetCL_Players()->GetLocalPlayerPawn();
if ( !pLocalPawn || !pLocalPawn->IsAlive() )
{
m_bWasOnGround = false;
return;
}
const auto flFlags = pLocalPawn->m_fFlags();
constexpr uint32 FL_ONGROUND = 1u;
const bool bOnGround = ( flFlags & FL_ONGROUND ) != 0;
if ( Settings::Misc::AutoStrafe )
RunAutoStrafe( pInput , pUserCmd , pLocalPawn , bOnGround );
if ( Settings::Misc::JumpBug )
{
if ( !bOnGround && pLocalPawn->m_flFallVelocity() > 430.f )
GetCL_Bypass()->SetJump( pUserCmd , true );
}
if ( Settings::Misc::EdgeJump )
{
if ( m_bWasOnGround && !bOnGround )
{
if ( pUserCmd->button_states.buttonstate1 & ( IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT ) )
GetCL_Bypass()->SetJump( pUserCmd , true );
}
}
if ( Settings::Misc::LongJump )
{
if ( !bOnGround )
pUserCmd->button_states.buttonstate1 |= IN_DUCK;
}
if ( Settings::Misc::FastStop )
{
if ( bOnGround )
{
if ( !( pUserCmd->button_states.buttonstate1 & ( IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT ) ) )
{
const Vector3 Velocity = pLocalPawn->m_vecVelocity();
const float flSpeed = Velocity.Length2D();
if ( flSpeed > 5.f )
{
constexpr float k_Pi = 3.14159265358979f;
const float flVelYaw = std::atan2f( Velocity.m_y , Velocity.m_x ) * ( 180.f / k_Pi );
auto* pViewAngles = CCSGOInput_GetViewAngles( pInput , 0 );
if ( pViewAngles )
{
float flDelta = flVelYaw - pViewAngles->m_y;
while ( flDelta > 180.f )
flDelta -= 360.f;
while ( flDelta < -180.f )
flDelta += 360.f;
if ( flDelta > -45.f && flDelta <= 45.f )
pUserCmd->button_states.buttonstate1 |= IN_BACK;
else if ( flDelta > 45.f && flDelta <= 135.f )
pUserCmd->button_states.buttonstate1 |= IN_MOVELEFT;
else if ( flDelta > 135.f || flDelta <= -135.f )
pUserCmd->button_states.buttonstate1 |= IN_FORWARD;
else
pUserCmd->button_states.buttonstate1 |= IN_MOVERIGHT;
}
}
}
}
}
if ( Settings::Misc::SlowWalk )
pUserCmd->button_states.buttonstate1 |= IN_SPEED;
m_bWasOnGround = bOnGround;
}
auto CMisc::RunAutoStrafe( CCSGOInput* pInput , CUserCmd* pUserCmd , C_CSPlayerPawn* pLocalPawn , bool bOnGround ) -> void
{
if ( bOnGround )
return;
if ( pUserCmd->button_states.buttonstate1 & ( IN_FORWARD | IN_BACK ) )
return;
const Vector3 Velocity = pLocalPawn->m_vecVelocity();
const float flSpeed = Velocity.Length2D();
if ( flSpeed < 0.1f )
return;
constexpr float k_Pi = 3.14159265358979f;
const float flVelYaw = std::atan2f( Velocity.m_y , Velocity.m_x ) * ( 180.f / k_Pi );
auto* pViewAngles = CCSGOInput_GetViewAngles( pInput , 0 );
if ( !pViewAngles )
return;
float flDelta = flVelYaw - pViewAngles->m_y;
while ( flDelta > 180.f )
flDelta -= 360.f;
while ( flDelta < -180.f )
flDelta += 360.f;
constexpr float k_TurnSpeed = 5.f;
QAngle NewAngles = *pViewAngles;
if ( flDelta > 0.f )
{
NewAngles.m_y += k_TurnSpeed;
pUserCmd->button_states.buttonstate1 |= IN_MOVERIGHT;
}
else
{
NewAngles.m_y -= k_TurnSpeed;
pUserCmd->button_states.buttonstate1 |= IN_MOVELEFT;
}
GetCL_Bypass()->SetViewAngles( &NewAngles , pInput , pUserCmd );
}
auto CMisc::RunTriggerbot( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void auto CMisc::RunTriggerbot( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void
{ {
auto Reset = [ & ]() auto Reset = [ & ]()
@@ -37,6 +37,9 @@ private:
auto CalculateHitchance( CCSGOInput* pInput , C_CSPlayerPawn* pTarget , const QAngle& ViewAngles , const int Samples ) -> float; auto CalculateHitchance( CCSGOInput* pInput , C_CSPlayerPawn* pTarget , const QAngle& ViewAngles , const int Samples ) -> float;
auto CalculateSeedDirection( CCSGOInput* pInput , CUserCmd* pUserCmd , Vector3* vOutDirection ) -> bool; auto CalculateSeedDirection( CCSGOInput* pInput , CUserCmd* pUserCmd , Vector3* vOutDirection ) -> bool;
auto RunMovement( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void;
auto RunAutoStrafe( CCSGOInput* pInput , CUserCmd* pUserCmd , C_CSPlayerPawn* pLocalPawn , bool bOnGround ) -> void;
private: private:
std::chrono::steady_clock::time_point m_HitTime{}; std::chrono::steady_clock::time_point m_HitTime{};
std::chrono::steady_clock::time_point m_HitSoundTime{}; std::chrono::steady_clock::time_point m_HitSoundTime{};
@@ -50,6 +53,8 @@ private:
std::atomic_bool m_bTargetInCrosshair = false; std::atomic_bool m_bTargetInCrosshair = false;
std::atomic_bool m_bTriggerFiring = false; std::atomic_bool m_bTriggerFiring = false;
bool m_bWasOnGround = false;
}; };
auto GetMisc() -> CMisc*; auto GetMisc() -> CMisc*;
@@ -332,6 +332,12 @@ auto CAndromedaMenu::RenderMiscPanel() -> void
ImGui::SeparatorText( "Movement" ); ImGui::SeparatorText( "Movement" );
Checkbox( "Bunnyhop" , Settings::Misc::Bunnyhop ); Checkbox( "Bunnyhop" , Settings::Misc::Bunnyhop );
Checkbox( "Auto-Strafe" , Settings::Misc::AutoStrafe );
Checkbox( "JumpBug" , Settings::Misc::JumpBug );
Checkbox( "EdgeJump" , Settings::Misc::EdgeJump );
Checkbox( "Fast-Stop" , Settings::Misc::FastStop );
Checkbox( "LongJump" , Settings::Misc::LongJump );
Checkbox( "Slow Walk" , Settings::Misc::SlowWalk );
Checkbox( "No Flash" , Settings::Misc::NoFlash ); Checkbox( "No Flash" , Settings::Misc::NoFlash );
ImGui::SeparatorText( "Camera" ); ImGui::SeparatorText( "Camera" );
@@ -44,6 +44,12 @@ namespace Settings
namespace Misc namespace Misc
{ {
inline auto Bunnyhop = false; inline auto Bunnyhop = false;
inline auto AutoStrafe = false;
inline auto JumpBug = false;
inline auto EdgeJump = false;
inline auto FastStop = false;
inline auto LongJump = false;
inline auto SlowWalk = false;
inline auto NoFlash = false; inline auto NoFlash = false;
inline auto FOVChanger = false; inline auto FOVChanger = false;
inline auto FOV = 90; inline auto FOV = 90;
@@ -242,6 +242,7 @@ public:
SCHEMA_OFFSET( "C_BaseEntity" , "m_iTeamNum" , m_iTeamNum , uint8 ); SCHEMA_OFFSET( "C_BaseEntity" , "m_iTeamNum" , m_iTeamNum , uint8 );
SCHEMA_OFFSET( "C_BaseEntity" , "m_fFlags" , m_fFlags , uint32 ); SCHEMA_OFFSET( "C_BaseEntity" , "m_fFlags" , m_fFlags , uint32 );
SCHEMA_OFFSET( "C_BaseEntity" , "m_MoveType" , m_MoveType , MoveType_t ); SCHEMA_OFFSET( "C_BaseEntity" , "m_MoveType" , m_MoveType , MoveType_t );
SCHEMA_OFFSET( "C_BaseEntity" , "m_vecVelocity" , m_vecVelocity , Vector3 );
SCHEMA_OFFSET( "C_BaseEntity" , "m_hOwnerEntity" , m_hOwnerEntity , CHandle ); SCHEMA_OFFSET( "C_BaseEntity" , "m_hOwnerEntity" , m_hOwnerEntity , CHandle );
SCHEMA_OFFSET( "C_BaseEntity" , "m_nSubclassID" , m_nSubclassID , CUtlStringToken ); SCHEMA_OFFSET( "C_BaseEntity" , "m_nSubclassID" , m_nSubclassID , CUtlStringToken );
}; };
@@ -425,6 +426,8 @@ public:
SCHEMA_OFFSET( "C_BasePlayerPawn" , "m_pObserverServices" , m_pObserverServices , CPlayer_ObserverServices* ); SCHEMA_OFFSET( "C_BasePlayerPawn" , "m_pObserverServices" , m_pObserverServices , CPlayer_ObserverServices* );
SCHEMA_OFFSET( "C_BasePlayerPawn" , "m_pCameraServices" , m_pCameraServices , CCSPlayerBase_CameraServices* ); SCHEMA_OFFSET( "C_BasePlayerPawn" , "m_pCameraServices" , m_pCameraServices , CCSPlayerBase_CameraServices* );
SCHEMA_OFFSET( "C_BasePlayerPawn" , "m_vOldOrigin" , m_vOldOrigin , Vector3 ); SCHEMA_OFFSET( "C_BasePlayerPawn" , "m_vOldOrigin" , m_vOldOrigin , Vector3 );
SCHEMA_OFFSET( "C_BasePlayerPawn" , "m_flFallVelocity" , m_flFallVelocity , float32 );
SCHEMA_OFFSET( "C_BasePlayerPawn" , "m_bDucked" , m_bDucked , bool );
SCHEMA_OFFSET( "C_BasePlayerPawn" , "m_hController" , m_hController , CHandle ); // CCSPlayerController SCHEMA_OFFSET( "C_BasePlayerPawn" , "m_hController" , m_hController , CHandle ); // CCSPlayerController
}; };