]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/func/door.qc
Resolve conflicts 2: Merge branch 'master' into bones_was_here/q3compat
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / func / door.qc
index 66de9fbb378ab91ede399beef489793e12475af5..d3c042ef93dae155463cfff3f6b012803b88f799 100644 (file)
@@ -361,7 +361,7 @@ void door_trigger_touch(entity this, entity toucher)
 #ifdef SVQC
                if (!((toucher.iscreature || (toucher.flags & FL_PROJECTILE)) && !IS_DEAD(toucher)))
 #elif defined(CSQC)
-               if(!((IS_CLIENT(toucher) || toucher.classname == "csqcprojectile") && !IS_DEAD(toucher)))
+               if(!((IS_CLIENT(toucher) || toucher.classname == "ENT_CLIENT_PROJECTILE") && !IS_DEAD(toucher)))
 #endif
                        return;
 
@@ -443,7 +443,7 @@ void LinkDoors(entity this)
 
                if (GetResource(this, RES_HEALTH))
                        return;
-               IFTARGETED
+               if(this.targetname && this.targetname != "")
                        return;
                if (this.items)
                        return;
@@ -511,7 +511,7 @@ void LinkDoors(entity this)
 
        if (GetResource(this, RES_HEALTH))
                return;
-       IFTARGETED
+       if(this.targetname && this.targetname != "")
                return;
        if (this.items)
                return;
@@ -653,12 +653,25 @@ void door_init_shared(entity this)
        }
 
        // TODO: other soundpacks
-       if (this.sounds > 0)
+       if (this.sounds > 0 || q3compat)
        {
+               // Doors in Q3 always have sounds (they're hard coded in Q3 engine)
                this.noise2 = "plats/medplat1.wav";
                this.noise1 = "plats/medplat2.wav";
        }
 
+       if (q3compat)
+       {
+               // CPMA adds these fields for overriding the engine sounds
+               string s = GetField_fullspawndata(this, "sound_start", true);
+               string e = GetField_fullspawndata(this, "sound_end", true);
+
+               if (s)
+                       this.noise2 = strzone(s);
+               if (e)
+                       this.noise1 = strzone(e);
+       }
+
        // sound when door stops moving
        if(this.noise1 && this.noise1 != "")
        {
@@ -674,12 +687,9 @@ void door_init_shared(entity this)
         {
                  this.wait = -1;
         }
-        else
+        else if (!this.wait)
         {
-                 if (!this.wait)
-                 {
-                       this.wait = 3;
-                 }
+               this.wait = 3;
         }
 
        if (!this.lip)
@@ -736,14 +746,14 @@ spawnfunc(func_door)
 
         if(autocvar_sv_doors_always_open)
         {
-                this.speed = 750;
+                this.speed = max(750, this.speed);
         }
-        else
+        else if (!this.speed)
         {
-                if (!this.speed)
-                {
-                        this.speed = 100;
-                }
+               if (q3compat)
+                       this.speed = 400;
+               else
+                       this.speed = 100;
         }
 
        settouch(this, door_touch);