From fe13019366cd7929093516f479d7f23c6c38d19f Mon Sep 17 00:00:00 2001 From: navewindre Date: Fri, 21 Sep 2018 13:45:50 +0200 Subject: a --- internal_rewrite/movement.cpp | 42 +++++++++++++++++++++++++++++++++++-- internal_rewrite/settings.hpp | 2 +- internal_rewrite/ui.h | 2 +- internal_rewrite/ui_dropdown_item.h | 6 ++++++ internal_rewrite/visual_world.cpp | 4 ++-- 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/internal_rewrite/movement.cpp b/internal_rewrite/movement.cpp index 8760487..3793e1b 100644 --- a/internal_rewrite/movement.cpp +++ b/internal_rewrite/movement.cpp @@ -50,7 +50,10 @@ void c_movement::auto_strafer( ) { vec3_t velocity = g_ctx.m_local->m_vecVelocity( ); float speed = velocity.length2d( ); - auto cmd = g_ctx.get_last_cmd( ); + + bool use_original = !g_settings.rage.enabled && !g_settings.rage.anti_aim; + + auto cmd = use_original ? m_ucmd : g_ctx.get_last_cmd( ); auto on_ground = g_ctx.m_local->m_fFlags( ) & FL_ONGROUND; if( cmd && ( m_ucmd->m_buttons & IN_JUMP ) && ( speed > 1.0f || g_settings.misc.air_duck( ) ) && !on_ground ) { @@ -64,12 +67,47 @@ void c_movement::auto_strafer( ) { cmd->m_sidemove = ( cmd->m_cmd_nr % 2 ) ? 450.f : -450.f; cmd->m_forwardmove = 0; - rotate_movement( cmd, std::remainderf( ideal_rotation, 360.f ) ); + rotate_movement( cmd, ideal_rotation ); } else { cmd->m_sidemove = m_ucmd->m_mousedx < 0.f ? -450.f : 450.f; } } + else if( g_settings.misc.auto_strafe == 2 ) { + if( !cmd->m_mousedx ) { + float ideal_rotation = std::min( RAD2DEG( std::asinf( 30.f / std::max( speed, FLT_EPSILON ) ) ) * 0.5f, 45.f ); + + float move_yaw = math::vector_angles( vec3_t( ), vec3_t( cmd->m_forwardmove, cmd->m_sidemove, 0.f ) ).y; + float vel_yaw = math::vector_angles( vec3_t( ), velocity ).y; + + float velocity_delta = std::remainderf( g_csgo.m_engine( )->GetViewAngles( ).y - vel_yaw, 360.f ); + + float move_delta = std::remainderf( move_yaw - velocity_delta, 360.f ); + float ideal_yaw = math::approach_angle( move_yaw, velocity_delta, ideal_rotation ); + + float delta_yaw = std::remainderf( move_yaw - ideal_yaw, 360.f ); + + if( std::abs( delta_yaw ) > ideal_rotation ) + ideal_rotation = 0.f; + else if( ( cmd->m_cmd_nr % 2 ) ) + ideal_rotation *= -1; + + cmd->m_sidemove = ( cmd->m_cmd_nr % 2 ) ? 450.f : -450.f; + cmd->m_forwardmove = 0; + + rotate_movement( cmd, std::remainderf( ideal_yaw + ideal_rotation, 360.f ) ); + } + else { + float move_yaw = math::vector_angles( vec3_t( ), vec3_t( cmd->m_forwardmove, cmd->m_sidemove, 0.f ) ).y; + + float rotation = cmd->m_mousedx < 0.f ? -90.f : 90.f; + + cmd->m_forwardmove = 450.f; + cmd->m_sidemove = 0.f; + + rotate_movement( cmd, move_yaw + rotation ); + } + } } } diff --git a/internal_rewrite/settings.hpp b/internal_rewrite/settings.hpp index 8586f78..2f082e4 100644 --- a/internal_rewrite/settings.hpp +++ b/internal_rewrite/settings.hpp @@ -370,7 +370,7 @@ namespace data struct { con_var< bool > watermark{ &holder_, fnv( "misc_watermark" ), false }; con_var< bool > bunny_hop{ &holder_, fnv( "misc_bhop" ), false }; - con_var< bool > auto_strafe{ &holder_, fnv( "misc_autostrafe" ), false }; + con_var< int > auto_strafe{ &holder_, fnv( "misc_autostrafe" ), false }; con_var< bool > circle_strafe{ &holder_, fnv( "misc_circlestrafe" ), false }; con_var< int > circle_strafe_key{ &holder_, fnv( "misc_circle_key" ), 0 }; con_var< bool > edge_jump{ &holder_, fnv( "misc_edgejump" ), false }; diff --git a/internal_rewrite/ui.h b/internal_rewrite/ui.h index 247a0d5..ff646a5 100644 --- a/internal_rewrite/ui.h +++ b/internal_rewrite/ui.h @@ -669,7 +669,7 @@ namespace ui auto column_right = subtab_general->add_item( std::make_shared< ui::base_item >( 220, -5, 0, 0 ) ); auto movement_form = std::make_shared< ui::c_form >( 0, 0, 215, 0, xors( "movement" ), 145 ); { - movement_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "auto strafe" ), &g_settings.misc.auto_strafe ) ); + movement_form->add_item( std::make_shared< ui::c_dropdown< > >( 0, 0, 120, xors( "auto strafe" ), &g_settings.misc.auto_strafe, &dropdowns::autostrafe_types ) ); movement_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "bhop" ), &g_settings.misc.bunny_hop( ) ) ); auto circle_box = movement_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "circle strafe" ), &g_settings.misc.circle_strafe ) ); circle_box->add_item( std::make_shared< ui::c_key_picker_small >( 195, 1, &g_settings.misc.circle_strafe_key ) ); diff --git a/internal_rewrite/ui_dropdown_item.h b/internal_rewrite/ui_dropdown_item.h index f3b3606..9afbbd2 100644 --- a/internal_rewrite/ui_dropdown_item.h +++ b/internal_rewrite/ui_dropdown_item.h @@ -81,6 +81,12 @@ namespace ui { xors( "full" ), 2 }, }; + static std::vector< dropdown_item_t< > > autostrafe_types = { + { xors( "none" ), 0 }, + { xors( "view" ), 1 }, + { xors( "view + movement" ), 2 } + }; + static std::vector< dropdown_item_t< > > antiaim_edge_type = { { xors( "static" ), 0 }, { xors( "narrow angle" ), 1 }, diff --git a/internal_rewrite/visual_world.cpp b/internal_rewrite/visual_world.cpp index 1a64090..10b4c9f 100644 --- a/internal_rewrite/visual_world.cpp +++ b/internal_rewrite/visual_world.cpp @@ -209,9 +209,9 @@ namespace features auto dist = g_ctx.m_local->m_vecOrigin( ).dist_to( pos ); - clr_t col = g_settings.visuals.grenade_esp_clr; + clr_t col = g_settings.visuals.grenade_esp_clr( ); if( dist > 250.f && fade ) { - col.a( ) *= std::max( 750.f - ( dist - 250.f ), 0.f ) / 750.f; + col.a( ) *= std::max( ( 1000.f - ( dist - 250.f ) ) / 1000.f, 0.f ); } draw_string( w2s.x, w2s.y, ALIGN_CENTER, false, -- cgit v1.2.3