]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/itemstime' into 'master'
authorMario <zacjardine@y7mail.com>
Tue, 11 Aug 2015 16:30:30 +0000 (16:30 +0000)
committerMario <zacjardine@y7mail.com>
Tue, 11 Aug 2015 16:30:30 +0000 (16:30 +0000)
Items Time

Features:
* Panel that displays left time until important items respawn in the map: mega health, large armor, powerups (strenght, invincible, jetpack, fuel regenerator) and superweapons.

* Waypoints for mega health and large armor, displayed just like the existing powerup waypoints, obviously visible only to spectators

Panel and waypoints can be enabled when spectating (g_waypointsprite_itemstime 1, hud_panel_itemstime 1) or also when playing in warmup stage (g_waypointsprite_itemstime 2, hud_panel_itemstime 2).

In order to prevent cheating, server can completely disable this feature by setting sv_itemstime to 0 (1 by default).

See merge request !133

43 files changed:
_hud_common.cfg
_hud_descriptions.cfg
defaultXonotic.cfg
gfx/hud/default/fuelregen.tga [new file with mode: 0644]
gfx/hud/default/item_large_armor.tga [new file with mode: 0644]
gfx/hud/default/item_mega_health.tga [new file with mode: 0644]
gfx/hud/default/item_shield.tga [new file with mode: 0644]
gfx/hud/default/item_strength.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/item_large_armor.tga [new file with mode: 0644]
gfx/hud/luminos/item_mega_health.tga [new file with mode: 0644]
gfx/hud/luminos/item_shield.tga [new file with mode: 0644]
gfx/hud/luminos/item_strength.tga [new file with mode: 0644]
gfx/hud/luminos/jetpack.tga [new file with mode: 0644]
gfx/hud/old/item_large_armor.tga [new file with mode: 0644]
gfx/hud/old/item_mega_health.tga [new file with mode: 0644]
gfx/hud/old/item_shield.tga [new file with mode: 0644]
gfx/hud/old/item_strength.tga [new file with mode: 0644]
hud_luma.cfg
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/stats.qh
qcsrc/menu/classes.inc
qcsrc/menu/xonotic/dialog_hudpanel_itemstime.qc [new file with mode: 0644]
qcsrc/menu/xonotic/mainwindow.qc
qcsrc/server/autocvars.qh
qcsrc/server/cl_client.qc
qcsrc/server/command/vote.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/t_items.qc
qcsrc/server/t_items.qh
qcsrc/server/waypointsprites.qc

index b74eff9607999b19978d0128dd466824e1167585..d409ee1e6736499f3a0b2ce7eddca51bbec1f89f 100644 (file)
@@ -41,6 +41,9 @@ seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_ch
 seta hud_panel_physics_acceleration_movingaverage 1 "use an averaging method for calculating acceleration instead of the real value"
 seta hud_panel_phisics_update_interval 0.0666 "how often (in seconds) numeric values get updated on screen"
 
+seta hud_panel_itemstime_progressbar_maxtime "30" "when left time is at least this amount, the status bar is full"
+seta hud_panel_itemstime_hidespawned "1" "if 1 hide an item from the panel when all the occurrences of it are available again; if 2 hide it when at least one occurrence is available again"
+
 // 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 radar 1"
index 01c768aec9933b5f261e869573c5a2960107d41b..7b6f739753e8c06ace70dd2eb5d98aedf727f4aa 100644 (file)
@@ -310,3 +310,20 @@ seta hud_panel_mapvote_bg_color_team "" "override panel color with team color in
 seta hud_panel_mapvote_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
 seta hud_panel_mapvote_bg_border "" "if set to something else than \"\" = override default size of border around the background"
 seta hud_panel_mapvote_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
+
+seta hud_panel_itemstime "" "enable/disable this panel, it shows left time until important items (mega health, large armor, powerups, superweapons, etc...) respawn in the map: 1 when spectating, 2 even playing in warmup stage"
+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_reduced "" "progressbar is displayed only in the text field"
+seta hud_panel_itemstime_text "" "show text"
+seta hud_panel_itemstime_ratio "" "ratio between space reserved for text and icon width of each item entry (min value is 2)"
+seta hud_panel_itemstime_dynamicsize "" "allow panel size reduction by removing spacing among items"
index ced5e6d970a0bb8d9001300ab780191fd0979b8b..45c920195ede5f95c6f1e68fd9bdf2063d00a5d6 100644 (file)
@@ -758,6 +758,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_itemstime 2 "show waypoints to indicate that some important items (mega health, large armor) are about to respawn: 1 when spectating, 2 even playing in warmup stage"
 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"
@@ -779,6 +780,8 @@ seta g_waypointsprite_turrets 1 "disable turret waypoints"
 seta g_waypointsprite_turrets_maxdist 5000 "max distace for turret sprites"
 seta g_waypointsprite_tactical 1 "tactical overlay on turrets when in a vehicle"
 
