void door_blocked(entity this, entity blocker)
{
+ bool reverse = false;
if((this.spawnflags & DOOR_CRUSH)
#ifdef SVQC
&& (blocker.takedamage != DAMAGE_NO)
else
door_rotating_go_down(this);
}
+ reverse = true;
}
}
#ifdef SVQC
}
#endif
}
+ if (!reverse && this.classname == "door")
+ SUB_CalcMovePause(this);
}
void door_hit_top(entity this)
#endif
return;
- if (time < this.door_finished)
+ if (this.owner.state == STATE_UP)
return;
// check if door is locked
if (!door_check_keys(this, toucher))
return;
- this.door_finished = time + 1;
+ if (this.owner.state == STATE_TOP)
+ {
+ if (this.owner.nextthink < this.owner.ltime + this.owner.wait)
+ {
+ entity e = this.owner;
+ do {
+ e.nextthink = e.ltime + e.wait;
+ e = e.enemy;
+ } while (e != this.owner);
+ }
+ return;
+ }
door_use(this.owner, toucher, NULL);
}
}
// 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 != "")
{
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 = q3compat ? 2 : 3;
+ }
if (!this.lip)
{
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;
door_init_shared(this);
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)
- {
- if (autocvar_sv_q3defragcompat)
+ vector absmovedir;
+ absmovedir.x = fabs(this.movedir.x);
+ absmovedir.y = fabs(this.movedir.y);
+ absmovedir.z = fabs(this.movedir.z);
+ this.pos2 = this.pos1 + this.movedir * (absmovedir * this.size - this.lip);
+
+ 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;
- }
+ this.speed = 100;
+ }
settouch(this, door_touch);