From 3da2597f3c6edc7a99855778400b265074c6142d Mon Sep 17 00:00:00 2001 From: TimePath Date: Mon, 28 Sep 2015 15:55:53 +1000 Subject: [PATCH] Turrets: prepare for upgrade --- qcsrc/common/turrets/all.qh | 27 ++++++------ qcsrc/common/turrets/cl_turrets.qc | 26 ++++++------ qcsrc/common/turrets/sv_turrets.qc | 33 +++++++-------- qcsrc/common/turrets/turret.qh | 43 +++++++++++++------- qcsrc/common/turrets/turret/ewheel.qc | 4 +- qcsrc/common/turrets/turret/flac.qc | 4 +- qcsrc/common/turrets/turret/fusionreactor.qc | 4 +- qcsrc/common/turrets/turret/hellion.qc | 4 +- qcsrc/common/turrets/turret/hk.qc | 4 +- qcsrc/common/turrets/turret/machinegun.qc | 4 +- qcsrc/common/turrets/turret/mlrs.qc | 4 +- qcsrc/common/turrets/turret/phaser.qc | 4 +- qcsrc/common/turrets/turret/plasma.qc | 4 +- qcsrc/common/turrets/turret/plasma_dual.qc | 7 ++-- qcsrc/common/turrets/turret/tesla.qc | 4 +- qcsrc/common/turrets/turret/walker.qc | 4 +- 16 files changed, 99 insertions(+), 81 deletions(-) diff --git a/qcsrc/common/turrets/all.qh b/qcsrc/common/turrets/all.qh index 3e4af08f6..1a464c126 100644 --- a/qcsrc/common/turrets/all.qh +++ b/qcsrc/common/turrets/all.qh @@ -3,48 +3,51 @@ #include "turret.qh" -void register_turret(entity e, float(float) func, float turretflags, vector min_s, vector max_s, string modelname, string headmodelname, string shortname, string mname); +void register_turret(Turret e, bool(Turret, int) func, float turretflags, vector min_s, vector max_s, string modelname, string headmodelname, string shortname, string mname); const int TUR_MAXCOUNT = 24; entity turret_info[TUR_MAXCOUNT], turret_info_first, turret_info_last; float TUR_COUNT; #define _REGISTER_TURRET(id, func, turretflags, min_s, max_s, modelname, headmodelname, shortname, mname) \ - float func(float); \ + bool func(Turret, int); \ REGISTER(RegisterTurrets, TUR, turret_info, TUR_COUNT, id, m_id, NEW(Turret)) { \ register_turret(this, func,turretflags,min_s,max_s,modelname,headmodelname,shortname,mname); \ } void RegisterTurrets(); REGISTER_REGISTRY(RegisterTurrets) +#define REGISTER_TURRET(...) EVAL(OVERLOAD(REGISTER_TURRET, __VA_ARGS__)) + +#define REGISTER_TURRET_2(id, inst) REGISTER(RegisterTurrets, TUR, turret_info, TUR_COUNT, id, m_id, inst) + #ifdef MENUQC -#define REGISTER_TURRET(id,func,turretflags,min_s,max_s,modelname,headmodelname,shortname,mname) \ - _REGISTER_TURRET(id,t_null,turretflags,min_s,max_s,modelname,headmodelname,shortname,mname) +#define REGISTER_TURRET_9(id,func,turretflags,min_s,max_s,modelname,headmodelname,shortname,mname) \ + _REGISTER_TURRET(id,t_new,turretflags,min_s,max_s,modelname,headmodelname,shortname,mname) #else -#define REGISTER_TURRET(id,func,turretflags,min_s,max_s,modelname,headmodelname,shortname,mname) \ +#define REGISTER_TURRET_9(id,func,turretflags,min_s,max_s,modelname,headmodelname,shortname,mname) \ _REGISTER_TURRET(id,func,turretflags,min_s,max_s,modelname,headmodelname,shortname,mname) #endif -void register_turret(Turret e, float(float) func, float turretflags, vector min_s, vector max_s, string modelname, string headmodelname, string shortname, string mname) +void register_turret(Turret e, bool(Turret, int) func, float turretflags, vector min_s, vector max_s, string modelname, string headmodelname, string shortname, string mname) { e.classname = "turret_info"; - e.turretid = e.m_id; - e.netname = shortname; - e.turret_name = mname; + e.turret_func = func; - e.mdl = modelname; - e.cvar_basename = shortname; e.spawnflags = turretflags; e.mins = min_s; e.maxs = max_s; + e.mdl = modelname; e.model = strzone(strcat("models/turrets/", modelname)); e.head_model = strzone(strcat("models/turrets/", headmodelname)); + e.netname = shortname; + e.turret_name = mname; } entity get_turretinfo(int id); REGISTER_TURRET(Null, - t_null, + t_new, 0, '-0 -0 -0', '0 0 0', diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index 94fb4ae3f..3de0e95b1 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -84,7 +84,7 @@ void turret_draw2d() o_z = 0; if(hud != HUD_NORMAL) { - if((get_turretinfo(self.turretid)).spawnflags & TUR_FLAG_MOVE) + if((get_turretinfo(self.m_id)).spawnflags & TUR_FLAG_MOVE) txt = "gfx/vehicles/turret_moving.tga"; else txt = "gfx/vehicles/turret_stationary.tga"; @@ -203,12 +203,12 @@ void turret_draw2d() void turret_construct() {SELFPARAM(); - entity tur = get_turretinfo(self.turretid); + entity tur = get_turretinfo(self.m_id); if(self.tur_head == world) self.tur_head = spawn(); - self.netname = TUR_NAME(self.turretid); + self.netname = TUR_NAME(self.m_id); setorigin(self, self.origin); _setmodel(self, tur.model); @@ -216,7 +216,7 @@ void turret_construct() setsize(self, tur.mins, tur.maxs); setsize(self.tur_head, '0 0 0', '0 0 0'); - if(self.turretid == TUR_EWHEEL.m_id) + if(self.m_id == TUR_EWHEEL.m_id) setattachment(self.tur_head, self, ""); else setattachment(self.tur_head, self, "tag_head"); @@ -241,7 +241,7 @@ void turret_construct() self.teamradar_color = '1 0 0'; self.alpha = 1; - TUR_ACTION(self.turretid, TR_SETUP); + TUR_ACTION(self.m_id, TR_SETUP); } entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode); @@ -323,12 +323,12 @@ void turret_die() if (!autocvar_cl_nogibs) { // Base - if(self.turretid == TUR_EWHEEL.m_id) - turret_gibtoss((get_turretinfo(self.turretid)).model, self.origin + '0 0 18', self.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', true); - else if (self.turretid == TUR_WALKER.m_id) - turret_gibtoss((get_turretinfo(self.turretid)).model, self.origin + '0 0 18', self.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', true); - else if (self.turretid == TUR_TESLA.m_id) - turret_gibtoss((get_turretinfo(self.turretid)).model, self.origin + '0 0 18', '0 0 200', '-1 -1 -1', false); + if(self.m_id == TUR_EWHEEL.m_id) + turret_gibtoss((get_turretinfo(self.m_id)).model, self.origin + '0 0 18', self.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', true); + else if (self.m_id == TUR_WALKER.m_id) + turret_gibtoss((get_turretinfo(self.m_id)).model, self.origin + '0 0 18', self.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', true); + else if (self.m_id == TUR_TESLA.m_id) + turret_gibtoss((get_turretinfo(self.m_id)).model, self.origin + '0 0 18', '0 0 200', '-1 -1 -1', false); else { if (random() > 0.5) @@ -340,7 +340,7 @@ void turret_die() else turret_gibtoss("models/turrets/base-gib1.md3", self.origin + '0 0 8', '0 0 0', '0 0 0', true); - entity headgib = turret_gibtoss((get_turretinfo(self.turretid)).head_model, self.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', true); + entity headgib = turret_gibtoss((get_turretinfo(self.m_id)).head_model, self.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', true); if(headgib) { headgib.angles = headgib.move_angles = self.tur_head.angles; @@ -362,7 +362,7 @@ void ent_turret() if(sf & TNSF_SETUP) { - self.turretid = ReadByte(); + self.m_id = ReadByte(); self.origin_x = ReadCoord(); self.origin_y = ReadCoord(); diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 337b2789a..d8e94560c 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -190,7 +190,7 @@ void turret_die() if(self.damage_flags & TFL_DMG_DEATH_NORESPAWN) { - TUR_ACTION(self.turretid, TR_DEATH); + TUR_ACTION(self.m_id, TR_DEATH); remove(self.tur_head); remove(self); @@ -202,7 +202,7 @@ void turret_die() self.nextthink = time + 0.2; self.think = turret_hide; - TUR_ACTION(self.turretid, TR_DEATH); + TUR_ACTION(self.m_id, TR_DEATH); } } @@ -275,7 +275,7 @@ void turret_respawn() self.SendFlags = TNSF_FULL_UPDATE; - TUR_ACTION(self.turretid, TR_SETUP); + TUR_ACTION(self.m_id, TR_SETUP); } @@ -304,7 +304,7 @@ float turret_send(entity to, float sf) WriteByte(MSG_ENTITY, sf); if(sf & TNSF_SETUP) { - WriteByte(MSG_ENTITY, self.turretid); + WriteByte(MSG_ENTITY, self.m_id); WriteCoord(MSG_ENTITY, self.origin_x); WriteCoord(MSG_ENTITY, self.origin_y); @@ -358,8 +358,9 @@ float turret_send(entity to, float sf) return true; } -void load_unit_settings(entity ent, string unitname, float is_reload) +void load_unit_settings(entity ent, float is_reload) {SELFPARAM(); + string unitname = ent.netname; string sbase; if (ent == world) @@ -419,7 +420,7 @@ void load_unit_settings(entity ent, string unitname, float is_reload) ent.track_blendrate = cvar(strcat(sbase,"_track_blendrate")); if(is_reload) - TUR_ACTION(self.turretid, TR_SETUP); + TUR_ACTION(self.m_id, TR_SETUP); } void turret_projectile_explode() @@ -989,7 +990,7 @@ void turret_fire() if(MUTATOR_CALLHOOK(TurretFire, self)) return; - TUR_ACTION(self.turretid, TR_ATTACK); + TUR_ACTION(self.m_id, TR_ATTACK); self.attack_finished_single = time + self.shot_refire; self.ammo -= self.shot_dmg; @@ -1117,7 +1118,7 @@ void turret_think() if (turret_checkfire()) turret_fire(); - TUR_ACTION(self.turretid, TR_THINK); + TUR_ACTION(self.m_id, TR_THINK); return; } @@ -1155,7 +1156,7 @@ void turret_think() if(!(self.track_flags & TFL_TRACK_NO)) turret_track(); - TUR_ACTION(self.turretid, TR_THINK); + TUR_ACTION(self.m_id, TR_THINK); // And bail. return; @@ -1178,7 +1179,7 @@ void turret_think() turret_fire(); } - TUR_ACTION(self.turretid, TR_THINK); + TUR_ACTION(self.m_id, TR_THINK); } /* @@ -1218,8 +1219,8 @@ void turrets_manager_think() { if (IS_TURRET(e)) { - load_unit_settings(e,e.cvar_basename,1); - TUR_ACTION(self.turretid, TR_THINK); + load_unit_settings(e,1); + TUR_ACTION(self.m_id, TR_THINK); } e = nextent(e); @@ -1235,7 +1236,7 @@ float turret_initialize(float tur_id) entity e; entity tur = get_turretinfo(tur_id); - if(tur.turretid == 0) + if(tur.m_id == 0) return false; // invalid turret if(!self.tur_head) { TUR_ACTION(tur_id, TR_PRECACHE); } // if tur_head exists, we can assume this turret re-spawned @@ -1252,8 +1253,8 @@ float turret_initialize(float tur_id) if(!(self.spawnflags & TSF_SUSPENDED)) builtin_droptofloor(); - self.cvar_basename = tur.cvar_basename; - load_unit_settings(self, self.cvar_basename, 0); + self.netname = tur.netname; + load_unit_settings(self, 0); if(!self.team || !teamplay) { self.team = MAX_SHOT_DISTANCE; } if(!self.ticrate) { self.ticrate = ((self.turret_flags & TUR_FLAG_SUPPORT) ? 0.2 : 0.1); } @@ -1330,7 +1331,7 @@ float turret_initialize(float tur_id) _setmodel(self, tur.model); setsize(self, tur.mins, tur.maxs); - self.turretid = tur_id; + self.m_id = tur_id; self.classname = "turret_main"; self.active = ACTIVE_ACTIVE; self.effects = EF_NODRAW; diff --git a/qcsrc/common/turrets/turret.qh b/qcsrc/common/turrets/turret.qh index e31d93fd2..17cf20c73 100644 --- a/qcsrc/common/turrets/turret.qh +++ b/qcsrc/common/turrets/turret.qh @@ -1,14 +1,6 @@ #ifndef TURRET_H #define TURRET_H -// turret requests -const int TR_SETUP = 1; // (BOTH) setup turret data -const int TR_THINK = 2; // (SERVER) logic to run every frame -const int TR_DEATH = 3; // (SERVER) called when turret dies -const int TR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this turret -const int TR_ATTACK = 5; // (SERVER) called when turret attacks -const int TR_CONFIG = 6; // (ALL) - // functions: entity get_turretinfo(int id); @@ -134,29 +126,27 @@ const int TNSF_FULL_UPDATE = 16777215; // other useful macros -#define TUR_ACTION(turrettype,mrequest) (get_turretinfo(turrettype)).turret_func(mrequest) +#define _TUR_ACTION(tur, mrequest) tur.turret_func(tur, mrequest) +#define TUR_ACTION(tur, mrequest) _TUR_ACTION(get_turretinfo(tur), mrequest) #define TUR_NAME(turrettype) (get_turretinfo(turrettype)).turret_name -float t_null(float dummy) { return 0; } +bool t_new(entity this, int req); CLASS(Turret, Object) ATTRIB(Turret, m_id, int, 0) - ATTRIB(Turret, turretid, int, 0) /** short name */ ATTRIB(Turret, netname, string, string_null) /** human readable name */ ATTRIB(Turret, turret_name, string, string_null) /** t_... */ - ATTRIB(Turret, turret_func, float(float), t_null) + ATTRIB(Turret, turret_func, float(Turret, int), t_new) /** currently a copy of the model */ ATTRIB(Turret, mdl, string, string_null) /** full name of model */ ATTRIB(Turret, model, string, string_null) /** full name of tur_head model */ ATTRIB(Turret, head_model, string, string_null) - /** TODO: deprecate! */ - ATTRIB(Turret, cvar_basename, string, string_null) ATTRIB(Turret, spawnflags, int, 0) /** turret hitbox size */ @@ -170,4 +160,29 @@ CLASS(Turret, Object) ENDCLASS(Turret) +// turret requests +const int TR_SETUP = 1; // (BOTH) setup turret data +.bool(Turret) tr_setup; +const int TR_THINK = 2; // (SERVER) logic to run every frame +.bool(Turret) tr_think; +const int TR_DEATH = 3; // (SERVER) called when turret dies +.bool(Turret) tr_death; +const int TR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this turret +.bool(Turret) tr_precache; +const int TR_ATTACK = 5; // (SERVER) called when turret attacks +.bool(Turret) tr_attack; +const int TR_CONFIG = 6; // (ALL) +.bool(Turret) tr_config; + +bool t_new(Turret this, int req) +{ + if (req == TR_SETUP) return this.tr_setup ? this.tr_setup(this) : false; + if (req == TR_THINK) return this.tr_think ? this.tr_think(this) : false; + if (req == TR_DEATH) return this.tr_death ? this.tr_death(this) : false; + if (req == TR_PRECACHE) return this.tr_precache ? this.tr_precache(this) : false; + if (req == TR_ATTACK) return this.tr_attack ? this.tr_attack(this) : false; + if (req == TR_CONFIG) return this.tr_config ? this.tr_config(this) : false; + return false; +} + #endif diff --git a/qcsrc/common/turrets/turret/ewheel.qc b/qcsrc/common/turrets/turret/ewheel.qc index a27860bc4..44e7f18e2 100644 --- a/qcsrc/common/turrets/turret/ewheel.qc +++ b/qcsrc/common/turrets/turret/ewheel.qc @@ -126,7 +126,7 @@ void ewheel_move_idle() void spawnfunc_turret_ewheel() { SELFPARAM(); if(!turret_initialize(TUR_EWHEEL.m_id)) remove(self); } -float t_ewheel(float req) +float t_ewheel(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -284,7 +284,7 @@ void ewheel_draw() te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16); } -float t_ewheel(float req) +float t_ewheel(Turret thistur, float req) {SELFPARAM(); switch(req) { diff --git a/qcsrc/common/turrets/turret/flac.qc b/qcsrc/common/turrets/turret/flac.qc index aacefd164..bcd46a364 100644 --- a/qcsrc/common/turrets/turret/flac.qc +++ b/qcsrc/common/turrets/turret/flac.qc @@ -33,7 +33,7 @@ void turret_flac_projectile_think_explode() void spawnfunc_turret_flac() { SELFPARAM(); if(!turret_initialize(TUR_FLAC.m_id)) remove(self); } -float t_flac(float req) +float t_flac(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -83,7 +83,7 @@ float t_flac(float req) #endif // SVQC #ifdef CSQC -float t_flac(float req) +float t_flac(Turret thistur, float req) { switch(req) { diff --git a/qcsrc/common/turrets/turret/fusionreactor.qc b/qcsrc/common/turrets/turret/fusionreactor.qc index 7d2f4f0b6..89fdef5d4 100644 --- a/qcsrc/common/turrets/turret/fusionreactor.qc +++ b/qcsrc/common/turrets/turret/fusionreactor.qc @@ -45,7 +45,7 @@ bool turret_fusionreactor_firecheck() void spawnfunc_turret_fusionreactor() { SELFPARAM(); if(!turret_initialize(TUR_FUSIONREACTOR.m_id)) remove(self); } -float t_fusionreactor(float req) +float t_fusionreactor(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -96,7 +96,7 @@ float t_fusionreactor(float req) #endif // SVQC #ifdef CSQC -float t_fusionreactor(float req) +float t_fusionreactor(Turret thistur, float req) { switch(req) { diff --git a/qcsrc/common/turrets/turret/hellion.qc b/qcsrc/common/turrets/turret/hellion.qc index 9efae2d96..6b0393057 100644 --- a/qcsrc/common/turrets/turret/hellion.qc +++ b/qcsrc/common/turrets/turret/hellion.qc @@ -81,7 +81,7 @@ void turret_hellion_missile_think() void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION.m_id)) remove(self); } -float t_hellion(float req) +float t_hellion(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -140,7 +140,7 @@ float t_hellion(float req) #endif // SVQC #ifdef CSQC -float t_hellion(float req) +float t_hellion(Turret thistur, float req) { switch(req) { diff --git a/qcsrc/common/turrets/turret/hk.qc b/qcsrc/common/turrets/turret/hk.qc index 8ec6f16bc..63ad489c6 100644 --- a/qcsrc/common/turrets/turret/hk.qc +++ b/qcsrc/common/turrets/turret/hk.qc @@ -278,7 +278,7 @@ float turret_hk_addtarget(entity e_target,entity e_sender) void spawnfunc_turret_hk() { SELFPARAM(); if(!turret_initialize(TUR_HK.m_id)) remove(self); } -float t_hk(float req) +float t_hk(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -341,7 +341,7 @@ float t_hk(float req) #endif // SVQC #ifdef CSQC -float t_hk(float req) +float t_hk(Turret thistur, float req) { switch(req) { diff --git a/qcsrc/common/turrets/turret/machinegun.qc b/qcsrc/common/turrets/turret/machinegun.qc index 48a200cd7..07c641ee7 100644 --- a/qcsrc/common/turrets/turret/machinegun.qc +++ b/qcsrc/common/turrets/turret/machinegun.qc @@ -18,7 +18,7 @@ void spawnfunc_turret_machinegun() { SELFPARAM(); if(!turret_initialize(TUR_MACH void W_MachineGun_MuzzleFlash(void); -float t_machinegun(float req) +float t_machinegun(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -60,7 +60,7 @@ float t_machinegun(float req) #endif // SVQC #ifdef CSQC -float t_machinegun(float req) +float t_machinegun(Turret thistur, float req) { switch(req) { diff --git a/qcsrc/common/turrets/turret/mlrs.qc b/qcsrc/common/turrets/turret/mlrs.qc index fe3775bd1..d2c28abb7 100644 --- a/qcsrc/common/turrets/turret/mlrs.qc +++ b/qcsrc/common/turrets/turret/mlrs.qc @@ -16,7 +16,7 @@ REGISTER_TURRET( #ifdef SVQC void spawnfunc_turret_mlrs() { SELFPARAM(); if(!turret_initialize(TUR_MLRS.m_id)) remove(self); } -float t_mlrs(float req) +float t_mlrs(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -70,7 +70,7 @@ float t_mlrs(float req) #endif // SVQC #ifdef CSQC -float t_mlrs(float req) +float t_mlrs(Turret thistur, float req) { switch(req) { diff --git a/qcsrc/common/turrets/turret/phaser.qc b/qcsrc/common/turrets/turret/phaser.qc index 9e162495b..f0b8e227d 100644 --- a/qcsrc/common/turrets/turret/phaser.qc +++ b/qcsrc/common/turrets/turret/phaser.qc @@ -62,7 +62,7 @@ void beam_think() void spawnfunc_turret_phaser() { SELFPARAM(); if(!turret_initialize(TUR_PHASER.m_id)) remove(self); } -float t_phaser(float req) +float t_phaser(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -149,7 +149,7 @@ float t_phaser(float req) #endif // SVQC #ifdef CSQC -float t_phaser(float req) +float t_phaser(Turret thistur, float req) { switch(req) { diff --git a/qcsrc/common/turrets/turret/plasma.qc b/qcsrc/common/turrets/turret/plasma.qc index 0cfe13ca6..a528af21e 100644 --- a/qcsrc/common/turrets/turret/plasma.qc +++ b/qcsrc/common/turrets/turret/plasma.qc @@ -16,7 +16,7 @@ REGISTER_TURRET( #ifdef SVQC void spawnfunc_turret_plasma() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA.m_id)) remove(self); } -float t_plasma(float req) +float t_plasma(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -86,7 +86,7 @@ float t_plasma(float req) #endif // SVQC #ifdef CSQC -float t_plasma(float req) +float t_plasma(Turret thistur, float req) { switch(req) { diff --git a/qcsrc/common/turrets/turret/plasma_dual.qc b/qcsrc/common/turrets/turret/plasma_dual.qc index 74713eaa9..1f4ea0a6d 100644 --- a/qcsrc/common/turrets/turret/plasma_dual.qc +++ b/qcsrc/common/turrets/turret/plasma_dual.qc @@ -26,7 +26,6 @@ REGISTER_WEAPON(PLASMA_DUAL, NEW(PlasmaDualAttack)); #ifdef SVQC -float t_plasma_dual(float req); METHOD(PlasmaDualAttack, wr_think, bool(entity thiswep)) { SELFPARAM(); if (self.BUTTON_ATCK) @@ -37,7 +36,7 @@ METHOD(PlasmaDualAttack, wr_think, bool(entity thiswep)) { self.tur_head = self; self.shot_speed = max(1, ((!self.shot_speed) ? 2500 : self.shot_speed)); self.shot_spread = bound(0.0001, ((!self.shot_spread) ? 0.0125 : self.shot_spread), 500); - t_plasma_dual(TR_ATTACK); + TUR_ACTION(TUR_PLASMA_DUAL.m_id, TR_ATTACK); weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); } return true; @@ -45,7 +44,7 @@ METHOD(PlasmaDualAttack, wr_think, bool(entity thiswep)) { void spawnfunc_turret_plasma_dual() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA_DUAL.m_id)) remove(self); } -float t_plasma_dual(float req) +float t_plasma_dual(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -113,7 +112,7 @@ float t_plasma_dual(float req) #endif // SVQC #ifdef CSQC -float t_plasma_dual(float req) +float t_plasma_dual(Turret thistur, float req) { switch(req) { diff --git a/qcsrc/common/turrets/turret/tesla.qc b/qcsrc/common/turrets/turret/tesla.qc index 66c675157..6851d5479 100644 --- a/qcsrc/common/turrets/turret/tesla.qc +++ b/qcsrc/common/turrets/turret/tesla.qc @@ -94,7 +94,7 @@ float turret_tesla_firecheck() void spawnfunc_turret_tesla() { SELFPARAM(); if(!turret_initialize(TUR_TESLA.m_id)) remove(self); } -float t_tesla(float req) +float t_tesla(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -197,7 +197,7 @@ float t_tesla(float req) #endif // SVQC #ifdef CSQC -float t_tesla(float req) +float t_tesla(Turret thistur, float req) { switch(req) { diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index 82fb62238..f6855e70e 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -339,7 +339,7 @@ void walker_move_path() void spawnfunc_turret_walker() { SELFPARAM(); if(!turret_initialize(TUR_WALKER.m_id)) remove(self); } -float t_walker(float req) +float t_walker(Turret thistur, float req) {SELFPARAM(); switch(req) { @@ -669,7 +669,7 @@ void walker_draw() te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16); } -float t_walker(float req) +float t_walker(Turret thistur, float req) {SELFPARAM(); switch(req) { -- 2.39.2