From 68dbb976714f884e29e0abe1adc0bf2fa624e00b Mon Sep 17 00:00:00 2001 From: navewindre Date: Tue, 4 Dec 2018 21:47:14 +0100 Subject: dad --- cheat/internal_rewrite/visual_local.cpp | 80 +++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'cheat/internal_rewrite/visual_local.cpp') diff --git a/cheat/internal_rewrite/visual_local.cpp b/cheat/internal_rewrite/visual_local.cpp index 927486a..e6c6d4b 100644 --- a/cheat/internal_rewrite/visual_local.cpp +++ b/cheat/internal_rewrite/visual_local.cpp @@ -9,12 +9,92 @@ namespace features { + class flake { + public: + vec2_t pos; + float time; + float speed; + float fall_ang; + float fall_time; + int size; + }; + + void c_visuals::do_christmas( ) { + int screen_w, screen_h; + g_csgo.m_engine( )->GetScreenSize( screen_w, screen_h ); + + const float degree_offset = 80.f; + + static std::vector< flake > flakes; + static float last_time = 0.f; + float curtime = g_csgo.m_globals->m_curtime; + + if( std::abs( last_time - curtime ) > 1.f ) + flakes.clear( ); + + auto num_new = math::random_number( 0, 2 ); + + for( size_t i{ }; i < num_new; ++i ) { + int rand_x = math::random_number( 0, screen_w - 100 ); + int rand_ang = math::random_number( -30.f, 15.f ); + int rand_size = math::random_number( 1, 4 ); + int rand_speed = math::random_number( 1.5f, 6.f ); + + flake new_flake; + new_flake.pos = { ( float )( rand_x ), 0.f }; + new_flake.fall_ang = rand_ang + degree_offset; + new_flake.fall_time = 0.f; + new_flake.size = rand_size; + new_flake.speed = rand_speed; + new_flake.time = curtime; + + flakes.push_back( new_flake ); + } + + for( size_t i{ }; i < flakes.size( ) && !flakes.empty( ); ++i ) { + auto* it = &flakes.at( i ); + + float ang = it->fall_ang; + + float x = cos( DEG2RAD( ang ) ); + float y = sin( DEG2RAD( ang ) ); + + float alpha = 1.f; + if( it->pos.y + it->size / 2 >= screen_h - 1 ) { + if( !it->fall_time ) + it->fall_time = curtime; + + float totaltime = it->speed / 3.f; + float endtime = it->fall_time + totaltime; + + float delta = ( endtime - curtime ) / totaltime; + if( delta < 0.f ) { + flakes.erase( flakes.begin( ) + i ); + continue; + } + + delta = std::clamp( delta, 0.f, 1.f ); + alpha = delta; + } + else { + it->pos.x += x * it->speed; + it->pos.y += y * it->speed; + } + + for( size_t i{ }; i <= it->size; ++i ) + draw_circle( ( float )it->pos.x, ( float )it->pos.y, i, clr_t( 255, 255, 255, alpha * 255 ) ); + } + + last_time = g_csgo.m_globals->m_curtime; + } + void c_visuals::draw_local( ) { int screen_w, screen_h; g_csgo.m_engine( )->GetScreenSize( screen_w, screen_h ); int cur_pos{ }; + //do_christmas( ); draw_shots( ); grenade_prediction( ); draw_spread( ); -- cgit v1.2.3