]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Replace magic numbers in door_rotating, fix sound precache issues
authorFreddy <schro.sb@gmail.com>
Mon, 5 Mar 2018 12:26:24 +0000 (13:26 +0100)
committerFreddy <schro.sb@gmail.com>
Mon, 5 Mar 2018 12:26:24 +0000 (13:26 +0100)
Also remove useless spawnflag check

qcsrc/common/triggers/func/door_rotating.qc
qcsrc/common/triggers/func/door_rotating.qh

index c61a02686650eb56ae3a138d3cace85fed2a99b0..04cd81a401710bf64086c9665dd7486999f48650 100644 (file)
@@ -52,9 +52,9 @@ spawnfunc(func_door_rotating)
        //      this.deathtype = " got in the way";
 
        // I abuse "movedir" for denoting the axis for now
-       if (this.spawnflags & 64) // X (untested)
+       if (this.spawnflags & DOOR_ROTATING_XAXIS)
                this.movedir = '0 0 1';
-       else if (this.spawnflags & 128) // Y (untested)
+       else if (this.spawnflags & DOOR_ROTATING_YAXIS)
                this.movedir = '1 0 0';
        else // Z
                this.movedir = '0 1 0';
@@ -75,21 +75,24 @@ spawnfunc(func_door_rotating)
        setblocked(this, door_blocked);
        this.use = door_use;
 
-    if(this.spawnflags & 8)
-        this.dmg = 10000;
-
     if(this.dmg && (this.message == ""))
                this.message = "was squished";
     if(this.dmg && (this.message2 == ""))
                this.message2 = "was squished by";
 
-    if (this.sounds > 0)
+       if (this.sounds > 0)
        {
-               precache_sound ("plats/medplat1.wav");
-               precache_sound ("plats/medplat2.wav");
                this.noise2 = "plats/medplat1.wav";
                this.noise1 = "plats/medplat2.wav";
        }
+       if(this.noise1 && this.noise1 != "")
+       {
+               precache_sound(this.noise1);
+       }
+       if(this.noise2 && this.noise2 != "")
+       {
+               precache_sound(this.noise2);
+       }
 
        if (!this.speed)
                this.speed = 50;
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..2e299b20558680aa959b13ff426d8f4ca9b13545 100644 (file)
@@ -1 +1,5 @@
 #pragma once
+
+
+const int DOOR_ROTATING_XAXIS = BIT(6);
+const int DOOR_ROTATING_YAXIS = BIT(7);