X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fdevastator.qc;h=772b9ea6294c616d38aed6aa346de49ee4440e74;hb=c0da80fe6125a43ee99a90808ac6f9d0ddcf88c8;hp=2d930ad7212a8b83920e659e8b6992b0e81ef7c2;hpb=3cfb64730d883ae9ccf0315f365da19345270890;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 2d930ad72..772b9ea62 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -72,8 +72,8 @@ spawnfunc(weapon_rocketlauncher) { spawnfunc_weapon_devastator(this); } .entity lastrocket; -void W_Devastator_Unregister() -{SELFPARAM(); +void W_Devastator_Unregister(entity this) +{ if(self.realowner && self.realowner.lastrocket == self) { self.realowner.lastrocket = world; @@ -81,9 +81,9 @@ void W_Devastator_Unregister() } } -void W_Devastator_Explode() -{SELFPARAM(); - W_Devastator_Unregister(); +void W_Devastator_Explode(entity this) +{ + W_Devastator_Unregister(self); if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) @@ -123,9 +123,9 @@ void W_Devastator_Explode() remove(self); } -void W_Devastator_DoRemoteExplode(.entity weaponentity) -{SELFPARAM(); - W_Devastator_Unregister(); +void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) +{ + W_Devastator_Unregister(self); self.event_damage = func_null; self.takedamage = DAMAGE_NO; @@ -204,8 +204,8 @@ void W_Devastator_DoRemoteExplode(.entity weaponentity) remove(self); } -void W_Devastator_RemoteExplode(.entity weaponentity) -{SELFPARAM(); +void W_Devastator_RemoteExplode(entity this, .entity weaponentity) +{ if(!IS_DEAD(self.realowner)) if(self.realowner.lastrocket) { @@ -214,7 +214,7 @@ void W_Devastator_RemoteExplode(.entity weaponentity) : (vdist(NearestPointOnBox(self.realowner, self.origin) - self.origin, >, WEP_CVAR(devastator, remote_radius))) // safety device ) { - W_Devastator_DoRemoteExplode(weaponentity); + W_Devastator_DoRemoteExplode(self, weaponentity); } } } @@ -252,8 +252,8 @@ vector W_Devastator_SteerTo(vector thisdir, vector goaldir, float maxturn_cos) // normalize(thisdir + goaldir) // normalize(0) -void W_Devastator_Think() -{SELFPARAM(); +void W_Devastator_Think(entity this) +{ vector desireddir, olddir, newdir, desiredorigin, goal; float velspeed, f; self.nextthink = time; @@ -261,7 +261,7 @@ void W_Devastator_Think() { other = world; self.projectiledeathtype |= HITTYPE_BOUNCE; - W_Devastator_Explode(); + W_Devastator_Explode(self); return; } @@ -313,23 +313,23 @@ void W_Devastator_Think() .entity weaponentity = weaponentities[0]; // TODO: unhardcode if(self.rl_detonate_later) - W_Devastator_RemoteExplode(weaponentity); + W_Devastator_RemoteExplode(self, weaponentity); } if(self.csqcprojectile_clientanimate == 0) UpdateCSQCProjectile(self); } -void W_Devastator_Touch() -{SELFPARAM(); - if(WarpZone_Projectile_Touch()) +void W_Devastator_Touch(entity this) +{ + if(WarpZone_Projectile_Touch(this)) { - if(wasfreed(self)) - W_Devastator_Unregister(); + if(wasfreed(this)) + W_Devastator_Unregister(this); return; } - W_Devastator_Unregister(); - W_Devastator_Explode(); + W_Devastator_Unregister(this); + W_Devastator_Explode(this); } void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -344,11 +344,11 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d this.angles = vectoangles(this.velocity); if(this.health <= 0) - WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode)); + W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode); } -void W_Devastator_Attack(Weapon thiswep) -{SELFPARAM(); +void W_Devastator_Attack(Weapon thiswep, entity actor) +{entity this = actor; entity missile; entity flash; @@ -384,8 +384,8 @@ void W_Devastator_Attack(Weapon thiswep) W_SetupProjVelocity_Basic(missile, WEP_CVAR(devastator, speedstart), 0); missile.angles = vectoangles(missile.velocity); - missile.touch = W_Devastator_Touch; - missile.think = W_Devastator_Think; + settouch(missile, W_Devastator_Touch); + setthink(missile, W_Devastator_Think); missile.nextthink = time; missile.cnt = time + WEP_CVAR(devastator, lifetime); missile.flags = FL_PROJECTILE; @@ -405,8 +405,9 @@ void W_Devastator_Attack(Weapon thiswep) } #if 0 -METHOD(Devastator, wr_aim, void(entity thiswep)) +METHOD(Devastator, wr_aim, void(entity thiswep, entity actor)) { + entity this = actor; // aim and decide to fire if appropriate PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! @@ -432,9 +433,9 @@ METHOD(Devastator, wr_aim, void(entity thiswep)) } } #else -METHOD(Devastator, wr_aim, void(entity thiswep)) +METHOD(Devastator, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; // aim and decide to fire if appropriate PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! @@ -530,7 +531,7 @@ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponen if(actor.rl_release || WEP_CVAR(devastator, guidestop)) if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire))) { - W_Devastator_Attack(thiswep); + W_Devastator_Attack(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready); actor.rl_release = 0; } @@ -556,62 +557,60 @@ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponen } } } -METHOD(Devastator, wr_setup, void(entity thiswep)) +METHOD(Devastator, wr_setup, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.rl_release = 1; } -METHOD(Devastator, wr_checkammo1, bool(entity thiswep)) +METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor)) { - SELFPARAM(); #if 0 // don't switch while guiding a missile - if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR) + if(ATTACK_FINISHED(actor, slot) <= time || PS(actor).m_weapon != WEP_DEVASTATOR) { ammo_amount = false; if(WEP_CVAR(devastator, reload_ammo)) { - if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo)) + if(actor.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && actor.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo)) ammo_amount = true; } - else if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo)) + else if(actor.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo)) ammo_amount = true; return !ammo_amount; } #endif #if 0 - if(self.rl_release == 0) + if(actor.rl_release == 0) { - LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo)); + LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo)); return true; } else { - ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo); - ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo); - LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE")); + ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo); + ammo_amount += actor.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo); + LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE")); return ammo_amount; } #else - float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo); - ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo); + float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo); + ammo_amount += actor.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo); return ammo_amount; #endif } -METHOD(Devastator, wr_checkammo2, bool(entity thiswep)) +METHOD(Devastator, wr_checkammo2, bool(entity thiswep, entity actor)) { return false; } -METHOD(Devastator, wr_resetplayer, void(entity thiswep)) +METHOD(Devastator, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave! self.rl_release = 0; } METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, WEP_CVAR(devastator, ammo), SND_RELOAD); + W_Reload(actor, WEP_CVAR(devastator, ammo), SND_RELOAD); } METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep)) { @@ -628,9 +627,9 @@ METHOD(Devastator, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Devastator, wr_impacteffect, void(entity thiswep)) +METHOD(Devastator, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 12; pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);