From b383d10ec99e35d31836fd8abb91da22208891a5 Mon Sep 17 00:00:00 2001 From: navewindre Date: Wed, 12 Sep 2018 02:14:46 +0200 Subject: dsadsad --- internal_rewrite/update_clientside_animation.cpp | 74 ++---------------------- 1 file changed, 4 insertions(+), 70 deletions(-) (limited to 'internal_rewrite/update_clientside_animation.cpp') diff --git a/internal_rewrite/update_clientside_animation.cpp b/internal_rewrite/update_clientside_animation.cpp index fb4ab72..d61916a 100644 --- a/internal_rewrite/update_clientside_animation.cpp +++ b/internal_rewrite/update_clientside_animation.cpp @@ -13,10 +13,8 @@ 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_choke; static float last_update; static float last_spawntime = 0.f; - static float last_yaw; // Arbitrary number much. if( !g_settings.rage.anti_aim || !g_ctx.m_local->is_valid( ) || std::abs( last_update - g_csgo.m_globals->m_curtime ) > TICKS_TO_TIME( 20 ) || last_spawntime != ent->m_flSpawnTime( ) ) { @@ -33,18 +31,19 @@ void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) { if( !g_cheat.m_lagmgr.get_choked( ) || g_cheat.m_lagmgr.get_sent( ) > 1 || first_update ) { vec3_t backup; g_csgo.m_prediction( )->GetLocalViewAngles( backup ); + float backup_curtime = g_csgo.m_globals->m_curtime; float backup_frametime = g_csgo.m_globals->m_frametime; + last_update = backup_curtime; + g_csgo.m_globals->m_curtime = g_ctx.pred_time( ); g_csgo.m_globals->m_frametime = TICK_INTERVAL( ); if( g_csgo.m_globals->m_curtime != ent->get_animstate( )->m_flLastClientSideAnimationUpdateTime ) { last_update = backup_curtime; - last_choke = std::max( g_csgo.m_globals->m_curtime - ent->get_animstate( )->m_flLastClientSideAnimationUpdateTime, TICK_INTERVAL( ) ); - vec3_t real_angle = g_ctx.m_thirdperson_angle; float pitch; @@ -63,16 +62,9 @@ void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) { real_angle.x = pitch; } - last_yaw = ent->get_animstate( )->m_flGoalFeetYaw; - if( last_yaw < 0.f ) - last_yaw += 360.f; - - g_csgo.m_prediction( )->SetViewAngles( real_angle ); ent->get_animstate( )->update( real_angle.y, real_angle.x ); old_func( ecx_, edx_ ); - memcpy( &prev_anims, &ent->get_animdata( ), sizeof( prev_anims ) ); - prev_anims.m_last_simtime = last_yaw; ent->cache_anim_data( ); } @@ -83,67 +75,9 @@ void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) { ent->restore_anim_data( true ); - float lerp = std::min( last_choke, TICK_INTERVAL( ) * 2.f ); - float update_delta = last_choke; - float update_lerp = std::clamp( update_delta - lerp, 0.f, 1.f ); - if( update_delta > 0.f ) - lerp = std::clamp( lerp, 0.f, update_delta ); - - float lerp_progress = ( last_update + lerp - g_csgo.m_globals->m_curtime ) / lerp; - - float lerp_yaw = 0.f; - if( !first_update && ( ent->get_animstate( )->m_velocity > 0.1f || std::abs( last_yaw - ent->get_animstate( )->m_flGoalFeetYaw ) < 35.f ) && update_delta <= TICK_INTERVAL( ) * 2.f ) { - float yaw = ent->get_animstate( )->m_flGoalFeetYaw; - if( yaw < 0.f ) - yaw += 360.f; - - if( std::abs( yaw - last_yaw ) >= 180.f ) - lerp_yaw = yaw; - else { - lerp_yaw = math::lerp( yaw, last_yaw, std::clamp( lerp_progress, 0.f, 1.f ) ); - } - } - else { - lerp_yaw = ent->get_animstate( )->m_flGoalFeetYaw; - } - - //interpolate EVERYTHING - if( !first_update && !( ent->get_animstate( )->m_bInHitGroundAnimation && ent->get_animstate( )->m_bOnGround ) ) { - for( size_t i{ }; i < 18; ++i ) { - float old_param = prev_anims.m_poseparams.at( i ); - float param = ent->get_animdata( ).m_poseparams.at( i ); - - if( i == BODY_YAW ) - continue; - - if( !isfinite( old_param ) || !isfinite( param ) ) - continue; - - float final_param = math::lerp( param, old_param, std::clamp( lerp_progress, 0.f, 1.f ) ); - - ent->m_flPoseParameter( )[ i ] = final_param; - } - - for( size_t i{ }; i < 13; ++i ) { - auto old_cycle = prev_anims.m_animlayers.at( i ).m_flCycle; - auto cycle = ent->get_animdata( ).m_animlayers.at( i ).m_flCycle; - - if( old_cycle > 0.9f && cycle < 0.1f ) { - cycle += 1.f; - } - - float final_cycle = math::lerp( cycle, old_cycle, std::clamp( lerp_progress, 0.f, 1.f ) ); - - if( final_cycle > 1.f ) - final_cycle -= 1.f; - - ent->m_AnimOverlay( ).GetElements( )[ i ].m_flCycle = final_cycle; - } - } - if( !first_update ) { //*( byte* )( uintptr_t( ent ) + 0x270 ) = 0; - ent->set_abs_angles( vec3_t( 0, lerp_yaw, 0 ) ); + ent->set_abs_angles( vec3_t( 0, ent->get_animstate( )->m_flGoalFeetYaw, 0 ) ); bool backup = ent->get_animstate( )->m_bOnGround; ent->get_animstate( )->m_bOnGround = false; -- cgit v1.2.3