+set sv_itemstime 1 "enable networking of left time until respawn for items such as mega health and large armor"
+
 // so it can be stuffcmd-ed still
 set cl_gravity 800     "but ignored anyway"
 
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/item_large_armor.tga b/gfx/hud/default/item_large_armor.tga
new file mode 100644 (file)
index 0000000..6d84530
Binary files /dev/null and b/gfx/hud/default/item_large_armor.tga differ
diff --git a/gfx/hud/default/item_mega_health.tga b/gfx/hud/default/item_mega_health.tga
new file mode 100644 (file)
index 0000000..75515eb
Binary files /dev/null and b/gfx/hud/default/item_mega_health.tga differ
diff --git a/gfx/hud/default/item_shield.tga b/gfx/hud/default/item_shield.tga
new file mode 100644 (file)
index 0000000..da87b64
Binary files /dev/null and b/gfx/hud/default/item_shield.tga differ
diff --git a/gfx/hud/default/item_strength.tga b/gfx/hud/default/item_strength.tga
new file mode 100644 (file)
index 0000000..ed0e8a8
Binary files /dev/null and b/gfx/hud/default/item_strength.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/item_large_armor.tga b/gfx/hud/luminos/item_large_armor.tga
new file mode 100644 (file)
index 0000000..6d84530
Binary files /dev/null and b/gfx/hud/luminos/item_large_armor.tga differ
diff --git a/gfx/hud/luminos/item_mega_health.tga b/gfx/hud/luminos/item_mega_health.tga
new file mode 100644 (file)
index 0000000..75515eb
Binary files /dev/null and b/gfx/hud/luminos/item_mega_health.tga differ
diff --git a/gfx/hud/luminos/item_shield.tga b/gfx/hud/luminos/item_shield.tga
new file mode 100644 (file)
index 0000000..da87b64
Binary files /dev/null and b/gfx/hud/luminos/item_shield.tga differ
diff --git a/gfx/hud/luminos/item_strength.tga b/gfx/hud/luminos/item_strength.tga
new file mode 100644 (file)
index 0000000..ed0e8a8
Binary files /dev/null and b/gfx/hud/luminos/item_strength.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
diff --git a/gfx/hud/old/item_large_armor.tga b/gfx/hud/old/item_large_armor.tga
new file mode 100644 (file)
index 0000000..5f43ab1
Binary files /dev/null and b/gfx/hud/old/item_large_armor.tga differ
diff --git a/gfx/hud/old/item_mega_health.tga b/gfx/hud/old/item_mega_health.tga
new file mode 100644 (file)
index 0000000..71c3d6d
Binary files /dev/null and b/gfx/hud/old/item_mega_health.tga differ
diff --git a/gfx/hud/old/item_shield.tga b/gfx/hud/old/item_shield.tga
new file mode 100644 (file)
index 0000000..58cb73b
Binary files /dev/null and b/gfx/hud/old/item_shield.tga differ
diff --git a/gfx/hud/old/item_strength.tga b/gfx/hud/old/item_strength.tga
new file mode 100644 (file)
index 0000000..0f7689d
Binary files /dev/null and b/gfx/hud/old/item_strength.tga differ
index 2ff915b4729997645ab41440834285b3fa7a3acd..573e8da309c8d201e77b16622f0077ab5feb7b3b 100644 (file)
@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.86 0.35 0"
 seta hud_progressbar_vehicles_ammo1_color "0.77 0.67 0"
 seta hud_progressbar_vehicles_ammo2_color "0.86 0.35 0"
 
-seta _hud_panelorder "17 15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 "
+seta _hud_panelorder "17 15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 18"
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.005000"
@@ -309,4 +309,21 @@ seta hud_panel_mapvote_bg_alpha ""
 seta hud_panel_mapvote_bg_border ""
 seta hud_panel_mapvote_bg_padding ""
 
+seta hud_panel_itemstime 2
+seta hud_panel_itemstime_pos "0.030000 0.260000"
+seta hud_panel_itemstime_size "0.070000 0.230000"
+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_text "1"
+seta hud_panel_itemstime_ratio "2"
+seta hud_panel_itemstime_dynamicsize "1"
+
 menu_sync
index 641333a1551ea594d52f618b3ade66752dda66ce..302d4d769fb6efff8c45f1f70836d559981929b0 100644 (file)
@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
 seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
 
-seta _hud_panelorder "17 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 "
+seta _hud_panelorder "17 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 18"
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
@@ -309,4 +309,21 @@ seta hud_panel_mapvote_bg_alpha ""
 seta hud_panel_mapvote_bg_border ""
 seta hud_panel_mapvote_bg_padding ""
 
+seta hud_panel_itemstime 2
+seta hud_panel_itemstime_pos "0.030000 0.260000"
+seta hud_panel_itemstime_size "0.070000 0.230000"
+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_text "1"
+seta hud_panel_itemstime_ratio "2"
+seta hud_panel_itemstime_dynamicsize "1"
+
 menu_sync
index 75a74fae44bd8a96d892d681b500525205852efe..3386129fcfc92f49f41b2bb02a8a80b8a335c65b 100644 (file)
@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
 seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
 
-seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 "
+seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 18"
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
@@ -309,4 +309,21 @@ seta hud_panel_mapvote_bg_alpha ""
 seta hud_panel_mapvote_bg_border ""
 seta hud_panel_mapvote_bg_padding ""
 
+seta hud_panel_itemstime 2
+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_text "1"
+seta hud_panel_itemstime_ratio "2"
+seta hud_panel_itemstime_dynamicsize "1"
+
 menu_sync
index ead25b0a26b034370aa94733ae715314de06107f..200c763a4ab615a1cbda87c79e235bf549bfe0bf 100644 (file)
@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
 seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
 
-seta _hud_panelorder "17 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 "
+seta _hud_panelorder "17 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 18"
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
@@ -309,4 +309,21 @@ seta hud_panel_mapvote_bg_alpha ""
 seta hud_panel_mapvote_bg_border ""
 seta hud_panel_mapvote_bg_padding ""
 
+seta hud_panel_itemstime 2
+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_text "1"
+seta hud_panel_itemstime_ratio "2"
+seta hud_panel_itemstime_dynamicsize "1"
+
 menu_sync
