From: Mario <mario.mario@y7mail.com>
Date: Fri, 29 May 2020 17:57:35 +0000 (+1000)
Subject: Remove some unnecessary item bits, increase maximum items to 32 now that the item... 
X-Git-Tag: xonotic-v0.8.5~1003
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=294e75cd811b19c7f26271fec13c142470266bf6;p=xonotic%2Fxonotic-data.pk3dir.git

Remove some unnecessary item bits, increase maximum items to 32 now that the item stat limit isn't reached
---

diff --git a/qcsrc/common/items/all.qh b/qcsrc/common/items/all.qh
index 840eb0a88..39400eda1 100644
--- a/qcsrc/common/items/all.qh
+++ b/qcsrc/common/items/all.qh
@@ -4,8 +4,8 @@
 
 #include "item.qh"
 
-// 24 so it matches the limit for the .items field
-REGISTRY(Items, 24)
+// NOTE: 24 is the limit for the .items field
+REGISTRY(Items, 32)
 #ifdef GAMEQC
 REGISTRY_DEPENDS(Items, Models)
 #endif
diff --git a/qcsrc/common/items/inventory.qh b/qcsrc/common/items/inventory.qh
index 1c9d21669..5109628e8 100644
--- a/qcsrc/common/items/inventory.qh
+++ b/qcsrc/common/items/inventory.qh
@@ -16,7 +16,7 @@ ENDCLASS(Inventory)
 REGISTER_NET_LINKED(ENT_CLIENT_INVENTORY)
 
 const int Inventory_groups_minor = 8; // exactly 1 byte
-const int Inventory_groups_major = 3; // ceil(REGISTRY_MAX(Items) / Inventory_groups_minor)
+const int Inventory_groups_major = 4; // ceil(REGISTRY_MAX(Items) / Inventory_groups_minor)
 
 #define G_MAJOR(id) (floor((id) / Inventory_groups_minor))
 #define G_MINOR(id) ((id) % Inventory_groups_minor)
diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh
index d095c8134..a8b8b4675 100644
--- a/qcsrc/common/items/item.qh
+++ b/qcsrc/common/items/item.qh
@@ -18,30 +18,18 @@ const int IT_JETPACK               		=  BIT(2); // actual item
 const int IT_USING_JETPACK         		=  BIT(3); // confirmation that button is pressed
 const int IT_FUEL_REGEN            		=  BIT(4); // fuel regeneration trigger
 
-const int IT_FUEL       				=  BIT(5);
-const int IT_SHELLS                     =  BIT(6);
-const int IT_NAILS                      =  BIT(7);
-const int IT_ROCKETS                    =  BIT(8);
-const int IT_CELLS                      =  BIT(9);
-const int IT_PLASMA     				= BIT(10);
+const int IT_RESOURCE       			=  BIT(5); // bitflag to mark this item as a resource (unused)
 
-const int IT_5HP                       	= BIT(11);
-const int IT_25HP                      	= BIT(12);
-const int IT_HEALTH     				= BIT(13);
+const int IT_KEY1						= BIT(6);
+const int IT_KEY2						= BIT(7);
 
-const int IT_ARMOR_SHARD               	= BIT(14);
-const int IT_ARMOR                     	= BIT(15);
-
-const int IT_KEY1						= BIT(16);
-const int IT_KEY2						= BIT(17);
-
-const int IT_CTF_SHIELDED          		= BIT(18); // set for the flag shield
+const int IT_CTF_SHIELDED          		= BIT(8); // set for the flag shield
 
 // special colorblend meaning in engine
-const int IT_INVISIBILITY 				= BIT(19);
-const int IT_INVINCIBLE 				= BIT(20);
-const int IT_SUPERWEAPON				= BIT(21); // suit
-const int IT_STRENGTH   				= BIT(22);
+const int IT_INVISIBILITY 				= BIT(9);
+const int IT_INVINCIBLE 				= BIT(10);
+const int IT_SUPERWEAPON				= BIT(11); // suit
+const int IT_STRENGTH   				= BIT(12);
 
 // item masks
 const int IT_PICKUPMASK                	= IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately
