if(!door.itemkeys)
{
#ifdef SVQC
- play2(player, SND(TALK));
+ play2(player, door.noise);
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_DOOR_UNLOCKED);
#endif
return true;
#ifdef SVQC
-// spawnflags require key (for now only func_door)
-spawnfunc(func_door)
+// common code for func_door and func_door_rotating spawnfuncs
+void door_init_shared(entity this)
{
- // Quake 1 keys compatibility
- if (this.spawnflags & SPAWNFLAGS_GOLD_KEY)
- this.itemkeys |= ITEM_KEY_BIT(0);
- if (this.spawnflags & SPAWNFLAGS_SILVER_KEY)
- this.itemkeys |= ITEM_KEY_BIT(1);
-
- SetMovedir(this);
-
this.max_health = this.health;
- if (!InitMovingBrushTrigger(this))
- return;
- this.effects |= EF_LOWPRECISION;
- this.classname = "door";
+ // unlock sound
if(this.noise == "")
+ {
this.noise = "misc/talk.wav";
+ }
+ // door still locked sound
if(this.noise3 == "")
+ {
this.noise3 = "misc/talk.wav";
+ }
precache_sound(this.noise);
precache_sound(this.noise3);
- setblocked(this, door_blocked);
- this.use = door_use;
-
- if(this.dmg && (this.message == ""))
+ if((this.dmg || (this.spawnflags & DOOR_CRUSH)) && (this.message == ""))
+ {
this.message = "was squished";
- if(this.dmg && (this.message2 == ""))
+ }
+ if((this.dmg || (this.spawnflags & DOOR_CRUSH)) && (this.message2 == ""))
+ {
this.message2 = "was squished by";
+ }
+ // TODO: other soundpacks
if (this.sounds > 0)
{
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); }
+ // sound when door stops moving
+ if(this.noise1 && this.noise1 != "")
+ {
+ precache_sound(this.noise1);
+ }
+ // sound when door is moving
+ if(this.noise2 && this.noise2 != "")
+ {
+ precache_sound(this.noise2);
+ }
- if (!this.speed)
- this.speed = 100;
if (!this.wait)
+ {
this.wait = 3;
+ }
if (!this.lip)
+ {
this.lip = 8;
+ }
+
+ this.state = STATE_BOTTOM;
+
+ if (this.health)
+ {
+ //this.canteamdamage = true; // TODO
+ this.takedamage = DAMAGE_YES;
+ this.event_damage = door_damage;
+ }
+
+ if (this.items)
+ {
+ this.wait = -1;
+ }
+}
+
+// spawnflags require key (for now only func_door)
+spawnfunc(func_door)
+{
+ // Quake 1 keys compatibility
+ if (this.spawnflags & SPAWNFLAGS_GOLD_KEY)
+ this.itemkeys |= ITEM_KEY_BIT(0);
+ if (this.spawnflags & SPAWNFLAGS_SILVER_KEY)
+ this.itemkeys |= ITEM_KEY_BIT(1);
+
+ SetMovedir(this);
+
+ if (!InitMovingBrushTrigger(this))
+ return;
+ this.effects |= EF_LOWPRECISION;
+ this.classname = "door";
+
+ setblocked(this, door_blocked);
+ this.use = door_use;
this.pos1 = this.origin;
this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip);
if (this.spawnflags & DOOR_START_OPEN)
InitializeEntity(this, door_init_startopen, INITPRIO_SETLOCATION);
- this.state = STATE_BOTTOM;
+ door_init_shared(this);
- if (this.health)
+ if (!this.speed)
{
- //this.canteamdamage = true; // TODO
- this.takedamage = DAMAGE_YES;
- this.event_damage = door_damage;
+ this.speed = 100;
}
- if (this.items)
- this.wait = -1;
-
settouch(this, door_touch);
// LinkDoors can't be done until all of the doors have been spawned, so
spawnfunc(func_door_rotating)
{
- // possible TODO: support for Quake1 keys (like func_door)
- // however SPAWNFLAGS_GOLD_KEY (==8) has the same value as BIDIR_IN_DOWN
-
//if (!this.deathtype) // map makers can override this
// this.deathtype = " got in the way";
this.movedir = this.movedir * this.angles_y;
this.angles = '0 0 0';
- this.max_health = this.health;
this.avelocity = this.movedir;
if (!InitMovingBrushTrigger(this))
return;
setblocked(this, door_blocked);
this.use = door_use;
- if(this.dmg && (this.message == ""))
- this.message = "was squished";
- if(this.dmg && (this.message2 == ""))
- this.message2 = "was squished by";
-
- if (this.sounds > 0)
- {
- 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;
- if (!this.wait)
- this.wait = 1;
- this.lip = 0; // this.lip is used to remember reverse opening direction for door_rotating
-
this.pos1 = '0 0 0';
this.pos2 = this.movedir;
if (this.spawnflags & DOOR_START_OPEN)
InitializeEntity(this, door_rotating_init_startopen, INITPRIO_SETLOCATION);
- this.state = STATE_BOTTOM;
-
- if (this.health)
+ door_init_shared(this);
+ if (!this.speed)
{
- //this.canteamdamage = true; // TODO
- this.takedamage = DAMAGE_YES;
- this.event_damage = door_damage;
+ this.speed = 50;
}
-
- if (this.items)
- this.wait = -1;
+ this.lip = 0; // this.lip is used to remember reverse opening direction for door_rotating
settouch(this, door_touch);