From a4287628344552de70d9c1196704d4cf973fe356 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 8 Aug 2016 21:06:45 +1000 Subject: [PATCH] Unhardcode a few more weaponentities --- qcsrc/common/weapons/weapon/seeker.qc | 11 +++++++---- qcsrc/server/cl_impulse.qc | 7 +++++-- qcsrc/server/weapons/selection.qc | 7 +++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 02987232f..a772283a2 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -441,22 +441,23 @@ void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seek oldenemy = own.enemy; own.enemy = this.enemy; + .entity weaponentity = this.weaponentity_fld; c = own.cnt % 4; switch(c) { case 0: - W_Seeker_Fire_Missile(WEP_SEEKER, own, weaponentities[0], '-1.25 -3.75 0', own.enemy); // TODO + W_Seeker_Fire_Missile(WEP_SEEKER, own, weaponentity, '-1.25 -3.75 0', own.enemy); // TODO break; case 1: - W_Seeker_Fire_Missile(WEP_SEEKER, own, weaponentities[0], '+1.25 -3.75 0', own.enemy); // TODO + W_Seeker_Fire_Missile(WEP_SEEKER, own, weaponentity, '+1.25 -3.75 0', own.enemy); // TODO break; case 2: - W_Seeker_Fire_Missile(WEP_SEEKER, own, weaponentities[0], '-1.25 +3.75 0', own.enemy); // TODO + W_Seeker_Fire_Missile(WEP_SEEKER, own, weaponentity, '-1.25 +3.75 0', own.enemy); // TODO break; case 3: default: - W_Seeker_Fire_Missile(WEP_SEEKER, own, weaponentities[0], '+1.25 +3.75 0', own.enemy); // TODO + W_Seeker_Fire_Missile(WEP_SEEKER, own, weaponentity, '+1.25 +3.75 0', own.enemy); // TODO break; } @@ -534,6 +535,7 @@ void W_Seeker_Tag_Touch(entity this, entity toucher) { //sprint(this.realowner, strcat("You just tagged ^2", toucher.netname, "^7 with a tracking device!\n")); e = new(tag_tracker); + e.weaponentity_fld = this.weaponentity_fld; e.cnt = WEP_CVAR(seeker, missile_count); e.owner = this.owner; e.realowner = this.realowner; @@ -571,6 +573,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep, entity actor, .entity weaponentity) W_SetupShot_ProjectileSize(actor, weaponentity, '-2 -2 -2', '2 2 2', false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count)); entity missile = new(seeker_tag); + missile.weaponentity_fld = weaponentity; missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = 50; diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index bcd612c56..00c4ec22c 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -257,8 +257,11 @@ IMPULSE(weapon_reload) if (forbidWeaponUse(this)) return; Weapon w = PS(this).m_weapon; entity actor = this; - .entity weaponentity = weaponentities[0]; // TODO: unhardcode - w.wr_reload(w, actor, weaponentity); + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + w.wr_reload(w, actor, weaponentity); + } } void ImpulseCommands(entity this) diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 8a787241a..b05c0621b 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -272,8 +272,11 @@ void W_SwitchWeapon(entity this, Weapon w) } else if(!forbidWeaponUse(this)) { entity actor = this; - .entity weaponentity = weaponentities[0]; // TODO: unhardcode - w.wr_reload(w, actor, weaponentity); + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + w.wr_reload(w, actor, weaponentity); + } } } -- 2.39.2