diff --git a/qcsrc/common/items/item/ammo.qh b/qcsrc/common/items/item/ammo.qh
index 936d42f1f..22d2826fe 100644
--- a/qcsrc/common/items/item/ammo.qh
+++ b/qcsrc/common/items/item/ammo.qh
@@ -67,7 +67,7 @@ REGISTER_ITEM(Bullets, Bullets) {
     this.m_icon     =   "ammo_bullets";
 #ifdef SVQC
     this.m_botvalue =   1500;
-    this.m_itemid   =   IT_NAILS;
+    this.m_itemid   =   IT_RESOURCE;
     this.m_iteminit =   ammo_bullets_init;
 #endif
 }
@@ -97,7 +97,7 @@ REGISTER_ITEM(Cells, Ammo) {
     this.m_icon     =   "ammo_cells";
 #ifdef SVQC
     this.m_botvalue =   1500;
-    this.m_itemid   =   IT_CELLS;
+    this.m_itemid   =   IT_RESOURCE;
     this.m_iteminit =   ammo_cells_init;
 #endif
 }
@@ -127,7 +127,7 @@ REGISTER_ITEM(Plasma, Ammo) {
     this.m_icon     =   "ammo_plasma";
 #ifdef SVQC
     this.m_botvalue =   1500;
-    this.m_itemid   =   IT_PLASMA;
+    this.m_itemid   =   IT_RESOURCE;
     this.m_iteminit =   ammo_plasma_init;
 #endif
 }
@@ -157,7 +157,7 @@ REGISTER_ITEM(Rockets, Ammo) {
     this.m_icon     =   "ammo_rockets";
 #ifdef SVQC
     this.m_botvalue =   1500;
-    this.m_itemid   =   IT_ROCKETS;
+    this.m_itemid   =   IT_RESOURCE;
     this.m_iteminit =   ammo_rockets_init;
 #endif
 }
@@ -191,7 +191,7 @@ REGISTER_ITEM(Shells, Shells) {
     this.m_icon     =   "ammo_shells";
 #ifdef SVQC
     this.m_botvalue =   1000;
-    this.m_itemid   =   IT_SHELLS;
+    this.m_itemid   =   IT_RESOURCE;
     this.m_iteminit =   ammo_shells_init;
 #endif
 }
diff --git a/qcsrc/common/items/item/armor.qh b/qcsrc/common/items/item/armor.qh
index be6c52af5..4f605c2e6 100644
--- a/qcsrc/common/items/item/armor.qh
+++ b/qcsrc/common/items/item/armor.qh
@@ -42,7 +42,7 @@ REGISTER_ITEM(ArmorSmall, Armor) {
     this.m_name                 =   _("Small armor");
     this.m_icon                 =   "armor";
 #ifdef SVQC
-    this.m_itemid               =   IT_ARMOR_SHARD;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_short);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
     this.m_pickupanyway         =   GET(g_pickup_armorsmall_anyway);
@@ -80,7 +80,7 @@ REGISTER_ITEM(ArmorMedium, Armor) {
     this.m_name                 =   _("Medium armor");
     this.m_icon                 =   "armor";
 #ifdef SVQC
-    this.m_itemid               =   IT_ARMOR;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_medium);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_medium);
     this.m_pickupanyway         =   GET(g_pickup_armormedium_anyway);
@@ -120,7 +120,7 @@ REGISTER_ITEM(ArmorBig, Armor) {
     this.m_color                =   '0 1 0';
     this.m_waypoint             =   _("Big armor");
 #ifdef SVQC
-    this.m_itemid               =   IT_ARMOR;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_long);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
     this.m_pickupanyway         =   GET(g_pickup_armorbig_anyway);
@@ -162,7 +162,7 @@ REGISTER_ITEM(ArmorMega, Armor) {
     this.m_waypointblink        =   2;
 #ifdef SVQC
     this.m_maxs                 =   '16 16 70';
-    this.m_itemid               =   IT_ARMOR;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_long);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
     this.m_pickupanyway         =   GET(g_pickup_armormega_anyway);
diff --git a/qcsrc/common/items/item/health.qh b/qcsrc/common/items/item/health.qh
index 14e942a08..869c1838f 100644
--- a/qcsrc/common/items/item/health.qh
+++ b/qcsrc/common/items/item/health.qh
@@ -42,7 +42,7 @@ REGISTER_ITEM(HealthSmall, Health) {
     this.m_name                 =   _("Small health");
     this.m_icon                 =   "health";
 #ifdef SVQC
-    this.m_itemid               =   IT_5HP;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_short);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
     this.m_pickupanyway         =   GET(g_pickup_healthsmall_anyway);
