From e8bff3fb5f484e2fb98bf157f4b85b61fdbd0620 Mon Sep 17 00:00:00 2001 From: navewindre Date: Wed, 12 Sep 2018 19:59:25 +0200 Subject: a --- internal_rewrite/context.cpp | 4 +- internal_rewrite/create_move.cpp | 4 ++ internal_rewrite/lag_mgr.cpp | 43 +++++++++++----- internal_rewrite/lag_mgr.hpp | 2 +- internal_rewrite/ragebot.cpp | 31 +++++++++--- internal_rewrite/ragebot.hpp | 3 +- internal_rewrite/ragebot_antiaim.cpp | 63 +++++++++++++++++++----- internal_rewrite/run_command.cpp | 2 +- internal_rewrite/ui_dropdown_item.h | 2 + internal_rewrite/update_clientside_animation.cpp | 55 +++++---------------- 10 files changed, 127 insertions(+), 82 deletions(-) diff --git a/internal_rewrite/context.cpp b/internal_rewrite/context.cpp index 9ec1f62..26af64c 100644 --- a/internal_rewrite/context.cpp +++ b/internal_rewrite/context.cpp @@ -27,10 +27,10 @@ void c_context::on_cmove_end( user_cmd_t* cmd ) { } else { m_last_realangle = cmd->m_viewangles; - m_last_realangle.x = m_last_fakeangle.x; + //m_last_realangle.x = m_last_fakeangle.x; } - if( !g_cheat.m_lagmgr.get_choked( ) ) { + if( g_cheat.m_lagmgr.get_choked( ) == 1 ) { m_thirdperson_angle = m_last_realangle; } diff --git a/internal_rewrite/create_move.cpp b/internal_rewrite/create_move.cpp index 47232fa..c2959d0 100644 --- a/internal_rewrite/create_move.cpp +++ b/internal_rewrite/create_move.cpp @@ -101,8 +101,12 @@ bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_f g_cheat.m_lagmgr.set_state( true ); } + vec3_t real_angle = g_ctx.m_thirdperson_angle; + g_cheat.m_lagmgr.on_cmove_end( ); g_ctx.on_cmove_end( ucmd ); + + g_cheat.m_ragebot.m_antiaim->on_runcommand( ); } else { g_ctx.reset_shot_queue( ); diff --git a/internal_rewrite/lag_mgr.cpp b/internal_rewrite/lag_mgr.cpp index 17dc194..ce6d37f 100644 --- a/internal_rewrite/lag_mgr.cpp +++ b/internal_rewrite/lag_mgr.cpp @@ -12,7 +12,7 @@ namespace features } } - bool c_lagmgr::predict_position( ) { + bool c_lagmgr::predict_position( float dist ) { vec3_t local_pos = g_ctx.m_local->get_eye_pos( ); auto i = util::get_closest_player( ); @@ -100,17 +100,24 @@ namespace features } } - bool send = false; + bool send = true; static bool was_onground{ }; - if( !settings.in_move ) { - send = true; + if( settings.in_move && ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) && g_ctx.m_local->m_vecVelocity( ).length2d( ) > 0.1f ) { + send = false; } if( settings.on_peek ) { static int choke_ticks = 0; - bool predicted = predict_position( ); - if( !predicted ) + + bool peeking = predict_position( 20.f + g_ctx.m_local->m_vecVelocity( ) * TICK_INTERVAL( ) * 2.f ); + bool predicted = predict_position( 20.f ); + + if( !peeking && predicted ) { + choke_ticks = 0; + send = true; + } + else if( !predicted ) choke_ticks = settings.ticks; if( choke_ticks ) { @@ -123,23 +130,35 @@ namespace features } if( settings.avoid_ground ) { - if( !was_onground && g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) { - send = false; + static int choked = 0; + + if( !was_onground && ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { + choked = settings.ticks; } + + if( choked ) + send = !--choked; } if( settings.jump_reset ) { - if( was_onground && !( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { - send = get_choked( ) > 0; + if( settings.avoid_ground ) { + if( was_onground && !( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { + send = get_choked( ) > 0; + } + } + else { + if( !was_onground && ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { + send = get_choked( ) > 0; + } } } - was_onground = g_ctx.m_local->m_fFlags( ) & FL_ONGROUND; + was_onground = ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ); if( ( m_cmd->m_buttons & IN_ATTACK ) && g_ctx.m_local->can_attack( ) && !settings.in_attack ) { if( !weapon->is_grenade( ) || ( weapon->is_grenade( ) && weapon->m_fThrowTime( ) < TICK_INTERVAL( ) ) ) { - send = true; + send = get_choked( ) > 0; } } diff --git a/internal_rewrite/lag_mgr.hpp b/internal_rewrite/lag_mgr.hpp index 4f64c24..d495210 100644 --- a/internal_rewrite/lag_mgr.hpp +++ b/internal_rewrite/lag_mgr.hpp @@ -52,7 +52,7 @@ namespace features private: void on_antiaim( ); - bool predict_position( ); + bool predict_position( float dist ); void fakelag( ); user_cmd_t* m_cmd{ }; diff --git a/internal_rewrite/ragebot.cpp b/internal_rewrite/ragebot.cpp index 9e02f1b..28dae0a 100644 --- a/internal_rewrite/ragebot.cpp +++ b/internal_rewrite/ragebot.cpp @@ -814,12 +814,19 @@ namespace features if( g_settings.rage.active->m_auto_stop( ) == 2 ) quick_stop( m_cmd ); + else if( g_settings.rage.active->m_auto_stop( ) == 3 ) { + m_antiaim->run_fakewalk( ); + } + if( !util::hitchance( it, aim_ang, g_settings.rage.active->m_hitchance, hitbox ) ) { - if( g_settings.rage.active->m_auto_stop( ) == 1 ) + if( g_settings.rage.active->m_auto_stop( ) == 1 || g_settings.rage.active->m_auto_stop( ) == 4 ) quick_stop( m_cmd ); + if( g_settings.rage.active->m_auto_stop( ) == 4 && g_cheat.m_lagmgr.get_choked( ) < 10 && !m_antiaim->is_fakewalking( ) ) + g_cheat.m_lagmgr.set_state( false ); + if( g_settings.rage.auto_scope( ) && g_ctx.m_local->get_weapon( )->is_sniper( ) ) { if( !g_ctx.m_local->m_bIsScoped( ) ) { m_cmd->m_buttons |= IN_ATTACK2; @@ -901,12 +908,13 @@ namespace features m_cmd->m_viewangles = angles; } - if( g_settings.rage.silent == 2 ) { - g_cheat.m_lagmgr.set_state( g_cheat.m_lagmgr.get_choked( ) && !g_settings.rage.fakelag.in_attack && !m_antiaim->is_fakewalking( ) ); - } + //if( g_settings.rage.silent == 2 ) { + // if( !m_antiaim->is_fakewalking( ) ) + // g_cheat.m_lagmgr.set_state( g_cheat.m_lagmgr.get_choked( ) ); + //} if( g_settings.rage.silent == 1 && !m_antiaim->is_fakewalking( ) ) { - if( weapon->m_iItemDefinitionIndex( ) != WEAPON_R8REVOLVER ) + //if( weapon->m_iItemDefinitionIndex( ) != WEAPON_R8REVOLVER ) g_cheat.m_lagmgr.set_state( !g_cheat.m_lagmgr.get_sent( ) ); } @@ -1074,15 +1082,22 @@ namespace features bool is_zeus = wep->m_iItemDefinitionIndex( ) == WEAPON_TASER; if( m_target != -1 && !m_antiaim->is_fakewalking( ) ) - if( g_settings.rage.active->m_auto_stop == 2 && can_hit_target( m_target, &t, is_zeus ) ) + if( g_settings.rage.active->m_auto_stop == 2 && can_hit_target( m_target, &t, is_zeus ) ) { quick_stop( m_cmd ); + } + else if( g_settings.rage.active->m_auto_stop == 3 && can_hit_target( m_target, &t, is_zeus ) ) { + m_antiaim->run_fakewalk( ); + //if( !g_cheat.m_lagmgr.get_choked( ) || g_cheat.m_lagmgr.get_state( ) ) + m_cmd->m_viewangles.y = m_antiaim->get_yaw( ); + } return; } // do not - if( g_settings.rage.silent == 2 && !g_cheat.m_lagmgr.get_choked( ) && !m_antiaim->is_fakewalking( ) && !is_revolver ) { - g_cheat.m_lagmgr.set_state( false ); + if( g_settings.rage.silent == 2 && !g_cheat.m_lagmgr.get_choked( ) && !is_revolver ) { + if( !m_antiaim->is_fakewalking( ) ) + g_cheat.m_lagmgr.set_state( false ); return; } diff --git a/internal_rewrite/ragebot.hpp b/internal_rewrite/ragebot.hpp index 83b960f..8a7e856 100644 --- a/internal_rewrite/ragebot.hpp +++ b/internal_rewrite/ragebot.hpp @@ -117,10 +117,11 @@ namespace features bool run_freestanding( int player = -1 ); bool run_edge_dtc( ); - void run_fakewalk( ); + public: bool is_fakewalking( ) const { return m_is_fakewalking; } + void run_fakewalk( ); bool is_edging( ) const { return m_is_edging; } float get_yaw( bool no_jitter = false ); diff --git a/internal_rewrite/ragebot_antiaim.cpp b/internal_rewrite/ragebot_antiaim.cpp index f172285..d8ada3c 100644 --- a/internal_rewrite/ragebot_antiaim.cpp +++ b/internal_rewrite/ragebot_antiaim.cpp @@ -87,14 +87,55 @@ namespace features void c_ragebot::c_lby_breaker::update_animstate( ) { + if( !g_settings.rage.anti_aim( ) ) + return; + + if( !g_ctx.m_local->get_animstate( ) ) + return; + auto cl = g_csgo.m_global_state->get_client_state( ); if( !cl ) return; - if( g_cheat.m_lagmgr.get_choked( ) ) + if( g_cheat.m_lagmgr.get_choked( ) != 1 ) return; - bool moving = g_ctx.m_local->get_animstate( )->m_velocity >= 0.1f && g_ctx.m_local->get_animstate( )->m_bOnGround; + float backup_curtime = g_csgo.m_globals->m_curtime; + float backup_frametime = g_csgo.m_globals->m_frametime; + + g_csgo.m_globals->m_curtime = g_ctx.pred_time( ); + g_csgo.m_globals->m_frametime = TICK_INTERVAL( ); + + vec3_t real_angle = g_ctx.m_thirdperson_angle; + + float pitch; + if( g_ctx.m_local->get_animstate( )->m_bInHitGroundAnimation && ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { + bool dist = g_settings.rage.enabled( ) && g_settings.rage.selection_type( ) == 1; + int target = util::get_closest_player( dist ); + + if( target != -1 ) { + auto t = g_csgo.m_entlist( )->GetClientEntity( target ); + + pitch = math::vector_angles( g_ctx.m_local->m_vecOrigin( ), t->m_vecOrigin( ) ).x; + } + else + pitch = -10.f; + + real_angle.x = pitch; + } + + g_ctx.m_local->get_animstate( )->m_iLastClientSideAnimationUpdateFramecount -= 1; + + g_ctx.m_local->get_animstate( )->update( real_angle.y, real_angle.x ); + g_ctx.m_local->cache_anim_data( ); + + g_csgo.m_globals->m_curtime = backup_curtime; + g_csgo.m_globals->m_frametime = backup_frametime; + + if( g_ctx.m_local->get_animstate( )->m_velocity < 0.1f ) + g_ctx.m_local->get_animstate( )->m_velocity = 0.f; + + bool moving = g_ctx.m_local->get_animstate( )->m_velocity > 0.1f && g_ctx.m_local->get_animstate( )->m_bOnGround; float time = g_ctx.pred_time( ); if( moving ) { @@ -172,14 +213,14 @@ namespace features } if( std::abs( offset ) < 105 ) { - int min_tick = g_cheat.m_ragebot.m_antiaim->is_fakewalking( ) ? g_settings.rage.fakewalk_ticks( ) + 1 : 4; - if( update_ticks < min_tick && update_ticks > 2 ) { + int min_tick = g_cheat.m_ragebot.m_antiaim->is_fakewalking( ) ? g_settings.rage.fakewalk_ticks( ) + 2 : 4; + if( update_ticks < min_tick && update_ticks >= 1 ) { *angles = break_angle + ( offset < 0 ? 105 : -105 ); return; } } - if( breaking && update_ticks < 3 ) { + if( breaking && update_ticks < 1 ) { *angles = break_angle; if( !freestanding ) { last_angle = break_angle; @@ -234,7 +275,7 @@ namespace features if( !g_settings.rage.edge_dtc_normal ) return false; - if( !( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) + if( !g_ctx.m_local->get_animstate( )->m_bOnGround ) return false; if( g_settings.rage.edge_dtc_normal == 1 ) { @@ -350,7 +391,7 @@ namespace features if( !g_settings.rage.edge_detection ) return false; - if( !( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) + if( !g_ctx.m_local->get_animstate( )->m_bOnGround ) return false; bool is_fake = g_cheat.m_lagmgr.get_state( ); @@ -457,7 +498,7 @@ namespace features if( !g_ctx.m_local->get_weapon( ) ) return; - bool in_move = !( m_cmd->m_buttons & IN_FORWARD ) && !( m_cmd->m_buttons & IN_BACK ) && !( m_cmd->m_buttons & IN_LEFT ) && !( m_cmd->m_buttons & IN_RIGHT ); + bool in_move = ( m_cmd->m_buttons & IN_FORWARD ) || ( m_cmd->m_buttons & IN_BACK ) || ( m_cmd->m_buttons & IN_LEFT ) || ( m_cmd->m_buttons & IN_RIGHT ); if( !m_cmd->m_sidemove && !m_cmd->m_forwardmove && !g_ctx.m_local->m_vecVelocity( ) && !in_move ) return; @@ -552,10 +593,6 @@ namespace features g_cheat.m_lagmgr.set_state( false ); } - if( !g_ctx.m_local->m_vecVelocity( ).length2d( ) && !g_cheat.m_lagmgr.get_sent( ) && choked > max_ticks ) { - g_cheat.m_lagmgr.set_state( true ); - } - if( ticks_to_stop > ticks_left - 1 || !choked ) { quick_stop( ); } @@ -595,7 +632,7 @@ namespace features int setting = fake ? g_settings.rage.fake_yaw : g_settings.rage.real_yaw; int jitter = fake ? g_settings.rage.fake_yaw_jitter : g_settings.rage.real_yaw_jitter; int add = fake ? g_settings.rage.fake_yaw_add : g_settings.rage.real_yaw_add; - if( !( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { + if( !g_ctx.m_local->get_animstate( )->m_bOnGround ) { if( !fake && g_settings.rage.air_yaw( ) ) { setting = g_settings.rage.air_yaw; jitter = g_settings.rage.air_yaw_jitter; diff --git a/internal_rewrite/run_command.cpp b/internal_rewrite/run_command.cpp index 9761960..d8df083 100644 --- a/internal_rewrite/run_command.cpp +++ b/internal_rewrite/run_command.cpp @@ -4,7 +4,7 @@ void __fastcall hooks::run_command( void* ecx_, void* edx_, IClientEntity* entity, user_cmd_t* ucmd, IMoveHelper* move_helper ) { if( !g_csgo.m_panic && g_settings.rage.anti_aim( ) && entity == g_ctx.m_local->ce( ) ) { - g_cheat.m_ragebot.m_antiaim->on_runcommand( ); + } run_command_o( ecx_, edx_, entity, ucmd, move_helper ); diff --git a/internal_rewrite/ui_dropdown_item.h b/internal_rewrite/ui_dropdown_item.h index aa3d41e..f3b3606 100644 --- a/internal_rewrite/ui_dropdown_item.h +++ b/internal_rewrite/ui_dropdown_item.h @@ -70,6 +70,8 @@ namespace ui static std::vector< dropdown_item_t< > > auto_stop = { { xors( "none" ), 0 }, { xors( "hitchance" ), 1 }, + { xors( "hitchance + lag" ), 4 }, + { xors( "slide" ), 3 }, { xors( "full" ), 2 } }; diff --git a/internal_rewrite/update_clientside_animation.cpp b/internal_rewrite/update_clientside_animation.cpp index d61916a..e7889c1 100644 --- a/internal_rewrite/update_clientside_animation.cpp +++ b/internal_rewrite/update_clientside_animation.cpp @@ -8,7 +8,7 @@ void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) { auto old_func = update_clientside_animation_o; if( ecx_ != g_ctx.m_local ) - return old_func( ecx_, edx_ ); + return old_func( ecx_, 0 ); auto ent = ( c_base_player* )( ecx_ ); @@ -27,53 +27,20 @@ void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) { return old_func( ecx_, edx_ ); } - *( byte* )( uintptr_t( ent ) + 0x270 ) = 1; - if( !g_cheat.m_lagmgr.get_choked( ) || g_cheat.m_lagmgr.get_sent( ) > 1 || first_update ) { - vec3_t backup; - g_csgo.m_prediction( )->GetLocalViewAngles( backup ); - - - float backup_curtime = g_csgo.m_globals->m_curtime; - float backup_frametime = g_csgo.m_globals->m_frametime; - - last_update = backup_curtime; - - g_csgo.m_globals->m_curtime = g_ctx.pred_time( ); - g_csgo.m_globals->m_frametime = TICK_INTERVAL( ); - - if( g_csgo.m_globals->m_curtime != ent->get_animstate( )->m_flLastClientSideAnimationUpdateTime ) { - last_update = backup_curtime; - - vec3_t real_angle = g_ctx.m_thirdperson_angle; + last_update = g_csgo.m_globals->m_curtime; - float pitch; - if( g_ctx.m_local->get_animstate( )->m_bInHitGroundAnimation && ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { - bool dist = g_settings.rage.enabled( ) && g_settings.rage.selection_type( ) == 1; - int target = util::get_closest_player( dist ); + float backup_curtime = g_csgo.m_globals->m_curtime; + float backup_frametime = g_csgo.m_globals->m_frametime; - if( target != -1 ) { - auto t = g_csgo.m_entlist( )->GetClientEntity( target ); + g_csgo.m_globals->m_curtime = g_ctx.pred_time( ); + g_csgo.m_globals->m_frametime = TICK_INTERVAL( ); - pitch = math::vector_angles( ent->m_vecOrigin( ), t->m_vecOrigin( ) ).x; - } - else - pitch = -10.f; - - real_angle.x = pitch; - } - - ent->get_animstate( )->update( real_angle.y, real_angle.x ); - old_func( ecx_, edx_ ); - - ent->cache_anim_data( ); - } - - g_csgo.m_prediction( )->SetLocalViewAngles( backup ); - g_csgo.m_globals->m_curtime = backup_curtime; - g_csgo.m_globals->m_frametime = backup_frametime; - } + ent->get_animstate( )->m_iLastClientSideAnimationUpdateFramecount = g_csgo.m_globals->m_framecount; + //ent->get_animstate( )->m_flLastClientSideAnimationUpdateTime = g_csgo.m_globals->m_curtime; + old_func( ecx_, edx_ ); - ent->restore_anim_data( true ); + g_csgo.m_globals->m_curtime = backup_curtime; + g_csgo.m_globals->m_frametime = backup_frametime; if( !first_update ) { //*( byte* )( uintptr_t( ent ) + 0x270 ) = 0; -- cgit v1.2.3