]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/turret/phaser.qc
Merge branch 'DefaultUser/gametype_votescreen' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / phaser.qc
index 5c973c65aef92dc531329a1cd426a03b677df22f..31ece9cb2b8b86d7946d9c0eaf45634910e09036 100644 (file)
@@ -1,55 +1,36 @@
-#ifndef TURRET_PHASER_H
-#define TURRET_PHASER_H
-
-#include "phaser_weapon.qc"
-
-CLASS(PhaserTurret, Turret)
-/* spawnflags */ ATTRIB(PhaserTurret, spawnflags, int, TUR_FLAG_SNIPER | TUR_FLAG_HITSCAN | TUR_FLAG_PLAYER);
-/* mins       */ ATTRIB(PhaserTurret, mins, vector, '-32 -32 0');
-/* maxs       */ ATTRIB(PhaserTurret, maxs, vector, '32 32 64');
-/* modelname  */ ATTRIB(PhaserTurret, mdl, string, "base.md3");
-/* model      */ ATTRIB_STRZONE(PhaserTurret, model, string, strcat("models/turrets/", this.mdl));
-/* head_model */ ATTRIB_STRZONE(PhaserTurret, head_model, string, strcat("models/turrets/", "phaser.md3"));
-/* netname    */ ATTRIB(PhaserTurret, netname, string, "phaser");
-/* fullname   */ ATTRIB(PhaserTurret, turret_name, string, _("Phaser Cannon"));
-    ATTRIB(PhaserTurret, m_weapon, Weapon, WEP_PHASER);
-ENDCLASS(PhaserTurret)
-REGISTER_TURRET(PHASER, NEW(PhaserTurret));
-
-#endif
+#include "phaser.qh"
 
 #ifdef IMPLEMENTATION
 
-#include "phaser_weapon.qc"
-
 #ifdef SVQC
 
-spawnfunc(turret_phaser) { if (!turret_initialize(TUR_PHASER)) remove(self); }
+spawnfunc(turret_phaser) { if (!turret_initialize(this, TUR_PHASER)) delete(this); }
+
+.int fireflag;
 
 METHOD(PhaserTurret, tr_think, void(PhaserTurret thistur, entity it))
 {
-    SELFPARAM();
-    if (self.tur_head.frame != 0)
+    if (it.tur_head.frame != 0)
     {
-        if (self.fireflag == 1)
+        if (it.fireflag == 1)
         {
-            if (self.tur_head.frame == 10)
-                self.tur_head.frame = 1;
+            if (it.tur_head.frame == 10)
+                it.tur_head.frame = 1;
             else
-                self.tur_head.frame = self.tur_head.frame +1;
+                it.tur_head.frame = it.tur_head.frame +1;
         }
-        else if (self.fireflag == 2 )
+        else if (it.fireflag == 2 )
         {
-            self.tur_head.frame = self.tur_head.frame +1;
-            if (self.tur_head.frame == 15)
+            it.tur_head.frame = it.tur_head.frame +1;
+            if (it.tur_head.frame == 15)
             {
-                self.tur_head.frame = 0;
-                self.fireflag = 0;
+                it.tur_head.frame = 0;
+                it.fireflag = 0;
             }
         }
     }
 }
-float turret_phaser_firecheck();
+bool turret_phaser_firecheck(entity this);
 METHOD(PhaserTurret, tr_setup, void(PhaserTurret this, entity it))
 {
     it.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
@@ -57,11 +38,10 @@ METHOD(PhaserTurret, tr_setup, void(PhaserTurret this, entity it))
 
     it.turret_firecheckfunc = turret_phaser_firecheck;
 }
-float turret_phaser_firecheck()
+bool turret_phaser_firecheck(entity this)
 {
-    SELFPARAM();
-    if (self.fireflag != 0) return 0;
-    return turret_firecheck();
+    if (this.fireflag != 0) return false;
+    return turret_firecheck(this);
 }
 
 #endif