From 8ce7173ad6e67489f927722de3f58ca41bdb099d Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Fri, 11 Feb 2011 15:54:23 +0100 Subject: [PATCH] have the weapon entities know the ammo field of the weapon --- qcsrc/common/items.qc | 12 ++++++++++++ qcsrc/common/items.qh | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/items.qc b/qcsrc/common/items.qc index 5387c05aa..3ddf8099f 100644 --- a/qcsrc/common/items.qc +++ b/qcsrc/common/items.qc @@ -19,6 +19,18 @@ void register_weapon(float id, float(float) func, float ammotype, float i, float e.model2 = strzone(strcat("wpn-", e.mdl)); e.impulse = i; e.bot_pickupbasevalue = pickupbasevalue; + if(ammotype & IT_SHELLS) + e.ammo_field = ammo_shells; + else if(ammotype & IT_NAILS) + e.ammo_field = ammo_nails; + else if(ammotype & IT_ROCKETS) + e.ammo_field = ammo_rockets; + else if(ammotype & IT_CELLS) + e.ammo_field = ammo_cells; + else if(ammotype & IT_FUEL) + e.ammo_field = ammo_fuel; + else + e.ammo_field = ammo_batteries; } float w_null(float dummy) { diff --git a/qcsrc/common/items.qh b/qcsrc/common/items.qh index 64d7abd64..ebee8aaaa 100644 --- a/qcsrc/common/items.qh +++ b/qcsrc/common/items.qh @@ -60,6 +60,14 @@ string W_FixWeaponOrder(string order, float complete); string W_NameWeaponOrder(string order); string W_NumberWeaponOrder(string order); +// ammo types +.float ammo_shells; +.float ammo_nails; +.float ammo_rockets; +.float ammo_cells; +.float ammo_fuel; +.float ammo_batteries; // dummy + // entity properties of weaponinfo: .float weapon; // WEP_... .float weapons; // WEPBIT_... @@ -73,8 +81,7 @@ string W_NumberWeaponOrder(string order); .float impulse; // weapon impulse .float bot_pickupbasevalue; // bot weapon priority .string model2; // wpn- sprite name - - +..float ammo_field; // main ammo field // dynamic weapon adding float w_null(float dummy); -- 2.39.2