index 162b9a32047edca268e4b4bb1743caef61a370e8..95aab98e1853890960aa542a3a867d0f6978a7d1 100644 (file)
@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
 seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
 
-seta _hud_panelorder "17 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 "
+seta _hud_panelorder "17 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 18"
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
@@ -309,4 +309,21 @@ seta hud_panel_mapvote_bg_alpha ""
 seta hud_panel_mapvote_bg_border ""
 seta hud_panel_mapvote_bg_padding ""
 
+seta hud_panel_itemstime 2
+seta hud_panel_itemstime_pos "0.020000 0.490000"
+seta hud_panel_itemstime_size "0.090000 0.140000"
+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 "1"
+seta hud_panel_itemstime_progressbar_name "progressbar"
+seta hud_panel_itemstime_progressbar_reduced "1"
+seta hud_panel_itemstime_text "1"
+seta hud_panel_itemstime_ratio "3.5"
+seta hud_panel_itemstime_dynamicsize "1"
+
 menu_sync
index 66bfa6900935bc12277e5cd6472ed25bea93ae3e..f1e1cdf24e56fd08be3aa55c435bd5127450d04d 100644 (file)
@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
 seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
 
-seta _hud_panelorder "17 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 "
+seta _hud_panelorder "17 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 18"
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.01"
@@ -309,4 +309,21 @@ seta hud_panel_mapvote_bg_alpha ""
 seta hud_panel_mapvote_bg_border ""
 seta hud_panel_mapvote_bg_padding ""
 
+seta hud_panel_itemstime 2
+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_text "1"
+seta hud_panel_itemstime_ratio "2"
+seta hud_panel_itemstime_dynamicsize "1"
+
 menu_sync
index c26fcfa8bf0e209dd87d5719ecb66d08d916aaef..1e6d7444afef449449215d9796152eee68e00180 100644 (file)
@@ -172,6 +172,7 @@ float autocvar_g_waypointsprite_edgeoffset_left;
 float autocvar_g_waypointsprite_edgeoffset_right;
 float autocvar_g_waypointsprite_edgeoffset_top;
 float autocvar_g_waypointsprite_fontsize;
+int autocvar_g_waypointsprite_itemstime;
 float autocvar_g_waypointsprite_minalpha;
 float autocvar_g_waypointsprite_minscale;
 float autocvar_g_waypointsprite_normdistance;
@@ -268,6 +269,16 @@ float autocvar_hud_panel_healtharmor_progressbar_gfx_damage;
 float autocvar_hud_panel_healtharmor_progressbar_gfx_lowhealth;
 float autocvar_hud_panel_healtharmor_progressbar_gfx_smooth;
 int autocvar_hud_panel_healtharmor_text;
+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;
+int autocvar_hud_panel_itemstime_text = 1;
 bool autocvar_hud_panel_infomessages;
 bool autocvar_hud_panel_infomessages_flip;
 bool autocvar_hud_panel_modicons;
index 9019afc18f37f7e3531c94c58962d212c789f113..c422892ea3cb0baea1593245a19eb9477f9a980b 100644 (file)
@@ -4604,6 +4604,252 @@ void HUD_CenterPrint (void)
        }
 }
 
