]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 840eb0a88b05c33f98e9ed2954cc6d7d74058123..39400eda12ccdc8f7f0ef0523f92a6920d8a9afb 100644 (file)
@@ -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
index 1c9d21669d2b8d9502d1e5f69d6a8c91fb549ecd..5109628e8ff4e930353748e418f758e832e76b39 100644 (file)
@@ -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)
index d095c81347e25414956bbae4ae0fe8fc5ef4b7c4..a8b8b46757f7359607d468aeafe15ecf349cc1b4 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_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
index 936d42f1f2a3b00e65f23f31e3ac76406ac21306..22d2826fe7db98fe59b9c2a9e0c981ba02d17db1 100644 (file)
@@ -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
 }
index be6c52af59389d37ade902bd65e1db1ff541f0d6..4f605c2e606e645ec4f96d3897e85909a9bc8508 100644 (file)
@@ -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);
index 14e942a085a1f01e9cfd1e54d05d09daf227d49b..869c1838f625de62245f9e769fcbccbfd2b4966a 100644 (file)
@@ -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);
index 8440975d02d4fe5096f6763c926eb7ba71e32a88..2099fdc6790faa4dc8f2c8a54efd7efd432967dc 100644 (file)
@@ -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
 }
index abc57a4a03a9b85472370221d452094dad77689d..c0aa8312186bd131c554b6dfddbba928449e1a9e 100644 (file)
@@ -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)
index 2f45c06aed9adbab7ebd8d499e1bf4ee3d6e768b..ccb7053e4b2e3fc0a8ac92ab520d9f3ab9866449 100644 (file)
@@ -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)