added sv.frameTime variable on server (passed as a parameter on WriteDeltaEntity/WriteDeltaPlayerState)

This commit is contained in:
L 2023-01-30 14:12:00 +01:00
parent edd18be095
commit 58c8e743d2
2 changed files with 6 additions and 5 deletions

View file

@ -71,6 +71,7 @@ typedef struct {
int snapshotCounter; // incremented for each snapshot built
int timeResidual; // <= 1000 / sv_frame->value
int nextFrameTime; // when time > nextFrameTime, process world
float frameTime;
struct cmodel_s *models[MAX_MODELS];
char *configstrings[MAX_CONFIGSTRINGS];
svEntity_t svEntities[MAX_GENTITIES];

View file

@ -88,7 +88,7 @@ static void SV_EmitPacketEntities( clientSnapshot_t *from, clientSnapshot_t *to,
// delta update from old position
// because the force parm is qfalse, this will not result
// in any bytes being emited if the entity has not changed at all
MSG_WriteDeltaEntity (msg, oldent, newent, qfalse );
MSG_WriteDeltaEntity (msg, oldent, newent, qfalse, sv.frameTime);
oldindex++;
newindex++;
continue;
@ -96,14 +96,14 @@ static void SV_EmitPacketEntities( clientSnapshot_t *from, clientSnapshot_t *to,
if ( newnum < oldnum ) {
// this is a new entity, send it from the baseline
MSG_WriteDeltaEntity (msg, &sv.svEntities[newnum].baseline, newent, qtrue );
MSG_WriteDeltaEntity (msg, &sv.svEntities[newnum].baseline, newent, qtrue, sv.frameTime);
newindex++;
continue;
}
if ( newnum > oldnum ) {
// the old entity isn't present in the new message
MSG_WriteDeltaEntity (msg, oldent, NULL, qtrue );
MSG_WriteDeltaEntity (msg, oldent, NULL, qtrue, sv.frameTime);
oldindex++;
continue;
}
@ -202,9 +202,9 @@ static void SV_WriteSnapshotToClient( client_t *client, msg_t *msg ) {
// delta encode the playerstate
if ( oldframe ) {
MSG_WriteDeltaPlayerstate( msg, &oldframe->ps, &frame->ps );
MSG_WriteDeltaPlayerstate( msg, &oldframe->ps, &frame->ps, sv.frameTime);
} else {
MSG_WriteDeltaPlayerstate( msg, NULL, &frame->ps );
MSG_WriteDeltaPlayerstate( msg, NULL, &frame->ps, sv.frameTime);
}
// delta encode the entities