@@ -80,7 +80,7 @@ REGISTER_ITEM(HealthMedium, Health) {
     this.m_name                 =   _("Medium health");
     this.m_icon                 =   "health";
 #ifdef SVQC
-    this.m_itemid               =   IT_25HP;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_short);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
     this.m_pickupanyway         =   GET(g_pickup_healthmedium_anyway);
@@ -120,7 +120,7 @@ REGISTER_ITEM(HealthBig, Health) {
     this.m_color                =   '1 0 0';
     this.m_waypoint             =   _("Big health");
 #ifdef SVQC
-    this.m_itemid               =   IT_25HP;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_medium);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_medium);
     this.m_pickupanyway         =   GET(g_pickup_healthbig_anyway);
@@ -162,7 +162,7 @@ REGISTER_ITEM(HealthMega, Health) {
     this.m_waypointblink        =   2;
 #ifdef SVQC
     this.m_maxs                 =   '16 16 70';
-    this.m_itemid               =   IT_HEALTH;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_long);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
     this.m_pickupanyway         =   GET(g_pickup_healthmega_anyway);
diff --git a/qcsrc/common/items/item/jetpack.qh b/qcsrc/common/items/item/jetpack.qh
index 8440975d0..2099fdc67 100644
--- a/qcsrc/common/items/item/jetpack.qh
+++ b/qcsrc/common/items/item/jetpack.qh
@@ -72,7 +72,7 @@ REGISTER_ITEM(JetpackFuel, Ammo) {
     this.m_icon     =   "ammo_fuel";
 #ifdef SVQC
     this.m_botvalue =   2000;
-    this.m_itemid   =   IT_FUEL;
+    this.m_itemid   =   IT_RESOURCE;
     this.m_iteminit =   ammo_fuel_init;
 #endif
 }
diff --git a/qcsrc/common/mutators/mutator/instagib/items.qh b/qcsrc/common/mutators/mutator/instagib/items.qh
index abc57a4a0..c0aa83121 100644
--- a/qcsrc/common/mutators/mutator/instagib/items.qh
+++ b/qcsrc/common/mutators/mutator/instagib/items.qh
@@ -34,7 +34,7 @@ REGISTER_ITEM(VaporizerCells, Ammo) {
     this.m_icon                 =   "ammo_supercells";
 #ifdef SVQC
     this.m_botvalue             =   2000;
-    this.m_itemid               =   IT_CELLS;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(instagib_respawntime_ammo);
     this.m_respawntimejitter    =   GET(instagib_respawntimejitter_ammo);
     this.m_iteminit             =   ammo_vaporizercells_init;
@@ -61,7 +61,7 @@ REGISTER_ITEM(ExtraLife, Powerup) {
     this.m_color                =   '1 0 0';
     this.m_waypoint             =   _("Extra life");
     this.m_waypointblink        =   2;
-    this.m_itemid               =   IT_NAILS;
+    this.m_itemid               =   IT_RESOURCE;
 }
 
 SPAWNFUNC_ITEM(item_extralife, ITEM_ExtraLife)
diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc
index 2f45c06ae..ccb7053e4 100644
--- a/qcsrc/server/client.qc
+++ b/qcsrc/server/client.qc
@@ -2101,7 +2101,6 @@ bool joinAllowed(entity this)
 	return true;
 }
 
-.int items_added;
 .string shootfromfixedorigin;
 .bool dualwielding_prev;
 bool PlayerThink(entity this)
@@ -2218,8 +2217,6 @@ bool PlayerThink(entity this)
 	// LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
 	//if(frametime)
 	{
-		this.items &= ~this.items_added;
-
 		for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
 		{
 			.entity weaponentity = weaponentities[slot];
@@ -2227,12 +2224,6 @@ bool PlayerThink(entity this)
 				W_Vortex_Charge(this, weaponentity, frametime);
 			W_WeaponFrame(this, weaponentity);
 		}
-
-		this.items_added = 0;
-		if ((this.items & ITEM_Jetpack.m_itemid) && ((this.items & ITEM_JetpackRegen.m_itemid) || GetResource(this, RES_FUEL) >= 0.01))
-            this.items_added |= IT_FUEL;
-
-		this.items |= this.items_added;
 	}
 
 	if (frametime)