]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/func/door.qc
Fix #2744 "Blocking of bmodel movers is broken"
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / func / door.qc
index 57faf51455f18f0c47b5732dbf199045d73ed27d..2dcd2333d214f3137a0de938a1fe9582524b9906 100644 (file)
@@ -27,6 +27,7 @@ void door_go_up(entity this, entity actor, entity trigger);
 
 void door_blocked(entity this, entity blocker)
 {
+       bool reverse = false;
        if((this.spawnflags & DOOR_CRUSH)
 #ifdef SVQC
                && (blocker.takedamage != DAMAGE_NO)
@@ -69,6 +70,7 @@ void door_blocked(entity this, entity blocker)
                                        else
                                                door_rotating_go_down(this);
                                }
+                               reverse = true;
                        }
                }
 #ifdef SVQC
@@ -80,6 +82,8 @@ void door_blocked(entity this, entity blocker)
                }
 #endif
        }
+       if (!reverse)
+               SUB_CalcMovePause(this);
 }
 
 void door_hit_top(entity this)
@@ -361,7 +365,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;
 
@@ -653,12 +657,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)
                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 != "")
        {
@@ -670,14 +687,14 @@ void door_init_shared(entity this)
                precache_sound(this.noise2);
        }
 
-        if(autocvar_sv_doors_always_open)
-        {
-                 this.wait = -1;
-        }
-        else if (!this.wait)
-        {
-               this.wait = 3;
-        }
+       if(autocvar_sv_doors_always_open)
+       {
+               this.wait = -1;
+       }
+       else if (!this.wait)
+       {
+               this.wait = 3;
+       }
 
        if (!this.lip)
        {
@@ -686,7 +703,7 @@ void door_init_shared(entity this)
 
        this.state = STATE_BOTTOM;
 
-       if (GetResource(this, RES_HEALTH))
+       if (GetResource(this, RES_HEALTH) || (q3compat && this.targetname == ""))
        {
                //this.canteamdamage = true; // TODO
                this.takedamage = DAMAGE_YES;
@@ -731,14 +748,17 @@ spawnfunc(func_door)
        this.pos1 = this.origin;
        this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip);
 
-        if(autocvar_sv_doors_always_open)
-        {
-                this.speed = max(750, this.speed);
-        }
-        else if (!this.speed)
-        {
-                this.speed = 100;
-        }
+       if(autocvar_sv_doors_always_open)
+       {
+               this.speed = max(750, this.speed);
+       }
+       else if (!this.speed)
+       {
+               if (q3compat)
+                       this.speed = 400;
+               else
+                       this.speed = 100;
+       }
 
        settouch(this, door_touch);