]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/turret/phaser_weapon.qc
Remove SELFPARAM() from .think and .touch
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / phaser_weapon.qc
index 69717ed3e3b422c96df780ed321bf305bd024c65..1f6d62c95b78bb7fa13a81b8955b00ef4f6b2a05 100644 (file)
@@ -1,23 +1,12 @@
-#ifndef TURRET_PHASER_WEAPON_H
-#define TURRET_PHASER_WEAPON_H
-
-CLASS(PhaserTurretAttack, PortoLaunch)
-/* flags     */ ATTRIB(PhaserTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(PhaserTurretAttack, impulse, int, 9);
-/* refname   */ ATTRIB(PhaserTurretAttack, netname, string, "turret_phaser");
-/* wepname   */ ATTRIB(PhaserTurretAttack, m_name, string, _("Phaser"));
-ENDCLASS(PhaserTurretAttack)
-REGISTER_WEAPON(PHASER, NEW(PhaserTurretAttack));
-
-#endif
+#include "phaser_weapon.qh"
 
 #ifdef IMPLEMENTATION
 
 #ifdef SVQC
-void beam_think();
+void beam_think(entity this);
 
 .int fireflag;
-
+SOUND(PhaserTurretAttack_FIRE, W_Sound("electro_fire"));
 METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
     bool isPlayer = IS_PLAYER(actor);
@@ -25,7 +14,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND_PhaserTurretAttack_FIRE, CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
@@ -37,7 +26,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
         setmodel(beam, MDL_TUR_PHASER_BEAM);
         beam.effects = EF_LOWPRECISION;
         beam.solid = SOLID_NOT;
-        beam.think = beam_think;
+        setthink(beam, beam_think);
         beam.cnt = time + actor.shot_speed;
         beam.shot_spread = time + 2;
         beam.nextthink = time;
@@ -63,9 +52,9 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
     }
 }
 
-void beam_think()
-{SELFPARAM();
-    if ((time > self.cnt) || (self.owner.deadflag != DEAD_NO))
+void beam_think(entity this)
+{
+    if ((time > self.cnt) || (IS_DEAD(self.owner)))
     {
         self.owner.attack_finished_single[0] = time + self.owner.shot_refire;
         self.owner.fireflag = 2;
@@ -87,8 +76,7 @@ void beam_think()
     self.nextthink = time + self.ticrate;
 
     self.owner.attack_finished_single[0] = time + frametime;
-    setself(self.owner);
-    FireImoBeam (   self.tur_shotorg,
+    FireImoBeam (   self.owner, self.tur_shotorg,
                     self.tur_shotorg + self.tur_shotdir_updated * self.target_range,
                     '-1 -1 -1' * self.shot_radius,
                     '1 1 1' * self.shot_radius,
@@ -96,7 +84,6 @@ void beam_think()
                     this.shot_dmg,
                     0.75,
                     DEATH_TURRET_PHASER.m_id);
-    setself(this);
     self.scale = vlen(self.owner.tur_shotorg - trace_endpos) / 256;
 
 }