From 1b61a95eb65e7e52a3a4abd49cbd88e7dd1693d1 Mon Sep 17 00:00:00 2001 From: div0 Date: Mon, 30 Mar 2009 10:37:13 +0000 Subject: [PATCH] no-operation change to pave the way for fuel and jetpack pickups git-svn-id: svn://svn.icculus.org/nexuiz/trunk@6365 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/common/items.qh | 7 ++++--- data/qcsrc/server/t_items.qc | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/data/qcsrc/common/items.qh b/data/qcsrc/common/items.qh index 2caa0f937..898ebbe20 100644 --- a/data/qcsrc/common/items.qh +++ b/data/qcsrc/common/items.qh @@ -27,8 +27,6 @@ float IT_UNLIMITED_WEAPON_AMMO = 1; // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup. float IT_UNLIMITED_SUPERWEAPONS = 2; // when this bit is set, using a superweapon does not throw it away. Checkpoints can give this powerup. -float IT_UNLIMITED_AMMO = 3; -// both of these combined float IT_CTF_SHIELDED = 4; // set for the flag shield // using jetpack float IT_USING_JETPACK = 8; // confirmation that button is pressed @@ -40,7 +38,6 @@ float IT_ROCKETS = 1024; float IT_CELLS = 2048; float IT_SUPERWEAPON = 4096; float IT_FUEL = 128; -float IT_AMMO = 8064; float IT_STRENGTH = 8192; float IT_INVINCIBLE = 16384; float IT_HEALTH = 32768; @@ -61,6 +58,10 @@ float IT_25HP = 1048576; float IT_ARMOR_SHARD = 2097152; float IT_ARMOR = 4194304; +float IT_AMMO = 8064; // IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_SUPERWEAPON | IT_FUEL; +float IT_PICKUPMASK = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; +float IT_UNLIMITED_AMMO = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO; + // variables: string weaponpriority_hudselector_0; string weaponpriority_hudselector_1; diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index 023000edb..38d6a34ff 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -6,6 +6,7 @@ floatfield Item_CounterField(float it) case IT_NAILS: return ammo_nails; case IT_ROCKETS: return ammo_rockets; case IT_CELLS: return ammo_cells; + case IT_FUEL: return ammo_fuel; case IT_5HP: return health; case IT_25HP: return health; case IT_HEALTH: return health; @@ -24,6 +25,7 @@ string Item_CounterFieldName(float it) case IT_NAILS: return "nails"; case IT_ROCKETS: return "rockets"; case IT_CELLS: return "cells"; + case IT_FUEL: return "fuel"; // add more things here (health, armor) default: error("requested item has no counter field name"); @@ -158,6 +160,12 @@ float Item_GiveTo(entity item, entity player) pickedup = TRUE; player.ammo_cells = min (player.ammo_cells + item.ammo_cells, g_pickup_cells_max); } + if (item.ammo_fuel) + if (player.ammo_fuel < g_pickup_fuel_max) + { + pickedup = TRUE; + player.ammo_fuel = min (player.ammo_fuel + item.ammo_fuel, g_pickup_fuel_max); + } if (item.flags & FL_WEAPON) if ((it = item.weapons - (item.weapons & player.weapons))) @@ -171,6 +179,12 @@ float Item_GiveTo(entity item, entity player) } } + if((it = (item.items - (item.items & player.items) & IT_PICKUPMASK))) + { + pickedup = TRUE; + player.items |= it; + } + if (item.strength_finished) { pickedup = TRUE; @@ -1162,6 +1176,7 @@ void target_items_use (void) target_item_change(0, ammo_nails, target_item_func_set, "misc/itempickup.wav", ""); target_item_change(0, ammo_rockets, target_item_func_set, "misc/itempickup.wav", ""); target_item_change(0, ammo_cells, target_item_func_set, "misc/itempickup.wav", ""); + target_item_change(0, ammo_fuel, target_item_func_set, "misc/itempickup.wav", ""); target_item_change(0, health, target_item_func_set, "misc/megahealth.wav", ""); target_item_change(0, armorvalue, target_item_func_set, "misc/armor25.wav", ""); target_item_change(1, items, target_item_func_itembitset, "misc/powerup.wav", ""); @@ -1178,6 +1193,7 @@ void target_items_use (void) target_item_change(0, ammo_nails, target_item_func_min, "misc/itempickup.wav", ""); target_item_change(0, ammo_rockets, target_item_func_min, "misc/itempickup.wav", ""); target_item_change(0, ammo_cells, target_item_func_min, "misc/itempickup.wav", ""); + target_item_change(0, ammo_fuel, target_item_func_min, "misc/itempickup.wav", ""); target_item_change(0, health, target_item_func_min, "misc/megahealth.wav", ""); target_item_change(0, armorvalue, target_item_func_min, "misc/armor25.wav", ""); target_item_change(1, items, target_item_func_itemand, "misc/powerup.wav", ""); @@ -1194,6 +1210,7 @@ void target_items_use (void) target_item_change(0, ammo_nails, target_item_func_max, "misc/itempickup.wav", ""); target_item_change(0, ammo_rockets, target_item_func_max, "misc/itempickup.wav", ""); target_item_change(0, ammo_cells, target_item_func_max, "misc/itempickup.wav", ""); + target_item_change(0, ammo_fuel, target_item_func_max, "misc/itempickup.wav", ""); target_item_change(0, health, target_item_func_max, "misc/megahealth.wav", ""); target_item_change(0, armorvalue, target_item_func_max, "misc/armor25.wav", ""); target_item_change(1, items, target_item_func_or, "misc/powerup.wav", ""); @@ -1210,6 +1227,7 @@ void target_items_use (void) target_item_change(0, ammo_nails, target_item_func_min, "misc/itempickup.wav", ""); target_item_change(0, ammo_rockets, target_item_func_min, "misc/itempickup.wav", ""); target_item_change(0, ammo_cells, target_item_func_min, "misc/itempickup.wav", ""); + target_item_change(0, ammo_fuel, target_item_func_min, "misc/itempickup.wav", ""); target_item_change(0, health, target_item_func_min, "misc/megahealth.wav", ""); target_item_change(0, armorvalue, target_item_func_min, "misc/armor25.wav", ""); target_item_change(1, items, target_item_func_andnot, "misc/powerup.wav", ""); @@ -1270,6 +1288,8 @@ void spawnfunc_target_items (void) if(argv(i) == "unlimited_superweapons") self.items |= IT_UNLIMITED_SUPERWEAPONS; if(argv(i) == "strength") self.items |= IT_STRENGTH; if(argv(i) == "invincible") self.items |= IT_INVINCIBLE; + if(argv(i) == "jetpack") self.items |= IT_JETPACK; + if(argv(i) == "fuel_regen") self.items |= IT_FUEL_REGEN; for(j = WEP_FIRST; j <= WEP_LAST; ++j) { e = get_weaponinfo(j); -- 2.39.2