summaryrefslogtreecommitdiff
path: root/internal_rewrite/ragebot_lagcomp.cpp
diff options
context:
space:
mode:
authornavewindre <boneyaard@gmail.com>2018-11-13 00:42:56 +0100
committernavewindre <boneyaard@gmail.com>2018-11-13 00:42:56 +0100
commit5e5b152f4b62432655cc4069c1d95be636749b7d (patch)
tree3fc1433561fb6c90a04f3a671afca4df91a653a4 /internal_rewrite/ragebot_lagcomp.cpp
parentd106396b02c486c9135c505ed82b73431f2c27de (diff)
yo sick
Diffstat (limited to 'internal_rewrite/ragebot_lagcomp.cpp')
-rw-r--r--internal_rewrite/ragebot_lagcomp.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/internal_rewrite/ragebot_lagcomp.cpp b/internal_rewrite/ragebot_lagcomp.cpp
index 5c18735..f87b8fd 100644
--- a/internal_rewrite/ragebot_lagcomp.cpp
+++ b/internal_rewrite/ragebot_lagcomp.cpp
@@ -193,12 +193,16 @@ namespace features
for( int i{ }; i < 65; ++i ) {
auto ent = g_csgo.m_entlist( )->GetClientEntity< >( i );
auto& data = m_data_render[ i ];
-
+
if( ent == g_ctx.m_local )
continue;
- if( ent && ent->is_valid( ) && !ent->m_bGunGameImmunity( ) &&
- !!std::abs( last_simtime[ i ] - ent->m_flSimulationTime( ) ) && ent->has_valid_anim( ) ) {
+ if( !ent || !ent->is_valid( ) || ent->m_bGunGameImmunity( ) ) {
+ data.clear( );
+ continue;
+ }
+
+ if( !!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( );
@@ -242,14 +246,17 @@ namespace features
return std::abs( delta ) <= 0.2f;
};
- for( auto it = data.rbegin( ); it != data.rend( ) && ( it + 1 ) != data.rend( ); it++ ) {
- if( is_time_valid( it->m_globaltime ) ) {
+ for( auto it = data.rbegin( ); it != data.rend( ); it++ ) {
+ if( is_time_valid( it->m_globaltime ) || ( it + 1 ) == data.rend( ) ) {
if( it->m_origin.dist_to( ent->m_vecOrigin( ) ) < 1.f )
return false;
if( ent->is_breaking_lc( ) )
return false;
+ if( std::abs( it->m_simtime - ent->m_flSimulationTime( ) ) > TIME_TO_TICKS( 15 ) )
+ break;
+
if( !it->m_validtime )
it->m_validtime = g_csgo.m_globals->m_curtime;
@@ -257,13 +264,16 @@ namespace features
float latency = util::get_total_latency( );
float correct = latency + util::get_lerptime( );
- float deadtime = it->m_globaltime + correct + 0.2f;
+ float choke = ent->m_flSimulationTime( ) - ent->m_flOldSimulationTime( );
+ float lerptime = std::max( choke + TICK_INTERVAL( ), 0.2f );
+
+ float deadtime = it->m_globaltime + correct + lerptime;
float totaltime = deadtime - it->m_validtime;
float curtime = g_csgo.m_globals->m_curtime;
- float delta = ( 0.2f + correct - ( curtime - it->m_globaltime ) ) / totaltime;
+ float delta = ( lerptime + correct - ( curtime - it->m_globaltime ) ) / totaltime;
- vec3_t next = ( it + 1 )->m_origin;
+ vec3_t next = ( it + 1 ) == data.rend( ) ? ent->m_vecOrigin( ) : ( it + 1 )->m_origin;
vec3_t lerp = math::lerp( it->m_origin, next, std::clamp( 1.f - delta, 0.f, 1.f ) );
matrix3x4 ret[ 128 ];