+// ItemsTime (#XX)
+//
+const float ITEMSTIME_MAXITEMS = 10;
+float ItemsTime_time[ITEMSTIME_MAXITEMS];
+float ItemsTime_availableTime[ITEMSTIME_MAXITEMS];
+string GetItemsTimePicture(float i)
+{
+       switch(i)
+       {
+               case 0: return "item_large_armor";
+               case 1: return "item_mega_health";
+               case 2: return "item_strength";
+               case 3: return "item_shield";
+               case 4: return "item_mega_health";
+               case 5: return "item_strength";
+               case 6: return "item_shield";
+               case 7: return "fuelregen";
+               case 8: return "jetpack";
+               case 9: return "superweapons";
+               default: return "";
+       }
+}
+
+void DrawItemsTimeItem(vector myPos, vector mySize, float ar, float itemcode, float item_time, bool item_available, float item_availableTime)
+{
+       float t = 0;
+       vector color = '0 0 0';
+       float picalpha;
+
+       if(autocvar_hud_panel_itemstime_hidespawned == 2)
+               picalpha = 1;
+       else if(item_available)
+       {
+               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 = 0.3;
+       t = floor(item_time - 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 * (ar - 1) * 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 * ((ar - 1)/ar) * 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, autocvar_hud_panel_itemstime_iconalign, color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+       }
+
+       if(t > 0 && autocvar_hud_panel_itemstime_text)
+               drawstring_aspect(numpos, ftos(t), eX * ((ar - 1)/ar) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+       else
+               picpos.x = myPos.x + mySize.x / 2 - mySize.y / 2;
+       if(item_availableTime)
+               drawpic_aspect_skin_expanding(picpos, GetItemsTimePicture(itemcode), '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL, item_availableTime);
+       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 == 1 && spectatee_status != 0)
+               ||      (autocvar_hud_panel_itemstime == 2 && (spectatee_status != 0 || warmup_stage))
+                       )) { 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);
+               ItemsTime_time[9] = getstatf(STAT_SUPERWEAPONS_TIME);
+       }
+       else
+       {
+               // do not show here mutator-dependent items
+               ItemsTime_time[0] = time + 0;
+               ItemsTime_time[1] = time + 8;
+               ItemsTime_time[2] = -1; // mutator-dependent
+               ItemsTime_time[3] = -1; // mutator-dependent
+               ItemsTime_time[4] = -1; // mutator-dependent
+               ItemsTime_time[5] = time + 0;
+               ItemsTime_time[6] = time + 4;
+               ItemsTime_time[7] = time + 49;
+               ItemsTime_time[8] = -1;
+               ItemsTime_time[9] = time + 28;
+       }
+
+       float i;
+       float count = 0;
+       if(autocvar_hud_panel_itemstime_hidespawned == 1)
+               for (i = 0; i < ITEMSTIME_MAXITEMS; ++i)
+                       count += (ItemsTime_time[i] > time || -ItemsTime_time[i] > time);
+       else if(autocvar_hud_panel_itemstime_hidespawned == 2)
+               for (i = 0; i < ITEMSTIME_MAXITEMS; ++i)
+                       count += (ItemsTime_time[i] > time);
+       else
+               for (i = 0; i < ITEMSTIME_MAXITEMS; ++i)
+                       count += (ItemsTime_time[i] != -1);
+       if (count == 0)
+               return;
+
+       HUD_Panel_UpdateCvars();
+
+       vector pos, mySize;
+       pos = panel_pos;
+       mySize = panel_size;
+
+       if(panel_bg_padding)
+       {
+               pos += '1 1 0' * panel_bg_padding;
+               mySize -= '2 2 0' * panel_bg_padding;
+       }
+
+       float rows, columns;
+       float ar = max(2, autocvar_hud_panel_itemstime_ratio) + 1;
+       rows = HUD_GetRowCount(count, mySize, ar);
+       columns = ceil(count/rows);
+
+       vector itemstime_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
+
+       vector offset = '0 0 0';
+       float newSize;
+       if(autocvar_hud_panel_itemstime_dynamicsize)
+       {
+               if(autocvar__hud_configure)
+               if(menu_enabled != 2)
+                       HUD_Panel_DrawBg(1); // also draw the bg of the entire panel
+
+               // reduce panel to avoid spacing items
+               if(itemstime_size.x / itemstime_size.y < ar)
+               {
+                       newSize = rows * itemstime_size.x / ar;
+                       pos.y += (mySize.y - newSize) / 2;
+                       mySize.y = newSize;
+                       itemstime_size.y = mySize.y / rows;
+               }
+               else
+               {
+                       newSize = columns * itemstime_size.y * ar;
+                       pos.x += (mySize.x - newSize) / 2;
+                       mySize.x = newSize;
+                       itemstime_size.x = mySize.x / columns;
+               }
+               panel_pos = pos - '1 1 0' * panel_bg_padding;
+               panel_size = mySize + '2 2 0' * panel_bg_padding;
+       }
+       else
+       {
+               if(itemstime_size.x/itemstime_size.y > ar)
+               {
+                       newSize = ar * itemstime_size.y;
+                       offset.x = itemstime_size.x - newSize;
+                       pos.x += offset.x/2;
+                       itemstime_size.x = newSize;
+               }
+               else
+               {
+                       newSize = 1/ar * itemstime_size.x;
+                       offset.y = itemstime_size.y - newSize;
+                       pos.y += offset.y/2;
+                       itemstime_size.y = newSize;
+               }
+       }
+
+       HUD_Panel_DrawBg(1);
+
+       float row = 0, column = 0;
+       bool item_available;
+       for (i = 0; i < ITEMSTIME_MAXITEMS; ++i) {
+               if (ItemsTime_time[i] == -1)
+                       continue;
+
+               float item_time = ItemsTime_time[i];
+               if(item_time < -1)
+               {
+                       item_available = true;
+                       item_time = -item_time;
+               }
+               else
+                       item_available = (item_time <= time);
+
+               if(ItemsTime_time[i] >= 0)
+               {
+                       if(time <= ItemsTime_time[i])
+                               ItemsTime_availableTime[i] = 0;
+                       else if(ItemsTime_availableTime[i] == 0)
+                               ItemsTime_availableTime[i] = time;
+               }
+               else if(ItemsTime_availableTime[i] == 0)
+                       ItemsTime_availableTime[i] = time;
+
+               float f = (time - ItemsTime_availableTime[i]) * 2;
+               f = (f > 1) ? 0 : bound(0, f, 1);
+
+               if(autocvar_hud_panel_itemstime_hidespawned == 1)
+                       if(!(ItemsTime_time[i] > time || -ItemsTime_time[i] > time))
+                               continue;
+
+               if(autocvar_hud_panel_itemstime_hidespawned == 2)
+                       if(!(ItemsTime_time[i] > time))
+                               continue;
+
+               DrawItemsTimeItem(pos + eX * column * (itemstime_size.x + offset.x) + eY * row * (itemstime_size.y + offset.y), itemstime_size, ar, i, item_time, item_available, f);
+               ++row;
+               if(row >= rows)
+               {
+                       row = 0;
+                       column = column + 1;
+               }
+       }
+}
+
+
 /*
 ==================
 Main HUD system
index 894066028f624dfe06b4c49dd2b7c259f3700a12..72e3326429eb7662feca88680ec696d5287494d4 100644 (file)
@@ -161,6 +161,7 @@ int prev_p_health, prev_p_armor;
        HUD_PANEL(PHYSICS      , HUD_Physics      , physics) \
        HUD_PANEL(CENTERPRINT  , HUD_CenterPrint  , centerprint) \
        HUD_PANEL(MAPVOTE      , MapVote_Draw     , mapvote) \
+       HUD_PANEL(ITEMSTIME    , HUD_ItemsTime    , itemstime) \
        // always add new panels to the end of list
 
 #define HUD_PANEL(NAME, draw_func, name)                                                                                                                                                       \
index 3a0f94d1d3aa18e7a4e0a3afd23e78acf67ae9a6..485b82b2c3ed2fc3a5689f859df502a944d8d789 100644 (file)
@@ -200,6 +200,16 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_fade_subsequent_passtwo_minalpha");
                                        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_reduced");
+                                       HUD_Write_PanelCvar_q("_text");
+                                       HUD_Write_PanelCvar_q("_ratio");
+                                       HUD_Write_PanelCvar_q("_dynamicsize");
+                                       break;
                        }
                        HUD_Write("\n");
                }
index 0aede97267cd6a24a1776fd8be83848a2fc5f972..9de48dff5261d72f482d7334f20fb53b461809df 100644 (file)
@@ -166,6 +166,10 @@ vector drawspritetext(vector o, float ang, float minwidth, vector rgb, float a,
 
 float spritelookupblinkvalue(string s)
 {
+       if(substring(s, 0, 4) == "wpn-")
+       if(get_weaponinfo(stof(substring(s, 4, strlen(s)))).spawnflags & WEP_FLAG_SUPERWEAPON)
+               return 2;
+
        switch(s)
        {
                case "ons-cp-atck-neut": return 2;
@@ -173,6 +177,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;
@@ -248,6 +254,8 @@ 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");
@@ -349,6 +357,14 @@ void Draw_WaypointSprite()
        // choose the sprite
        switch(self.rule)
        {
+               case SPRITERULE_SPECTATOR:
+                       if(!(
+                               (autocvar_g_waypointsprite_itemstime == 1 && t == NUM_SPECTATOR + 1)
+                       ||      (autocvar_g_waypointsprite_itemstime == 2 && (t == NUM_SPECTATOR + 1 || warmup_stage))
+                               ))
+                               return;
+                       spriteimage = self.netname;
+                       break;
                case SPRITERULE_DEFAULT:
                        if(self.team)
                        {
@@ -402,7 +418,7 @@ void Draw_WaypointSprite()
        {
                if(self.helpme && time < self.helpme)
                        a *= SPRITE_HELPME_BLINK;
-               else
+               else if(!self.lifetime) // fading out waypoints don't blink
                        a *= spritelookupblinkvalue(spriteimage);
        }
 
@@ -412,7 +428,7 @@ void Draw_WaypointSprite()
                a = 1;
        }
 
-       if(a <= 0)
+       if(a <= 0.003)
                return;
 
        rgb = fixrgbexcess(rgb);
index 5c48e63964e5360d21bfc1df173d58a250dc286a..61c08bf86f3c1b1f201a986739f57db4fc6ba2a1 100644 (file)
@@ -122,6 +122,7 @@ const int ENT_CLIENT_HEALING_ORB = 80;
 
 const int SPRITERULE_DEFAULT = 0;
 const int SPRITERULE_TEAMPLAY = 1;
+const int SPRITERULE_SPECTATOR = 2;
 
 const int RADARICON_NONE = 0;
 const int RADARICON_FLAG = 1;
index f6faf634dbee88605a24d69c51059a90b61cedd1..eb6b0ea9704c67fadbe0c65fccf0901e903b9c04 100644 (file)
@@ -109,18 +109,18 @@ const int STAT_OK_AMMO_CHARGE         = 85;
 const int STAT_OK_AMMO_CHARGEPOOL     = 86;
 const int STAT_FROZEN                 = 87;
 const int STAT_REVIVE_PROGRESS        = 88;
-const int STAT_BUFF_TIME              = 90;
-const int STAT_WEAPONSINMAP           = 91;
-const int STAT_WEAPONSINMAP2          = 92;
-const int STAT_WEAPONSINMAP3          = 93;
-const int STAT_CTF_FLAGSTATUS         = 94;
-// 95 empty?
-// 96 empty?
-// 97 empty?
-// 98 empty?
+const int STAT_ARMOR_LARGE_TIME       = 89;
+const int STAT_HEALTH_MEGA_TIME       = 90;
+const int STAT_INVISIBLE_TIME         = 91;
+const int STAT_SPEED_TIME             = 92;
+const int STAT_EXTRALIFE_TIME         = 93;
+const int STAT_STRENGTH_TIME          = 94;
+const int STAT_SHIELD_TIME            = 95;
+const int STAT_FUELREGEN_TIME         = 96;
+const int STAT_JETPACK_TIME           = 97;
+const int STAT_SUPERWEAPONS_TIME      = 98;
 // 99 empty?
 
-
 /* The following stats change depending on the gamemode, so can share the same ID */
 // IDs 100 to 104 reserved for gamemodes
 
