]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/itemstime
authorterencehill <piuntn@gmail.com>
Wed, 21 Dec 2011 20:21:05 +0000 (21:21 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 21 Dec 2011 20:21:05 +0000 (21:21 +0100)
27 files changed:
_hud_common.cfg
_hud_descriptions.cfg
defaultXonotic.cfg
gfx/hud/default/fuelregen.tga [new file with mode: 0644]
gfx/hud/default/jetpack.tga [new file with mode: 0644]
gfx/hud/luminos/fuelregen.tga [new file with mode: 0644]
gfx/hud/luminos/jetpack.tga [new file with mode: 0644]
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_minimal_xhair.cfg
hud_luminos_old.cfg
hud_nexuiz.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/hud_config.qc
qcsrc/client/waypointsprites.qc
qcsrc/common/constants.qh
qcsrc/common/util.qh
qcsrc/menu/classes.c
qcsrc/menu/xonotic/dialog_hudpanel_itemstime.c [new file with mode: 0644]
qcsrc/menu/xonotic/mainwindow.c
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/t_items.qc
qcsrc/server/waypointsprites.qc

index c46bbee713bf099c6bf74b45e474ee7baea0a559..7ecdf4cd29f19346e6bcabfbadfbb2ad73622d61 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_progressbar_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..2f2ea597eeb994da7ec3ae8f6558f70d751da1eb 100644 (file)
@@ -287,3 +287,20 @@ 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_showspawned "0" "show icons of already spawned items"
+seta hud_panel_itemstime_text "" "show text/icons"
+
index 5535d9cceea250f59dc2d592ec28fe929ec17229..06d1a59d0f2ea8d487ed431188c429e9e86920b4 100644 (file)
@@ -1305,6 +1305,7 @@ seta g_waypointsprite_crosshairfadedistance 150 "distance in virtual pixels from
 seta g_waypointsprite_distancefadealpha 1 "alpha multiplier near distance"
 seta g_waypointsprite_distancefadescale 0.7 "scale multiplier near the distance"
 seta g_waypointsprite_distancefadedistancemultiplier 0.5 "distance in map sizes from distance where to stop fading"
+seta g_waypointsprite_items_for_spectators 1 "show waypoints when spectating to indicate that some important items (mega health, large armor) are about to respawn"
 set g_waypointsprite_spam 0 "Debugging feature. Set to 10 and load courtfun in race mode to test."
 alias "g_waypointsprite_personal"      "impulse 30"
 alias "g_waypointsprite_personal_p"    "impulse 31"
diff --git a/gfx/hud/default/fuelregen.tga b/gfx/hud/default/fuelregen.tga
new file mode 100644 (file)
index 0000000..3f3a891
Binary files /dev/null and b/gfx/hud/default/fuelregen.tga differ
diff --git a/gfx/hud/default/jetpack.tga b/gfx/hud/default/jetpack.tga
new file mode 100644 (file)
index 0000000..ba76c45
Binary files /dev/null and b/gfx/hud/default/jetpack.tga differ
diff --git a/gfx/hud/luminos/fuelregen.tga b/gfx/hud/luminos/fuelregen.tga
new file mode 100644 (file)
index 0000000..3f3a891
Binary files /dev/null and b/gfx/hud/luminos/fuelregen.tga differ
diff --git a/gfx/hud/luminos/jetpack.tga b/gfx/hud/luminos/jetpack.tga
new file mode 100644 (file)
index 0000000..ba76c45
Binary files /dev/null and b/gfx/hud/luminos/jetpack.tga differ
index f32279f2b9b1d36c06a97512dbd3048037d093a9..723d77efa792bbf12a08cee48fd5609bf8150e16 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,20 @@ 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_reduced "0"
+seta hud_panel_itemstime_showspawned "0"
+seta hud_panel_itemstime_text "1"
+
 menu_sync
index 52a7d96c1327844d54a461e89f6305f0c4c95b7f..802231d7bdb5ad2a59cfa3405cdee1ee1be155c4 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 "10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 "
+seta _hud_panelorder "10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 17 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
@@ -282,4 +282,20 @@ 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.310000"
+seta hud_panel_itemstime_size "0.070000 0.180000"
+seta hud_panel_itemstime_bg ""
+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_reduced "0"
+seta hud_panel_itemstime_showspawned "0"
+seta hud_panel_itemstime_text "1"
+
 menu_sync
index 2d5e07600c09265f849b888e6584ab75c87994c1..df62eb38d44ba0b69288c9915598068c88d6a555 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 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 "
+seta _hud_panelorder "15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 17 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
@@ -282,4 +282,20 @@ 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.310000"
+seta hud_panel_itemstime_size "0.070000 0.180000"
+seta hud_panel_itemstime_bg ""
+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_reduced "0"
+seta hud_panel_itemstime_showspawned "0"
+seta hud_panel_itemstime_text "1"
+
 menu_sync
index fe7f66085519cc3ed94cf1e08cd44390e3b2ccd3..07e0147a60674d2ff134c3a66d9bab87646afe2f 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 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 "
+seta _hud_panelorder "15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 17 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
@@ -282,4 +282,20 @@ 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.020000 0.500000"
+seta hud_panel_itemstime_size "0.150000 0.120000"
+seta hud_panel_itemstime_bg ""
+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_reduced "0"
+seta hud_panel_itemstime_showspawned "0"
+seta hud_panel_itemstime_text "1"
+
 menu_sync
index 5c2138370660bdf3e40d204af441cbe42cb81b9f..5fbfb9d4edb5d29d5e7a2a16ecc126d39d530013 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 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 "
+seta _hud_panelorder "15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 17 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.01"
@@ -282,4 +282,20 @@ 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.290000"
+seta hud_panel_itemstime_size "0.150000 0.060000"
+seta hud_panel_itemstime_bg "0"
+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_reduced "0"
+seta hud_panel_itemstime_showspawned "0"
+seta hud_panel_itemstime_text "1"
+
 menu_sync
index d829904631ab0cf20e04d1fe5ffdea4b7b541ad4..e9b088a9d1eb07e398b7d0dcd6a5c231dbbfbb82 100644 (file)
@@ -145,6 +145,7 @@ float autocvar_g_waypointsprite_edgeoffset_left;
 float autocvar_g_waypointsprite_edgeoffset_right;
 float autocvar_g_waypointsprite_edgeoffset_top;
 float autocvar_g_waypointsprite_fontsize;
+float autocvar_g_waypointsprite_items_for_spectators;
 float autocvar_g_waypointsprite_minalpha;
 float autocvar_g_waypointsprite_minscale;
 float autocvar_g_waypointsprite_normdistance;
@@ -241,6 +242,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_progressbar;
+float autocvar_hud_panel_itemstime_progressbar_maxtime;
+string autocvar_hud_panel_itemstime_progressbar_name;
+float autocvar_hud_panel_itemstime_progressbar_reduced;
+float autocvar_hud_panel_itemstime_showspawned;
+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..76daff588d97eebb88fc54ecd16c8724304e902d 100644 (file)
@@ -4778,6 +4778,185 @@ void HUD_CenterPrint (void)
        }
 }
 
