From e5b19c10513176fc9af718fbd627218570c7069d Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Mon, 9 Dec 2013 20:32:52 -0500 Subject: [PATCH] Begin fixing ammo field usage --- qcsrc/common/weapons/w_arc.qc | 2 +- qcsrc/common/weapons/w_blaster.qc | 2 +- qcsrc/common/weapons/w_crylink.qc | 2 +- qcsrc/common/weapons/w_devastator.qc | 2 +- qcsrc/common/weapons/w_electro.qc | 2 +- qcsrc/common/weapons/w_fireball.qc | 2 +- qcsrc/common/weapons/w_hagar.qc | 2 +- qcsrc/common/weapons/w_hlac.qc | 2 +- qcsrc/common/weapons/w_hook.qc | 2 +- qcsrc/common/weapons/w_machinegun.qc | 2 +- qcsrc/common/weapons/w_minelayer.qc | 2 +- qcsrc/common/weapons/w_minstanex.qc | 2 +- qcsrc/common/weapons/w_mortar.qc | 2 +- qcsrc/common/weapons/w_nex.qc | 2 +- qcsrc/common/weapons/w_porto.qc | 2 +- qcsrc/common/weapons/w_rifle.qc | 2 +- qcsrc/common/weapons/w_seeker.qc | 2 +- qcsrc/common/weapons/w_shockwave.qc | 2 +- qcsrc/common/weapons/w_tuba.qc | 2 +- qcsrc/common/weapons/weapons.qc | 22 ++++++---------------- qcsrc/common/weapons/weapons.qh | 7 ++++--- qcsrc/server/defs.qh | 2 -- 22 files changed, 29 insertions(+), 40 deletions(-) diff --git a/qcsrc/common/weapons/w_arc.qc b/qcsrc/common/weapons/w_arc.qc index 6ce4a90d0..18b1ba567 100644 --- a/qcsrc/common/weapons/w_arc.qc +++ b/qcsrc/common/weapons/w_arc.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ ARC, /* function */ w_arc, -/* ammotype */ IT_CELLS, +/* ammotype */ ammo_cells, /* impulse */ 5, /* flags */ WEP_FLAG_NORMAL, /* rating */ BOT_PICKUP_RATING_HIGH, diff --git a/qcsrc/common/weapons/w_blaster.qc b/qcsrc/common/weapons/w_blaster.qc index 24cc175d8..96bc865bc 100644 --- a/qcsrc/common/weapons/w_blaster.qc +++ b/qcsrc/common/weapons/w_blaster.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ BLASTER, /* function */ W_Blaster, -/* ammotype */ 0, +/* ammotype */ ammo_none, /* impulse */ 1, /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, /* rating */ 0, diff --git a/qcsrc/common/weapons/w_crylink.qc b/qcsrc/common/weapons/w_crylink.qc index 8d25c6b7e..df9b1f922 100644 --- a/qcsrc/common/weapons/w_crylink.qc +++ b/qcsrc/common/weapons/w_crylink.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ CRYLINK, /* function */ w_crylink, -/* ammotype */ IT_CELLS, +/* ammotype */ ammo_cells, /* impulse */ 6, /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, /* rating */ BOT_PICKUP_RATING_MID, diff --git a/qcsrc/common/weapons/w_devastator.qc b/qcsrc/common/weapons/w_devastator.qc index 43e5359ac..3744ff81a 100644 --- a/qcsrc/common/weapons/w_devastator.qc +++ b/qcsrc/common/weapons/w_devastator.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ DEVASTATOR, /* function */ W_Devastator, -/* ammotype */ IT_ROCKETS, +/* ammotype */ ammo_rockets, /* impulse */ 9, /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, /* rating */ BOT_PICKUP_RATING_HIGH, diff --git a/qcsrc/common/weapons/w_electro.qc b/qcsrc/common/weapons/w_electro.qc index 47bffb0af..53fb053a8 100644 --- a/qcsrc/common/weapons/w_electro.qc +++ b/qcsrc/common/weapons/w_electro.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ ELECTRO, /* function */ W_Electro, -/* ammotype */ IT_CELLS, +/* ammotype */ ammo_cells, /* impulse */ 5, /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, /* rating */ BOT_PICKUP_RATING_MID, diff --git a/qcsrc/common/weapons/w_fireball.qc b/qcsrc/common/weapons/w_fireball.qc index 83b69a700..d27d565b7 100644 --- a/qcsrc/common/weapons/w_fireball.qc +++ b/qcsrc/common/weapons/w_fireball.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ FIREBALL, /* function */ w_fireball, -/* ammotype */ 0, +/* ammotype */ ammo_none, // WEAPONTODO /* impulse */ 9, /* flags */ WEP_FLAG_SUPERWEAPON | WEP_TYPE_SPLASH, /* rating */ BOT_PICKUP_RATING_MID, diff --git a/qcsrc/common/weapons/w_hagar.qc b/qcsrc/common/weapons/w_hagar.qc index 02554970c..20e7b7b90 100644 --- a/qcsrc/common/weapons/w_hagar.qc +++ b/qcsrc/common/weapons/w_hagar.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ HAGAR, /* function */ w_hagar, -/* ammotype */ IT_ROCKETS, +/* ammotype */ ammo_rockets, /* impulse */ 8, /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, /* rating */ BOT_PICKUP_RATING_MID, diff --git a/qcsrc/common/weapons/w_hlac.qc b/qcsrc/common/weapons/w_hlac.qc index 509a0eabb..d4e4b3136 100644 --- a/qcsrc/common/weapons/w_hlac.qc +++ b/qcsrc/common/weapons/w_hlac.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ HLAC, /* function */ w_hlac, -/* ammotype */ IT_CELLS, +/* ammotype */ ammo_cells, /* impulse */ 6, /* flags */ WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, /* rating */ BOT_PICKUP_RATING_MID, diff --git a/qcsrc/common/weapons/w_hook.qc b/qcsrc/common/weapons/w_hook.qc index 3deabd127..8a5cc0531 100644 --- a/qcsrc/common/weapons/w_hook.qc +++ b/qcsrc/common/weapons/w_hook.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ HOOK, /* function */ w_hook, -/* ammotype */ IT_CELLS|IT_FUEL, +/* ammotype */ ammo_fuel, /* impulse */ 0, /* flags */ WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, /* rating */ 0, diff --git a/qcsrc/common/weapons/w_machinegun.qc b/qcsrc/common/weapons/w_machinegun.qc index a8e5a756b..57924a1c2 100644 --- a/qcsrc/common/weapons/w_machinegun.qc +++ b/qcsrc/common/weapons/w_machinegun.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ UZI, /* function */ w_uzi, -/* ammotype */ IT_NAILS, +/* ammotype */ ammo_nails, /* impulse */ 3, /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN, /* rating */ BOT_PICKUP_RATING_MID, diff --git a/qcsrc/common/weapons/w_minelayer.qc b/qcsrc/common/weapons/w_minelayer.qc index 49d2605b4..4e1092eed 100644 --- a/qcsrc/common/weapons/w_minelayer.qc +++ b/qcsrc/common/weapons/w_minelayer.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ MINE_LAYER, /* function */ w_minelayer, -/* ammotype */ IT_ROCKETS, +/* ammotype */ ammo_rockets, /* impulse */ 4, /* flags */ WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, /* rating */ BOT_PICKUP_RATING_HIGH, diff --git a/qcsrc/common/weapons/w_minstanex.qc b/qcsrc/common/weapons/w_minstanex.qc index 46f84d258..433a5ee81 100644 --- a/qcsrc/common/weapons/w_minstanex.qc +++ b/qcsrc/common/weapons/w_minstanex.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ MINSTANEX, /* function */ w_minstanex, -/* ammotype */ IT_CELLS, +/* ammotype */ ammo_cells, /* impulse */ 7, /* flags */ WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN, /* rating */ BOT_PICKUP_RATING_HIGH, diff --git a/qcsrc/common/weapons/w_mortar.qc b/qcsrc/common/weapons/w_mortar.qc index 3ac46814c..588d4994b 100644 --- a/qcsrc/common/weapons/w_mortar.qc +++ b/qcsrc/common/weapons/w_mortar.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ MORTAR, /* function */ w_glauncher, -/* ammotype */ IT_ROCKETS, +/* ammotype */ ammo_rockets, /* impulse */ 4, /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, /* rating */ BOT_PICKUP_RATING_MID, diff --git a/qcsrc/common/weapons/w_nex.qc b/qcsrc/common/weapons/w_nex.qc index 0cfa1f247..9c0dfbbe8 100644 --- a/qcsrc/common/weapons/w_nex.qc +++ b/qcsrc/common/weapons/w_nex.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ NEX, /* function */ w_nex, -/* ammotype */ IT_CELLS, +/* ammotype */ ammo_cells, /* impulse */ 7, /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN, /* rating */ BOT_PICKUP_RATING_HIGH, diff --git a/qcsrc/common/weapons/w_porto.qc b/qcsrc/common/weapons/w_porto.qc index b22e5471d..802dabbb3 100644 --- a/qcsrc/common/weapons/w_porto.qc +++ b/qcsrc/common/weapons/w_porto.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ PORTO, /* function */ w_porto, -/* ammotype */ 0, +/* ammotype */ ammo_none, /* impulse */ 0, /* flags */ WEP_TYPE_OTHER | WEP_FLAG_SUPERWEAPON, /* rating */ 0, diff --git a/qcsrc/common/weapons/w_rifle.qc b/qcsrc/common/weapons/w_rifle.qc index 424874768..c37489135 100644 --- a/qcsrc/common/weapons/w_rifle.qc +++ b/qcsrc/common/weapons/w_rifle.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ RIFLE, /* function */ w_rifle, -/* ammotype */ IT_NAILS, +/* ammotype */ ammo_nails, /* impulse */ 7, /* flags */ WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN, /* rating */ BOT_PICKUP_RATING_MID, diff --git a/qcsrc/common/weapons/w_seeker.qc b/qcsrc/common/weapons/w_seeker.qc index 63385c67a..05dc4dd1e 100644 --- a/qcsrc/common/weapons/w_seeker.qc +++ b/qcsrc/common/weapons/w_seeker.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ SEEKER, /* function */ w_seeker, -/* ammotype */ IT_ROCKETS, +/* ammotype */ ammo_rockets, /* impulse */ 8, /* flags */ WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, /* rating */ BOT_PICKUP_RATING_MID, diff --git a/qcsrc/common/weapons/w_shockwave.qc b/qcsrc/common/weapons/w_shockwave.qc index 0f98789cc..617248eae 100644 --- a/qcsrc/common/weapons/w_shockwave.qc +++ b/qcsrc/common/weapons/w_shockwave.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ SHOCKWAVE, /* function */ W_Shockwave, -/* ammotype */ IT_SHELLS, +/* ammotype */ ammo_shells, /* impulse */ 2, /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN, /* rating */ BOT_PICKUP_RATING_LOW, diff --git a/qcsrc/common/weapons/w_tuba.qc b/qcsrc/common/weapons/w_tuba.qc index a68ba575a..983b0dec2 100644 --- a/qcsrc/common/weapons/w_tuba.qc +++ b/qcsrc/common/weapons/w_tuba.qc @@ -2,7 +2,7 @@ REGISTER_WEAPON( /* WEP_##id */ TUBA, /* function */ w_tuba, -/* ammotype */ 0, +/* ammotype */ ammo_none, /* impulse */ 1, /* flags */ WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH, /* rating */ BOT_PICKUP_RATING_MID, diff --git a/qcsrc/common/weapons/weapons.qc b/qcsrc/common/weapons/weapons.qc index 2f9dd2c92..9ec3b7ec0 100644 --- a/qcsrc/common/weapons/weapons.qc +++ b/qcsrc/common/weapons/weapons.qc @@ -74,7 +74,7 @@ WepSet ReadWepSet() } #endif -void register_weapon(float id, WepSet bit, float(float) func, float ammotype, float i, float weapontype, float pickupbasevalue, string modelname, string shortname, string wname) +void register_weapon(float id, WepSet bit, float(float) func, .float ammotype, float i, float weapontype, float pickupbasevalue, string modelname, string shortname, string wname) { entity e; weapon_info[id - 1] = e = spawn(); @@ -83,7 +83,7 @@ void register_weapon(float id, WepSet bit, float(float) func, float ammotype, fl e.weapons = bit; e.netname = shortname; e.message = wname; - e.items = ammotype; + //e.items = ammotype; e.weapon_func = func; e.mdl = modelname; e.model = strzone(strcat("models/weapons/g_", modelname, ".md3")); @@ -91,18 +91,7 @@ void register_weapon(float id, WepSet bit, float(float) func, float ammotype, fl 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; + e.current_ammo = ammotype; #ifndef MENUQC func(WR_INIT); @@ -120,7 +109,7 @@ void register_weapons_done() dummy_weapon_info.weapons = '0 0 0'; dummy_weapon_info.netname = ""; dummy_weapon_info.message = "AOL CD Thrower"; - dummy_weapon_info.items = 0; + //dummy_weapon_info.items = 0; dummy_weapon_info.weapon_func = w_null; dummy_weapon_info.mdl = ""; dummy_weapon_info.model = ""; @@ -128,6 +117,7 @@ void register_weapons_done() dummy_weapon_info.model2 = ""; dummy_weapon_info.impulse = -1; dummy_weapon_info.bot_pickupbasevalue = 0; + dummy_weapon_info.current_ammo = ammo_broken; float i; weaponorder_byid = ""; @@ -256,5 +246,5 @@ string W_Name(float weaponid) float W_AmmoItemCode(float wpn) { - return (get_weaponinfo(wpn)).items & IT_AMMO; + return (get_weaponinfo(wpn)).items & IT_AMMO; // WEAPONTODO } diff --git a/qcsrc/common/weapons/weapons.qh b/qcsrc/common/weapons/weapons.qh index bf768411c..3ff5b6225 100644 --- a/qcsrc/common/weapons/weapons.qh +++ b/qcsrc/common/weapons/weapons.qh @@ -122,7 +122,8 @@ float W_AmmoItemCode(float wpn); .float ammo_rockets; .float ammo_cells; .float ammo_fuel; -.float ammo_batteries; // dummy +.float ammo_none; +.float ammo_broken; // dummy // entity properties of weaponinfo: .float weapon; // WEP_... @@ -137,7 +138,7 @@ float W_AmmoItemCode(float wpn); .float impulse; // weapon impulse .float bot_pickupbasevalue; // bot weapon priority .string model2; // wpn- sprite name -..float ammo_field; // main ammo field +..float current_ammo; // main ammo field // other useful macros #define WEP_ACTION(wpn,wrequest) (get_weaponinfo(wpn)).weapon_func(wrequest) @@ -172,7 +173,7 @@ float W_AmmoItemCode(float wpn); #define WEP_SET_PROP(wepid,wepname,type,prop,name) get_weaponinfo(WEP_##wepid).##prop = autocvar_g_balance_##wepname##_##name; float w_null(float dummy); -void register_weapon(float id, WepSet bit, float(float) func, float ammotype, float i, float weapontype, float pickupbasevalue, string modelname, string shortname, string wname); +void register_weapon(float id, WepSet bit, float(float) func, .float ammotype, float i, float weapontype, float pickupbasevalue, string modelname, string shortname, string wname); void register_weapons_done(); // note: the fabs call is just there to hide "if result is constant" warning diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 0ebc93756..bf8456e92 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -526,8 +526,6 @@ float client_cefc_accumulator; float client_cefc_accumulatortime; #endif -..float current_ammo; - .float weapon_load[WEP_MAXCOUNT]; .float ammo_none; // used by the reloading system, must always be 0 .float clip_load; -- 2.39.2