From 5e5b152f4b62432655cc4069c1d95be636749b7d Mon Sep 17 00:00:00 2001 From: navewindre Date: Tue, 13 Nov 2018 00:42:56 +0100 Subject: yo sick --- internal_rewrite/visual_world.cpp | 53 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'internal_rewrite/visual_world.cpp') diff --git a/internal_rewrite/visual_world.cpp b/internal_rewrite/visual_world.cpp index 10b4c9f..ea3d31d 100644 --- a/internal_rewrite/visual_world.cpp +++ b/internal_rewrite/visual_world.cpp @@ -29,6 +29,7 @@ namespace features new_grenade.m_time = g_csgo.m_globals->m_curtime; new_grenade.m_ent = index; new_grenade.m_pos = pos; + m_firegrenades.emplace_back( new_grenade ); } @@ -227,6 +228,7 @@ namespace features } } } + void c_visuals::draw_firegrenade( ) { static auto life_span = g_csgo.m_cvar( )->FindVar( xors( "inferno_flame_lifetime" ) ); float time = g_csgo.m_globals->m_curtime; @@ -248,7 +250,56 @@ namespace features continue; clr_t col = g_settings.visuals.grenade_esp_clr; - auto w2s = util::screen_transform( it.m_pos ); + + vec3_t text_pos = it.m_pos; + text_pos.z += 5.f; + + auto w2s = util::screen_transform( text_pos ); + + float delta = g_csgo.m_globals->m_curtime - it.m_time; + + if( g_ctx.m_local->is_valid( ) && ( ent->m_iTeamNum( ) != g_ctx.m_local->m_iTeamNum( ) || ent == g_ctx.m_local ) ) { + vec3_t last_pos; + + const float fill = ( life_span->get_float( ) - delta ) / ( life_span->get_float( ) ) * 180.f; + + for( float rot = -fill; rot <= fill; rot += 3.f ) { + auto rotation = rot + delta * 90.f; + + while( rotation > 360.f ) + rotation -= 360.f; + + vec3_t rotated_pos = it.m_pos; + + rotated_pos.z -= 5.f; + + const auto radius = 50.f; + rotated_pos.x += cos( DEG2RAD( rotation ) ) * radius; + rotated_pos.y += sin( DEG2RAD( rotation ) ) * radius; + + if( rot != -fill ) { + auto w2s_new = util::screen_transform( rotated_pos ); + auto w2s_old = util::screen_transform( last_pos ); + auto alpha = 1.f - ( std::abs( rot ) / fill ); + + float threshold = life_span->get_float( ) * 0.2f; + + if( life_span->get_float( ) - delta < threshold ) { + float diff = ( life_span->get_float( ) - delta ) / ( life_span->get_float( ) ) * 5.f; + + alpha *= diff; + } + + clr_t col = g_settings.visuals.grenade_esp_clr; + + col.a( ) *= alpha; + + draw_line( w2s_old, w2s_new, col ); + } + + last_pos = rotated_pos; + } + } draw_string( w2s.x, w2s.y, ALIGN_CENTER, false, col, xors( "molotov" ) ); if( g_settings.visuals.grenade_owner ) -- cgit v1.2.3