@@ -170,11 +170,11 @@ const int STAT_PL_CROUCH_MAX3         = 119;
 const int STAT_PL_CROUCH_VIEW_OFS1    = 117;
 const int STAT_PL_CROUCH_VIEW_OFS2    = 118;
 const int STAT_PL_CROUCH_VIEW_OFS3    = 119;
-// 120 empty?
-// 121 empty?
-// 122 empty?
-// 123 empty?
-// 124 empty?
+const int STAT_WEAPONSINMAP           = 120;
+const int STAT_WEAPONSINMAP2          = 121;
+const int STAT_WEAPONSINMAP3          = 122;
+const int STAT_BUFF_TIME              = 123;
+const int STAT_CTF_FLAGSTATUS         = 124;
 // 125 empty?
 // 126 empty?
 // 127 empty?
index df022315821d781171be2f06145de94b82ed5470..01a7c8a040f47526e09ee027a125068acacb78ef 100644 (file)
@@ -47,6 +47,7 @@
 #include "xonotic/dialog_hudpanel_engineinfo.qc"
 #include "xonotic/dialog_hudpanel_healtharmor.qc"
 #include "xonotic/dialog_hudpanel_infomessages.qc"
+#include "xonotic/dialog_hudpanel_itemstime.qc"
 #include "xonotic/dialog_hudpanel_modicons.qc"
 #include "xonotic/dialog_hudpanel_notification.qc"
 #include "xonotic/dialog_hudpanel_physics.qc"
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_itemstime.qc b/qcsrc/menu/xonotic/dialog_hudpanel_itemstime.qc
new file mode 100644 (file)
index 0000000..77f99dc
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef DIALOG_HUDPANEL_ITEMSTIME_H
+#define DIALOG_HUDPANEL_ITEMSTIME_H
+#include "rootdialog.qc"
+CLASS(XonoticHUDItemsTimeDialog, 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";
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_itemstime"));
+                       e.addValue(e, ZCTX(_("PNL^Disabled")), "0");
+                       e.addValue(e, ZCTX(_("PNL^Enabled spectating")), "1");
+                       e.addValue(e, ZCTX(_("PNL^Enabled even playing in warmup")), "2");
+                       e.configureXonoticTextSliderValues(e);
+
+       DIALOG_HUDPANEL_COMMON_NOTOGGLE();
+
+       me.TR(me);
+               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Align icon:")));
+                       me.TD(me, 1, 2.6/2, e = makeXonoticRadioButton(2, "hud_panel_itemstime_iconalign", "0", _("Left")));
+                       me.TD(me, 1, 2.6/2, e = makeXonoticRadioButton(2, "hud_panel_itemstime_iconalign", "1", _("Right")));
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "hud_panel_itemstime_progressbar", _("Enable status bar")));
+               me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "hud_panel_itemstime_progressbar_reduced", _("Reduced")));
+                       setDependent(e, "hud_panel_itemstime_progressbar", 1, 1);
+       me.TR(me);
+               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Text/icon ratio:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(2, 8, 0.5, "hud_panel_itemstime_ratio"));
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_itemstime_hidespawned", _("Hide spawned items")));
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_itemstime_dynamicsize", _("Dynamic size")));
+}
+#endif
index a3e0727fba82705658d4ef62caf2d91c6cef5eaf..4ca94c9b0236bd3f2ad6b71fa715eb9f717e01d1 100644 (file)
@@ -128,6 +128,9 @@ void MainWindow_configureMainWindow(entity me)
        i.configureDialog(i);
        me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
