]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/itemstime.qc
Add a cvar to hide large armor and health
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / itemstime.qc
index f0db281af8c522f3d23e06898f6f745fca7fa69d..ca65c2c48f0f9bcf0daac6616ea211cd1305d232 100644 (file)
@@ -24,19 +24,37 @@ MUTATOR_HOOKFUNCTION(itemstime, CSQC_Parse_TempEntity) {
 }
 #endif
 
+#ifdef CSQC
+int autocvar_hud_panel_itemstime = 2;
+float autocvar_hud_panel_itemstime_dynamicsize = 1;
+float autocvar_hud_panel_itemstime_ratio = 2;
+int autocvar_hud_panel_itemstime_iconalign;
+bool autocvar_hud_panel_itemstime_progressbar = 0;
+float autocvar_hud_panel_itemstime_progressbar_maxtime = 30;
+string autocvar_hud_panel_itemstime_progressbar_name = "progressbar";
+float autocvar_hud_panel_itemstime_progressbar_reduced;
+bool autocvar_hud_panel_itemstime_hidespawned = 1;
+bool autocvar_hud_panel_itemstime_hidelarge = false;
+int autocvar_hud_panel_itemstime_text = 1;
+#define hud_panel_itemstime_hidelarge autocvar_hud_panel_itemstime_hidelarge
+#endif
+
 #ifdef SVQC
+#define hud_panel_itemstime_hidelarge false
+#endif
 
-bool Item_ItemsTime_Allow(entity e)
+bool Item_ItemsTime_Allow(GameItem it, WepSet _weapons)
 {
-    GameItem it = e.itemdef;
-       return (false
-       || it.instanceOfPowerup
-       || it == ITEM_ArmorMega     || it == ITEM_ArmorLarge
-       || it == ITEM_HealthMega    || it == ITEM_HealthLarge
-       || (e.weapons & WEPSET_SUPERWEAPONS)
-       );
+    return (false
+    || it.instanceOfPowerup
+    || it == ITEM_ArmorMega     || (it == ITEM_ArmorLarge && !hud_panel_itemstime_hidelarge)
+    || it == ITEM_HealthMega    || (it == ITEM_HealthLarge && !hud_panel_itemstime_hidelarge)
+    || (_weapons & WEPSET_SUPERWEAPONS)
+    );
 }
 
+#ifdef SVQC
+
 float it_times[MAX_ITEMS];
 
 void Item_ItemsTime_Init()
@@ -222,17 +240,19 @@ void HUD_ItemsTime()
         ItemsTime_time[ITEM_Shield.m_id] = time + 4;
     }
 
-    float i;
-    float count = 0;
+    int count = 0;
     if (autocvar_hud_panel_itemstime_hidespawned == 1)
-        for (i = 0; i < MAX_ITEMS; ++i)
+        FOREACH(ITEMS, Item_ItemsTime_Allow(it, '0 0 0'), LAMBDA(
             count += (ItemsTime_time[i] > time || -ItemsTime_time[i] > time);
+        ));
     else if (autocvar_hud_panel_itemstime_hidespawned == 2)
-        for (i = 0; i < MAX_ITEMS; ++i)
+        FOREACH(ITEMS, Item_ItemsTime_Allow(it, '0 0 0'), LAMBDA(
             count += (ItemsTime_time[i] > time);
+        ));
     else
-        for (i = 0; i < MAX_ITEMS; ++i)
+        FOREACH(ITEMS, Item_ItemsTime_Allow(it, '0 0 0'), LAMBDA(
             count += (ItemsTime_time[i] != -1);
+        ));
     if (count == 0)
         return;
 
@@ -303,7 +323,7 @@ void HUD_ItemsTime()
 
     float row = 0, column = 0;
     bool item_available;
-    FOREACH(ITEMS, ItemsTime_time[i] != -1, LAMBDA(
+    FOREACH(ITEMS, Item_ItemsTime_Allow(it, '0 0 0') && ItemsTime_time[i] != -1, LAMBDA(
         float item_time = ItemsTime_time[i];
         if (item_time < -1)
         {