From 83237c211f21b83959f234b58f44980423864f02 Mon Sep 17 00:00:00 2001 From: navewindre Date: Mon, 19 Nov 2018 11:48:11 +0100 Subject: ddsd --- internal_rewrite/visual_player.cpp | 158 ++++++++++++++++++++++++++++++++++--- 1 file changed, 149 insertions(+), 9 deletions(-) (limited to 'internal_rewrite/visual_player.cpp') 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