+       i = NEW(XonoticHUDItemsTimeDialog);
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        // dialogs used by settings
        me.userbindEditDialog = i = NEW(XonoticUserbindEditDialog);
index 5e1c01a11b9b1f6239bb67c233e44efdc0817a8f..0b6d044753c6cc2e8004ef157287837daf21c16e 100644 (file)
@@ -625,6 +625,7 @@ float autocvar_sv_gameplayfix_q2airaccelerate;
 int autocvar_sv_gentle;
 #define autocvar_sv_gravity cvar("sv_gravity")
 string autocvar_sv_intermission_cdtrack;
+float autocvar_sv_itemstime;
 string autocvar_sv_jumpspeedcap_max;
 float autocvar_sv_jumpspeedcap_max_disable_on_ramps;
 string autocvar_sv_jumpspeedcap_min;
index 8867afb316a695f26cb96372a097e8ee75e03c75..6d3d786aecda1de1a1b2c70c697bcb3c3cc3b7a8 100644 (file)
@@ -195,6 +195,7 @@ void PutObserverInServer (void)
 
        if(IS_REAL_CLIENT(self))
        {
+               Item_ItemsTime_SetTimesForPlayer(self);
                msg_entity = self;
                WriteByte(MSG_ONE, SVC_SETVIEW);
                WriteEntity(MSG_ONE, self);
@@ -507,6 +508,9 @@ void PutClientInServer (void)
                else
                        self.superweapons_finished = 0;
 
+               if(!warmup_stage)
+                       Item_ItemsTime_ResetTimesForPlayer(self);
+
                if(g_weaponarena_random) // WEAPONTODO: more stuff that should be in a mutator. also: rename those cvars
                {
                        if(g_weaponarena_random_with_blaster)
index 4be48e124e82b98d38fb26c41c5df7dfe18efc29..6ea03dd43fdaad2c88dca9ee34ce0b0171a73adc 100644 (file)
@@ -462,6 +462,8 @@ void ReadyRestart_force()
        // disable the warmup global for the server
        warmup_stage = 0; // once the game is restarted the game is in match stage
 
+       Item_ItemsTime_ResetTimes();
+
        // reset the .ready status of all players (also spectators)
        FOR_EACH_REALCLIENT(tmp_player) { tmp_player.ready = 0; }
        readycount = 0;
index 1fbc8d09a50587b2c30094d4fabe2bf8bde001b5..cab4d569fc6061a4628873cbb5f5358be128352a 100644 (file)
@@ -110,6 +110,7 @@ void setanim(entity e, vector anim, float looping, float override, float restart
 
 .float species;
 
+.float scheduledrespawntime;
 .float respawntime;
 .float respawntimejitter;
 //.float       chasecam;
@@ -512,6 +513,17 @@ const float ACTIVE_TOGGLE  = 3;
 .void (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 item_superweapons_time;
+
 //float serverflags;
 
 .float team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
index c913e86e75a7d5b72346fe6c67b5dbca7f3ea65c..98417c73ebda9ae11d154887ffffe8f6b1205478 100644 (file)
@@ -574,6 +574,7 @@ void spawnfunc___init_dedicated_server(void)
 void Map_MarkAsRecent(string m);
 float world_already_spawned;
 void Nagger_Init();
+void Item_ItemsTime_Init();
 void ClientInit_Spawn();
 void WeaponStats_Init();
 void WeaponStats_Shutdown();
@@ -816,6 +817,19 @@ void spawnfunc_worldspawn (void)
 
        addstat(STAT_ARC_HEAT, AS_FLOAT, arc_heat_percent);
 
+       // items time
+       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);
+       addstat(STAT_SUPERWEAPONS_TIME, AS_FLOAT, item_superweapons_time);
+       Item_ItemsTime_Init();
+
        // freeze attacks
        addstat(STAT_FROZEN, AS_INT, frozen);
        addstat(STAT_REVIVE_PROGRESS, AS_FLOAT, revive_progress);
index 4e3e376e3b26625d03bb5c8ff1cd8f22c20a60c0..873f7a53c1f89159e32534626b6609221d15bd23 100644 (file)
@@ -412,6 +412,180 @@ void Item_Think()
        }
 }
 
+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;
+float it_superweapons_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;
+       it_superweapons_time = -1;
+}
+void Item_ItemsTime_ResetTimes()
+{
+       it_armor_large_time = (it_armor_large_time == -1) ? -1 : 0;
+       it_health_mega_time = (it_health_mega_time == -1) ? -1 : 0;
+       it_invisible_time   = (it_invisible_time   == -1) ? -1 : 0;
+       it_speed_time       = (it_speed_time       == -1) ? -1 : 0;
+       it_extralife_time   = (it_extralife_time   == -1) ? -1 : 0;
+       it_strength_time    = (it_strength_time    == -1) ? -1 : 0;
+       it_shield_time      = (it_shield_time      == -1) ? -1 : 0;
+       it_fuelregen_time   = (it_fuelregen_time   == -1) ? -1 : 0;
+       it_jetpack_time     = (it_jetpack_time     == -1) ? -1 : 0;
+       it_superweapons_time= (it_superweapons_time== -1) ? -1 : 0;
+}
+void Item_ItemsTime_ResetTimesForPlayer(entity e)
+{
+       e.item_armor_large_time = (it_armor_large_time == -1) ? -1 : 0;
+       e.item_health_mega_time = (it_health_mega_time == -1) ? -1 : 0;
+       e.item_invisible_time   = (it_invisible_time   == -1) ? -1 : 0;
+       e.item_speed_time       = (it_speed_time       == -1) ? -1 : 0;
+       e.item_extralife_time   = (it_extralife_time   == -1) ? -1 : 0;
+       e.item_strength_time    = (it_strength_time    == -1) ? -1 : 0;
+       e.item_shield_time      = (it_shield_time      == -1) ? -1 : 0;
+       e.item_fuelregen_time   = (it_fuelregen_time   == -1) ? -1 : 0;
+       e.item_jetpack_time     = (it_jetpack_time     == -1) ? -1 : 0;
+       e.item_superweapons_time= (it_superweapons_time== -1) ? -1 : 0;
+}
+void Item_ItemsTime_SetTimesForPlayer(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;
+       e.item_superweapons_time = it_superweapons_time;
+}
+
+void Item_ItemsTime_SetTime(entity e, float t)
+{
+       if(!autocvar_sv_itemstime)
+               return;
+
+       if(g_instagib)
+       {
+               switch(e.items)
+               {
+                       case IT_STRENGTH://"item-invis"
+                               it_invisible_time = t;
+                               break;
+                       case IT_NAILS://"item-extralife"
+                               it_extralife_time = t;
+                               break;
+                       case IT_INVINCIBLE://"item-speed"
+                               it_speed_time = t;
+                               break;
+               }
+       }
+       else
+       {
+               switch(e.items)
+               {
+                       case IT_HEALTH:
+                               // if(e.classname == "item_health_mega") // IT_HEALTH unequivocally identifies it
+                                       it_health_mega_time = t;
+                               break;
+                       case IT_ARMOR:
+                               if(e.classname == "item_armor_large") // IT_ARMOR doesn't unequivocally identifies it
+                                       it_armor_large_time = t;
+                               break;
+                       case IT_STRENGTH://"item-strength"
+                               it_strength_time = t;
+                               break;
+                       case IT_INVINCIBLE://"item-shield"
+                               it_shield_time = t;
+                               break;
+                       default:
+                               if(e.weapons & WEPSET_SUPERWEAPONS)
+                                       it_superweapons_time = t;
+               }
+       }
+       switch(e.items)
+       {
+               case IT_FUEL_REGEN://"item-fuelregen"
+                       it_fuelregen_time = t;
+                       break;
+               case IT_JETPACK://"item-jetpack"
+                       it_jetpack_time = t;
+                       break;
+       }
+}
+void Item_ItemsTime_SetTimesForAllPlayers()
+{
+       entity e;
+       if(warmup_stage)
+       {
+               FOR_EACH_REALCLIENT(e)
+                       Item_ItemsTime_SetTimesForPlayer(e);
+       }
+       else
+       {
+               FOR_EACH_REALCLIENT(e)
+               {
+                       if(!IS_PLAYER(e))
+                               Item_ItemsTime_SetTimesForPlayer(e);
+               }
+       }
+}
+
+float Item_ItemsTime_UpdateTime(entity e, float t)
+{
+       entity head;
+       bool isavailable = (t == 0);
+       if(e.weapons & WEPSET_SUPERWEAPONS)
+       {
+               for(head = world; (head = nextent(head)); )
+               {
+                       if(clienttype(head) != CLIENTTYPE_NOTACLIENT || !(head.weapons & WEPSET_SUPERWEAPONS) || head.classname == "weapon_info")
+                               continue;
+                       if(e == head)
+                               continue;
+
+                       if(head.scheduledrespawntime <= time)
+                               isavailable = true;
+                       else if(t == 0 || head.scheduledrespawntime < t)
+                               t = head.scheduledrespawntime;
+               }
+       }
+       else
+       {
+               for(head = world; (head = nextent(head)); )
+               {
+                       if(head.itemdef != e.itemdef)
+                               continue;
+                       if(e == head)
+                               continue;
+
+                       if(head.scheduledrespawntime <= time)
+                               isavailable = true;
+                       else if(t == 0 || head.scheduledrespawntime < t)
+                               t = head.scheduledrespawntime;
+               }
+       }
+       if(isavailable)
+               t = -t; // let know the client there's another available item
+       return t;
+}
+
 void Item_Respawn (void)
 {
        Item_Show(self, 1);
@@ -424,6 +598,13 @@ void Item_Respawn (void)
                sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound
        setorigin (self, self.origin);
 
+       if(self.flags & FL_POWERUP || self.classname == "item_armor_large" || self.items == IT_HEALTH || (self.weapons & WEPSET_SUPERWEAPONS))
+       {
+               float t = Item_ItemsTime_UpdateTime(self, 0);
+               Item_ItemsTime_SetTime(self, t);
+               Item_ItemsTime_SetTimesForAllPlayers();
+       }
+
        self.think = Item_Think;
        self.nextthink = time;
 
@@ -454,6 +635,14 @@ void Item_RespawnCountdown (void)
                                case IT_JETPACK:    name = "item-jetpack"; rgb = '0.5 0.5 0.5'; break;
                                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;
                        }
                        item_name = name;
                        item_color = rgb;
