diff options
author | /dev/humancontroller <devhc@example.com> | 2014-07-14 21:53:49 +0200 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-03-09 13:51:08 +0100 |
commit | 40669e28041d5cf9863d3464c41fe39979aa39d6 (patch) | |
tree | 80a13b69c2b9854ab3ae4ce1c2febb55e0a8b983 | |
parent | 42cacc935bddc55e706de808b4194fe3c0b9501a (diff) |
fix unlagged not being used at all for overly large latencies
-rw-r--r-- | src/game/g_active.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c index 1b7be618..aa8bfc5d 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -994,10 +994,10 @@ void G_UnlaggedCalc( int time, gentity_t *rewindEnt ) { int i = 0; gentity_t *ent; - int startIndex = level.unlaggedIndex; - int stopIndex = -1; - int frameMsec = 0; - float lerp = 0.5f; + int startIndex; + int stopIndex; + int frameMsec; + float lerp; if( !g_unlagged.integer ) return; @@ -1009,13 +1009,18 @@ void G_UnlaggedCalc( int time, gentity_t *rewindEnt ) ent->client->unlaggedCalc.used = qfalse; } - for( i = 0; i < MAX_UNLAGGED_MARKERS; i++ ) + // client is on the current frame, no need for unlagged + if( level.unlaggedTimes[ level.unlaggedIndex ] <= time ) + return; + + startIndex = level.unlaggedIndex; + for( i = 1; i < MAX_UNLAGGED_MARKERS; i++ ) { - if( level.unlaggedTimes[ startIndex ] <= time ) - break; stopIndex = startIndex; if( --startIndex < 0 ) startIndex = MAX_UNLAGGED_MARKERS - 1; + if( level.unlaggedTimes[ startIndex ] <= time ) + break; } if( i == MAX_UNLAGGED_MARKERS ) { @@ -1023,18 +1028,11 @@ void G_UnlaggedCalc( int time, gentity_t *rewindEnt ) // just use the oldest marker with no lerping lerp = 0.0f; } - - // client is on the current frame, no need for unlagged - if( stopIndex == -1 ) - return; - - // lerp between two markers - frameMsec = level.unlaggedTimes[ stopIndex ] - - level.unlaggedTimes[ startIndex ]; - if( frameMsec > 0 ) + else { - lerp = ( float )( time - level.unlaggedTimes[ startIndex ] ) / - ( float )frameMsec; + // lerp between two markers + frameMsec = level.unlaggedTimes[ stopIndex ] - level.unlaggedTimes[ startIndex ]; + lerp = ( float )( time - level.unlaggedTimes[ startIndex ] ) / ( float )frameMsec; } for( i = 0; i < level.maxclients; i++ ) |