]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Brand new panel to display left time for important items to respawn in the map
authorterencehill <piuntn@gmail.com>
Wed, 14 Dec 2011 14:31:24 +0000 (15:31 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 14 Dec 2011 14:31:24 +0000 (15:31 +0100)
13 files changed:
_hud_common.cfg
_hud_descriptions.cfg
hud_luminos.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/hud_config.qc
qcsrc/common/constants.qh
qcsrc/common/util.qh
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/t_items.qc

index c46bbee713bf099c6bf74b45e474ee7baea0a559..8266694f2e4c95e97a2a8e02dc4456f93035c14e 100644 (file)
@@ -26,6 +26,8 @@ seta hud_panel_engineinfo_framecounter_exponentialmovingaverage 1 "use an averag
 seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_new_weight 0.1 "weight of latest data point"
 seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold 0.5 "threshold for fps change when to update instantly, to make big fps changes update faster"
 
+seta hud_panel_itemstime_maxtime "30" "when left time is at least this amount, the status bar is full"
+
 // hud panel aliases
 alias hud_panel_radar_rotate "toggle hud_panel_radar_rotation 0 1 2 3 4"
 alias +hud_panel_radar_maximized "cl_cmd hud_panel_radar_maximized 1"
index 061720a844f8b9dc7cb5ee8c4d8cb33c988e7059..bfd08bd9f8b772f6c3f1815310dee24fe69d28d6 100644 (file)
@@ -287,3 +287,19 @@ seta hud_panel_centerprint_fade_subsequent_passtwo "" "division factor for the s
 seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "" "minimum factor that the second pass can fade to"
 seta hud_panel_centerprint_fade_subsequent_minfontsize "" "minimum factor for the font size from the subsequent fading effects"
 seta hud_panel_centerprint_fade_minfontsize "" "minimum factor for the font size from the fading in/out effects"
+
+seta hud_panel_itemstime "" "enable/disable this panel"
+seta hud_panel_itemstime_pos "" "position of this base of the panel"
+seta hud_panel_itemstime_size "" "size of this panel"
+seta hud_panel_itemstime_bg "" "if set to something else than \"\" = override default background"
+seta hud_panel_itemstime_bg_color "" "if set to something else than \"\" = override default panel background color"
+seta hud_panel_itemstime_bg_color_team "" "override panel color with team color in team based games"
+seta hud_panel_itemstime_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
+seta hud_panel_itemstime_bg_border "" "if set to something else than \"\" = override default size of border around the background"
+seta hud_panel_itemstime_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
+seta hud_panel_itemstime_iconalign "" "0 = align icons to the left, 1 = align icons to the right"
+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_text "" "show text/icons"
+
index f32279f2b9b1d36c06a97512dbd3048037d093a9..24bf065722bda984c2b3f9a492da4f13fbe2ea44 100644 (file)
@@ -23,7 +23,7 @@ seta hud_progressbar_speed_color "1 0.75 0"
 seta hud_progressbar_acceleration_color "0.5 0.75 1" 
 seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" 
 
-seta _hud_panelorder "15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 "
+seta _hud_panelorder "15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 17 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
@@ -282,4 +282,19 @@ seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "0.5"
 seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
 seta hud_panel_centerprint_fade_minfontsize "0"
 
+seta hud_panel_itemstime 1
+seta hud_panel_itemstime_pos "0.000000 0.420000"
+seta hud_panel_itemstime_size "0.150000 0.270000"
+seta hud_panel_itemstime_bg "border_itemstime"
+seta hud_panel_itemstime_bg_color ""
+seta hud_panel_itemstime_bg_color_team ""
+seta hud_panel_itemstime_bg_alpha ""
+seta hud_panel_itemstime_bg_border ""
+seta hud_panel_itemstime_bg_padding ""
+seta hud_panel_itemstime_iconalign "0"
+seta hud_panel_itemstime_progressbar "0"
+seta hud_panel_itemstime_progressbar_name "progressbar"
+seta hud_panel_itemstime_progressbar_xoffset "0"
+seta hud_panel_itemstime_text "1"
+
 menu_sync
index e18433e9666465ef36702c7ba10637eb4e3d1a6a..cbd6aca624d3e4f49fe9eabed90614a8b2f93ce7 100644 (file)
@@ -241,6 +241,14 @@ float autocvar_hud_panel_healtharmor_progressbar_gfx_smooth;
 float autocvar_hud_panel_healtharmor_text;
 float autocvar_hud_panel_infomessages;
 float autocvar_hud_panel_infomessages_flip;
+float autocvar_hud_panel_itemstime;
+float autocvar_hud_panel_itemstime_iconalign;
+float autocvar_hud_panel_itemstime_maxitemstime;
+float autocvar_hud_panel_itemstime_onlycurrent;
+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_text;
 float autocvar_hud_panel_modicons;
 float autocvar_hud_panel_modicons_dom_layout;
 float autocvar_hud_panel_notify;
index 86b49761e5ca59cd34e978073f82e79ad9ddf395..f2cee46e0429d94b3ca65ac75290b447e91784d6 100644 (file)
@@ -4778,6 +4778,154 @@ void HUD_CenterPrint (void)
        }
 }
 