@@ -473,7 +662,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);
+                               }
                        }
                        else
                        {
@@ -481,12 +674,25 @@ void Item_RespawnCountdown (void)
                                localcmd(sprintf("prvm_edict server %d\n", num_for_edict(self)));
                        }
                }
-               sound (self, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTEN_NORM);        // play respawn sound
+
                if(self.waypointsprite_attached)
                {
+                       entity e;
+                       entity it = self;
+                       self = self.waypointsprite_attached;
+                       FOR_EACH_REALCLIENT(e)
+                               if(self.waypointsprite_visible_for_player(e))
+                               {
+                                       msg_entity = e;
+                                       soundto(MSG_ONE, it, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTEN_NORM);        // play respawn sound
+                               }
+                       self = it;
+
                        WaypointSprite_Ping(self.waypointsprite_attached);
                        //WaypointSprite_UpdateHealth(self.waypointsprite_attached, self.count);
                }
+               else
+                       sound(self, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTEN_NORM); // play respawn sound
        }
 }
 
@@ -505,16 +711,21 @@ void Item_RespawnThink()
 
 void Item_ScheduleRespawnIn(entity e, float t)
 {
-       if((e.flags & FL_POWERUP) || (e.weapons & WEPSET_SUPERWEAPONS))
+       if((e.flags & FL_POWERUP) || (e.weapons & WEPSET_SUPERWEAPONS) || e.classname == "item_armor_large" || e.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;
+               t = Item_ItemsTime_UpdateTime(e, e.scheduledrespawntime);
+               Item_ItemsTime_SetTime(e, t);
+               Item_ItemsTime_SetTimesForAllPlayers();
        }
        else
        {
                e.think = Item_RespawnThink;
                e.nextthink = time;
+               e.scheduledrespawntime = time + t;
                e.wait = time + t;
        }
 }
