summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2017-04-15 16:35:26 +0200
committer/dev/humancontroller <devhc@example.com>2017-04-15 16:35:26 +0200
commit1c2435ce13828d7b90c939aa48a6a89ed5b5cc5f (patch)
treec9d9b9ed16bd63e2353ae98184c274e76fd63e26 /src/game
parent82f45b3acaf411e967cb978233786326e5c0c95e (diff)
fix unlagged not being used at all for overly large latencies
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_active.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 2c18f00..5b167a5 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -1313,10 +1313,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;
@@ -1328,13 +1328,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 )
{
@@ -1342,18 +1347,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++ )