build.cfg: Bump BUILD_ENGINEREVISION to 6303, thus fixing FreeTS from not compiling.

Shared: Fix that colormap was evaluated as part of PLAYER_VELOCITY instead of PLAYER_MODELINDEX
This is a minor optimisation.
Add NSClientPlayer::OptimiseChangedFlags...
This commit is contained in:
Marco Cawthorne 2022-08-09 09:05:31 -07:00
parent 389ece17d5
commit a4a0cc3c43
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
3 changed files with 35 additions and 6 deletions

View File

@ -32,7 +32,7 @@ BUILD_IQMTOOL=1
BUILD_IMGTOOL=1
# Specify which engine revision to build, these are considered 'stable'; 0 = latest
BUILD_ENGINEREVISION=6302
BUILD_ENGINEREVISION=6303
# Whether or not to run 'git pull' or 'svn up' before building a component
BUILD_UPDATE=1

View File

@ -117,6 +117,7 @@ NSClientPlayer:NSClientSpectator
virtual void(void) Respawn;
virtual void(void) EvaluateEntity;
virtual float(entity, float) SendEntity;
virtual float(entity, float) OptimiseChangedFlags;
virtual void(void) Death;
virtual void(void) MakePlayer;
@ -133,7 +134,6 @@ enumflags
PLAYER_MODELINDEX,
PLAYER_ORIGIN,
PLAYER_ANGLES,
PLAYER_COLORMAP,
PLAYER_VELOCITY,
PLAYER_FLAGS,
PLAYER_WEAPON,
@ -146,5 +146,5 @@ enumflags
PLAYER_TIMINGS,
PLAYER_VEHICLE,
PLAYER_SPECTATE,
PLAYER_CUSTOMFIELDSTART = PLAYER_SPECTATE
PLAYER_CUSTOMFIELDSTART,
};

View File

@ -290,6 +290,7 @@ NSClientPlayer::ReceiveEntity(float new, float flChanged)
}
READENTITY_INT(modelindex, PLAYER_MODELINDEX)
READENTITY_BYTE(colormap, PLAYER_MODELINDEX)
READENTITY_COORD(origin[0], PLAYER_ORIGIN)
READENTITY_COORD(origin[1], PLAYER_ORIGIN)
READENTITY_COORD(origin[2], PLAYER_ORIGIN)
@ -299,7 +300,6 @@ NSClientPlayer::ReceiveEntity(float new, float flChanged)
READENTITY_ANGLE(angles[0], PLAYER_ANGLES)
READENTITY_ANGLE(angles[1], PLAYER_ANGLES)
READENTITY_ANGLE(angles[2], PLAYER_ANGLES)
READENTITY_BYTE(colormap, PLAYER_VELOCITY)
READENTITY_COORD(velocity[0], PLAYER_VELOCITY)
READENTITY_COORD(velocity[1], PLAYER_VELOCITY)
READENTITY_COORD(velocity[2], PLAYER_VELOCITY)
@ -664,6 +664,7 @@ void
NSClientPlayer::EvaluateEntity(void)
{
EVALUATE_FIELD(modelindex, PLAYER_MODELINDEX)
EVALUATE_FIELD(colormap, PLAYER_MODELINDEX)
EVALUATE_VECTOR(origin, 0, PLAYER_ORIGIN)
EVALUATE_VECTOR(origin, 1, PLAYER_ORIGIN)
EVALUATE_VECTOR(origin, 2, PLAYER_ORIGIN)
@ -673,7 +674,6 @@ NSClientPlayer::EvaluateEntity(void)
EVALUATE_VECTOR(angles, 0, PLAYER_ANGLES)
EVALUATE_VECTOR(angles, 1, PLAYER_ANGLES)
EVALUATE_VECTOR(angles, 2, PLAYER_ANGLES)
EVALUATE_FIELD(colormap, PLAYER_VELOCITY)
EVALUATE_VECTOR(velocity, 0, PLAYER_VELOCITY)
EVALUATE_VECTOR(velocity, 1, PLAYER_VELOCITY)
EVALUATE_VECTOR(velocity, 2, PLAYER_VELOCITY)
@ -721,6 +721,7 @@ float
NSClientPlayer::SendEntity(entity ePEnt, float flChanged)
{
SENDENTITY_INT(modelindex, PLAYER_MODELINDEX)
SENDENTITY_BYTE(colormap, PLAYER_MODELINDEX)
SENDENTITY_COORD(origin[0], PLAYER_ORIGIN)
SENDENTITY_COORD(origin[1], PLAYER_ORIGIN)
SENDENTITY_COORD(origin[2], PLAYER_ORIGIN)
@ -730,7 +731,6 @@ NSClientPlayer::SendEntity(entity ePEnt, float flChanged)
SENDENTITY_ANGLE(angles[0], PLAYER_ANGLES)
SENDENTITY_ANGLE(angles[1], PLAYER_ANGLES)
SENDENTITY_ANGLE(angles[2], PLAYER_ANGLES)
SENDENTITY_BYTE(colormap, PLAYER_VELOCITY)
SENDENTITY_COORD(velocity[0], PLAYER_VELOCITY)
SENDENTITY_COORD(velocity[1], PLAYER_VELOCITY)
SENDENTITY_COORD(velocity[2], PLAYER_VELOCITY)
@ -767,6 +767,35 @@ NSClientPlayer::SendEntity(entity ePEnt, float flChanged)
return (1);
}
float
NSClientPlayer::OptimiseChangedFlags(entity ePEnt, float flChanged)
{
bool is_spec = false;
bool spectarget = false;
/* figure out if we should optimise this player */
if (ePEnt.flags & FL_CLIENT && ePEnt != this) {
NSClientSpectator sp = (NSClientSpectator)ePEnt;
is_spec = (sp.IsFakeSpectator() || sp.IsRealSpectator());
spectarget = (is_spec == true && edict_num(sp.spec_ent) == this);
}
/* if we're a spectator of any type and spectate this player */
if (ePEnt != this && spectarget == false) {
flChanged &= ~PLAYER_ITEMS;
flChanged &= ~PLAYER_HEALTH;
flChanged &= ~PLAYER_TIMINGS;
flChanged &= ~PLAYER_AMMO1;
flChanged &= ~PLAYER_AMMO2;
flChanged &= ~PLAYER_AMMO3;
flChanged &= ~PLAYER_FLAGS;
flChanged &= ~PLAYER_PUNCHANGLE;
flChanged &= ~PLAYER_VIEWZOOM;
flChanged &= ~PLAYER_SPECTATE;
}
return flChanged;
}
/*
====================
_NSClientPlayer_useworkaround