diff options
| author | navewindre <boneyaard@gmail.com> | 2018-11-18 20:06:19 +0100 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2018-11-18 20:06:19 +0100 |
| commit | ee88bdeca83ebf6aff4b2bebf2c1f93eb2bf9541 (patch) | |
| tree | ce352cb7c1f10780c4a1584c7dbd3483d4179d36 /internal_rewrite/ragebot_lagcomp.cpp | |
| parent | cbb78808aa8d30055afbabf72f61183ba9015935 (diff) | |
d
Diffstat (limited to 'internal_rewrite/ragebot_lagcomp.cpp')
| -rw-r--r-- | internal_rewrite/ragebot_lagcomp.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/internal_rewrite/ragebot_lagcomp.cpp b/internal_rewrite/ragebot_lagcomp.cpp index e8d9db6..62f588c 100644 --- a/internal_rewrite/ragebot_lagcomp.cpp +++ b/internal_rewrite/ragebot_lagcomp.cpp @@ -202,7 +202,7 @@ namespace features continue;
}
- if( !!std::abs( last_simtime[ i ] - ent->m_flSimulationTime( ) ) && ent->has_valid_anim( ) ) {
+ 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( );
@@ -215,6 +215,8 @@ namespace features else
new_record.m_globaltime -= TICK_INTERVAL( );
+ new_record.m_validtime = 0.f;
+
if( ent->ce( )->SetupBones( new_record.m_matrix, 128, BONE_USED_BY_ANYTHING, 0.f ) ) {
data.push_front( new_record );
}
@@ -250,14 +252,16 @@ namespace features };
for( auto it = data.rbegin( ); it != data.rend( ); it++ ) {
- if( is_time_valid( it->m_globaltime ) || ( it + 1 ) == data.rend( ) ) {
+ if( ( it + 1 ) == data.rend( ) || is_time_valid( it->m_simtime ) || ( it + 1 )->m_simtime == ent->m_flSimulationTime( ) + util::get_lerptime( ) ) {
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 ) )
+ auto next_record = ( it + 1 );
+
+ if( std::abs( it->m_simtime - ent->m_flSimulationTime( ) ) > TIME_TO_TICKS( 16 ) )
break;
if( !it->m_validtime )
@@ -268,16 +272,16 @@ namespace features float correct = latency + util::get_lerptime( );
float choke = ent->m_flSimulationTime( ) - ent->m_flOldSimulationTime( );
- float lerptime = std::max( choke + TICK_INTERVAL( ), 0.2f );
+ float lerptime = next_record == data.rend( ) ? choke : next_record->m_simtime - it->m_simtime;
- float deadtime = it->m_globaltime + correct + lerptime;
- float totaltime = deadtime - it->m_validtime;
+ lerptime = std::max( lerptime, TICK_INTERVAL( ) );
float curtime = g_csgo.m_globals->m_curtime;
- float delta = ( lerptime + correct - ( curtime - it->m_globaltime ) ) / totaltime;
+
+ float delta = ( curtime - it->m_validtime ) / lerptime;
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 ) );
+ vec3_t lerp = math::lerp( it->m_origin, next, std::clamp( delta, 0.f, 1.f ) );
matrix3x4 ret[ 128 ];
|
