X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Fplatforms.qc;h=7b583f1d3d370545b900505b40167cadb966c2e3;hb=5ecaac8e9064c2eae23370c07c14a7e66abb8935;hp=b837d7c5a8788c43d36d019e08919dfe4d9966e4;hpb=2aed36e128f8f00da9c76f9e66baae89d5bb26b2;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/platforms.qc b/qcsrc/common/triggers/platforms.qc index b837d7c5a..7b583f1d3 100644 --- a/qcsrc/common/triggers/platforms.qc +++ b/qcsrc/common/triggers/platforms.qc @@ -1,38 +1,33 @@ void generic_plat_blocked() { #ifdef SVQC + SELFPARAM(); if(self.dmg && other.takedamage != DAMAGE_NO) { if(self.dmgtime2 < time) { - 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'); self.dmgtime2 = time + self.dmgtime; } // Gib dead/dying stuff - if(other.deadflag != DEAD_NO) - Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + if(IS_DEAD(other)) + Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } #endif } void plat_spawn_inside_trigger() -{ +{SELFPARAM(); entity trigger; vector tmin, tmax; trigger = spawn(); - trigger.touch = plat_center_touch; + settouch(trigger, plat_center_touch); trigger.movetype = MOVETYPE_NONE; trigger.solid = SOLID_TRIGGER; trigger.enemy = self; -#ifdef CSQC - trigger.drawmask = MASK_NORMAL; - trigger.trigger_touch = plat_center_touch; - trigger.draw = trigger_draw_generic; -#endif - tmin = self.absmin + '25 25 0'; tmax = self.absmax - '25 25 -8'; tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8); @@ -63,36 +58,36 @@ void plat_spawn_inside_trigger() objerror("plat_spawn_inside_trigger: platform has odd size or lip, can't spawn"); } -void plat_hit_top() +void plat_hit_top(entity this) { - sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = 1; - self.SUB_THINK = plat_go_down; + SUB_THINK(self, plat_go_down); self.SUB_NEXTTHINK = self.SUB_LTIME + 3; } -void plat_hit_bottom() +void plat_hit_bottom(entity this) { - sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = 2; } -void plat_go_down() +void plat_go_down(entity this) { - sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); self.state = 3; SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom); } void plat_go_up() -{ - sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); +{SELFPARAM(); + _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); self.state = 4; SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top); } -void plat_center_touch() +void plat_center_touch(entity this) { #ifdef SVQC if (!other.iscreature) @@ -103,18 +98,17 @@ void plat_center_touch() #elif defined(CSQC) if (!IS_PLAYER(other)) return; - if(PHYS_DEAD(other)) + if(IS_DEAD(other)) return; #endif - self = self.enemy; - if (self.state == 2) - plat_go_up (); - else if (self.state == 1) - self.SUB_NEXTTHINK = self.SUB_LTIME + 1; + if (self.enemy.state == 2) + WITHSELF(self.enemy, plat_go_up()); + else if (self.enemy.state == 1) + self.enemy.SUB_NEXTTHINK = self.enemy.SUB_LTIME + 1; } -void plat_outside_touch() +void plat_outside_touch(entity this) { #ifdef SVQC if (!other.iscreature) @@ -127,30 +121,31 @@ void plat_outside_touch() return; #endif - self = self.enemy; - if (self.state == 1) - plat_go_down (); + if (self.enemy.state == 1) { + entity e = self.enemy; + WITHSELF(e, plat_go_down(e)); + } } -void plat_trigger_use() +void plat_trigger_use(entity this, entity actor, entity trigger) { #ifdef SVQC - if (self.think) + if (getthink(this)) return; // already activated #elif defined(CSQC) - if(self.move_think) + if(this.move_think) return; #endif - plat_go_down(); + WITHSELF(this, plat_go_down(this)); } void plat_crush() -{ +{SELFPARAM(); if((self.spawnflags & 4) && (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 @@ -158,15 +153,15 @@ void plat_crush() #ifdef SVQC if((self.dmg) && (other.takedamage != DAMAGE_NO)) { // 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'); // Gib dead/dying stuff - if(other.deadflag != DEAD_NO) - Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + if(IS_DEAD(other)) + Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } #endif if (self.state == 4) - plat_go_down (); + plat_go_down (self); else if (self.state == 3) plat_go_up (); // when in other states, then the plat_crush event came delayed after @@ -175,33 +170,33 @@ void plat_crush() } } -void plat_use() +void plat_use(entity this, entity actor, entity trigger) { - self.use = func_null; - if (self.state != 4) + this.use = func_null; + if (this.state != 4) objerror ("plat_use: not in up state"); - plat_go_down(); + WITHSELF(this, plat_go_down(this)); } .string sound1, sound2; -void plat_reset() +void plat_reset(entity this) { IFTARGETED { - setorigin (self, self.pos1); - self.state = 4; - self.use = plat_use; + setorigin (this, this.pos1); + this.state = 4; + this.use = plat_use; } else { - setorigin (self, self.pos2); - self.state = 2; - self.use = plat_trigger_use; + setorigin (this, this.pos2); + this.state = 2; + this.use = plat_trigger_use; } #ifdef SVQC - self.SendFlags |= SF_TRIGGER_RESET; + this.SendFlags |= SF_TRIGGER_RESET; #endif }