From b1cd9458f103d99f4de1807f512ed9ffd2e38220 Mon Sep 17 00:00:00 2001 From: navewindre Date: Wed, 19 Sep 2018 21:51:56 +0200 Subject: dsad --- internal_rewrite/c_base_player.cpp | 12 ++++--- internal_rewrite/create_move.cpp | 2 -- internal_rewrite/movement.cpp | 15 ++------- internal_rewrite/override_view.cpp | 12 +++++-- internal_rewrite/ragebot_lagcomp.cpp | 2 +- internal_rewrite/renderer.hpp | 2 +- internal_rewrite/update_clientside_animation.cpp | 10 +----- internal_rewrite/visual.hpp | 1 + internal_rewrite/visual_draw.cpp | 6 ++-- internal_rewrite/visual_player.cpp | 40 +++++++++++++++++------- internal_rewrite/visual_world.cpp | 14 +++++++-- 11 files changed, 64 insertions(+), 52 deletions(-) diff --git a/internal_rewrite/c_base_player.cpp b/internal_rewrite/c_base_player.cpp index eed90e0..07a90be 100644 --- a/internal_rewrite/c_base_player.cpp +++ b/internal_rewrite/c_base_player.cpp @@ -566,6 +566,9 @@ void c_base_player::do_ent_interpolation( bool reset ) { if( !lerp ) return; + if( anim_data->m_last_interp_origin.dist_to( anim_data->m_interp_origin ) > 64.f ) + return; + for( size_t i{ }; i < 3; ++i ) { if( !std::isfinite( anim_data->m_last_interp_origin[ i ] ) || !std::isfinite( anim_data->m_interp_origin[ i ] ) ) { char error_msg[ 128 ]; @@ -742,13 +745,12 @@ void c_base_player::calc_anim_velocity( bool reset ) { est_tick_vel = friction( est_tick_vel ); } + if( velocity.length2d( ) > last_velocity.length2d( ) ) + anim_vel = accelerate( anim_vel, wishdir, 250.f, sv_accelerate->get_float( ) ); + //assume fakewalk - if( velocity.length2d( ) >= last_velocity.length2d( ) && est_tick_vel.length2d( ) < 5.f && delta > TICK_INTERVAL( ) ) + if( anim_vel.length2d( ) >= sm_animdata[ idx ].m_anim_velocity.length2d( ) && est_tick_vel.length2d( ) < 5.f && delta > TICK_INTERVAL( ) ) anim_vel = vec3_t( ); - - else if( anim_vel.length2d( ) >= 0.1f && velocity.length2d( ) > last_velocity.length2d( ) ) { - anim_vel = accelerate( anim_vel, wishdir, 250.f, sv_accelerate->get_float( ) ); - } } else { anim_vel = math::lerp( diff --git a/internal_rewrite/create_move.cpp b/internal_rewrite/create_move.cpp index 329c77b..e9bb5ea 100644 --- a/internal_rewrite/create_move.cpp +++ b/internal_rewrite/create_move.cpp @@ -119,8 +119,6 @@ bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_f ucmd->m_buttons &= ~IN_ATTACK; } - - //m_bIsValveDS //if( *( bool* )( c_base_player::get_game_rules( ) + 0x75 ) ) //g_settings.menu.anti_untrusted = true; diff --git a/internal_rewrite/movement.cpp b/internal_rewrite/movement.cpp index e62dfda..8760487 100644 --- a/internal_rewrite/movement.cpp +++ b/internal_rewrite/movement.cpp @@ -14,13 +14,7 @@ float get_ideal_strafe_step( float speed ) { static auto* sv_airaccelerate = g_csgo.m_cvar( )->FindVar( xors( "sv_airaccelerate" ) ); float airaccel = std::min< float >( sv_airaccelerate->get_float( ), 30.f ); - float step = std::atan2( airaccel, speed ) * M_RADPI; - - //tickcount correction - float tickcount = 1.0f / g_csgo.m_globals->m_interval_per_tick; - step *= ( 64.f / tickcount ); - - return step; + return RAD2DEG( std::asinf( 30.f / speed ) ) * 0.5f; } void rotate_movement( user_cmd_t* cmd, float rotation ) { @@ -62,13 +56,8 @@ void c_movement::auto_strafer( ) { if( cmd && ( m_ucmd->m_buttons & IN_JUMP ) && ( speed > 1.0f || g_settings.misc.air_duck( ) ) && !on_ground ) { if( !cmd->m_forwardmove && !cmd->m_sidemove ) { if( !cmd->m_mousedx ) { - vec3_t velocity_dir = math::vector_angles( vec3_t( ), velocity ); - float yaw = g_csgo.m_engine( )->GetViewAngles( ).y; - - static auto* sv_airaccelerate = g_csgo.m_cvar( )->FindVar( xors( "sv_airaccelerate" ) ); - float airaccel = std::min< float >( sv_airaccelerate->get_float( ), 30.f ); + float ideal_rotation = std::min( RAD2DEG( std::asinf( 30.f / std::max( speed, FLT_EPSILON ) ) ) * 0.5f, 45.f ); - float ideal_rotation = std::clamp( RAD2DEG( std::atan2f( airaccel, speed ) ), 0.f, 45.f ); if( ( cmd->m_cmd_nr % 2 ) ) ideal_rotation *= -1; diff --git a/internal_rewrite/override_view.cpp b/internal_rewrite/override_view.cpp index 9217381..73daab4 100644 --- a/internal_rewrite/override_view.cpp +++ b/internal_rewrite/override_view.cpp @@ -7,10 +7,16 @@ void __fastcall hooks::override_view( void* ecx_, void* edx_, CViewSetup* setup return override_view_o( ecx_, nullptr, setup ); } - g_ctx.m_fov = setup->m_flFov; - if ( g_ctx.run_frame( ) && g_ctx.m_local->is_valid( ) && ( !g_ctx.m_local->m_bIsScoped( ) || g_settings.misc.no_zoom( ) ) ) { - setup->m_flFov = g_settings.misc.fov_changer( ); + float fov = setup->m_flFov; + if ( g_ctx.run_frame( ) && g_ctx.m_local->is_valid( ) ) { + if( g_settings.misc.no_zoom ) + setup->m_flFov = g_settings.misc.fov_changer( ); + else + setup->m_flFov = g_settings.misc.fov_changer( ) * ( fov / 90.f ); } + + g_ctx.m_fov = setup->m_flFov; + g_cheat.m_extra.thirdperson( ); override_view_o( ecx_, nullptr, setup ); } \ No newline at end of file diff --git a/internal_rewrite/ragebot_lagcomp.cpp b/internal_rewrite/ragebot_lagcomp.cpp index e961b15..5c18735 100644 --- a/internal_rewrite/ragebot_lagcomp.cpp +++ b/internal_rewrite/ragebot_lagcomp.cpp @@ -198,7 +198,7 @@ namespace features continue; if( ent && ent->is_valid( ) && !ent->m_bGunGameImmunity( ) && - !!std::abs( last_simtime[ i ] - ent->m_flSimulationTime( ) ) ) { + !!std::abs( last_simtime[ i ] - ent->m_flSimulationTime( ) ) && ent->has_valid_anim( ) ) { render_record_t new_record; new_record.m_simtime = ent->m_flSimulationTime( ) + util::get_lerptime( ); new_record.m_origin = ent->m_vecOrigin( ); diff --git a/internal_rewrite/renderer.hpp b/internal_rewrite/renderer.hpp index de156d7..1247440 100644 --- a/internal_rewrite/renderer.hpp +++ b/internal_rewrite/renderer.hpp @@ -45,7 +45,7 @@ protected: public: void initialize( ); - font_t f_esp_small{ xors( "Tahoma" ), 11, 500, FONTFLAG_OUTLINE }; + font_t f_esp_small{ xors( "Tahoma" ), 11, 500, FONTFLAG_DROPSHADOW }; font_t f_bold{ xors( "Verdana" ), 18, 900, FONTFLAG_DROPSHADOW | FONTFLAG_ANTIALIAS }; font_t f_12{ #ifndef COMIC_SANS diff --git a/internal_rewrite/update_clientside_animation.cpp b/internal_rewrite/update_clientside_animation.cpp index cef0d0c..5e99e95 100644 --- a/internal_rewrite/update_clientside_animation.cpp +++ b/internal_rewrite/update_clientside_animation.cpp @@ -12,7 +12,6 @@ void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) { auto ent = ( c_base_player* )( ecx_ ); - static ent_animdata_t prev_anims; static float last_update; static float last_spawntime = 0.f; @@ -24,22 +23,15 @@ void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) { if( last_spawntime != ent->m_flSpawnTime( ) ) last_spawntime = ent->m_flSpawnTime( ); - old_func( ecx_, edx_ ); - ent->cache_anim_data( ); - - return; + return old_func( ecx_, edx_ ); } last_update = g_csgo.m_globals->m_curtime; - if( g_cheat.m_lagmgr.get_choked( ) == 1 || g_cheat.m_lagmgr.get_sent( ) > 1 ) - ent->cache_anim_data( ); - ent->get_animstate( )->m_iLastClientSideAnimationUpdateFramecount = g_csgo.m_globals->m_framecount; old_func( ecx_, edx_ ); if( !first_update ) { - ent->restore_anim_data( true ); ent->set_abs_angles( vec3_t( 0, ent->get_animstate( )->m_flGoalFeetYaw, 0 ) ); bool backup = ent->get_animstate( )->m_bOnGround; diff --git a/internal_rewrite/visual.hpp b/internal_rewrite/visual.hpp index 79709ca..f6558aa 100644 --- a/internal_rewrite/visual.hpp +++ b/internal_rewrite/visual.hpp @@ -79,6 +79,7 @@ namespace features vec3_t m_stored_pos[ 65 ]{ }; float m_anim_progress[ 65 ]{ }; + bool m_has_seen[ 65 ]{ }; float m_last_hit{ }; int m_ent_dmg[ 65 ]{ }; int m_teamdmg{ 0 }; diff --git a/internal_rewrite/visual_draw.cpp b/internal_rewrite/visual_draw.cpp index 3c40f29..8636af2 100644 --- a/internal_rewrite/visual_draw.cpp +++ b/internal_rewrite/visual_draw.cpp @@ -54,21 +54,21 @@ namespace features switch( align ) { case ALIGN_CENTER: if( g_settings.misc.hide_from_obs ) - g_d3d.draw_text< ALIGN_CENTER >( big ? ::d3d::fonts.f_12 : ::d3d::fonts.f_esp_small, col, x, y, big ? D3DFONTFLAG_DROPSHADOW : D3DFONTFLAG_OUTLINE, buffer ); + g_d3d.draw_text< ALIGN_CENTER >( big ? ::d3d::fonts.f_12 : ::d3d::fonts.f_esp_small, col, x, y, D3DFONTFLAG_DROPSHADOW, buffer ); else g_renderer.draw_string< ALIGN_CENTER >( big ? g_fonts.f_12 : g_fonts.f_esp_small, x, y, col, buffer ); break; case ALIGN_LEFT: if( g_settings.misc.hide_from_obs ) - g_d3d.draw_text< ALIGN_LEFT >( big ? ::d3d::fonts.f_12 : ::d3d::fonts.f_esp_small, col, x, y, big ? D3DFONTFLAG_DROPSHADOW : D3DFONTFLAG_OUTLINE, buffer ); + g_d3d.draw_text< ALIGN_LEFT >( big ? ::d3d::fonts.f_12 : ::d3d::fonts.f_esp_small, col, x, y, D3DFONTFLAG_DROPSHADOW, buffer ); else g_renderer.draw_string< ALIGN_LEFT >( big ? g_fonts.f_12 : g_fonts.f_esp_small, x, y, col, buffer ); break; case ALIGN_RIGHT: if( g_settings.misc.hide_from_obs ) - g_d3d.draw_text< ALIGN_RIGHT >( big ? ::d3d::fonts.f_12 : ::d3d::fonts.f_esp_small, col, x, y, big ? D3DFONTFLAG_DROPSHADOW : D3DFONTFLAG_OUTLINE, buffer ); + g_d3d.draw_text< ALIGN_RIGHT >( big ? ::d3d::fonts.f_12 : ::d3d::fonts.f_esp_small, col, x, y, D3DFONTFLAG_DROPSHADOW, buffer ); else g_renderer.draw_string< ALIGN_RIGHT >( big ? g_fonts.f_12 : g_fonts.f_esp_small, x, y, col, buffer ); 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; } } diff --git a/internal_rewrite/visual_world.cpp b/internal_rewrite/visual_world.cpp index b9b3430..5ceffba 100644 --- a/internal_rewrite/visual_world.cpp +++ b/internal_rewrite/visual_world.cpp @@ -179,15 +179,20 @@ namespace features if( !strstr( hdr->name, xors( "thrown" ) ) && !strstr( hdr->name, xors( "dropped" ) ) ) continue; + bool fade = false; + std::string name = xors( "nade" ); if( strstr( hdr->name, xors( "flash" ) ) ) { name = xors( "flash" ); + fade = true; } else if( strstr( hdr->name, xors( "smoke" ) ) ) { name = xors( "smoke" ); + fade = true; } else if( strstr( hdr->name, xors( "decoy" ) ) ) { name = xors( "decoy" ); + fade = true; } else if( strstr( hdr->name, xors( "incendiary" ) ) || strstr( hdr->name, xors( "molotov" ) ) ) { name = xors( "molotov" ); @@ -205,15 +210,18 @@ namespace features auto dist = g_ctx.m_local->m_vecOrigin( ).dist_to( pos ); clr_t col = g_settings.visuals.grenade_esp_clr; - if( dist > 250.f && !strstr( hdr->name, xors( "thrown" ) ) ) { - col.a( ) *= ( 750.f - ( dist - 250.f ) ) / 750.f; + if( dist > 250.f ) { + col.a( ) *= std::min( 750.f - ( dist - 250.f ), 0.f ) / 750.f; } draw_string( w2s.x, w2s.y, ALIGN_CENTER, false, col, name.c_str( ) ); + char name[ 32 ]; + cutie->get_name_safe( name ); + if( g_settings.visuals.grenade_owner( ) ) - draw_string( w2s.x, w2s.y + 10, ALIGN_CENTER, false, col, cutie->get_info( ).name ); + draw_string( w2s.x, w2s.y + 10, ALIGN_CENTER, false, col, name ); } } } -- cgit v1.2.3