+
+// ItemsTime (#17)
+//
+const float ITEMSTIME_MAXITEMS = 9;
+float ItemsTime_time[ITEMSTIME_MAXITEMS];
+string GetItemsTimePicture(float i)
+{
+       switch(i)
+       {
+               case 0: return "armor";
+               case 1: return "health";
+               case 2: return "strength";
+               case 3: return "shield";
+               case 4: return "health";
+               case 5: return "strength";
+               case 6: return "shield";
+               case 7: return "fuelregen";
+               case 8: return "jetpack";
+               default: return "";
+       }
+}
+
+void DrawItemsTimeItem(vector myPos, vector mySize, float itemcode)
+{
+       float t;
+       vector color;
+       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
+       {
+               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)
+       {
+               numpos = myPos;
+               picpos = myPos + eX * 2 * mySize_y;
+       }
+       else
+       {
+               numpos = myPos + eX * mySize_y;
+               picpos = myPos;
+       }
+
+       if(t > 0 && autocvar_hud_panel_itemstime_progressbar)
+       {
+               vector p_pos, p_size;
+               if(autocvar_hud_panel_itemstime_progressbar_reduced)
+               {
+                       p_pos = numpos;
+                       p_size = eX * (2/3) * mySize_x + eY * mySize_y;
+               }
+               else
+               {
+                       p_pos = myPos;
+                       p_size = mySize;
+               }
+               HUD_Panel_DrawProgressBar(p_pos, p_size, autocvar_hud_panel_itemstime_progressbar_name, t/autocvar_hud_panel_itemstime_progressbar_maxtime, 0, 0, color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+       }
+
+       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 * picalpha, DRAWFLAG_NORMAL);
+}
+
+void HUD_ItemsTime(void)
+{
+       if(!autocvar__hud_configure)
+       {
+               if(!autocvar_hud_panel_itemstime) return;
+               if(spectatee_status == 0) return;
+
+               ItemsTime_time[0] = getstatf(STAT_ARMOR_LARGE_TIME);
+               ItemsTime_time[1] = getstatf(STAT_HEALTH_MEGA_TIME);
+               ItemsTime_time[2] = getstatf(STAT_INVISIBLE_TIME);
+               ItemsTime_time[3] = getstatf(STAT_SPEED_TIME);
+               ItemsTime_time[4] = getstatf(STAT_EXTRALIFE_TIME);
+               ItemsTime_time[5] = getstatf(STAT_STRENGTH_TIME);
+               ItemsTime_time[6] = getstatf(STAT_SHIELD_TIME);
+               ItemsTime_time[7] = getstatf(STAT_FUELREGEN_TIME);
+               ItemsTime_time[8] = getstatf(STAT_JETPACK_TIME);
+       }
+       else
+       {
+               hud_configure_active_panel = HUD_PANEL_ITEMSTIME;
+
+               // do not show here mutators-dependent items
+               ItemsTime_time[0] = time + 25;
+               ItemsTime_time[1] = time + 8;
+               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;
+       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;
+
+       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;
+       const float ASPECT_RATIO = 3;
+       rows = mySize_y/mySize_x;
+       rows = bound(1, floor((sqrt(4 * ASPECT_RATIO * rows * count + rows * rows) + rows + 0.5) / 2), count);
+
+       columns = ceil(count/rows);
+
+       vector itemstime_size;
+       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 > ASPECT_RATIO)
+       {
+               newSize = ASPECT_RATIO * itemstime_size_y;
+               offset_x = itemstime_size_x - newSize;
+               pos_x += offset_x/2;
+               itemstime_size_x = newSize;
+       }
+       else
+       {
+               newSize = 1/ASPECT_RATIO * 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 (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)
+               {
+                       row = 0;
+                       column = column + 1;
+               }
+       }
+}
+
 /*
 ==================
 Main HUD system
@@ -4829,6 +5008,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..c9c78d481c3d85f286ec7f70d1dee7abe18b5e15 100644 (file)
@@ -177,6 +177,14 @@ 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("_showspawned");
+                                       HUD_Write_PanelCvar_q("_text");
+                                       break;
                        }
                        HUD_Write("\n");
                }
index 6d9b0ee8bd7fee0f2112cf77686f6a25111dce6b..3b3fb6cae9a45ba75ea3513d1e321b77dce7298f 100644 (file)
@@ -212,6 +212,8 @@ float spritelookupblinkvalue(string s)
                case "ons-cp-atck-blue": return 2;
                case "ons-cp-dfnd-red":  return 0.5;
                case "ons-cp-dfnd-blue": return 0.5;
+               case "item_health_mega": return 2;
+               case "item_armor_large": return 2;
                case "item-invis":       return 2;
                case "item-extralife":   return 2;
                case "item-speed":       return 2;
@@ -308,13 +310,15 @@ string spritelookuptext(string s)
                case "dom-blue": return _("Control point");
                case "dom-yellow": return _("Control point");
                case "dom-pink": return _("Control point");
+               case "item_health_mega": return _("Mega health");
+               case "item_armor_large": return _("Large armor");
                case "item-invis": return _("Invisibility");
                case "item-extralife": return _("Extra life");
                case "item-speed": return _("Speed");
                case "item-strength": return _("Strength");
                case "item-shield": return _("Shield");
-               case "item-fuelregen": return _("Fuel regen");
-               case "item-jetpack": return _("Jet Pack");
+               case "item-fuelregen": return _("Fuel regenerator");
+               case "item-jetpack": return _("Jet pack");
                case "freezetag_frozen": return _("Frozen!");
                case "tagged-target": return _("Tagged");
                case "vehicle": return _("Vehicle");
@@ -410,6 +414,9 @@ void Draw_WaypointSprite()
        // choose the sprite
        switch(self.rule)
        {
+               case SPRITERULE_SPECTATOR:
+                       if(!autocvar_g_waypointsprite_items_for_spectators)
+                               return;
                case SPRITERULE_DEFAULT:
                        if(self.team)
                        {
index 55834f1a6d36bd5f84f20475a908f737c8a6a0a4..162375773320258fb17d83ec5ccb454aca33f359 100644 (file)
@@ -122,6 +122,7 @@ const float ENT_CLIENT_VEHICLE = 60;
 
 const float SPRITERULE_DEFAULT = 0;
 const float SPRITERULE_TEAMPLAY = 1;
+const float SPRITERULE_SPECTATOR = 2;
 
 const float RADARICON_NONE = 0;
 const float RADARICON_FLAG = 1;
@@ -214,6 +215,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_INVISIBLE_TIME = 82;
+const float STAT_SPEED_TIME = 83;
+const float STAT_EXTRALIFE_TIME = 84;
+const float STAT_STRENGTH_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;
@@ -550,7 +561,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";
@@ -569,6 +581,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 e2dfcb3b86b1257c7b440837e7714fc78a1e48ff..c4dabf296c5583079b2b7e9202b71ee771bbe767 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 c0a9780471e3689ca0f1490c51459d9ce05c84ed..047d9e8554c5561e4546b878dfda0476ce972505 100644 (file)
 #include "xonotic/dialog_hudpanel_weapons.c"
 #include "xonotic/dialog_hudpanel_physics.c"
 #include "xonotic/dialog_hudpanel_centerprint.c"
+#include "xonotic/dialog_hudpanel_itemstime.c"
 #include "xonotic/slider_picmip.c"
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_itemstime.c b/qcsrc/menu/xonotic/dialog_hudpanel_itemstime.c
new file mode 100644 (file)
index 0000000..7a0b32b
--- /dev/null
@@ -0,0 +1,32 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDItemsTimeDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDItemsTimeDialog, fill, void(entity))
+       ATTRIB(XonoticHUDItemsTimeDialog, title, string, _("Items Time Panel"))
+       ATTRIB(XonoticHUDItemsTimeDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDItemsTimeDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDItemsTimeDialog, rows, float, 15)
+       ATTRIB(XonoticHUDItemsTimeDialog, columns, float, 4)
+       ATTRIB(XonoticHUDItemsTimeDialog, name, string, "HUDitemstime")
+ENDCLASS(XonoticHUDItemsTimeDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDItemsTimeDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "itemstime";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Items time display:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               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
index 20627c7a579d25adee8be4192d7e00c8264640e5..3b433fa5afb4122c8a3b5fa3ed9f4e967aaec823 100644 (file)
@@ -126,6 +126,10 @@ void MainWindow_configureMainWindow(entity me)
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
+       i = spawnXonoticHUDItemsTimeDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
        me.advancedDialog = i = spawnXonoticAdvancedDialog();
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
index a5d0a22294b40f916b1a816cabcc0a3103a4a960..66126e8d69d7fc65aea111d986a06b3d4ec1f34f 100644 (file)
@@ -396,6 +396,7 @@ void PutObserverInServer (void)
 
        if(clienttype(self) == CLIENTTYPE_REAL)
        {
+               Item_GetItemsTime(self);
                msg_entity = self;
                WriteByte(MSG_ONE, SVC_SETVIEW);
                WriteEntity(MSG_ONE, self);
@@ -693,6 +694,8 @@ void PutClientInServer (void)
                        return; // spawn failed
                }
 
+               Item_ClearItemsTime();
+
                RemoveGrapplingHook(self); // Wazat's Grappling Hook
 
                self.classname = "player";
index 0c06958af30d6de3baf411d5ba5308495894227f..528b74c3b9ddf563d6d45954aa7be0af6434ca53 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;
@@ -651,6 +652,16 @@ string deathmessage;
 .float (float act_state) setactive;
 .entity realowner;
 
+.float item_armor_large_time;
+.float item_health_mega_time;
+.float item_invisible_time;
+.float item_speed_time;
+.float item_extralife_time;
+.float item_strength_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 1c0f9306e4fe34263a1e6ff7b2d9868b71fd646e..12daf1b48a249fdf0306fb50172e4b3a1127c851 100644 (file)
@@ -616,6 +616,7 @@ void Map_MarkAsRecent(string m);
 float world_already_spawned;
 void RegisterWeapons();
 void Nagger_Init();
+void Item_ItemsTime_Init();
 void ClientInit_Spawn();
 void WeaponStats_Init();
 void WeaponStats_Shutdown();
@@ -859,6 +860,17 @@ 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_INVISIBLE_TIME, AS_FLOAT, item_invisible_time);
+       addstat(STAT_SPEED_TIME, AS_FLOAT, item_speed_time);
+       addstat(STAT_EXTRALIFE_TIME, AS_FLOAT, item_extralife_time);
+       addstat(STAT_STRENGTH_TIME, AS_FLOAT, item_strength_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);
+       Item_ItemsTime_Init();
+
        if(g_ca || g_freezetag)
        {
                addstat(STAT_REDALIVE, AS_INT, redalive_stat);
index 79c39ae95d7998899e99529451df30ff22b05fed..61d6a1e186fb786ca6ddf7e5563fd1b641f8e374 100644 (file)
@@ -179,8 +179,121 @@ void Item_Show (entity e, float mode)
        setorigin(e, e.origin);
 }
 
+float it_armor_large_time;
+float it_health_mega_time;
+float it_invisible_time;
+float it_speed_time;
+float it_extralife_time;
+float it_strength_time;
+float it_shield_time;
+float it_fuelregen_time;
+float it_jetpack_time;
+
+void Item_ItemsTime_Init()
+{
+       it_armor_large_time = -1;
+       it_health_mega_time = -1;
+       it_invisible_time = -1;
+       it_speed_time = -1;
+       it_extralife_time = -1;
+       it_strength_time = -1;
+       it_shield_time = -1;
+       it_fuelregen_time = -1;
+       it_jetpack_time = -1;
+}
+void Item_ClearItemsTime()
+{
+       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_invisible_time   = (it_invisible_time   == -1) ? -1 : 0;
+       self.item_speed_time       = (it_speed_time       == -1) ? -1 : 0;
+       self.item_extralife_time   = (it_extralife_time   == -1) ? -1 : 0;
+       self.item_strength_time    = (it_strength_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)
+{
+       e.item_armor_large_time = it_armor_large_time;
+       e.item_health_mega_time = it_health_mega_time;
+       e.item_invisible_time = it_invisible_time;
+       e.item_speed_time = it_speed_time;
+       e.item_extralife_time = it_extralife_time;
+       e.item_strength_time = it_strength_time;
+       e.item_shield_time = it_shield_time;
+       e.item_fuelregen_time = it_fuelregen_time;
+       e.item_jetpack_time = it_jetpack_time;
+}
+float Item_UpdateTime_Check(float item_time, float t)
+{
+       if(t == 0 && item_time == -1)
+               return TRUE;
+       if(time < t && (item_time <= time || t < item_time))
+               return TRUE;
+       return FALSE;
+}
+void Item_UpdateTime(entity e, float t)
+{
+       if(g_minstagib)
+       {
+               switch(e.items)
+               {
+                       case IT_STRENGTH://"item-invis"
+                               if(Item_UpdateTime_Check(it_invisible_time, t))
+                                       it_invisible_time = t;
+                               break;
+                       case IT_NAILS://"item-extralife"
+                               if(Item_UpdateTime_Check(it_extralife_time, t))
+                                       it_extralife_time = t;
+                               break;
+                       case IT_INVINCIBLE://"item-speed"
+                               if(Item_UpdateTime_Check(it_speed_time, t))
+                                       it_speed_time = t;
+                               break;
+               }
+       }
+       else
+       {
+               switch(e.items)
+               {
+                       case IT_HEALTH:
+                               //if (e.classname == "item_health_mega")
+                                       if(Item_UpdateTime_Check(it_health_mega_time, t))
+                                               it_health_mega_time = t;
+                               break;
+                       case IT_ARMOR:
+                               if (e.classname == "item_armor_large")
+                                       if(Item_UpdateTime_Check(it_armor_large_time, t))
+                                               it_armor_large_time = t;
+                               break;
+                       case IT_STRENGTH://"item-strength"
+                               if(Item_UpdateTime_Check(it_strength_time, t))
+                                       it_strength_time = t;
+                               break;
+                       case IT_INVINCIBLE://"item-shield"
+                               if(Item_UpdateTime_Check(it_shield_time, t))
+                                       it_shield_time = t;
+                               break;
+               }
+       }
+       switch(e.items)
+       {
+               case IT_FUEL_REGEN://"item-fuelregen"
+                       if(Item_UpdateTime_Check(it_fuelregen_time, t))
+                               it_fuelregen_time = t;
+                       break;
+               case IT_JETPACK://"item-jetpack"
+                       if(Item_UpdateTime_Check(it_jetpack_time, t))
+                               it_jetpack_time = t;
+                       break;
+       }
+}
+
 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
@@ -190,6 +303,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.items == IT_HEALTH)
+       {
+               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);
 }
@@ -226,6 +358,14 @@ void Item_RespawnCountdown (void)
                                {
                                        case IT_STRENGTH:   name = "item-strength"; rgb = '0 0 1'; break;
                                        case IT_INVINCIBLE: name = "item-shield"; rgb = '1 0 1'; break;
+                                       case IT_HEALTH:
+                                               //if (self.classname == "item_health_mega")
+                                                       {name = "item_health_mega"; rgb = '1 0 0';}
+                                               break;
+                                       case IT_ARMOR:
+                                               if (self.classname == "item_armor_large")
+                                                       {name = "item_armor_large"; rgb = '0 1 0';}
+                                               break;
                                }
                        }
                        switch(self.items)
@@ -242,7 +382,11 @@ void Item_RespawnCountdown (void)
                        {
                                WaypointSprite_Spawn(name, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE, RADARICON_POWERUP, rgb);
                                if(self.waypointsprite_attached)
+                               {
+                                       if (self.items == IT_HEALTH || self.items == IT_ARMOR)
+                                               WaypointSprite_UpdateRule(self.waypointsprite_attached, 0, SPRITERULE_SPECTATOR);
                                        WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS);
+                               }
                        }
                }
                sound (self, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTN_NORM); // play respawn sound
@@ -256,16 +400,24 @@ void Item_RespawnCountdown (void)
 
 void Item_ScheduleRespawnIn(entity e, float t)
 {
-       if(e.flags & FL_POWERUP)
+       if(e.flags & FL_POWERUP || self.classname == "item_armor_large" || self.items == IT_HEALTH)
        {
                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);
        }
 }
 
@@ -803,6 +955,8 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
 
                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;
index 0e6f2168b863b50c94a7c49dd20659a9315ed879..5f9108f76fa32c52be77271324faf0c52f1d939c 100644 (file)
@@ -193,7 +193,12 @@ float WaypointSprite_visible_for_player(entity e)
                        return FALSE;
 
        // team waypoints
-       if(self.team && self.rule == SPRITERULE_DEFAULT)
+       if(self.rule == SPRITERULE_SPECTATOR)
+       {
+               if(e.classname == "player")
+                       return FALSE;
+       }
+       else if(self.team && self.rule == SPRITERULE_DEFAULT)
        {
                if(self.team != e.team)
                        return FALSE;