From: Mario Date: Fri, 26 Oct 2018 02:38:28 +0000 (+1000) Subject: Make the client side IS_PLAYER and IS_CLIENT checks more accurate X-Git-Tag: xonotic-v0.8.5~1745 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=017bc693f17e37e446c118f0a1c330ba5c5f321b;p=xonotic%2Fxonotic-data.pk3dir.git Make the client side IS_PLAYER and IS_CLIENT checks more accurate --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index bbe0b4d22..0b62704c5 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -413,7 +413,7 @@ void CSQCModel_AutoTagIndex_Apply(entity this) // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch if(this.tag_entity.classname == "csqcmodel") { - CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.isplayermodel & ISPLAYER_ENT)); + CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.isplayermodel & ISPLAYER_CLIENT)); } if(this.tag_entity.modelindex != this.tag_entity_lastmodelindex) diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index ee78f71a4..9ecf7eab7 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -190,8 +190,8 @@ STATIC_INIT(PHYS_INPUT_BUTTON) .entity hook; // TODO - #define IS_CLIENT(s) (((s).isplayermodel & ISPLAYER_ENT) || (s) == csqcplayer) - #define IS_PLAYER(s) ((s).isplayermodel & ISPLAYER_ENT) + #define IS_CLIENT(s) (((s).isplayermodel & ISPLAYER_CLIENT) || (s) == csqcplayer) + #define IS_PLAYER(s) ((s).isplayermodel & ISPLAYER_PLAYER) #define IS_NOT_A_CLIENT(s) (!(s).isplayermodel && (s) != csqcplayer) #define isPushable(s) ((s).isplayermodel || (s).pushable || ((s).flags & FL_PROJECTILE)) diff --git a/qcsrc/lib/csqcmodel/cl_model.qc b/qcsrc/lib/csqcmodel/cl_model.qc index 1275f1178..12be0dbaa 100644 --- a/qcsrc/lib/csqcmodel/cl_model.qc +++ b/qcsrc/lib/csqcmodel/cl_model.qc @@ -179,7 +179,7 @@ void CSQCModel_InterpolateAnimation_Do(entity this) void CSQCModel_Draw(entity this) { // some nice flags for CSQCMODEL_IF and the hooks - bool isplayer = (this.entnum >= 1 && this.entnum <= maxclients); + bool isplayer = (this.isplayermodel & ISPLAYER_CLIENT); noref bool islocalplayer = (this.entnum == player_localnum + 1); noref bool isnolocalplayer = (isplayer && (this.entnum != player_localnum + 1)); @@ -226,7 +226,7 @@ NET_HANDLE(ENT_CLIENT_MODEL, bool isnew) int psf = ReadByte(); // some nice flags for CSQCMODEL_IF and the hooks - bool isplayer = (psf & ISPLAYER_ENT) || (this.entnum >= 1 && this.entnum <= maxclients); + bool isplayer = (psf & ISPLAYER_CLIENT) || (this.entnum >= 1 && this.entnum <= maxclients); if (isnew && isplayer) { CSQCModel_players[this.entnum - 1] = this; @@ -235,8 +235,9 @@ NET_HANDLE(ENT_CLIENT_MODEL, bool isnew) bool islocalplayer = (this.entnum == player_localnum + 1); noref bool isnolocalplayer = (isplayer && !islocalplayer); - this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_ENT, isplayer); + this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_CLIENT, isplayer); this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_LOCAL, islocalplayer); + this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_PLAYER, (psf & ISPLAYER_PLAYER)); this.classname = "csqcmodel"; this.iflags |= IFLAG_ORIGIN; // interpolate origin too diff --git a/qcsrc/lib/csqcmodel/common.qh b/qcsrc/lib/csqcmodel/common.qh index 942c021e8..a2c9e68e5 100644 --- a/qcsrc/lib/csqcmodel/common.qh +++ b/qcsrc/lib/csqcmodel/common.qh @@ -54,8 +54,9 @@ IN THE SOFTWARE.\ .float lerpfrac; const int ISPLAYER_MODEL = BIT(0); // using a player model -const int ISPLAYER_ENT = BIT(1); // is an actual player +const int ISPLAYER_CLIENT = BIT(1); // is a client const int ISPLAYER_LOCAL = BIT(2); // is the local player +const int ISPLAYER_PLAYER = BIT(3); // is a player in the match const int CSQCMODEL_PROPERTY_FRAME = BIT(23); const int CSQCMODEL_PROPERTY_TELEPORTED = BIT(22); // the "teleport bit" cancelling interpolation diff --git a/qcsrc/lib/csqcmodel/sv_model.qc b/qcsrc/lib/csqcmodel/sv_model.qc index ba18464d7..584bfc23f 100644 --- a/qcsrc/lib/csqcmodel/sv_model.qc +++ b/qcsrc/lib/csqcmodel/sv_model.qc @@ -33,8 +33,9 @@ bool CSQCModel_Send(entity this, entity to, int sf) noref bool isnolocalplayer = (isplayer && (this != to)); int psf = 0; - psf = BITSET(psf, ISPLAYER_ENT, isplayer); + psf = BITSET(psf, ISPLAYER_CLIENT, isplayer); psf = BITSET(psf, ISPLAYER_LOCAL, islocalplayer); + psf = BITSET(psf, ISPLAYER_PLAYER, IS_PLAYER(this)); WriteHeader(MSG_ENTITY, ENT_CLIENT_MODEL); WriteInt24_t(MSG_ENTITY, sf);