+
+// ItemsTime (#17)
+//
+const float ITEMSTIME_MAXITEMS = 9;
+float item_timeleft[ITEMSTIME_MAXITEMS];
+string GetItemsTimePicture(float i)
+{
+       switch(i)
+       {
+               case 0: return "armor";
+               case 1: return "health";
+               case 2: return "shield";
+               case 3: return "strength";
+               case 4: return "health";
+               case 5: return "strength";
+               case 6: return "shield";
+               case 7: case 8: return "ammo_fuel"; // FIXME: proper image for jetpack and fuel regen
+               default: return "";
+       }
+}
+
+void DrawItemsTimeItem(vector myPos, vector mySize, float itemcode)
+{
+       float t;
+       t = item_timeleft[itemcode];
+
+       vector color;
+       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)
+       {
+               numpos = myPos;
+               picpos = myPos + eX * 2 * mySize_y;
+       }
+       else
+       {
+               numpos = myPos + eX * mySize_y;
+               picpos = myPos;
+       }
+
+    if(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)
+       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);
+}
+
+void HUD_ItemsTime(void)
+{
+       if(!autocvar__hud_configure)
+       {
+               if(!autocvar_hud_panel_itemstime) return;
+               if(spectatee_status == 0) return;
+
+               item_timeleft[0] = floor(getstatf(STAT_ARMOR_LARGE_TIME) - time + 1);
+               item_timeleft[1] = floor(getstatf(STAT_HEALTH_MEGA_TIME) - time + 1);
+               item_timeleft[2] = floor(getstatf(STAT_STRENGTH_TIME) - time + 1);
+               item_timeleft[3] = floor(getstatf(STAT_INVISIBLE_TIME) - time + 1);
+               item_timeleft[4] = floor(getstatf(STAT_EXTRALIFE_TIME) - time + 1);
+               item_timeleft[5] = floor(getstatf(STAT_SPEED_TIME) - time + 1);
+               item_timeleft[6] = floor(getstatf(STAT_SHIELD_TIME) - time + 1);
+               item_timeleft[7] = floor(getstatf(STAT_FUELREGEN_TIME) - time + 1);
+               item_timeleft[8] = floor(getstatf(STAT_JETPACK_TIME) - time + 1);
+       }
+       else
+       {
+               hud_configure_active_panel = HUD_PANEL_ITEMSTIME;
+
+               // do not show here mutators-dependent items
+               item_timeleft[0] = 25;
+               item_timeleft[1] = 8;
+               item_timeleft[2] = 0;
+               item_timeleft[3] = 0;
+               item_timeleft[4] = 0;
+               item_timeleft[5] = 34;
+               item_timeleft[6] = 4;
+               item_timeleft[7] = 19;
+               item_timeleft[8] = 46;
+       }
+
+       float i;
+       float count;
+       for (i = 0; i < ITEMSTIME_MAXITEMS; ++i)
+               count += (item_timeleft[i] > 0);
+       if (count == 0)
+               return;
+
+       HUD_Panel_UpdateCvars(itemstime);
+       HUD_Panel_ApplyFadeAlpha();
+       vector pos, mySize;
+       pos = panel_pos;
+       mySize = panel_size;
+
+       HUD_Panel_DrawBg(1);
+       if(panel_bg_padding)
+       {
+               pos += '1 1 0' * panel_bg_padding;
+               mySize -= '2 2 0' * panel_bg_padding;
+       }
+
+       float rows, columns, row, column;
+       vector itemstime_size;
+
+       rows = mySize_y/mySize_x;
+       rows = bound(1, floor((sqrt(4 * (3/1) * rows * count + rows * rows) + rows + 0.5) / 2), count);
+       //                               ^^^ itemstime item aspect goes here
+
+       columns = ceil(count/rows);
+
+       itemstime_size = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
+
+       local noref vector offset; // fteqcc sucks
+       float newSize;
+       if(itemstime_size_x/itemstime_size_y > 3)
+       {
+               newSize = 3 * itemstime_size_y;
+               offset_x = itemstime_size_x - newSize;
+               pos_x += offset_x/2;
+               itemstime_size_x = newSize;
+       }
+       else
+       {
+               newSize = 1/3 * itemstime_size_x;
+               offset_y = itemstime_size_y - newSize;
+               pos_y += offset_y/2;
+               itemstime_size_y = newSize;
+       }
+
+       for (i = 0; i < ITEMSTIME_MAXITEMS; ++i) {
+               if (item_timeleft[i] <= 0)
+                       continue;
+               DrawItemsTimeItem(pos + eX * column * (itemstime_size_x + offset_x) + eY * row * (itemstime_size_y + offset_y), itemstime_size, i);
+               ++row;
+               if(row >= rows)
+               {
+                       row = 0;
+                       column = column + 1;
+               }
+       }
+}
+
 /*
 ==================
 Main HUD system
@@ -4829,6 +4977,8 @@ switch (id) {\
                 HUD_Physics(); break;\
        case (HUD_PANEL_CENTERPRINT):\
                 HUD_CenterPrint(); break;\
+       case (HUD_PANEL_ITEMSTIME):\
+                HUD_ItemsTime(); break;\
 } ENDS_WITH_CURLY_BRACE
 
 void HUD_Main (void)
index 16ccd0c79c0d33aea202eaa3d7c2aab7b4b2721f..37b38aa9bb6c6791796bbdc257b9b6bce0f2a19e 100644 (file)
@@ -3,6 +3,7 @@ string hud_panelorder_prev;
 
 float hud_draw_maximized;
 float hud_panel_radar_maximized;
+float hud_panel_itemstime;
 
 vector mousepos;
 vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click)
@@ -287,6 +288,7 @@ switch(id) { \
        case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdateCvars(infomessages) break; \
        case HUD_PANEL_PHYSICS: HUD_Panel_UpdateCvars(physics); break;\
        case HUD_PANEL_CENTERPRINT: HUD_Panel_UpdateCvars(centerprint); break;\
+       case HUD_PANEL_ITEMSTIME: HUD_Panel_UpdateCvars(itemstime); break;\
 }
 
 #define HUD_Panel_UpdateCvarsForId(id) \
@@ -325,6 +327,7 @@ switch(id) { \
        case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdatePosSize(infomessages) break;\
        case HUD_PANEL_PHYSICS: HUD_Panel_UpdatePosSize(physics); break;\
        case HUD_PANEL_CENTERPRINT: HUD_Panel_UpdatePosSize(centerprint); break;\
+       case HUD_PANEL_ITEMSTIME: HUD_Panel_UpdatePosSize(itemstime); break;\
 }
 
 #define HUD_Panel_UpdatePosSizeForId(id) \
index 3ad600e41c74de9e6d42918fbae7634dcedb091d..f4a3f68a2d06e464a0f02f775fcde9f2a05410d2 100644 (file)
@@ -177,6 +177,13 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
                                        HUD_Write_PanelCvar_q("_fade_minfontsize");
                                        break;
+                               case HUD_PANEL_ITEMSTIME:
+                                       HUD_Write_PanelCvar_q("_iconalign");
+                                       HUD_Write_PanelCvar_q("_progressbar");
+                                       HUD_Write_PanelCvar_q("_progressbar_name");
+                                       HUD_Write_PanelCvar_q("_progressbar_xoffset");
+                                       HUD_Write_PanelCvar_q("_text");
+                                       break;
                        }
                        HUD_Write("\n");
                }
index 7e5e99edbf9a5a2c64476c7e526c305a70284c6f..21906dc4192710c6551847974ea0121565a8fcdc 100644 (file)
@@ -213,6 +213,16 @@ const float STAT_VEHICLESTAT_RELOAD2 = 66;
 const float STAT_SECRETS_TOTAL = 70;
 const float STAT_SECRETS_FOUND = 71;
 
+const float STAT_ARMOR_LARGE_TIME = 80;
+const float STAT_HEALTH_MEGA_TIME = 81;
+const float STAT_STRENGTH_TIME = 82;
+const float STAT_INVISIBLE_TIME = 83;
+const float STAT_EXTRALIFE_TIME = 84;
+const float STAT_SPEED_TIME = 85;
+const float STAT_SHIELD_TIME = 86;
+const float STAT_FUELREGEN_TIME = 87;
+const float STAT_JETPACK_TIME = 88;
+
 // mod stats (1xx)
 const float STAT_REDALIVE = 100;
 const float STAT_BLUEALIVE = 101;
@@ -549,7 +559,8 @@ float HUD_PANEL_ENGINEINFO  = 13;
 float HUD_PANEL_INFOMESSAGES   = 14;
 float HUD_PANEL_PHYSICS        = 15;
 float HUD_PANEL_CENTERPRINT    = 16;
-float HUD_PANEL_NUM            = 17; // always last panel id + 1, please increment when adding a new panel
+float HUD_PANEL_ITEMSTIME              = 17;
+float HUD_PANEL_NUM                            = 18; // always last panel id + 1, please increment when adding a new panel
 
 string HUD_PANELNAME_WEAPONS           = "weapons";
 string HUD_PANELNAME_AMMO              = "ammo";
@@ -568,6 +579,7 @@ string HUD_PANELNAME_ENGINEINFO             = "engineinfo";
 string HUD_PANELNAME_INFOMESSAGES      = "infomessages";
 string HUD_PANELNAME_PHYSICS   = "physics";
 string HUD_PANELNAME_CENTERPRINT       = "centerprint";
+string HUD_PANELNAME_ITEMSTIME         = "itemstime";
 
 float HUD_MENU_ENABLE          = 0;
 
index b2e77484e398695ea3b2febb290bd217cdf83af5..461cfd9b23876195f8731210e432a14d51d376b2 100644 (file)
@@ -223,6 +223,7 @@ switch(id) {\
        case HUD_PANEL_INFOMESSAGES: panel_name = HUD_PANELNAME_INFOMESSAGES; break; \
        case HUD_PANEL_PHYSICS: panel_name = HUD_PANELNAME_PHYSICS; break; \
        case HUD_PANEL_CENTERPRINT: panel_name = HUD_PANELNAME_CENTERPRINT; break; \
+       case HUD_PANEL_ITEMSTIME: panel_name = HUD_PANELNAME_ITEMSTIME; break; \
 } ENDS_WITH_CURLY_BRACE
 
 // Get name of specified panel id
index 3d393755a0f3749d33793dc7b6de1e574c1284c2..a29742a335e4e7047b7dcdeded0366acbb4fc7b8 100644 (file)
@@ -520,6 +520,7 @@ void PutObserverInServer (void)
 
        if(clienttype(self) == CLIENTTYPE_REAL)
        {
+               Item_GetItemsTime(self);
                msg_entity = self;
                WriteByte(MSG_ONE, SVC_SETVIEW);
                WriteEntity(MSG_ONE, self);
@@ -825,6 +826,8 @@ void PutClientInServer (void)
                        return; // spawn failed
                }
 
+               Item_ClearItemsTime();
+
                RemoveGrapplingHook(self); // Wazat's Grappling Hook
 
                self.classname = "player";
index ae8be3f9d609a26668c4b855490475e583abe4c5..be30ca3bec48057280980083f2fad82602e1ddbb 100644 (file)
@@ -174,6 +174,7 @@ void setanim(entity e, vector anim, float looping, float override, float restart
 
 .float species;
 
+.float scheduledrespawntime;
 .float respawntime;
 .float respawntimejitter;
 //.float       chasecam;
@@ -660,6 +661,16 @@ string deathmessage;
 .float (float act_state) setactive;
 .entity realowner;
 
+.float item_armor_large_time;
+.float item_health_mega_time;
+.float item_strength_time;
+.float item_invisible_time;
+.float item_extralife_time;
+.float item_speed_time;
+.float item_shield_time;
+.float item_fuelregen_time;
+.float item_jetpack_time;
+
 .float nex_charge;
 .float nex_charge_rottime;
 .float nex_chargepool_ammo;
index d0474b8ed4e92633c8ee3a83747db22eff59ea99..3d3cd582cc9476a220482dfc87ab8e2861cef3d2 100644 (file)
@@ -844,6 +844,16 @@ void spawnfunc_worldspawn (void)
 
        addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load);
 
+       addstat(STAT_ARMOR_LARGE_TIME, AS_FLOAT, item_armor_large_time);
+       addstat(STAT_HEALTH_MEGA_TIME, AS_FLOAT, item_health_mega_time);
+       addstat(STAT_STRENGTH_TIME, AS_FLOAT, item_strength_time);
+       addstat(STAT_INVISIBLE_TIME, AS_FLOAT, item_invisible_time);
+       addstat(STAT_EXTRALIFE_TIME, AS_FLOAT, item_extralife_time);
+       addstat(STAT_SPEED_TIME, AS_FLOAT, item_speed_time);
+       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);
+
        if(g_ca || g_freezetag)
        {
                addstat(STAT_REDALIVE, AS_INT, redalive_stat);
index f7a8d2aec157a966e0299a89402e2b280af92721..49dcfc26788a96d6e9a5c0655cb24290dea71b80 100644 (file)
@@ -142,8 +142,114 @@ void Item_Show (entity e, float mode)
        setorigin(e, e.origin);
 }
 
+float it_armor_large_time;
+float it_health_mega_time;
+float it_strength_time;
+float it_invisible_time;
+float it_extralife_time;
+float it_speed_time;
+float it_shield_time;
+float it_fuelregen_time;
+float it_jetpack_time;
+
+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;
+}
+void Item_GetItemsTime(entity e)
+{
+       e.item_armor_large_time = it_armor_large_time;
+       e.item_health_mega_time = it_health_mega_time;
+       e.item_strength_time = it_strength_time;
+       e.item_invisible_time = it_invisible_time;
+       e.item_extralife_time = it_extralife_time;
+       e.item_speed_time = it_speed_time;
+       e.item_shield_time = it_shield_time;
+       e.item_fuelregen_time = it_fuelregen_time;
+       e.item_jetpack_time = it_jetpack_time;
+}
+void Item_UpdateTime(entity e, float t)
+{
+       if(g_minstagib)
+       {
+               switch(e.items)
+               {
+                       case IT_STRENGTH://"item-invis"
+                               if (it_invisible_time > time && t > it_invisible_time)
+                                       return;
+                               it_invisible_time = t;
+                               return;
+                       case IT_NAILS://"item-extralife"
+                               if (it_extralife_time > time && t > it_extralife_time)
+                                       return;
+                               it_extralife_time = t;
+                               return;
+                       case IT_INVINCIBLE://"item-speed"
+                               if (it_speed_time > time && t > it_speed_time)
+                                       return;
+                               it_speed_time = t;
+                               return;
+               }
+       }
+       else
+       {
+               switch(e.items)
+               {
+                       case IT_HEALTH:
+                               if (e.classname == "item_health_mega")
+                               {
+                                       if (it_health_mega_time > time && t > it_health_mega_time)
+                                               return;
+                                       it_health_mega_time = t;
+                               }
+                               return;
+                       case IT_ARMOR:
+                               if (e.classname == "item_armor_large")
+                               {
+                                       if (it_armor_large_time > time && t > it_armor_large_time)
+                                               return;
+                                       it_armor_large_time = t;
+                               }
+                               return;
+                       case IT_STRENGTH://"item-strength"
+                               if (it_strength_time > time && t > it_strength_time)
+                                       return;
+                               it_strength_time = t;
+                               return;
+                       case IT_INVINCIBLE://"item-shield"
+                               if (it_shield_time > time && t > it_shield_time)
+                                       return;
+                               it_shield_time = t;
+                               return;
+               }
+       }
+       switch(e.items)
+       {
+               case IT_FUEL_REGEN://"item-fuelregen"
+                       if (it_fuelregen_time > time && t > it_fuelregen_time)
+                               return;
+                       it_fuelregen_time = t;
+                       return;
+               case IT_JETPACK://"item-jetpack"
+                       if (it_jetpack_time > time && t > it_jetpack_time)
+                               return;
+                       it_jetpack_time = t;
+                       return;
+       }
+}
+
 void Item_Respawn (void)
 {
+       float t;
+       entity head;
        Item_Show(self, 1);
        if(!g_minstagib && self.items == IT_STRENGTH)
                sound (self, CH_TRIGGER, "misc/strength_respawn.wav", VOL_BASE, ATTN_NORM);     // play respawn sound
@@ -153,6 +259,25 @@ void Item_Respawn (void)
                sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTN_NORM);  // play respawn sound
        setorigin (self, self.origin);
 
+       if (self.flags & FL_POWERUP || self.classname == "item_armor_large" || self.classname == "item_health_mega")
+       {
+               for(t = 0, head = world; (head = find(head, classname, self.classname)); )
+               {
+                       // in minstagib .classname is "minstagib" for every item
+                       if (g_minstagib && self.items != head.items)
+                               continue;
+                       if (head.scheduledrespawntime > time)
+                               if (t == 0 || head.scheduledrespawntime < t)
+                                       t = head.scheduledrespawntime;
+               }
+               Item_UpdateTime(self, t);
+               FOR_EACH_REALCLIENT(head)
+               {
+                       if (head.classname != "player")
+                               Item_GetItemsTime(head);
+               }
+       }
+
        //pointparticles(particleeffectnum("item_respawn"), self.origin + self.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1);
        pointparticles(particleeffectnum("item_respawn"), self.origin + 0.5 * (self.mins + self.maxs), '0 0 0', 1);
 }
@@ -218,12 +343,20 @@ void Item_ScheduleRespawnIn(entity e, float t)
        {
                e.think = Item_RespawnCountdown;
                e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
+               e.scheduledrespawntime = e.nextthink + ITEM_RESPAWN_TICKS;
                e.count = 0;
        }
        else
        {
                e.think = Item_Respawn;
                e.nextthink = time + t;
+               e.scheduledrespawntime = e.nextthink;
+       }
+       Item_UpdateTime(e, e.scheduledrespawntime);
+       FOR_EACH_REALCLIENT(e)
+       {
+               if (e.classname != "player")
+                       Item_GetItemsTime(e);
        }
 }