]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
help other qccs a bit
authorRudolf Polzer <divverent@xonotic.org>
Thu, 16 Jun 2011 05:52:02 +0000 (07:52 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 16 Jun 2011 05:52:02 +0000 (07:52 +0200)
qcsrc/server/defs.qh
qcsrc/warpzonelib/common.qc
qcsrc/warpzonelib/common.qh
qcsrc/warpzonelib/server.qc

index d6140ea2afaaab83b826f0890820c5062e93550e..cb88d354e4087a13d40ddf5473b50bb9ecef754a 100644 (file)
@@ -562,10 +562,6 @@ void ClientData_Touch(entity e);
 
 vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
 
-// the QC VM sucks
-#define BITXOR(v,b)        ((v) + (b) - 2 * ((v) & (b)))
-#define BITXOR_ASSIGN(v,b) ((v) += ((b) - 2 * ((v) & (b))))
-
 .float wasplayer;
 
 float servertime, serverprevtime, serverframetime;
index 62e74682090c725e544ce7725e57bc8ba2a06294..3481ed175cccde39c00b561793e6a045be69e9f9 100644 (file)
@@ -230,7 +230,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
                        break;
        }
        if((contentshack = (forent.dphitcontentsmask && !(forent.dphitcontentsmask & DPCONTENTS_SOLID))))
-               forent.dphitcontentsmask |= DPCONTENTS_SOLID;
+               BITSET_ASSIGN(forent.dphitcontentsmask, DPCONTENTS_SOLID);
 
        // if starting in warpzone, first transform
        wz = WarpZone_Find(org + mi, org + ma);
@@ -304,7 +304,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
        WarpZone_MakeAllOther();
 :fail
        if(contentshack)
-               forent.dphitcontentsmask &~= DPCONTENTS_SOLID;
+               BITCLR_ASSIGN(forent.dphitcontentsmask, DPCONTENTS_SOLID);
        trace_startsolid = sol;
        v_forward = vf;
        v_right = vr;
index 72485f25c4bc91ef64d1af1ab4c81576a407a6da..ae05ce026b2058d0ba02d211b0a6724b7491d80d 100644 (file)
@@ -71,3 +71,22 @@ vector WarpZone_RefSys_TransformVelocity(entity from, entity to, vector vel);
 vector WarpZone_RefSys_TransformAngles(entity from, entity to, vector ang);
 vector WarpZone_RefSys_TransformVAngles(entity from, entity to, vector ang);
 entity WarpZone_RefSys_SpawnSameRefSys(entity me);
+
+#ifndef BITCLR
+# define BITCLR(a,b) ((a) - ((a) & (b)))
+#endif
+#ifndef BITSET
+# define BITSET(a,b) ((a) | (b))
+#endif
+#ifndef BITXOR
+# define BITXOR(a,b) (((a) | (b)) - ((a) & (b)))
+#endif
+#ifndef BITCLR_ASSIGN
+# define BITCLR_ASSIGN(a,b) ((a) = (a) - ((a) & (b)))
+#endif
+#ifndef BITSET_ASSIGN
+# define BITSET_ASSIGN(a,b) ((a) |= (b))
+#endif
+#ifndef BITXOR_ASSIGN
+# define BITXOR_ASSIGN(a,b) ((a) = ((a) | (b)) - ((a) & (b)))
+#endif
index 46eaf595b72acf269ce85e46c1392f2ca2901c2d..921b2ed58289df9fadff0acb3d409feca06d498f 100644 (file)
@@ -22,13 +22,10 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector
        player.fixangle = TRUE;
        player.velocity = to_velocity;
 
-       if(player.effects & EF_TELEPORT_BIT)
-               player.effects &~= EF_TELEPORT_BIT;
-       else
-               player.effects |= EF_TELEPORT_BIT;
+       BITXOR_ASSIGN(player.effects, EF_TELEPORT_BIT);
 
        if(player.classname == "player")
-               player.flags &~= FL_ONGROUND;
+               BITCLR_ASSIGN(player.flags, FL_ONGROUND);
 
        WarpZone_PostTeleportPlayer_Callback(player);
 }
@@ -171,11 +168,11 @@ float WarpZone_Send(entity to, float sendflags)
        // we must send this flag for clientside to match properly too
        f = 0;
        if(self.warpzone_isboxy)
-               f |= 1;
+               BITSET_ASSIGN(f, 1);
        if(self.warpzone_fadestart)
-               f |= 2;
+               BITSET_ASSIGN(f, 2);
        if(self.origin != '0 0 0')
-               f |= 4;
+               BITSET_ASSIGN(f, 4);
        WriteByte(MSG_ENTITY, f);
 
        // we need THESE to render the warpzone (and cull properly)...
@@ -224,9 +221,9 @@ float WarpZone_Camera_Send(entity to, float sendflags)
        WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
 
        if(self.warpzone_fadestart)
-               f |= 2;
+               BITSET_ASSIGN(f, 2);
        if(self.origin != '0 0 0')
-               f |= 4;
+               BITSET_ASSIGN(f, 4);
        WriteByte(MSG_ENTITY, f);
 
        // we need THESE to render the warpzone (and cull properly)...
@@ -572,7 +569,7 @@ void spawnfunc_trigger_warpzone(void)
                setsize(self, self.mins, self.maxs);
        self.SendEntity = WarpZone_Send;
        self.SendFlags = 0xFFFFFF;
-       self.effects |= EF_NODEPTHTEST;
+       BITSET_ASSIGN(self.effects, EF_NODEPTHTEST);
        self.warpzone_next = warpzone_first;
        warpzone_first = self;
 }