From: Mario Date: Fri, 30 Sep 2016 09:07:19 +0000 (+1000) Subject: Clear up a few more hardcoded slot 0 cases X-Git-Tag: xonotic-v0.8.2~326^2~81 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a1290e98979eb573ff7da5a9d5e47831d586125c;p=xonotic%2Fxonotic-data.pk3dir.git Clear up a few more hardcoded slot 0 cases --- diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index f55d31f6d..6fdedd0d1 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -95,7 +95,7 @@ void W_Porto_Fail(entity this, float failhard) tracetoss(this, this); if(vdist(trace_endpos - this.realowner.origin, <, 128)) { - .entity weaponentity = weaponentities[0]; // TODO: unhardcode + .entity weaponentity = this.weaponentity_fld; W_ThrowNewWeapon(this.realowner, WEP_PORTO.m_id, 0, this.origin, this.velocity, weaponentity); Send_Notification(NOTIF_ONE, this.realowner, MSG_CENTER, CENTER_PORTO_FAILED); } @@ -148,7 +148,7 @@ void W_Porto_Touch(entity this, entity toucher) sound(this, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); delete(this); } - else if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP) + else if((trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK) || (trace_dphitcontents & DPCONTENTS_PLAYERCLIP)) { spamsound(this, CH_SHOTS, SND(PORTO_BOUNCE), VOL_BASE, ATTEN_NORM); // just reflect @@ -255,6 +255,7 @@ void W_Porto_Attack(entity actor, .entity weaponentity, float type) //Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); gren = new(porto); + gren.weaponentity_fld = weaponentity; gren.cnt = type; gren.owner = gren.realowner = actor; gren.playerid = actor.playerid; diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 2104c6edb..543943043 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -469,7 +469,7 @@ void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seek void W_Seeker_Tracker_Think(entity this) { - .entity weaponentity = weaponentities[0]; // TODO: unhardcode + .entity weaponentity = this.weaponentity_fld; // commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up if((IS_DEAD(this.realowner)) || (IS_DEAD(this.tag_target)) || (this.realowner.(weaponentity).m_switchweapon != WEP_SEEKER) || (time > this.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime))) diff --git a/qcsrc/server/tests.qc b/qcsrc/server/tests.qc index 388c4af7b..50dc5a35b 100644 --- a/qcsrc/server/tests.qc +++ b/qcsrc/server/tests.qc @@ -25,9 +25,8 @@ TEST(Weapons, Hurt) PHYS_INPUT_BUTTON_ATCK(it) = true; it.items |= IT_UNLIMITED_AMMO; Weapon wep = WEP_VORTEX; - .entity weaponentity = weaponentities[0]; // TODO: unhardcode W_GiveWeapon(it, wep.m_id); - W_SwitchWeapon_Force(it, wep, weaponentity); + W_SwitchWeapon_Force(it, wep, weaponentities[0]); it = b; PHYS_INPUT_BUTTON_JUMP(it) = true;