From 83237c211f21b83959f234b58f44980423864f02 Mon Sep 17 00:00:00 2001 From: navewindre Date: Mon, 19 Nov 2018 11:48:11 +0100 Subject: ddsd --- internal_rewrite/context.hpp | 1 + internal_rewrite/internal_rewrite.vcxproj | 2 + internal_rewrite/listener.cpp | 3 +- internal_rewrite/proxies.cpp | 2 - internal_rewrite/ragebot.cpp | 4 + internal_rewrite/ragebot_lagcomp.cpp | 2 - internal_rewrite/settings.hpp | 2 + internal_rewrite/simple_settings.hpp | 6 +- internal_rewrite/ui.h | 4 +- internal_rewrite/visual.hpp | 14 +++ internal_rewrite/visual_player.cpp | 158 ++++++++++++++++++++++++++++-- 11 files changed, 182 insertions(+), 16 deletions(-) diff --git a/internal_rewrite/context.hpp b/internal_rewrite/context.hpp index 8ed3845..03af09f 100644 --- a/internal_rewrite/context.hpp +++ b/internal_rewrite/context.hpp @@ -24,6 +24,7 @@ struct shot_data_t { int m_hit{ }; int m_damage{ }; bool m_logged{ }; + matrix3x4 m_matrix[ 128 ]; }; //replacement to the old global:: namespace diff --git a/internal_rewrite/internal_rewrite.vcxproj b/internal_rewrite/internal_rewrite.vcxproj index 09cd40c..728484c 100644 --- a/internal_rewrite/internal_rewrite.vcxproj +++ b/internal_rewrite/internal_rewrite.vcxproj @@ -299,10 +299,12 @@ _WINDLL;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS NotUsing precompiled.hpp + false true true + false diff --git a/internal_rewrite/listener.cpp b/internal_rewrite/listener.cpp index a28dde8..eb5caf4 100644 --- a/internal_rewrite/listener.cpp +++ b/internal_rewrite/listener.cpp @@ -132,7 +132,8 @@ namespace listeners g_con->game_console_print( "%s\n", print_str ); } - if( shot.m_enemy_index && !shot.m_missed ) { + if( shot.m_enemy_index ) { + g_cheat.m_visuals.store_hit( &shot ); //g_cheat.m_visuals.store_shot( shot.m_enemy_pos, true ); } } diff --git a/internal_rewrite/proxies.cpp b/internal_rewrite/proxies.cpp index 9ec6a48..287970b 100644 --- a/internal_rewrite/proxies.cpp +++ b/internal_rewrite/proxies.cpp @@ -110,8 +110,6 @@ void __cdecl hooks::simtime_proxy_fn( const CRecvProxyData* proxy_data_const, vo if( !proxy_data_const->m_Value.m_Int ) { return; } - - //aaaaaaaaaaaaa } old_fn( proxy_data_const, entity, output ); diff --git a/internal_rewrite/ragebot.cpp b/internal_rewrite/ragebot.cpp index 2f99b29..ac19504 100644 --- a/internal_rewrite/ragebot.cpp +++ b/internal_rewrite/ragebot.cpp @@ -1039,6 +1039,10 @@ namespace features g_ctx.m_has_incremented_shots = true; } + memcpy( g_ctx.m_shot_data[ g_ctx.m_last_shot ].m_matrix, + m_shot_matrix, + sizeof( matrix3x4 ) * ent->m_CachedBoneData( ).GetSize( ) ); + set_angles( angle.clamp( ) ); if( g_settings.rage.active->m_auto_stop && !g_settings.rage.compensate_spread( ) ) diff --git a/internal_rewrite/ragebot_lagcomp.cpp b/internal_rewrite/ragebot_lagcomp.cpp index 62f588c..c166174 100644 --- a/internal_rewrite/ragebot_lagcomp.cpp +++ b/internal_rewrite/ragebot_lagcomp.cpp @@ -211,8 +211,6 @@ namespace features new_record.m_globaltime = g_csgo.m_globals->m_curtime; if( g_settings.legit.enabled( ) ) - new_record.m_globaltime -= util::get_lerptime( ); - else new_record.m_globaltime -= TICK_INTERVAL( ); new_record.m_validtime = 0.f; diff --git a/internal_rewrite/settings.hpp b/internal_rewrite/settings.hpp index 19ab9b4..ed59f8f 100644 --- a/internal_rewrite/settings.hpp +++ b/internal_rewrite/settings.hpp @@ -328,6 +328,8 @@ namespace data con_var< bool > sound{ &holder_, fnv( "visuals_sound" ), false }; con_var< clr_t > box_enemy{ &holder_, fnv( "visuals_clr_enemy" ), clr_t( 0, 255, 255 ) }; con_var< clr_t > box_friendly{ &holder_, fnv( "visuals_clr_friendly" ), clr_t( 255, 0, 255 ) }; + + con_var< bool > hits{ &holder_, fnv( "visuals_hits" ), false }; con_var< clr_t > glow_enemy{ &holder_, fnv( "visuals_glow_enemy" ), clr_t( 255, 0, 255, 150 ) }; con_var< clr_t > glow_friendly{ &holder_, fnv( "visuals_glow_friendly" ), clr_t( 255, 120, 0, 150 ) }; diff --git a/internal_rewrite/simple_settings.hpp b/internal_rewrite/simple_settings.hpp index 9dffa55..e3187ba 100644 --- a/internal_rewrite/simple_settings.hpp +++ b/internal_rewrite/simple_settings.hpp @@ -44,8 +44,12 @@ public: strcat_s( full_path, "_" ); strcat_s( full_path, name_.c_str( ) ); - for ( auto x : setting_nodes_ ) + for( auto x : setting_nodes_ ) { + if( !x ) + continue; + x->load( full_path, file ); + } } __declspec( noinline ) void save( const char* path, const char* file ) const override diff --git a/internal_rewrite/ui.h b/internal_rewrite/ui.h index 39233c7..0970f26 100644 --- a/internal_rewrite/ui.h +++ b/internal_rewrite/ui.h @@ -550,9 +550,11 @@ namespace ui other_form->add_item( std::make_shared< ui::c_dropdown< > >( 0, 0, 120, xors( "bullet tracers" ), &g_settings.visuals.bullet_tracers, &dropdowns::tracer_type ) ); other_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "floating ragdolls" ), &g_settings.visuals.floating_ragdolls ) ); other_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "rank revealer" ), &g_settings.misc.rank_reveal ) ); + other_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "hit ghost" ), &g_settings.visuals.hits ) ); other_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "target" ), &g_settings.visuals.target ) ); + other_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 1, 7, &g_settings.visuals.target_time, "s" ) - )->set_cond( [ ]( ) { return g_settings.visuals.target; } ); + )->set_cond( [ ]( ) { return g_settings.visuals.target || g_settings.visuals.hits; } ); } auto chams_form = std::make_shared< ui::c_form >( 0, 0, 215, 0, xors( "chams" ), 165 ); { diff --git a/internal_rewrite/visual.hpp b/internal_rewrite/visual.hpp index 7b18fa4..4d0e996 100644 --- a/internal_rewrite/visual.hpp +++ b/internal_rewrite/visual.hpp @@ -5,6 +5,8 @@ #include #include "strings.hpp" #include "IVRenderView.hpp" +#include "context.hpp" + class c_base_player; enum HitFlag_t { @@ -53,6 +55,15 @@ namespace features bool m_local; }; + struct hit_t { + int m_ent; + char m_name[ 32 ]; + matrix3x4 m_matrix[ 128 ]; + vec3_t m_pos; + bool m_dead; + float m_time; + }; + //you should always store the entity index rather than the ptr struct sound_t { float m_time; @@ -76,6 +87,7 @@ namespace features std::vector< shot_t > m_shots; std::vector< sound_t > m_sounds; std::vector< tracer_t > m_tracers; + std::vector< hit_t > m_hits; vec3_t m_stored_pos[ 65 ]{ }; float m_anim_progress[ 65 ]{ }; @@ -104,9 +116,11 @@ namespace features void store_shot( vec3_t pos, bool hit = false ); void draw_shots( ); void reset_local_dmg( ); + void draw_skeletons( ); void on_round_start( ); void draw_sound( ); void update_hit_flags( ); + void store_hit( context::shot_data_t* shot ); void operator()( ); }; } \ No newline at end of file diff --git a/internal_rewrite/visual_player.cpp b/internal_rewrite/visual_player.cpp index 5d62cfa..f14a0d7 100644 --- a/internal_rewrite/visual_player.cpp +++ b/internal_rewrite/visual_player.cpp @@ -538,15 +538,51 @@ namespace features right_pos += 9; } - else if( is_fake ) { - draw_string( x_pos, y_pos, ALIGN_LEFT, false, - clr_t( 255, 255, 255, 255 * alpha ), - xors( "fake" ) ); + else if( is_fake && g_ctx.m_local->is_valid( ) ) { + if( ent->m_fFlags( ) & FL_ONGROUND && ent->get_anim_velocity( ).length2d( ) < 0.1f && !dormant && !g_settings.misc.hide_from_obs ) { + float update = g_cheat.m_ragebot.m_lagcomp->get_flick_time( i ); + float delta = ( ent->m_flSimulationTime( ) - update ) * 0.9f; - right_pos += 9; + if( delta >= 0.f && delta <= 1.f ) { + + //don't allocate 20000000 bytes on the stack thx + static vertex_t v[ 48 ]; + + float radius = box.w / 5.f; + + radius = std::clamp( radius, 4.f, 8.f ); + + right_pos += radius * 2; + + v[ 0 ].init( x_pos + radius / 2 + 2, y_pos + radius / 2 + 2 ); + + int progress = ( 1.f - delta ) * 48; + + + const float step = ( M_PI * 2.f ) / 48.f; + + for( int r = 1; r < progress; ++r ) { + float s = sin( step * r ) * radius; + float c = cos( step * r ) * radius; + + + v[ r ].init( x_pos + radius / 2 + c + 2, y_pos + s + radius / 2 + 2 ); + } + + g_renderer.draw_filled_circle( x_pos + radius / 2 + 2, y_pos + radius / 2 + 2, radius + 1, clr_t( 0, 0, 0, 170 * alpha ) ); + g_renderer.draw_polygon( progress, v, g_settings.visuals.lby_bar_clr ); + } + } + else { + draw_string( x_pos, y_pos, ALIGN_LEFT, false, + clr_t( 255, 255, 255, 255 * alpha ), + xors( "fake" ) ); + + right_pos += 9; + } } - if( !!g_cheat.m_ragebot.m_resolver->get_state( i ) && !dormant && g_ctx.m_local->is_valid( ) ) { + if( !!g_cheat.m_ragebot.m_resolver->get_state( i ) && !dormant && g_ctx.m_local->is_valid( ) && g_settings.misc.hide_from_obs( ) ) { float update = g_cheat.m_ragebot.m_lagcomp->get_flick_time( i ); float delta = ( ent->m_flSimulationTime( ) - update ) * 0.9f; if( delta >= 0.f && delta <= 1.f ) { @@ -630,10 +666,28 @@ namespace features } if( ent->is_flashed( ) && right_pos < box.h ) { - draw_string( x_pos, y_pos + right_pos, ALIGN_LEFT, false, blend_clr( esp_blue( 255 * alpha ), anim ), xors( "flash" ) ); - right_pos += 9; - } + const float step = M_PI * 2.f / 6; + + float radius = std::clamp( box.w / 5.f, 4.f, 8.f ); + + for( int i = 0; i < 6; ++i ) { + float c = cos( step * i + DEG2RAD( 30.f ) ); + float s = sin( step * i + DEG2RAD( 30.f ) ); + + float off = 0; + + if( i == 5 || i == 0 ) + off = 0.25f; + draw_line( x_pos + c * radius / 2 + radius / 2 + 2, y_pos + right_pos + s * radius / 2 + radius / 2 + 3, + x_pos + c * ( radius + off ) + radius / 2 + off + 2, y_pos + s * ( radius + off ) + right_pos + radius / 2 + 3, + blend_clr( esp_blue( 255 * alpha ), anim ) ); + } + + //draw_string( x_pos, y_pos + right_pos, ALIGN_LEFT, false, blend_clr( esp_blue( 255 * alpha ), anim ), xors( "flash" ) ); + right_pos += radius * 2.3f; + } + if( !( util::is_low_fps( ) && g_settings.rage.preserve_fps( ) ) ) { if( m_hit_flag[ i ] && g_ctx.m_local->is_valid( ) && i != g_cheat.m_ragebot.get_target( ) && g_settings.rage.enabled ) { clr_t col = m_hit_flag[ i ] == HIT_1W ? clr_t( 255, 255, 255, 255 * alpha ) : esp_red( alpha * 255 ); @@ -845,6 +899,91 @@ namespace features } } + void c_visuals::store_hit( context::shot_data_t* shot ) { + if( !g_settings.visuals.hits ) + return; + + hit_t new_hit; + + auto ent = g_csgo.m_entlist( )->GetClientEntity( shot->m_enemy_index ); + + new_hit.m_ent = shot->m_enemy_index; + ent->get_name_safe( new_hit.m_name ); + + memcpy( new_hit.m_matrix, + shot->m_matrix, + sizeof( matrix3x4 ) * 128 ); + + new_hit.m_pos = shot->m_enemy_pos; + new_hit.m_time = g_csgo.m_globals->m_curtime; + + m_hits.push_back( new_hit ); + } + + void c_visuals::draw_skeletons( ) { + if( !g_settings.visuals.hits ) + return; + + for( size_t i{ }; i < m_hits.size( ) && !m_hits.empty( ); ++i ) { + auto& hit = m_hits[ i ]; + + float delta = g_csgo.m_globals->m_curtime - hit.m_time; + if( std::abs( delta ) > g_settings.visuals.target_time ) + m_hits.erase( m_hits.begin( ) + i ); + } + + for( auto& it : m_hits ) { + auto ent = g_csgo.m_entlist( )->GetClientEntity( it.m_ent ); + + if( !ent || !ent->is_player( ) ) + continue; + + if( !ent->is_alive( ) ) + it.m_dead = true; + + auto hdr = g_csgo.m_model_info( )->GetStudiomodel( ent->ce( )->GetModel( ) ); + + auto matrix = it.m_matrix; + vec3_t pos = it.m_pos; + float delta = g_csgo.m_globals->m_curtime - it.m_time; + + float total = g_settings.visuals.target_time; + float threshold = total * 0.5f; + + float fade = total - delta < threshold ? ( total - delta ) / ( total * 0.5f ) : 1.f; + + float dist_fade = 1.f; + if( ent->is_valid( ) && !it.m_dead ) { + dist_fade = 300.f - std::clamp( ent->ce( )->GetRenderOrigin( ).dist_to( pos ), 1.f, 300.f ) / 300.f; + } + + clr_t col = clr_t( 255, 255, 255, 100 * dist_fade * fade ); + + clr_t outer_col = ent->m_iTeamNum( ) == g_ctx.m_local->m_iTeamNum( ) ? + g_settings.visuals.glow_friendly : + g_settings.visuals.glow_enemy; + + outer_col.a( ) *= 0.65f; + outer_col.a( ) *= ( fade * dist_fade ); + + for( size_t bone{ }; bone < hdr->numbones; ++bone ) { + auto b = hdr->GetBone( bone ); + if( b && b->flags & 0x100 && b->parent != -1 ) { + vec3_t child = vec3_t{ matrix[ bone ][ 0 ][ 3 ], matrix[ bone ][ 1 ][ 3 ], matrix[ bone ][ 2 ][ 3 ] }; + vec3_t parent = vec3_t{ matrix[ b->parent ][ 0 ][ 3 ], matrix[ b->parent ][ 1 ][ 3 ], matrix[ b->parent ][ 2 ][ 3 ] }; + + auto child_screen = util::screen_transform( child ); + auto parent_screen = util::screen_transform( parent ); + + draw_line( child_screen - vec2_t( 1, 1 ), parent_screen - vec2_t( 1, 1 ), outer_col ); + draw_line( child_screen, parent_screen, col ); + + draw_line( child_screen + vec2_t( 1, 1 ), parent_screen + vec2_t( 1, 1 ), outer_col ); + } + } + } + } + void c_visuals::update_hit_flags( ) { if( !g_settings.visuals.flags || !g_settings.rage.enabled ) return; @@ -1025,6 +1164,7 @@ namespace features if( g_settings.visuals.active ) { update_positions( ); draw_players( ); + draw_skeletons( ); } draw_world( ); -- cgit v1.2.3