)
{ // KIll Kill Kill!!
#ifdef SVQC
- Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
#endif
}
else
{
#ifdef SVQC
if((self.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite?
- Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
#endif
// don't change direction for dead or dying stuff
{
//gib dying stuff just to make sure
if((self.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite?
- Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
}
#endif
}
void door_hit_top()
{SELFPARAM();
if (self.noise1 != "")
- sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
+ _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = STATE_TOP;
if (self.spawnflags & DOOR_TOGGLE)
return; // don't come down automatically
void door_hit_bottom()
{SELFPARAM();
if (self.noise1 != "")
- sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
+ _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = STATE_BOTTOM;
}
void door_go_down()
{SELFPARAM();
if (self.noise2 != "")
- sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
+ _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
if (self.max_health)
{
self.takedamage = DAMAGE_YES;
}
if (self.noise2 != "")
- sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
+ _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, door_hit_top);
=============================================================================
*/
-float door_check_keys(void)
-{SELFPARAM();
- local entity door;
-
-
- if (self.owner)
- door = self.owner;
- else
- door = self;
+bool door_check_keys(entity door, entity player)
+{
+ if(door.owner)
+ door = door.owner;
// no key needed
- if (!door.itemkeys)
+ if(!door.itemkeys)
return true;
// this door require a key
// only a player can have a key
- if (!IS_PLAYER(other))
+ if(!IS_PLAYER(player))
return false;
-#ifdef SVQC
- if (item_keys_usekey(door, other))
- {
- // some keys were used
- if (other.key_door_messagetime <= time)
- {
+ int valid = (door.itemkeys & player.itemkeys);
+ door.itemkeys &= ~valid; // only some of the needed keys were given
- play2(other, "misc/talk.wav");
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(door.itemkeys));
- other.key_door_messagetime = time + 2;
- }
+ if(!door.itemkeys)
+ {
+#ifdef SVQC
+ play2(player, SND(TALK));
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_DOOR_UNLOCKED);
+#endif
+ return true;
}
- else
+
+ if(!valid)
{
- // no keys were used
- if (other.key_door_messagetime <= time)
+#ifdef SVQC
+ if(player.key_door_messagetime <= time)
{
- play2(other, "misc/talk.wav");
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(door.itemkeys));
-
- other.key_door_messagetime = time + 2;
+ play2(player, SND(TALK));
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(door.itemkeys));
+ player.key_door_messagetime = time + 2;
}
- }
#endif
+ return false;
+ }
- if (door.itemkeys)
- {
+ // door needs keys the player doesn't have
#ifdef SVQC
- // door is now unlocked
- play2(other, "misc/talk.wav");
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_UNLOCKED);
-#endif
- return true;
+ if(player.key_door_messagetime <= time)
+ {
+ play2(player, SND(TALK));
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(door.itemkeys));
+ player.key_door_messagetime = time + 2;
}
- else
- return false;
+#endif
+
+ return false;
}
void door_fire()
{
if (IS_CLIENT(other))
centerprint(other, self.owner.message);
- play2(other, "misc/talk.wav");
+ play2(other, self.owner.noise);
}
#endif
}
if((self.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
#ifdef SVQC
- Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
#endif
}
else
#ifdef SVQC
if((self.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite?
- Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
#endif
//Dont chamge direction for dead or dying stuff
{
//gib dying stuff just to make sure
if((self.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite?
- Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
}
#endif
}
void door_rotating_hit_top()
{SELFPARAM();
if (self.noise1 != "")
- sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
+ _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = STATE_TOP;
if (self.spawnflags & DOOR_TOGGLE)
return; // don't come down automatically
void door_rotating_hit_bottom()
{SELFPARAM();
if (self.noise1 != "")
- sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
+ _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
if (self.lip==666) // self.lip is used to remember reverse opening direction for door_rotating
{
self.pos2 = '0 0 0' - self.pos2;
void door_rotating_go_down()
{SELFPARAM();
if (self.noise2 != "")
- sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
+ _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
if (self.max_health)
{
self.takedamage = DAMAGE_YES;
return;
}
if (self.noise2 != "")
- sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
+ _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
self.state = STATE_UP;
SUB_CalcAngleMove (self.pos2, TSPEED_LINEAR, self.speed, door_rotating_hit_top);
return;
// check if door is locked
- if (!door_check_keys())
+ if (!door_check_keys(self, other))
return;
self.attack_finished_single = time + 1;
door_use ();
}
-void spawn_field(vector fmins, vector fmaxs)
+void door_spawnfield(vector fmins, vector fmaxs)
{SELFPARAM();
entity trigger;
vector t1 = fmins, t2 = fmaxs;
if (self.items)
return;
- spawn_field(self.absmin, self.absmax);
+ door_spawnfield(self.absmin, self.absmax);
return; // don't want to link this door
}
if (self.items)
return;
- spawn_field(cmins, cmaxs);
+ door_spawnfield(cmins, cmaxs);
}
#ifdef SVQC
#ifdef SVQC
// spawnflags require key (for now only func_door)
-void spawnfunc_func_door()
-{SELFPARAM();
+spawnfunc(func_door)
+{
// Quake 1 keys compatibility
if (self.spawnflags & SPAWNFLAGS_GOLD_KEY)
self.itemkeys |= ITEM_KEY_BIT(0);
if (self.spawnflags & SPAWNFLAGS_SILVER_KEY)
self.itemkeys |= ITEM_KEY_BIT(1);
- SetMovedir ();
+ SetMovedir(self);
self.max_health = self.health;
if (!InitMovingBrushTrigger())
self.effects |= EF_LOWPRECISION;
self.classname = "door";
+ if(self.noise == "")
+ self.noise = "misc/talk.wav";
+ precache_sound(self.noise);
+
self.blocked = door_blocked;
self.use = door_use;
#elif defined(CSQC)
-void door_draw()
+void door_draw(entity this)
{
Movetype_Physics_NoMatchServer();
- trigger_draw_generic();
+ trigger_draw_generic(this);
}
void ent_door()
self.spawnflags = ReadByte();
self.mdl = strzone(ReadString());
- setmodel(self, self.mdl);
+ _setmodel(self, self.mdl);
trigger_common_read(true);