fix a stupid interaction between weapon throwing and weapon load (loaded ammo was...
authorRudolf Polzer <divverent@alientrap.org>
Wed, 14 Mar 2012 09:33:13 +0000 (10:33 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 14 Mar 2012 09:33:13 +0000 (10:33 +0100)
qcsrc/server/cl_weapons.qc
qcsrc/server/t_items.qc

index 4a12ce1850323e10f7b11282a76874cb0f426e66..94eaccd2daf4a4cc8a46b3afc9982c122b006e38 100644 (file)
@@ -262,7 +262,6 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                                if(wa & j)
                                {
                                        ammofield = Item_CounterField(j);
-                                       wep.ammofield = 0;
 
                                        // if our weapon is loaded, give its load back to the player
                                        if(self.(weapon_load[self.weapon]) > 0)
@@ -270,6 +269,8 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                                                own.ammofield += self.(weapon_load[self.weapon]);
                                                self.(weapon_load[self.weapon]) = -1; // schedule the weapon for reloading
                                        }
+
+                                       wep.ammofield = 0;
                                }
                        }
                }
@@ -280,10 +281,6 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                                if(wa & j)
                                {
                                        ammofield = Item_CounterField(j);
-                                       thisammo = min(own.ammofield, wep.ammofield);
-                                       wep.ammofield = thisammo;
-                                       own.ammofield -= thisammo;
-                                       s = strcat(s, " and ", ftos(thisammo), " ", Item_CounterFieldName(j));
 
                                        // if our weapon is loaded, give its load back to the player
                                        if(self.(weapon_load[self.weapon]) > 0)
@@ -291,6 +288,11 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                                                own.ammofield += self.(weapon_load[self.weapon]);
                                                self.(weapon_load[self.weapon]) = -1; // schedule the weapon for reloading
                                        }
+
+                                       thisammo = min(own.ammofield, wep.ammofield);
+                                       wep.ammofield = thisammo;
+                                       own.ammofield -= thisammo;
+                                       s = strcat(s, " and ", ftos(thisammo), " ", Item_CounterFieldName(j));
                                }
                        }
                        s = substring(s, 5, -1);
index b26c840ff0c8834ba446c01939fe8760095a95c1..1e9d6a753c426c0708a8c6e6b79b6ec86f027950 100644 (file)
@@ -379,8 +379,6 @@ float Item_GiveTo(entity item, entity player)
 
                        if (item.weapons & WEPBIT_MINSTANEX)
                                W_GiveWeapon (player, WEP_MINSTANEX, item.netname);
-                       if (item.ammo_cells)
-                               player.ammo_cells = bound(player.ammo_cells, 999, player.ammo_cells + autocvar_g_minstagib_ammo_drop);
                        player.health = 100;
                }
 
@@ -1102,6 +1100,11 @@ void weapon_defaultspawnfunc(float wpn)
        if(self.team)
                f |= FL_NO_WEAPON_STAY;
 
+       // stupid minstagib hack, don't ask
+       if(g_minstagib)
+               if(self.ammo_cells)
+                       self.ammo_cells = autocvar_g_minstagib_ammo_drop;
+
        StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapons, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
        if (self.modelindex) // don't precache if self was removed
                weapon_action(e.weapon, WR_PRECACHE);