@@ -665,8 +876,6 @@ float Item_GiveTo(entity item, entity player)
        return 1;
 }
 
-.entity itemdef;
-
 void Item_Touch (void)
 {
        entity e, head;
@@ -1088,6 +1297,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_ItemsTime_SetTime(self, 0);
        }
 
        self.bot_pickup = true;
index a33e45a82c388acbb55dd9cf59fe4c1819752803..364f4c188dc9da5297766d4394736314d9d15988 100644 (file)
@@ -113,6 +113,10 @@ const float ITEM_RESPAWN_TICKS = 10;
 .float max_armorvalue;
 .float pickup_anyway;
 
+void Item_ItemsTime_SetTimesForPlayer(entity e);
+
+void Item_ItemsTime_ResetTimesForPlayer(entity e);
+
 void Item_Show (entity e, float mode);
 
 void Item_Respawn (void);
@@ -152,6 +156,7 @@ float weapon_pickupevalfunc(entity player, entity item);
 float commodity_pickupevalfunc(entity player, entity item);
 
 .float is_item;
+.entity itemdef;
 void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue);
 
 
index d7b637d0ce03fcefaabe35d6fbce6a6441b3d997..b0c8cb1226eaeda11f432629baabccf5dee87f33 100644 (file)
@@ -199,7 +199,14 @@ float WaypointSprite_visible_for_player(entity e)
                        return false;
 
        // team waypoints
-       if(self.team && self.rule == SPRITERULE_DEFAULT)
+       if(self.rule == SPRITERULE_SPECTATOR)
+       {
+               if(!autocvar_sv_itemstime)
+                       return FALSE;
+               if(!warmup_stage && e.classname == "player")
+                       return FALSE;
+       }
+       else if(self.team && self.rule == SPRITERULE_DEFAULT)
        {
                if(self.team != e.team)
                        return false;