]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make the client side IS_PLAYER and IS_CLIENT checks more accurate
authorMario <mario@smbclan.net>
Fri, 26 Oct 2018 02:38:28 +0000 (12:38 +1000)
committerMario <mario@smbclan.net>
Fri, 26 Oct 2018 02:38:28 +0000 (12:38 +1000)
qcsrc/client/csqcmodel_hooks.qc
qcsrc/common/physics/player.qh
qcsrc/lib/csqcmodel/cl_model.qc
qcsrc/lib/csqcmodel/common.qh
qcsrc/lib/csqcmodel/sv_model.qc

index bbe0b4d22dc5d3f972f877fea7a15dc7f554688c..0b62704c5baa6aabebdc2a932c7662cdf37daeb0 100644 (file)
@@ -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)
index ee78f71a4807a1d020c5fdb2966d27955a6676de..9ecf7eab71ed436c9d5e51be8246b4818474440f 100644 (file)
@@ -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))
 
index 1275f11783a0fb64fe3d2edfef4a31c4f8ec0d3b..12be0dbaa479c099cc2df23c376a21a1924b43c7 100644 (file)
@@ -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
index 942c021e828d0d125bac46ff8808ff84ddaac205..a2c9e68e556ac81dac54e6b56226d0dc2a8a73ba 100644 (file)
@@ -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
index ba18464d723d80b3690c4f81c124c88211b4dabb..584bfc23ff6f0901f524f823e0b6e66465944c1d 100644 (file)
@@ -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);