summaryrefslogtreecommitdiff
path: root/src/game/bg_misc.c
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-08-14 13:07:27 +0200
committerPaweł Redman <pawel.redman@gmail.com>2017-08-14 13:31:00 +0200
commita3ff3075710c7657dad4579c90fb451736421140 (patch)
tree85e59eaf3f240b4c7653ad0cfeec4c9dedd623af /src/game/bg_misc.c
parent8bc5b6fdd9424823a0c46b961f4a4d12b2a8692c (diff)
Implement player extrapolation.
If a player doesn't send client frames fast enough then there will be some server frames where they don't move. This is visible as 'warping' and is generally very undesirable. Extrapolation tries to fix the problem by filling in the missing data by continuing player's trajectory.
Diffstat (limited to 'src/game/bg_misc.c')
-rw-r--r--src/game/bg_misc.c112
1 files changed, 0 insertions, 112 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 4b0d56f..8810c12 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -3416,118 +3416,6 @@ void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean
s->otherEntityNum = ps->otherEntityNum;
}
-
-/*
-========================
-BG_PlayerStateToEntityStateExtraPolate
-
-This is done after each set of usercmd_t on the server,
-and after local prediction on the client
-========================
-*/
-void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s, int time, qboolean snap )
-{
- int i;
-
- if( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPECTATOR || ps->pm_type == PM_FREEZE )
- s->eType = ET_INVISIBLE;
- else if( ps->persistant[ PERS_TEAM ] == TEAM_SPECTATOR )
- s->eType = ET_INVISIBLE;
- else
- s->eType = ET_PLAYER;
-
- s->number = ps->clientNum;
-
- s->pos.trType = TR_LINEAR_STOP;
- VectorCopy( ps->origin, s->pos.trBase );
-
- if( snap )
- SnapVector( s->pos.trBase );
-
- // set the trDelta for flag direction and linear prediction
- VectorCopy( ps->velocity, s->pos.trDelta );
- // set the time for linear prediction
- s->pos.trTime = time;
- // set maximum extra polation time
- s->pos.trDuration = 50; // 1000 / sv_fps (default = 20)
-
- s->apos.trType = TR_INTERPOLATE;
- VectorCopy( ps->viewangles, s->apos.trBase );
- if( snap )
- SnapVector( s->apos.trBase );
-
- //TA: i need for other things :)
- //s->angles2[YAW] = ps->movementDir;
- s->time2 = ps->movementDir;
- s->legsAnim = ps->legsAnim;
- s->torsoAnim = ps->torsoAnim;
- s->clientNum = ps->clientNum; // ET_PLAYER looks here instead of at number
- // so corpses can also reference the proper config
- s->eFlags = ps->eFlags;
-
- if( ps->stats[STAT_HEALTH] <= 0 )
- s->eFlags |= EF_DEAD;
- else
- s->eFlags &= ~EF_DEAD;
-
- if( ps->stats[ STAT_STATE ] & SS_BLOBLOCKED )
- s->eFlags |= EF_BLOBLOCKED;
- else
- s->eFlags &= ~EF_BLOBLOCKED;
-
- if( ps->externalEvent )
- {
- s->event = ps->externalEvent;
- s->eventParm = ps->externalEventParm;
- }
- else if( ps->entityEventSequence < ps->eventSequence )
- {
- int seq;
-
- if( ps->entityEventSequence < ps->eventSequence - MAX_PS_EVENTS )
- ps->entityEventSequence = ps->eventSequence - MAX_PS_EVENTS;
-
- seq = ps->entityEventSequence & ( MAX_PS_EVENTS - 1 );
- s->event = ps->events[ seq ] | ( ( ps->entityEventSequence & 3 ) << 8 );
- s->eventParm = ps->eventParms[ seq ];
- ps->entityEventSequence++;
- }
-
- s->weapon = ps->weapon;
- s->groundEntityNum = ps->groundEntityNum;
-
- //store items held and active items in modelindex and modelindex2
- s->modelindex = 0;
- s->modelindex2 = 0;
-
- for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
- {
- if( BG_InventoryContainsUpgrade( i, ps->stats ) )
- {
- s->modelindex |= 1 << i;
-
- if( BG_UpgradeIsActive( i, ps->stats ) )
- s->modelindex2 |= 1 << i;
- }
- }
-
- // use misc field to store team/class info:
- s->misc = ps->stats[ STAT_PTEAM ] | ( ps->stats[ STAT_PCLASS ] << 8 );
-
- //TA: have to get the surfNormal thru somehow...
- VectorCopy( ps->grapplePoint, s->angles2 );
- if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
- s->eFlags |= EF_WALLCLIMBCEILING;
-
- s->loopSound = ps->loopSound;
- s->generic1 = ps->generic1;
-
- if( s->generic1 <= WPM_NONE || s->generic1 >= WPM_NUM_WEAPONMODES )
- s->generic1 = WPM_PRIMARY;
-
- s->otherEntityNum = ps->otherEntityNum;
-}
-
/*
========================
BG_WeaponIsFull