Remove some unnecessary item bits, increase maximum items to 32 now that the item...
authorMario <mario.mario@y7mail.com>
Fri, 29 May 2020 17:57:35 +0000 (03:57 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 29 May 2020 17:57:35 +0000 (03:57 +1000)
qcsrc/common/items/all.qh
qcsrc/common/items/inventory.qh
qcsrc/common/items/item.qh
qcsrc/common/items/item/ammo.qh
qcsrc/common/items/item/armor.qh
qcsrc/common/items/item/health.qh
qcsrc/common/items/item/jetpack.qh
qcsrc/common/mutators/mutator/instagib/items.qh
qcsrc/server/client.qc

index 840eb0a..39400ed 100644 (file)
@@ -4,8 +4,8 @@
 
 #include "item.qh"
 
 
 #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
 #ifdef GAMEQC
 REGISTRY_DEPENDS(Items, Models)
 #endif
index 1c9d216..5109628 100644 (file)
@@ -16,7 +16,7 @@ ENDCLASS(Inventory)
 REGISTER_NET_LINKED(ENT_CLIENT_INVENTORY)
 
 const int Inventory_groups_minor = 8; // exactly 1 byte
 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)
 
 #define G_MAJOR(id) (floor((id) / Inventory_groups_minor))
 #define G_MINOR(id) ((id) % Inventory_groups_minor)
index d095c81..a8b8b46 100644 (file)
@@ -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_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
 
 // 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
 
 // item masks
 const int IT_PICKUPMASK                        = IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately
index 936d42f..22d2826 100644 (file)
@@ -67,7 +67,7 @@ REGISTER_ITEM(Bullets, Bullets) {
     this.m_icon     =   "ammo_bullets";
 #ifdef SVQC
     this.m_botvalue =   1500;
     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
 }
     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_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
 }
     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_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
 }
     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_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
 }
     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_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
 }
     this.m_iteminit =   ammo_shells_init;
 #endif
 }
index be6c52a..4f605c2 100644 (file)
@@ -42,7 +42,7 @@ REGISTER_ITEM(ArmorSmall, Armor) {
     this.m_name                 =   _("Small armor");
     this.m_icon                 =   "armor";
 #ifdef SVQC
     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);
     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_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);
     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_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);
     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_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);
     this.m_respawntime          =   GET(g_pickup_respawntime_long);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
     this.m_pickupanyway         =   GET(g_pickup_armormega_anyway);
index 14e942a..869c183 100644 (file)
@@ -42,7 +42,7 @@ REGISTER_ITEM(HealthSmall, Health) {
     this.m_name                 =   _("Small health");
     this.m_icon                 =   "health";
 #ifdef SVQC
     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);
     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_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);
     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_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);
     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_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);
     this.m_respawntime          =   GET(g_pickup_respawntime_long);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
     this.m_pickupanyway         =   GET(g_pickup_healthmega_anyway);
index 8440975..2099fdc 100644 (file)
@@ -72,7 +72,7 @@ REGISTER_ITEM(JetpackFuel, Ammo) {
     this.m_icon     =   "ammo_fuel";
 #ifdef SVQC
     this.m_botvalue =   2000;
     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
 }
     this.m_iteminit =   ammo_fuel_init;
 #endif
 }
index abc57a4..c0aa831 100644 (file)
@@ -34,7 +34,7 @@ REGISTER_ITEM(VaporizerCells, Ammo) {
     this.m_icon                 =   "ammo_supercells";
 #ifdef SVQC
     this.m_botvalue             =   2000;
     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;
     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_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)
 }
 
 SPAWNFUNC_ITEM(item_extralife, ITEM_ExtraLife)
index 2f45c06..ccb7053 100644 (file)
@@ -2101,7 +2101,6 @@ bool joinAllowed(entity this)
        return true;
 }
 
        return true;
 }
 
-.int items_added;
 .string shootfromfixedorigin;
 .bool dualwielding_prev;
 bool PlayerThink(entity this)
 .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)
        {
        // 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];
                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);
                }
                                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)
        }
 
        if (frametime)