seta hud_panel_itemstime_progressbar "" "use progressbar behind icons"
seta hud_panel_itemstime_progressbar_name "" "name of progressbar to use behind icons"
seta hud_panel_itemstime_progressbar_xoffset "" "percentage of item width to offset progressbar with"
+seta hud_panel_itemstime_showspawned "0" "show icons of already spawned items"
seta hud_panel_itemstime_text "" "show text/icons"
seta hud_panel_itemstime_progressbar "0"
seta hud_panel_itemstime_progressbar_name "progressbar"
seta hud_panel_itemstime_progressbar_xoffset "0"
+seta hud_panel_itemstime_showspawned "0"
seta hud_panel_itemstime_text "1"
menu_sync
seta hud_panel_itemstime_progressbar "0"
seta hud_panel_itemstime_progressbar_name "progressbar"
seta hud_panel_itemstime_progressbar_xoffset "0"
+seta hud_panel_itemstime_showspawned "0"
seta hud_panel_itemstime_text "1"
menu_sync
seta hud_panel_itemstime_progressbar "0"
seta hud_panel_itemstime_progressbar_name "progressbar"
seta hud_panel_itemstime_progressbar_xoffset "0"
+seta hud_panel_itemstime_showspawned "0"
seta hud_panel_itemstime_text "1"
menu_sync
seta hud_panel_itemstime_progressbar "0"
seta hud_panel_itemstime_progressbar_name "progressbar"
seta hud_panel_itemstime_progressbar_xoffset "0"
+seta hud_panel_itemstime_showspawned "0"
seta hud_panel_itemstime_text "1"
menu_sync
seta hud_panel_itemstime_progressbar "0"
seta hud_panel_itemstime_progressbar_name "progressbar"
seta hud_panel_itemstime_progressbar_xoffset "0"
+seta hud_panel_itemstime_showspawned "0"
seta hud_panel_itemstime_text "1"
menu_sync
float autocvar_hud_panel_itemstime_progressbar;
string autocvar_hud_panel_itemstime_progressbar_name;
float autocvar_hud_panel_itemstime_progressbar_xoffset;
+float autocvar_hud_panel_itemstime_showspawned;
float autocvar_hud_panel_itemstime_text;
float autocvar_hud_panel_modicons;
float autocvar_hud_panel_modicons_dom_layout;
void DrawItemsTimeItem(vector myPos, vector mySize, float itemcode)
{
float t;
- t = floor(ItemsTime_time[itemcode] - time + 0.999);
-
vector color;
- if(t < 5)
- color = '0.7 0 0';
- else if(t < 10)
- color = '0.7 0.7 0';
+ float picalpha;
+ if(ItemsTime_time[itemcode] <= time)
+ {
+ float BLINK_FACTOR = 0.15;
+ float BLINK_BASE = 0.85;
+ float BLINK_FREQ = 5;
+ picalpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
+ }
else
- color = '1 1 1';
+ {
+ picalpha = 1;
+ t = floor(ItemsTime_time[itemcode] - time + 0.999);
+ if(t < 5)
+ color = '0.7 0 0';
+ else if(t < 10)
+ color = '0.7 0.7 0';
+ else
+ color = '1 1 1';
+ }
vector picpos, numpos;
if(autocvar_hud_panel_itemstime_iconalign)
picpos = myPos;
}
- if(autocvar_hud_panel_itemstime_progressbar)
+ if(t > 0 && autocvar_hud_panel_itemstime_progressbar)
HUD_Panel_DrawProgressBar(myPos + eX * autocvar_hud_panel_itemstime_progressbar_xoffset * mySize_x, mySize - eX * autocvar_hud_panel_itemstime_progressbar_xoffset * mySize_x, autocvar_hud_panel_itemstime_progressbar_name, t/autocvar_hud_panel_itemstime_maxitemstime, 0, 0, color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- if(autocvar_hud_panel_itemstime_text)
+ if(t > 0 && autocvar_hud_panel_itemstime_text)
drawstring_aspect(numpos, ftos(t), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
- drawpic_aspect_skin(picpos, GetItemsTimePicture(itemcode), '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(picpos, GetItemsTimePicture(itemcode), '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL);
}
void HUD_ItemsTime(void)
// do not show here mutators-dependent items
ItemsTime_time[0] = time + 25;
ItemsTime_time[1] = time + 8;
- ItemsTime_time[2] = time + 0;
- ItemsTime_time[3] = time + 0;
- ItemsTime_time[4] = time + 0;
- ItemsTime_time[5] = time + 34;
+ ItemsTime_time[2] = -1;
+ ItemsTime_time[3] = -1;
+ ItemsTime_time[4] = -1;
+ ItemsTime_time[5] = time + 0;
ItemsTime_time[6] = time + 4;
ItemsTime_time[7] = time + 19;
ItemsTime_time[8] = time + 46;
float i;
float count;
- for (i = 0; i < ITEMSTIME_MAXITEMS; ++i)
- count += (ItemsTime_time[i] > time);
+ if (autocvar_hud_panel_itemstime_showspawned)
+ for (i = 0; i < ITEMSTIME_MAXITEMS; ++i)
+ count += (ItemsTime_time[i] > time || (ItemsTime_time[i] != -1 && ItemsTime_time[i] <= time));
+ else
+ for (i = 0; i < ITEMSTIME_MAXITEMS; ++i)
+ count += (ItemsTime_time[i] > time);
if (count == 0)
return;
}
for (i = 0; i < ITEMSTIME_MAXITEMS; ++i) {
- if (ItemsTime_time[i] <= time)
+ if (ItemsTime_time[i] == -1)
continue;
+ if (!autocvar_hud_panel_itemstime_showspawned)
+ if (ItemsTime_time[i] <= time)
+ continue;
DrawItemsTimeItem(pos + eX * column * (itemstime_size_x + offset_x) + eY * row * (itemstime_size_y + offset_y), itemstime_size, i);
++row;
if(row >= rows)
HUD_Write_PanelCvar_q("_progressbar");
HUD_Write_PanelCvar_q("_progressbar_name");
HUD_Write_PanelCvar_q("_progressbar_xoffset");
+ HUD_Write_PanelCvar_q("_showspawned");
HUD_Write_PanelCvar_q("_text");
break;
}
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Align icon:")));
me.TD(me, 1, 2.4/2, e = makeXonoticRadioButton(2, "hud_panel_itemstime_iconalign", "0", _("Left")));
me.TD(me, 1, 2.4/2, e = makeXonoticRadioButton(2, "hud_panel_itemstime_iconalign", "1", _("Right")));
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_itemstime_showspawned", _("Show spawned items")));
}
#endif
float world_already_spawned;
void RegisterWeapons();
void Nagger_Init();
+void Item_ItemsTime_Init();
void ClientInit_Spawn();
void WeaponStats_Init();
void WeaponStats_Shutdown();
addstat(STAT_SHIELD_TIME, AS_FLOAT, item_shield_time);
addstat(STAT_FUELREGEN_TIME, AS_FLOAT, item_fuelregen_time);
addstat(STAT_JETPACK_TIME, AS_FLOAT, item_jetpack_time);
+ Item_ItemsTime_Init();
if(g_ca || g_freezetag)
{
float it_fuelregen_time;
float it_jetpack_time;
+void Item_ItemsTime_Init()
+{
+ it_armor_large_time = -1;
+ it_health_mega_time = -1;
+ it_strength_time = -1;
+ it_invisible_time = -1;
+ it_extralife_time = -1;
+ it_speed_time = -1;
+ it_shield_time = -1;
+ it_fuelregen_time = -1;
+ it_jetpack_time = -1;
+}
void Item_ClearItemsTime()
{
- self.item_armor_large_time = 0;
- self.item_health_mega_time = 0;
- self.item_strength_time = 0;
- self.item_invisible_time = 0;
- self.item_extralife_time = 0;
- self.item_speed_time = 0;
- self.item_shield_time = 0;
- self.item_fuelregen_time = 0;
- self.item_jetpack_time = 0;
+ self.item_armor_large_time = (it_armor_large_time == -1) ? -1 : 0;
+ self.item_health_mega_time = (it_health_mega_time == -1) ? -1 : 0;
+ self.item_strength_time = (it_strength_time == -1) ? -1 : 0;
+ self.item_invisible_time = (it_invisible_time == -1) ? -1 : 0;
+ self.item_extralife_time = (it_extralife_time == -1) ? -1 : 0;
+ self.item_speed_time = (it_speed_time == -1) ? -1 : 0;
+ self.item_shield_time = (it_shield_time == -1) ? -1 : 0;
+ self.item_fuelregen_time = (it_fuelregen_time == -1) ? -1 : 0;
+ self.item_jetpack_time = (it_jetpack_time == -1) ? -1 : 0;
}
void Item_GetItemsTime(entity e)
{
if((itemflags & (FL_POWERUP | FL_WEAPON)) || (itemid & (IT_HEALTH | IT_ARMOR | IT_KEY1 | IT_KEY2)))
self.target = "###item###"; // for finding the nearest item using find()
+
+ Item_UpdateTime(self, 0);
}
self.bot_pickup = TRUE;