]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clear up a few more hardcoded slot 0 cases
authorMario <mario@smbclan.net>
Fri, 30 Sep 2016 09:07:19 +0000 (19:07 +1000)
committerMario <mario@smbclan.net>
Fri, 30 Sep 2016 09:07:19 +0000 (19:07 +1000)
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/server/tests.qc

index f55d31f6d76207b65a14c7772948528bd976d68f..6fdedd0d1b273178b27371ddb8bdf2f04583462f 100644 (file)
@@ -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;
index 2104c6edb84b9110fa7dd8fba80ffeded172e5bd..5439430432f28085c473311a5ce56c6bbdaa7585 100644 (file)
@@ -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)))
index 388c4af7b83d57ea13120fb7afb824f98d485026..50dc5a35bca7cd130b7732fe141819539bc64e01 100644 (file)
@@ -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;