}
#endif
-#ifdef SVQC
-
-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)
+ || (_weapons & WEPSET_SUPERWEAPONS)
);
}
+#ifdef SVQC
+
float it_times[MAX_ITEMS];
void Item_ItemsTime_Init()
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;
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)
{
}
}
-bool Item_ItemsTime_Allow(entity e);
+bool Item_ItemsTime_Allow(GameItem it, WepSet _weapons);
float Item_ItemsTime_UpdateTime(entity e, float t);
void Item_ItemsTime_SetTime(entity e, float t);
void Item_ItemsTime_SetTimesForAllPlayers();
sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound
setorigin (self, self.origin);
- if (Item_ItemsTime_Allow(self))
+ if (Item_ItemsTime_Allow(self.itemdef, self.weapons))
{
float t = Item_ItemsTime_UpdateTime(self, 0);
Item_ItemsTime_SetTime(self, t);
void Item_ScheduleRespawnIn(entity e, float t)
{
- if (Item_ItemsTime_Allow(e))
+ if (Item_ItemsTime_Allow(e.itemdef, e.weapons))
{
e.think = Item_RespawnCountdown;
e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);