X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Felectro.qc;h=37dcf9f07e61e4c4de43d0573e0b3b0b3b89c82a;hb=fd20a1f1eae2b2ba955ce9ddedc20cd151a6f362;hp=315ea5a5a470731d5f699df18ae81c1e1e4eeea0;hpb=a823548db666d01ecf1ef8b8e559caa61334ce26;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 315ea5a5a..37dcf9f07 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -68,7 +68,7 @@ REGISTER_WEAPON(ELECTRO, electro, NEW(Electro)); #ifdef SVQC .float electro_count; .float electro_secondarytime; -void W_Electro_ExplodeCombo(); +void W_Electro_ExplodeCombo(entity this); #endif #endif #ifdef IMPLEMENTATION @@ -104,7 +104,7 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own) e.classname = "electro_orb_chain"; // now set the next one to trigger as well - e.think = W_Electro_ExplodeCombo; + setthink(e, W_Electro_ExplodeCombo); // delay combo chains, looks cooler e.nextthink = @@ -122,8 +122,8 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own) } } -void W_Electro_ExplodeCombo() -{SELFPARAM(); +void W_Electro_ExplodeCombo(entity this) +{ W_Electro_TriggerCombo(self.origin, WEP_CVAR(electro, combo_comboradius), self.realowner); self.event_damage = func_null; @@ -144,8 +144,8 @@ void W_Electro_ExplodeCombo() remove(self); } -void W_Electro_Explode() -{SELFPARAM(); +void W_Electro_Explode(entity this) +{ if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) if(DIFF_TEAM(self.realowner, other)) @@ -193,17 +193,17 @@ void W_Electro_Explode() void W_Electro_Explode_use(entity this, entity actor, entity trigger) { - WITHSELF(this, W_Electro_Explode()); + WITHSELF(this, W_Electro_Explode(this)); } -void W_Electro_TouchExplode() +void W_Electro_TouchExplode(entity this) { PROJECTILE_TOUCH; - W_Electro_Explode(); + W_Electro_Explode(this); } -void W_Electro_Bolt_Think() -{SELFPARAM(); +void W_Electro_Bolt_Think(entity this) +{ if(time >= self.ltime) { this.use(this, NULL, NULL); @@ -226,7 +226,7 @@ void W_Electro_Bolt_Think() e.classname = "electro_orb_chain"; // now set the next one to trigger as well - e.think = W_Electro_ExplodeCombo; + setthink(e, W_Electro_ExplodeCombo); // delay combo chains, looks cooler e.nextthink = @@ -254,8 +254,8 @@ void W_Electro_Bolt_Think() else { self.nextthink = self.ltime; } } -void W_Electro_Attack_Bolt(Weapon thiswep) -{SELFPARAM(); +void W_Electro_Attack_Bolt(Weapon thiswep, entity actor) +{entity this = actor; entity proj; W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(electro, ammo)); @@ -278,7 +278,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep) proj.bot_dodge = true; proj.bot_dodgerating = WEP_CVAR_PRI(electro, damage); proj.use = W_Electro_Explode_use; - proj.think = W_Electro_Bolt_Think; + setthink(proj, W_Electro_Bolt_Think); proj.nextthink = time; proj.ltime = time + WEP_CVAR_PRI(electro, lifetime); PROJECTILE_MAKETRIGGER(proj); @@ -288,7 +288,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep) proj.movetype = MOVETYPE_FLY; W_SetupProjVelocity_PRI(proj, electro); proj.angles = vectoangles(proj.velocity); - proj.touch = W_Electro_TouchExplode; + settouch(proj, W_Electro_TouchExplode); setsize(proj, '0 0 -3', '0 0 -3'); proj.flags = FL_PROJECTILE; proj.missile_flags = MIF_SPLASH; @@ -298,11 +298,11 @@ void W_Electro_Attack_Bolt(Weapon thiswep) MUTATOR_CALLHOOK(EditProjectile, self, proj); } -void W_Electro_Orb_Touch() -{SELFPARAM(); +void W_Electro_Orb_Touch(entity this) +{ PROJECTILE_TOUCH; if(other.takedamage == DAMAGE_AIM) - { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(); } } + { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(self); } } else { //UpdateCSQCProjectile(self); @@ -332,7 +332,7 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float // change owner to whoever caused the combo explosion this.realowner = inflictor.realowner; this.classname = "electro_orb_chain"; - this.think = W_Electro_ExplodeCombo; + setthink(this, W_Electro_ExplodeCombo); this.nextthink = time + ( // bound the length, inflictor may be in a galaxy far far away (warpzones) @@ -348,13 +348,13 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float else { this.use = W_Electro_Explode_use; - this.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately" + setthink(this, adaptor_think2use); // not _hittype_splash, as this runs "immediately" } } } -void W_Electro_Attack_Orb(Weapon thiswep) -{SELFPARAM(); +void W_Electro_Attack_Orb(Weapon thiswep, entity actor) +{entity this = actor; W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(electro, ammo)); W_SetupShot_ProjectileSize( @@ -375,7 +375,7 @@ void W_Electro_Attack_Orb(Weapon thiswep) entity proj = new(electro_orb); proj.owner = proj.realowner = self; proj.use = W_Electro_Explode_use; - proj.think = adaptor_think2use_hittype_splash; + setthink(proj, adaptor_think2use_hittype_splash); proj.bot_dodge = true; proj.bot_dodgerating = WEP_CVAR_SEC(electro, damage); proj.nextthink = time + WEP_CVAR_SEC(electro, lifetime); @@ -387,7 +387,7 @@ void W_Electro_Attack_Orb(Weapon thiswep) //proj.glow_color = 45; proj.movetype = MOVETYPE_BOUNCE; W_SetupProjVelocity_UP_SEC(proj, electro); - proj.touch = W_Electro_Orb_Touch; + settouch(proj, W_Electro_Orb_Touch); setsize(proj, '0 0 -4', '0 0 -4'); proj.takedamage = DAMAGE_YES; proj.damageforcescale = WEP_CVAR_SEC(electro, damageforcescale); @@ -414,12 +414,12 @@ void W_Electro_Attack_Orb(Weapon thiswep) } void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, int fire) -{SELFPARAM(); +{entity this = actor; if(self.electro_count > 1) if(PHYS_INPUT_BUTTON_ATCK2(self)) if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1)) { - W_Electro_Attack_Orb(WEP_ELECTRO); + W_Electro_Attack_Orb(WEP_ELECTRO, actor); self.electro_count -= 1; weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack); return; @@ -430,9 +430,9 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i .float bot_secondary_electromooth; -METHOD(Electro, wr_aim, void(entity thiswep)) +METHOD(Electro, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; PHYS_INPUT_BUTTON_ATCK(self) = PHYS_INPUT_BUTTON_ATCK2(self) = false; if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; } if(self.bot_secondary_electromooth == 0) @@ -480,7 +480,7 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { - W_Electro_Attack_Bolt(thiswep); + W_Electro_Attack_Bolt(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); } } @@ -489,45 +489,42 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit if(time >= actor.electro_secondarytime) if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire))) { - W_Electro_Attack_Orb(thiswep); + W_Electro_Attack_Orb(thiswep, actor); actor.electro_count = WEP_CVAR_SEC(electro, count); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack); actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(); } } } -METHOD(Electro, wr_checkammo1, bool(entity thiswep)) +METHOD(Electro, wr_checkammo1, bool(entity thiswep, entity actor)) { - SELFPARAM(); - float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo); - ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo); + float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo); + ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo); return ammo_amount; } -METHOD(Electro, wr_checkammo2, bool(entity thiswep)) +METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor)) { - SELFPARAM(); float ammo_amount; if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false. { - ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); - ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); + ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); + ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); } else { - ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo); - ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo); + ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo); + ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo); } return ammo_amount; } -METHOD(Electro, wr_resetplayer, void(entity thiswep)) +METHOD(Electro, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.electro_secondarytime = time; } METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD); + W_Reload(actor, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD); } METHOD(Electro, wr_suicidemessage, Notification(entity thiswep)) { @@ -554,9 +551,9 @@ METHOD(Electro, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Electro, wr_impacteffect, void(entity thiswep)) +METHOD(Electro, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 6; if(w_deathtype & HITTYPE_SECONDARY)