From: Mario Date: Mon, 8 Aug 2016 11:06:45 +0000 (+1000) Subject: Unhardcode a few more weaponentities X-Git-Tag: xonotic-v0.8.2~723^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a4287628344552de70d9c1196704d4cf973fe356;p=xonotic%2Fxonotic-data.pk3dir.git Unhardcode a few more weaponentities --- 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); + } } }