]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Unhardcode a few more weaponentities
authorMario <mario@smbclan.net>
Mon, 8 Aug 2016 11:06:45 +0000 (21:06 +1000)
committerMario <mario@smbclan.net>
Mon, 8 Aug 2016 11:06:45 +0000 (21:06 +1000)
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/weapons/selection.qc

index 02987232f84c24ed720efea67a6c61dde7c866ba..a772283a2ed8f9a950c3eac11724498499f164a2 100644 (file)
@@ -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;
index bcd612c5653f4c81a0deffa8791d0833ae5a02a8..00c4ec22cd869a0a1cac51f6df9e52be43a52b67 100644 (file)
@@ -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)
index 8a787241a095695376a8879484d6c8c7390c7b07..b05c0621b534d2dca5c83a840824532881cad9af 100644 (file)
@@ -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);
+               }
        }
 }