]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Itemstime: fix regression introduced by 0c071920ffd10ccebde36092b7b91eb1673ae856
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 7 Oct 2015 00:43:57 +0000 (11:43 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 7 Oct 2015 00:43:57 +0000 (11:43 +1100)
qcsrc/common/items/all.qh
qcsrc/common/items/inventory.qh
qcsrc/common/mutators/mutator/itemstime.qc

index b2b0dc1e411f59616a9f198902e6c3f3f17ad0dc..8097ab50fe70c1b22efe31cc98fd42fbcb8d8f5a 100644 (file)
@@ -7,7 +7,6 @@ REGISTRY(Items, 24)
 REGISTER_REGISTRY(RegisterItems)
 /** If you register a new item, make sure to add it to all.inc */
 #define REGISTER_ITEM(id, class) REGISTER(RegisterItems, ITEM, Items, Items_COUNT, id, m_id, NEW(class))
 REGISTER_REGISTRY(RegisterItems)
 /** If you register a new item, make sure to add it to all.inc */
 #define REGISTER_ITEM(id, class) REGISTER(RegisterItems, ITEM, Items, Items_COUNT, id, m_id, NEW(class))
-REGISTER_REGISTRY(RegisterItems)
 
 void Dump_Items();
 
 
 void Dump_Items();
 
index 64fa29cfc9f31fa312a567bd1dbcd3245caa3257..ba137a8f94ab3d7f98a7d4fcde1ab922abfb444f 100644 (file)
@@ -15,11 +15,11 @@ class(Inventory) .int inv_items[Items_MAX];
 void Inventory_Read(Inventory data)
 {
     const int bits = ReadInt24_t();
 void Inventory_Read(Inventory data)
 {
     const int bits = ReadInt24_t();
-    FOREACH(Items, bits & BIT(i), LAMBDA(
-        .int fld = inv_items[i];
+    FOREACH(Items, bits & BIT(it.m_id), LAMBDA(
+        .int fld = inv_items[it.m_id];
         int prev = data.(fld);
         int next = data.(fld) = ReadByte();
         int prev = data.(fld);
         int next = data.(fld) = ReadByte();
-        LOG_TRACEF("%s: %.0f -> %.0f\n", Items[i].m_name, prev, next);
+        LOG_TRACEF("%s: %.0f -> %.0f\n", it.m_name, prev, next);
     ));
 }
 #endif
     ));
 }
 #endif
@@ -29,12 +29,12 @@ void Inventory_Write(Inventory data)
 {
     int bits = 0;
     FOREACH(Items, true, LAMBDA(
 {
     int bits = 0;
     FOREACH(Items, true, LAMBDA(
-        .int fld = inv_items[i];
-        bits = BITSET(bits, BIT(i), data.inventory.(fld) != (data.inventory.(fld) = data.(fld)));
+        .int fld = inv_items[it.m_id];
+        bits = BITSET(bits, BIT(it.m_id), data.inventory.(fld) != (data.inventory.(fld) = data.(fld)));
     ));
     WriteInt24_t(MSG_ENTITY, bits);
     ));
     WriteInt24_t(MSG_ENTITY, bits);
-    FOREACH(Items, bits & BIT(i), LAMBDA(
-        WriteByte(MSG_ENTITY, data.inv_items[i]);
+    FOREACH(Items, bits & BIT(it.m_id), LAMBDA(
+        WriteByte(MSG_ENTITY, data.inv_items[it.m_id]);
     ));
 }
 #endif
     ));
 }
 #endif
index 1f17450e2faedd572d011d52257a75422b58eae2..1d615b7c0607623312b7f4ad95978cb27f53f6cb 100644 (file)
@@ -266,15 +266,15 @@ void HUD_ItemsTime()
     int count = 0;
     if (autocvar_hud_panel_itemstime_hidespawned == 1)
         FOREACH(Items, Item_ItemsTime_Allow(it, '0 0 0'), LAMBDA(
     int count = 0;
     if (autocvar_hud_panel_itemstime_hidespawned == 1)
         FOREACH(Items, Item_ItemsTime_Allow(it, '0 0 0'), LAMBDA(
-            count += (ItemsTime_time[i] > time || -ItemsTime_time[i] > time);
+            count += (ItemsTime_time[it.m_id] > time || -ItemsTime_time[it.m_id] > time);
         ));
     else if (autocvar_hud_panel_itemstime_hidespawned == 2)
         FOREACH(Items, Item_ItemsTime_Allow(it, '0 0 0'), LAMBDA(
         ));
     else if (autocvar_hud_panel_itemstime_hidespawned == 2)
         FOREACH(Items, Item_ItemsTime_Allow(it, '0 0 0'), LAMBDA(
-            count += (ItemsTime_time[i] > time);
+            count += (ItemsTime_time[it.m_id] > time);
         ));
     else
         FOREACH(Items, Item_ItemsTime_Allow(it, '0 0 0'), LAMBDA(
         ));
     else
         FOREACH(Items, Item_ItemsTime_Allow(it, '0 0 0'), LAMBDA(
-            count += (ItemsTime_time[i] != -1);
+            count += (ItemsTime_time[it.m_id] != -1);
         ));
     if (count == 0)
         return;
         ));
     if (count == 0)
         return;
@@ -346,8 +346,8 @@ void HUD_ItemsTime()
 
     float row = 0, column = 0;
     bool item_available;
 
     float row = 0, column = 0;
     bool item_available;
-    FOREACH(Items, Item_ItemsTime_Allow(it, '0 0 0') && ItemsTime_time[i] != -1, LAMBDA(
-        float item_time = ItemsTime_time[i];
+    FOREACH(Items, Item_ItemsTime_Allow(it, '0 0 0') && ItemsTime_time[it.m_id] != -1, LAMBDA(
+        float item_time = ItemsTime_time[it.m_id];
         if (item_time < -1)
         {
             item_available = true;
         if (item_time < -1)
         {
             item_available = true;
@@ -356,25 +356,25 @@ void HUD_ItemsTime()
         else
             item_available = (item_time <= time);
 
         else
             item_available = (item_time <= time);
 
-        if (ItemsTime_time[i] >= 0)
+        if (ItemsTime_time[it.m_id] >= 0)
         {
         {
-            if (time <= ItemsTime_time[i])
-                ItemsTime_availableTime[i] = 0;
-            else if (ItemsTime_availableTime[i] == 0)
-                ItemsTime_availableTime[i] = time;
+            if (time <= ItemsTime_time[it.m_id])
+                ItemsTime_availableTime[it.m_id] = 0;
+            else if (ItemsTime_availableTime[it.m_id] == 0)
+                ItemsTime_availableTime[it.m_id] = time;
         }
         }
-        else if (ItemsTime_availableTime[i] == 0)
-            ItemsTime_availableTime[i] = time;
+        else if (ItemsTime_availableTime[it.m_id] == 0)
+            ItemsTime_availableTime[it.m_id] = time;
 
 
-        float f = (time - ItemsTime_availableTime[i]) * 2;
+        float f = (time - ItemsTime_availableTime[it.m_id]) * 2;
         f = (f > 1) ? 0 : bound(0, f, 1);
 
         if (autocvar_hud_panel_itemstime_hidespawned == 1)
         f = (f > 1) ? 0 : bound(0, f, 1);
 
         if (autocvar_hud_panel_itemstime_hidespawned == 1)
-            if (!(ItemsTime_time[i] > time || -ItemsTime_time[i] > time))
+            if (!(ItemsTime_time[it.m_id] > time || -ItemsTime_time[it.m_id] > time))
                 continue;
 
         if (autocvar_hud_panel_itemstime_hidespawned == 2)
                 continue;
 
         if (autocvar_hud_panel_itemstime_hidespawned == 2)
-            if (!(ItemsTime_time[i] > time))
+            if (!(ItemsTime_time[it.m_id] > time))
                 continue;
 
         DrawItemsTimeItem(pos + eX * column * (itemstime_size.x + offset.x) + eY * row * (itemstime_size.y + offset.y), itemstime_size, ar, it, item_time, item_available, f);
                 continue;
 
         DrawItemsTimeItem(pos + eX * column * (itemstime_size.x + offset.x) + eY * row * (itemstime_size.y + offset.y), itemstime_size, ar, it, item_time, item_available, f);