From b1cd9458f103d99f4de1807f512ed9ffd2e38220 Mon Sep 17 00:00:00 2001 From: navewindre Date: Wed, 19 Sep 2018 21:51:56 +0200 Subject: dsad --- internal_rewrite/visual_player.cpp | 40 ++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'internal_rewrite/visual_player.cpp') diff --git a/internal_rewrite/visual_player.cpp b/internal_rewrite/visual_player.cpp index e3917a6..a117bd3 100644 --- a/internal_rewrite/visual_player.cpp +++ b/internal_rewrite/visual_player.cpp @@ -17,14 +17,17 @@ namespace features { void c_visuals::update_position( int index, const vec3_t& pos ) { m_stored_pos[ index ] = pos; - if( m_anim_progress[ index ] <= 0.3f && g_settings.visuals.dormant ) { + if( m_anim_progress[ index ] > 0.f && m_anim_progress[ index ] <= 0.3f + && m_has_seen[ index ] && g_settings.visuals.dormant ) { m_anim_progress[ index ] = 0.3f; } } void c_visuals::reset_position( ) { - for( size_t i{ }; i < 65; ++i ) + for( size_t i{ }; i < 65; ++i ) { m_anim_progress[ i ] = 0.f; + m_has_seen[ i ] = false; + } } void c_visuals::store_hit( ) { @@ -365,7 +368,7 @@ namespace features } void c_visuals::draw_players( ) { - static constexpr float anim_rate = 1.0f / 0.3f; + static constexpr float anim_rate = 1.0f / 0.5f; static float pov_progress[ 65 ]{ }; auto resource = c_base_player::get_player_resource( ); @@ -373,7 +376,13 @@ namespace features for( int i{ }; i < 65; ++i ) { auto ent = g_csgo.m_entlist( )->GetClientEntity< >( i ); - if( !ent || !ent->is_player( ) || !ent->is_alive( ) || ent == g_ctx.m_local ) + if( !ent || !ent->is_player( ) || !ent->is_alive( ) || ent == g_ctx.m_local ) { + m_has_seen[ i ] = false; + m_anim_progress[ i ] = 0.f; + continue; + } + + if( !ent->has_valid_anim( ) ) continue; if( i == ( g_ctx.m_local->m_hObserverTarget( ) & 0xfff ) ) @@ -386,29 +395,36 @@ namespace features float rate = g_csgo.m_globals->m_frametime * anim_rate; float& anim = m_anim_progress[ i ]; float alpha = anim; - bool dormant = ent->ce( )->IsDormant( ) || !ent->has_valid_anim( ); + bool dormant = ent->ce( )->IsDormant( ); int health = ent->m_iHealth( ); auto origin = ent->ce( )->GetRenderOrigin( ); int right_pos = 0; int bottom_pos = 0; bool too_distant = true; if( g_ctx.m_local ) - too_distant = ent->m_vecOrigin( ).dist_to( g_ctx.m_local->m_vecOrigin( ) ) > 2500.f; + too_distant = ent->m_vecOrigin( ).dist_to( g_ctx.m_local->m_vecOrigin( ) ) > 2000.f; if( !dormant ) { update_position( i, origin ); - anim = 1.0f; + if( anim > 0.f ) + anim = std::clamp( anim + rate, 0.f, 1.f ); + else + anim = 0.5f; + + m_has_seen[ i ] = true; } else { if( anim < 0.3f && g_settings.visuals.dormant && !too_distant ) { - rate *= 0.01f; + rate *= 0.02f; } anim = std::clamp( anim -= rate, 0.f, 1.0f ); - if( m_anim_progress[ i ] <= 0.f ) + if( m_anim_progress[ i ] <= 0.f ) { + m_has_seen[ i ] = false; continue; + } } - auto box = get_box( ent, m_stored_pos[ i ] ); + auto box = get_box( ent, m_stored_pos[ i ] ); clr_t col = ent->m_iTeamNum( ) == g_ctx.m_local->m_iTeamNum( ) ? g_settings.visuals.box_friendly : g_settings.visuals.box_enemy; @@ -422,7 +438,7 @@ namespace features box.y > screen_h || box.y + box.h < 0 ) { if( g_settings.visuals.out_of_pov ) { auto& anim = pov_progress[ i ]; - anim = std::clamp( anim += g_csgo.m_globals->m_frametime * anim_rate, 0.f, 1.0f ); + if( dormant ) anim = std::clamp( anim -= g_csgo.m_globals->m_frametime * anim_rate, 0.f, 1.0f ); else @@ -898,7 +914,7 @@ namespace features m_last_roundstart = g_csgo.m_globals->m_curtime; for( size_t i{ }; i < 65; ++i ) { - m_ent_dmg[ i ] = 0; + m_ent_dmg[ i ] = 0.f; } } -- cgit v1.2.3