diff options
Diffstat (limited to 'internal_rewrite/lag_mgr.cpp')
| -rw-r--r-- | internal_rewrite/lag_mgr.cpp | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/internal_rewrite/lag_mgr.cpp b/internal_rewrite/lag_mgr.cpp index 17dc194..ce6d37f 100644 --- a/internal_rewrite/lag_mgr.cpp +++ b/internal_rewrite/lag_mgr.cpp @@ -12,7 +12,7 @@ namespace features } } - bool c_lagmgr::predict_position( ) { + bool c_lagmgr::predict_position( float dist ) { vec3_t local_pos = g_ctx.m_local->get_eye_pos( ); auto i = util::get_closest_player( ); @@ -100,17 +100,24 @@ namespace features } } - bool send = false; + bool send = true; static bool was_onground{ }; - if( !settings.in_move ) { - send = true; + if( settings.in_move && ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) && g_ctx.m_local->m_vecVelocity( ).length2d( ) > 0.1f ) { + send = false; } if( settings.on_peek ) { static int choke_ticks = 0; - bool predicted = predict_position( ); - if( !predicted ) + + bool peeking = predict_position( 20.f + g_ctx.m_local->m_vecVelocity( ) * TICK_INTERVAL( ) * 2.f ); + bool predicted = predict_position( 20.f ); + + if( !peeking && predicted ) { + choke_ticks = 0; + send = true; + } + else if( !predicted ) choke_ticks = settings.ticks; if( choke_ticks ) { @@ -123,23 +130,35 @@ namespace features } if( settings.avoid_ground ) { - if( !was_onground && g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) { - send = false; + static int choked = 0; + + if( !was_onground && ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { + choked = settings.ticks; } + + if( choked ) + send = !--choked; } if( settings.jump_reset ) { - if( was_onground && !( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { - send = get_choked( ) > 0; + if( settings.avoid_ground ) { + if( was_onground && !( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { + send = get_choked( ) > 0; + } + } + else { + if( !was_onground && ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { + send = get_choked( ) > 0; + } } } - was_onground = g_ctx.m_local->m_fFlags( ) & FL_ONGROUND; + was_onground = ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ); if( ( m_cmd->m_buttons & IN_ATTACK ) && g_ctx.m_local->can_attack( ) && !settings.in_attack ) { if( !weapon->is_grenade( ) || ( weapon->is_grenade( ) && weapon->m_fThrowTime( ) < TICK_INTERVAL( ) ) ) { - send = true; + send = get_choked( ) > 0; } } |
