From: terencehill Date: Tue, 20 Jan 2015 16:51:44 +0000 (+0100) Subject: Merge branch 'master' into terencehill/itemstime X-Git-Tag: xonotic-v0.8.1~12^2~26 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ee32da5f4dafee5883369c759fe8ed042114bda5;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into terencehill/itemstime Conflicts: _hud_descriptions.cfg hud_luminos.cfg hud_luminos_minimal.cfg hud_luminos_minimal_xhair.cfg hud_luminos_old.cfg hud_nexuiz.cfg qcsrc/client/hud.qc qcsrc/client/hud.qh qcsrc/client/waypointsprites.qc qcsrc/common/constants.qh qcsrc/common/util.qh qcsrc/menu/classes.c qcsrc/menu/xonotic/mainwindow.c qcsrc/server/arena.qc qcsrc/server/cl_client.qc qcsrc/server/defs.qh qcsrc/server/g_world.qc qcsrc/server/t_items.qc --- ee32da5f4dafee5883369c759fe8ed042114bda5 diff --cc _hud_descriptions.cfg index 5b0925245,270bd2bd9..5493eceda --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@@ -295,21 -298,12 +298,30 @@@ seta hud_panel_centerprint_fade_subsequ 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_buffs "" "enable/disable this panel" + seta hud_panel_buffs_pos "" "position of this panel" + seta hud_panel_buffs_size "" "size of this panel" + seta hud_panel_buffs_bg "" "if set to something else than \"\" = override default background" + seta hud_panel_buffs_bg_color "" "if set to something else than \"\" = override default panel background color" + seta hud_panel_buffs_bg_color_team "" "override panel color with team color in team based games" + seta hud_panel_buffs_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" + seta hud_panel_buffs_bg_border "" "if set to something else than \"\" = override default size of border around the background" + seta hud_panel_buffs_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_showspawned "" "show icons of already spawned items" +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_size_dinamic "" "reduce panel size by removing spacing beetwen items" - diff --cc hud_luminos.cfg index 8d7e046c7,f3bc914e6..212717f97 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@@ -20,11 -20,11 +20,11 @@@ seta hud_progressbar_health_color "0.6 seta hud_progressbar_armor_color "0 0.6 0" seta hud_progressbar_fuel_color "0.6 0.6 0" seta hud_progressbar_nexball_color "0.7 0.1 0" - 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_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" @@@ -293,22 -296,14 +296,32 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" + seta hud_panel_buffs 1 + seta hud_panel_buffs_pos "0.450000 0.855000" + seta hud_panel_buffs_size "0.050000 0.070000" + seta hud_panel_buffs_bg "0" + seta hud_panel_buffs_bg_color "" + seta hud_panel_buffs_bg_color_team "" + seta hud_panel_buffs_bg_alpha "" + seta hud_panel_buffs_bg_border "" + seta hud_panel_buffs_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_showspawned "0" +seta hud_panel_itemstime_text "1" +seta hud_panel_itemstime_ratio "2" +seta hud_panel_itemstime_size_dinamic "1" + menu_sync diff --cc hud_luminos_minimal.cfg index 4cd38574b,050689b38..b1a934605 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@@ -20,11 -20,11 +20,11 @@@ seta hud_progressbar_health_color "0.6 seta hud_progressbar_armor_color "0 0.6 0" seta hud_progressbar_fuel_color "0.6 0.6 0" seta hud_progressbar_nexball_color "0.7 0.1 0" - 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_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" @@@ -293,22 -296,14 +296,32 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" + seta hud_panel_buffs 1 + seta hud_panel_buffs_pos "0.450000 0.855000" + seta hud_panel_buffs_size "0.050000 0.070000" + seta hud_panel_buffs_bg "0" + seta hud_panel_buffs_bg_color "" + seta hud_panel_buffs_bg_color_team "" + seta hud_panel_buffs_bg_alpha "" + seta hud_panel_buffs_bg_border "" + seta hud_panel_buffs_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_showspawned "0" +seta hud_panel_itemstime_text "1" +seta hud_panel_itemstime_ratio "2" +seta hud_panel_itemstime_size_dinamic "1" + menu_sync diff --cc hud_luminos_minimal_xhair.cfg index 966ebbb9e,8fb6cbe93..b88d4683c --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@@ -20,11 -20,11 +20,11 @@@ seta hud_progressbar_health_color "0.6 seta hud_progressbar_armor_color "0 0.6 0" seta hud_progressbar_fuel_color "0.6 0.6 0" seta hud_progressbar_nexball_color "0.7 0.1 0" - 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_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" @@@ -293,22 -296,14 +296,32 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" + seta hud_panel_buffs 1 + seta hud_panel_buffs_pos "0.450000 0.855000" + seta hud_panel_buffs_size "0.050000 0.070000" + seta hud_panel_buffs_bg "0" + seta hud_panel_buffs_bg_color "" + seta hud_panel_buffs_bg_color_team "" + seta hud_panel_buffs_bg_alpha "" + seta hud_panel_buffs_bg_border "" + seta hud_panel_buffs_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_showspawned "0" +seta hud_panel_itemstime_text "1" +seta hud_panel_itemstime_ratio "2" +seta hud_panel_itemstime_size_dinamic "1" + menu_sync diff --cc hud_luminos_old.cfg index 463812c61,9d71e2e28..896af911f --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@@ -20,11 -20,11 +20,11 @@@ seta hud_progressbar_health_color "0.6 seta hud_progressbar_armor_color "0 0.6 0" seta hud_progressbar_fuel_color "0.6 0.6 0" seta hud_progressbar_nexball_color "0.7 0.1 0" - 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_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" @@@ -293,22 -296,14 +296,32 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" + seta hud_panel_buffs 1 + seta hud_panel_buffs_pos "0.450000 0.855000" + seta hud_panel_buffs_size "0.050000 0.070000" + seta hud_panel_buffs_bg "0" + seta hud_panel_buffs_bg_color "" + seta hud_panel_buffs_bg_color_team "" + seta hud_panel_buffs_bg_alpha "" + seta hud_panel_buffs_bg_border "" + seta hud_panel_buffs_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_showspawned "0" +seta hud_panel_itemstime_text "1" +seta hud_panel_itemstime_ratio "3.5" +seta hud_panel_itemstime_size_dinamic "1" + menu_sync diff --cc hud_nexuiz.cfg index 0aa7a4ded,9e4678293..af05512d0 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@@ -20,11 -20,11 +20,11 @@@ seta hud_progressbar_health_color "0.6 seta hud_progressbar_armor_color "0 0.6 0" seta hud_progressbar_fuel_color "0.6 0.6 0" seta hud_progressbar_nexball_color "0.7 0.1 0" - 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_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" @@@ -293,22 -296,14 +296,32 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" + seta hud_panel_buffs 1 + seta hud_panel_buffs_pos "0.450000 0.855000" + seta hud_panel_buffs_size "0.050000 0.070000" + seta hud_panel_buffs_bg "0" + seta hud_panel_buffs_bg_color "" + seta hud_panel_buffs_bg_color_team "" + seta hud_panel_buffs_bg_alpha "" + seta hud_panel_buffs_bg_border "" + seta hud_panel_buffs_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_showspawned "0" +seta hud_panel_itemstime_text "1" +seta hud_panel_itemstime_ratio "2" +seta hud_panel_itemstime_size_dinamic "1" + menu_sync diff --cc qcsrc/client/autocvars.qh index 6a6425a02,f06c5bfb3..bf5e72be4 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@@ -253,18 -266,10 +267,20 @@@ float autocvar_hud_panel_healtharmor_pr 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_size_dinamic; +float autocvar_hud_panel_itemstime_ratio; +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_ca_layout; float autocvar_hud_panel_modicons_dom_layout; + float autocvar_hud_panel_modicons_freezetag_layout; float autocvar_hud_panel_notify; float autocvar_hud_panel_notify_fadetime; float autocvar_hud_panel_notify_flip; diff --cc qcsrc/client/hud.qc index 390fdb0dd,8a9aab304..9df07461c --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@@ -4358,217 -4411,65 +4411,273 @@@ void HUD_CenterPrint (void } } + // Buffs (#18) + // + void HUD_Buffs(void) + { + float buffs = getstati(STAT_BUFFS, 0, 24); + if(!autocvar__hud_configure) + { + if(!autocvar_hud_panel_buffs) return; + if(spectatee_status == -1) return; + if(getstati(STAT_HEALTH) <= 0) return; + if(!buffs) return; + } + else + { + buffs = Buff_Type_first.items; // force first buff + } + + float b = 0; // counter to tell other functions that we have buffs + entity e; + string s = ""; + for(e = Buff_Type_first; e; e = e.enemy) if(buffs & e.items) + { + ++b; + string o = strcat(rgb_to_hexcolor(Buff_Color(e.items)), Buff_PrettyName(e.items)); + if(s == "") + s = o; + else + s = strcat(s, " ", o); + } + + HUD_Panel_UpdateCvars(); + + draw_beginBoldFont(); + + vector pos, mySize; + pos = panel_pos; + mySize = panel_size; + + HUD_Panel_DrawBg(bound(0, b, 1)); + if(panel_bg_padding) + { + pos += '1 1 0' * panel_bg_padding; + mySize -= '2 2 0' * panel_bg_padding; + } + + //float panel_ar = mySize_x/mySize_y; + //float is_vertical = (panel_ar < 1); + //float buff_iconalign = autocvar_hud_panel_buffs_iconalign; + vector buff_offset = '0 0 0'; + + for(e = Buff_Type_first; e; e = e.enemy) if(buffs & e.items) + { + //DrawNumIcon(pos + buff_offset, mySize, shield, "shield", is_vertical, buff_iconalign, '1 1 1', 1); + drawcolorcodedstring_aspect(pos + buff_offset, s, mySize, panel_fg_alpha * 0.5, DRAWFLAG_NORMAL); + } + + draw_endBoldFont(); + } - // ItemsTime (#17) ++// ItemsTime (#XX) +// +const float ITEMSTIME_MAXITEMS = 10; +float ItemsTime_time[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 t = 0; + vector color = '0 0 0'; + float picalpha; + if(ItemsTime_time[itemcode] <= time) + { + float BLINK_FACTOR = 0.15; + float BLINK_BASE = 0.85; + float BLINK_FREQ = 5; + picalpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); + } + else + { + 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 * (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); + 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 not(autocvar_hud_panel_itemstime == 1 && spectatee_status != 0 - || autocvar_hud_panel_itemstime == 2 && (spectatee_status != 0 || warmup_stage)) ++ if not((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 + { - hud_configure_active_panel = HUD_PANEL_ITEMSTIME; - + // 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_showspawned) + for (i = 0; i < ITEMSTIME_MAXITEMS; ++i) + count += (ItemsTime_time[i] != -1); + else + for (i = 0; i < ITEMSTIME_MAXITEMS; ++i) + count += (ItemsTime_time[i] > time); + if (count == 0) + return; + - HUD_Panel_UpdateCvars(itemstime); - HUD_Panel_ApplyFadeAlpha(); ++ 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 = mySize_y/mySize_x; + rows = bound(1, floor((sqrt(4 * ar * 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); + + vector offset = '0 0 0'; + float newSize; + if(autocvar_hud_panel_itemstime_size_dinamic) + { + 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; + 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, ar, i); + ++row; + if(row >= rows) + { + row = 0; + column = column + 1; + } + } +} /* ================== diff --cc qcsrc/client/hud.qh index b1f02d39d,d56caf133..66e4e61eb --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@@ -76,8 -92,53 +92,54 @@@ var string panel_bg_border_str var float panel_bg_padding; var string panel_bg_padding_str; + .void() panel_draw; + float current_player; + + #define HUD_PANELS \ + HUD_PANEL(WEAPONS , HUD_Weapons , weapons) \ + HUD_PANEL(AMMO , HUD_Ammo , ammo) \ + HUD_PANEL(POWERUPS , HUD_Powerups , powerups) \ + HUD_PANEL(HEALTHARMOR , HUD_HealthArmor , healtharmor) \ + HUD_PANEL(NOTIFY , HUD_Notify , notify) \ + HUD_PANEL(TIMER , HUD_Timer , timer) \ + HUD_PANEL(RADAR , HUD_Radar , radar) \ + HUD_PANEL(SCORE , HUD_Score , score) \ + HUD_PANEL(RACETIMER , HUD_RaceTimer , racetimer) \ + HUD_PANEL(VOTE , HUD_Vote , vote) \ + HUD_PANEL(MODICONS , HUD_ModIcons , modicons) \ + HUD_PANEL(PRESSEDKEYS , HUD_PressedKeys , pressedkeys) \ + HUD_PANEL(CHAT , HUD_Chat , chat) \ + HUD_PANEL(ENGINEINFO , HUD_EngineInfo , engineinfo) \ + HUD_PANEL(INFOMESSAGES , HUD_InfoMessages , infomessages) \ + HUD_PANEL(PHYSICS , HUD_Physics , physics) \ + HUD_PANEL(CENTERPRINT , HUD_CenterPrint , centerprint) \ - HUD_PANEL(BUFFS , HUD_Buffs , buffs) ++ HUD_PANEL(BUFFS , HUD_Buffs , buffs) \ ++ HUD_PANEL(ITEMSTIME , HUD_ItemsTime , itemstime) + + #define HUD_PANEL(NAME,draw_func,name) \ + float HUD_PANEL_##NAME; \ + void draw_func(void); \ + void RegisterHUD_Panel_##NAME() \ + { \ + HUD_PANEL_LAST = HUD_PANEL_##NAME = HUD_PANEL_NUM; \ + entity hud_panelent = spawn(); \ + hud_panel[HUD_PANEL_##NAME] = hud_panelent; \ + hud_panelent.classname = "hud_panel"; \ + hud_panelent.panel_name = #name; \ + hud_panelent.panel_id = HUD_PANEL_##NAME; \ + hud_panelent.panel_draw = draw_func; \ + ++HUD_PANEL_NUM; \ + } \ + ACCUMULATE_FUNCTION(RegisterHUD_Panels, RegisterHUD_Panel_##NAME); + + HUD_PANELS + #undef HUD_PANEL + + #define HUD_PANEL(NAME) hud_panel[HUD_PANEL_##NAME] + + // Because calling lots of functions in QC apparently cuts fps in half on many machines: // ---------------------- // MACRO HELL STARTS HERE diff --cc qcsrc/client/waypointsprites.qc index 87341be96,2df3dd411..3c23911a0 --- a/qcsrc/client/waypointsprites.qc +++ b/qcsrc/client/waypointsprites.qc @@@ -418,12 -378,6 +385,12 @@@ void Draw_WaypointSprite( // choose the sprite switch(self.rule) { + case SPRITERULE_SPECTATOR: - if not(autocvar_g_waypointsprite_itemstime == 1 && t == NUM_SPECTATOR + 1 - || autocvar_g_waypointsprite_itemstime == 2 && (t == NUM_SPECTATOR + 1 || warmup_stage)) ++ if not((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) { diff --cc qcsrc/common/constants.qh index 898495764,8586cffa9..9b9bded9b --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@@ -102,9 -101,10 +101,11 @@@ const float ENT_CLIENT_TURRET = 40 const float ENT_CLIENT_AUXILIARYXHAIR = 50; const float ENT_CLIENT_VEHICLE = 60; + const float ENT_CLIENT_HEALING_ORB = 80; + 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; @@@ -380,68 -290,10 +291,11 @@@ const float SPECIES_RESERVED = 15 // we can use this frags value for both // water levels - float WATERLEVEL_NONE = 0; - float WATERLEVEL_WETFEET = 1; - float WATERLEVEL_SWIMMING = 2; - float WATERLEVEL_SUBMERGED = 3; - - float MAX_SHOT_DISTANCE = 32768; - - // weapon requests - float WR_SETUP = 1; // (SVQC) setup weapon data - float WR_THINK = 2; // (SVQC) logic to run every frame - float WR_CHECKAMMO1 = 3; // (SVQC) checks ammo for weapon - float WR_CHECKAMMO2 = 4; // (SVQC) checks ammo for weapon - float WR_AIM = 5; // (SVQC) runs bot aiming code for this weapon - float WR_PRECACHE = 6; // (CSQC and SVQC) precaches models/sounds used by this weapon - float WR_SUICIDEMESSAGE = 7; // (SVQC) notification number for suicide message (may inspect w_deathtype for details) - float WR_KILLMESSAGE = 8; // (SVQC) notification number for kill message (may inspect w_deathtype for details) - float WR_RELOAD = 9; // (SVQC) does not need to do anything - float WR_RESETPLAYER = 10; // (SVQC) does not need to do anything - float WR_IMPACTEFFECT = 11; // (CSQC) impact effect - float WR_SWITCHABLE = 12; // (CSQC) impact effect - float WR_PLAYERDEATH = 13; // (SVQC) does not need to do anything - float WR_GONETHINK = 14; // (SVQC) logic to run every frame, also if no longer having the weapon as long as the switch away has not been performed - - float HUD_PANEL_WEAPONS = 0; - float HUD_PANEL_AMMO = 1; - float HUD_PANEL_POWERUPS = 2; - float HUD_PANEL_HEALTHARMOR = 3; - float HUD_PANEL_NOTIFY = 4; - float HUD_PANEL_TIMER = 5; - float HUD_PANEL_RADAR = 6; - float HUD_PANEL_SCORE = 7; - float HUD_PANEL_RACETIMER = 8; - float HUD_PANEL_VOTE = 9; - float HUD_PANEL_MODICONS = 10; - float HUD_PANEL_PRESSEDKEYS = 11; - float HUD_PANEL_CHAT = 12; - float HUD_PANEL_ENGINEINFO = 13; - float HUD_PANEL_INFOMESSAGES = 14; - float HUD_PANEL_PHYSICS = 15; - float HUD_PANEL_CENTERPRINT = 16; - 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"; - string HUD_PANELNAME_POWERUPS = "powerups"; - string HUD_PANELNAME_HEALTHARMOR = "healtharmor"; - string HUD_PANELNAME_NOTIFY = "notify"; - string HUD_PANELNAME_TIMER = "timer"; - string HUD_PANELNAME_RADAR = "radar"; - string HUD_PANELNAME_SCORE = "score"; - string HUD_PANELNAME_RACETIMER = "racetimer"; - string HUD_PANELNAME_VOTE = "vote"; - string HUD_PANELNAME_MODICONS = "modicons"; - string HUD_PANELNAME_PRESSEDKEYS = "pressedkeys"; - string HUD_PANELNAME_CHAT = "chat"; - 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"; + const float WATERLEVEL_NONE = 0; + const float WATERLEVEL_WETFEET = 1; + const float WATERLEVEL_SWIMMING = 2; + const float WATERLEVEL_SUBMERGED = 3; + #define SERVERFLAG_ALLOW_FULLBRIGHT 1 #define SERVERFLAG_TEAMPLAY 2 #define SERVERFLAG_PLAYERSTATS 4 diff --cc qcsrc/common/stats.qh index 000000000,f05702997..bd34f6f88 mode 000000,100644..100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@@ -1,0 -1,290 +1,290 @@@ + // Full list of all stat constants, icnluded in a single location for easy reference + // 255 is the current limit (MAX_CL_STATS - 1), engine will need to be modified if you wish to add more stats + + const float MAX_CL_STATS = 256; + const float STAT_HEALTH = 0; + // 1 empty? + const float STAT_WEAPON = 2; + const float STAT_AMMO = 3; + const float STAT_ARMOR = 4; + const float STAT_WEAPONFRAME = 5; + const float STAT_SHELLS = 6; + const float STAT_NAILS = 7; + const float STAT_ROCKETS = 8; + const float STAT_CELLS = 9; + const float STAT_ACTIVEWEAPON = 10; + const float STAT_TOTALSECRETS = 11; + const float STAT_TOTALMONSTERS = 12; + const float STAT_SECRETS = 13; + const float STAT_MONSTERS = 14; + const float STAT_ITEMS = 15; + const float STAT_VIEWHEIGHT = 16; + // 17 empty? + // 18 empty? + // 19 empty? + // 20 empty? + const float STAT_VIEWZOOM = 21; + // 22 empty? + // 23 empty? + // 24 empty? + // 25 empty? + // 26 empty? + // 27 empty? + // 28 empty? + // 29 empty? + // 30 empty? + // 31 empty? + const float STAT_KH_KEYS = 32; + const float STAT_CTF_STATE = 33; + // 34 empty? + const float STAT_WEAPONS = 35; + const float STAT_SWITCHWEAPON = 36; + const float STAT_GAMESTARTTIME = 37; + const float STAT_STRENGTH_FINISHED = 38; + const float STAT_INVINCIBLE_FINISHED = 39; + // 40 empty? + const float STAT_ARC_HEAT = 41; + const float STAT_PRESSED_KEYS = 42; + const float STAT_ALLOW_OLDVORTEXBEAM = 43; // this stat could later contain some other bits of info, like, more server-side particle config + const float STAT_FUEL = 44; + const float STAT_NB_METERSTART = 45; + const float STAT_SHOTORG = 46; // compressShotOrigin + const float STAT_LEADLIMIT = 47; + const float STAT_WEAPON_CLIPLOAD = 48; + const float STAT_WEAPON_CLIPSIZE = 49; + const float STAT_VORTEX_CHARGE = 50; + const float STAT_LAST_PICKUP = 51; + const float STAT_HUD = 52; + const float STAT_VORTEX_CHARGEPOOL = 53; + const float STAT_HIT_TIME = 54; + const float STAT_DAMAGE_DEALT_TOTAL = 55; + const float STAT_TYPEHIT_TIME = 56; + const float STAT_LAYED_MINES = 57; + const float STAT_HAGAR_LOAD = 58; + const float STAT_SWITCHINGWEAPON = 59; + const float STAT_SUPERWEAPONS_FINISHED = 60; + const float STAT_VEHICLESTAT_HEALTH = 61; + const float STAT_VEHICLESTAT_SHIELD = 62; + const float STAT_VEHICLESTAT_ENERGY = 63; + const float STAT_VEHICLESTAT_AMMO1 = 64; + const float STAT_VEHICLESTAT_RELOAD1 = 65; + const float STAT_VEHICLESTAT_AMMO2 = 66; + const float STAT_VEHICLESTAT_RELOAD2 = 67; + const float STAT_VEHICLESTAT_W2MODE = 68; + const float STAT_NADE_TIMER = 69; + const float STAT_SECRETS_TOTAL = 70; + const float STAT_SECRETS_FOUND = 71; + const float STAT_RESPAWN_TIME = 72; + const float STAT_ROUNDSTARTTIME = 73; + const float STAT_WEAPONS2 = 74; + const float STAT_WEAPONS3 = 75; + const float STAT_MONSTERS_TOTAL = 76; + const float STAT_MONSTERS_KILLED = 77; + const float STAT_BUFFS = 78; + const float STAT_NADE_BONUS = 79; + const float STAT_NADE_BONUS_TYPE = 80; + const float STAT_NADE_BONUS_SCORE = 81; + const float STAT_HEALING_ORB = 82; + const float STAT_HEALING_ORB_ALPHA = 83; + const float STAT_PLASMA = 84; + const float STAT_OK_AMMO_CHARGE = 85; + const float STAT_OK_AMMO_CHARGEPOOl = 86; + // 87 empty? + // 88 empty? + // 89 empty? -// 90 empty? -// 91 empty? -// 92 empty? -// 93 empty? -// 94 empty? -// 95 empty? -// 96 empty? -// 97 empty? -// 98 empty? -// 99 empty? ++const float STAT_ARMOR_LARGE_TIME = 90; ++const float STAT_HEALTH_MEGA_TIME = 91; ++const float STAT_INVISIBLE_TIME = 92; ++const float STAT_SPEED_TIME = 93; ++const float STAT_EXTRALIFE_TIME = 94; ++const float STAT_STRENGTH_TIME = 95; ++const float STAT_SHIELD_TIME = 96; ++const float STAT_FUELREGEN_TIME = 97; ++const float STAT_JETPACK_TIME = 98; ++const float STAT_SUPERWEAPONS_TIME = 99; + + + /* The following stats change depending on the gamemode, so can share the same ID */ + // IDs 100 to 104 reserved for gamemodes + + // freeze tag, clan arena, jailbreak + const float STAT_REDALIVE = 100; + const float STAT_BLUEALIVE = 101; + const float STAT_YELLOWALIVE = 102; + const float STAT_PINKALIVE = 103; + + // domination + const float STAT_DOM_TOTAL_PPS = 100; + const float STAT_DOM_PPS_RED = 101; + const float STAT_DOM_PPS_BLUE = 102; + const float STAT_DOM_PPS_YELLOW = 103; + const float STAT_DOM_PPS_PINK = 104; + + // vip + const float STAT_VIP = 100; + const float STAT_VIP_RED = 101; + const float STAT_VIP_BLUE = 102; + const float STAT_VIP_YELLOW = 103; + const float STAT_VIP_PINK = 104; + + // key hunt + const float STAT_KH_REDKEY_TEAM = 100; + const float STAT_KH_BLUEKEY_TEAM = 101; + const float STAT_KH_YELLOWKEY_TEAM = 102; + const float STAT_KH_PINKKEY_TEAM = 103; + + /* Gamemode-specific stats end here */ + + + const float STAT_FROZEN = 105; + const float STAT_REVIVE_PROGRESS = 106; + // 107 empty? + // 108 empty? + // 109 empty? + // 110 empty? + // 111 empty? + // 112 empty? + // 113 empty? + // 114 empty? + // 115 empty? + // 116 empty? + // 117 empty? + // 118 empty? + // 119 empty? + // 120 empty? + // 121 empty? + // 122 empty? + // 123 empty? + // 124 empty? + // 125 empty? + // 126 empty? + // 127 empty? + // 128 empty? + // 129 empty? + // 130 empty? + // 131 empty? + // 132 empty? + // 133 empty? + // 134 empty? + // 135 empty? + // 136 empty? + // 137 empty? + // 138 empty? + // 139 empty? + // 140 empty? + // 141 empty? + // 142 empty? + // 143 empty? + // 144 empty? + // 145 empty? + // 146 empty? + // 147 empty? + // 148 empty? + // 149 empty? + // 150 empty? + // 151 empty? + // 152 empty? + // 153 empty? + // 154 empty? + // 155 empty? + // 156 empty? + // 157 empty? + // 158 empty? + // 159 empty? + // 160 empty? + // 161 empty? + // 162 empty? + // 162 empty? + // 163 empty? + // 164 empty? + // 165 empty? + // 166 empty? + // 167 empty? + // 168 empty? + // 169 empty? + // 170 empty? + // 171 empty? + // 172 empty? + // 173 empty? + // 174 empty? + // 175 empty? + // 176 empty? + // 177 empty? + // 178 empty? + // 179 empty? + // 180 empty? + // 181 empty? + // 182 empty? + // 183 empty? + // 184 empty? + // 185 empty? + // 186 empty? + // 187 empty? + // 188 empty? + // 189 empty? + // 190 empty? + // 191 empty? + // 192 empty? + // 193 empty? + // 194 empty? + // 195 empty? + // 196 empty? + // 197 empty? + // 198 empty? + // 199 empty? + // 200 empty? + // 201 empty? + // 202 empty? + // 203 empty? + // 204 empty? + // 205 empty? + // 206 empty? + // 207 empty? + // 208 empty? + // 209 empty? + // 210 empty? + // 211 empty? + // 212 empty? + // 213 empty? + // 214 empty? + // 215 empty? + // 216 empty? + // 217 empty? + // 218 empty? + // 219 empty? + const float STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR = 220; + const float STAT_MOVEVARS_AIRCONTROL_PENALTY = 221; + const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222; + const float STAT_MOVEVARS_AIRSTRAFEACCEL_QW = 223; + const float STAT_MOVEVARS_AIRCONTROL_POWER = 224; + const float STAT_MOVEFLAGS = 225; + const float STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL = 226; + const float STAT_MOVEVARS_WARSOWBUNNY_ACCEL = 227; + const float STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED = 228; + const float STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL = 229; + const float STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO = 230; + const float STAT_MOVEVARS_AIRSTOPACCELERATE = 231; + const float STAT_MOVEVARS_AIRSTRAFEACCELERATE = 232; + const float STAT_MOVEVARS_MAXAIRSTRAFESPEED = 233; + const float STAT_MOVEVARS_AIRCONTROL = 234; + const float STAT_FRAGLIMIT = 235; + const float STAT_TIMELIMIT = 236; + const float STAT_MOVEVARS_WALLFRICTION = 237; + const float STAT_MOVEVARS_FRICTION = 238; + const float STAT_MOVEVARS_WATERFRICTION = 239; + const float STAT_MOVEVARS_TICRATE = 240; + const float STAT_MOVEVARS_TIMESCALE = 241; + const float STAT_MOVEVARS_GRAVITY = 242; + const float STAT_MOVEVARS_STOPSPEED = 243; + const float STAT_MOVEVARS_MAXSPEED = 244; + const float STAT_MOVEVARS_SPECTATORMAXSPEED = 245; + const float STAT_MOVEVARS_ACCELERATE = 246; + const float STAT_MOVEVARS_AIRACCELERATE = 247; + const float STAT_MOVEVARS_WATERACCELERATE = 248; + const float STAT_MOVEVARS_ENTGRAVITY = 249; + const float STAT_MOVEVARS_JUMPVELOCITY = 250; + const float STAT_MOVEVARS_EDGEFRICTION = 251; + const float STAT_MOVEVARS_MAXAIRSPEED = 252; + const float STAT_MOVEVARS_STEPHEIGHT = 253; + const float STAT_MOVEVARS_AIRACCEL_QW = 254; + const float STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION = 255; diff --cc qcsrc/common/util.qh index dab177b35,65b4e67a4..87cdd99df --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@@ -431,3 -425,27 +425,27 @@@ void dedicated_print(string input) #define PROGNAME "CSQC" #endif #endif + + #ifndef MENUQC + #define CNT_NORMAL 1 + #define CNT_GAMESTART 2 + #define CNT_IDLE 3 + #define CNT_KILL 4 + #define CNT_RESPAWN 5 + #define CNT_ROUNDSTART 6 + float Announcer_PickNumber(float type, float num); + #endif + + #ifndef MENUQC + float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents); + float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents); + #endif + + // Quadratic splines (bezier) + vector bezier_quadratic_getpoint(vector a, vector p, vector b, float t); + vector bezier_quadratic_getderivative(vector a, vector p, vector b, float t); + + #define APPEND_TO_STRING(list,sep,add) ((list) = (((list) != "") ? strcat(list, sep, add) : (add))) + + // Returns the correct difference between two always increasing numbers -#define COMPARE_INCREASING(to,from) (to < from ? from + to + 2 : to - from) ++#define COMPARE_INCREASING(to,from) (to < from ? from + to + 2 : to - from) diff --cc qcsrc/menu/classes.c index 93ae4a838,9f01ee3fb..f4cc9c7c9 --- a/qcsrc/menu/classes.c +++ b/qcsrc/menu/classes.c @@@ -108,5 -123,8 +123,9 @@@ #include "xonotic/dialog_hudpanel_weapons.c" #include "xonotic/dialog_hudpanel_physics.c" #include "xonotic/dialog_hudpanel_centerprint.c" + #include "xonotic/dialog_hudpanel_buffs.c" +#include "xonotic/dialog_hudpanel_itemstime.c" #include "xonotic/slider_picmip.c" + #include "xonotic/slider_particles.c" + #include "xonotic/slider_sbfadetime.c" + #include "xonotic/dialog_settings_misc_reset.c" diff --cc qcsrc/menu/xonotic/mainwindow.c index 54ed66ada,6fa40bfac..5174fe09d --- a/qcsrc/menu/xonotic/mainwindow.c +++ b/qcsrc/menu/xonotic/mainwindow.c @@@ -125,11 -130,11 +130,15 @@@ void MainWindow_configureMainWindow(ent i.configureDialog(i); me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); + i = spawnXonoticHUDBuffsDialog(); + 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); - - ++ + // dialogs used by settings me.userbindEditDialog = i = spawnXonoticUserbindEditDialog(); i.configureDialog(i); diff --cc qcsrc/server/cl_client.qc index 9891e1afd,03ab777b9..83ba6d94a --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@@ -394,9 -147,8 +147,9 @@@ void PutObserverInServer (void error("No spawnpoints for observers?!?\n"); RemoveGrapplingHook(self); // Wazat's Grappling Hook - if(clienttype(self) == CLIENTTYPE_REAL) + if(IS_REAL_CLIENT(self)) { + Item_ItemsTime_Get(self); msg_entity = self; WriteByte(MSG_ONE, SVC_SETVIEW); WriteEntity(MSG_ONE, self); @@@ -764,16 -461,13 +462,16 @@@ void PutClientInServer (void else self.superweapons_finished = 0; - if(!inWarmupStage) ++ if(!warmup_stage) + Item_ItemsTime_ResetForPlayer(self); + - if(g_weaponarena_random) + if(g_weaponarena_random) // WEAPONTODO: more stuff that should be in a mutator. also: rename those cvars { - if(g_weaponarena_random_with_laser) - WEPSET_ANDNOT_EW(self, WEP_LASER); + if(g_weaponarena_random_with_blaster) + self.weapons &= ~WEPSET_BLASTER; W_RandomWeapons(self, g_weaponarena_random); - if(g_weaponarena_random_with_laser) - WEPSET_OR_EW(self, WEP_LASER); + if(g_weaponarena_random_with_blaster) + self.weapons |= WEPSET_BLASTER; } self.items = start_items; diff --cc qcsrc/server/command/vote.qc index b1bae14c1,214083eae..4eb2ae484 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@@ -358,12 -431,10 +431,12 @@@ void ReadyRestart_force( restart_mapalreadyrestarted = 0; // reset this var, needed when cvar sv_ready_restart_repeatable is in use // disable the warmup global for the server - inWarmupStage = 0; // once the game is restarted the game is in match stage + warmup_stage = 0; // once the game is restarted the game is in match stage + Item_ItemsTime_Reset(); + // reset the .ready status of all players (also spectators) - FOR_EACH_CLIENTSLOT(tmp_player) { tmp_player.ready = 0; } + FOR_EACH_REALCLIENT(tmp_player) { tmp_player.ready = 0; } readycount = 0; Nagger_ReadyCounted(); // NOTE: this causes a resend of that entity, and will also turn off warmup state on the client diff --cc qcsrc/server/defs.qh index 5fec66259,757ee65e2..8519c657a --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@@ -583,18 -565,6 +566,17 @@@ string deathmessage .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 allowed_to_spawn; // boolean variable used by the clan arena code to determine if a player can spawn (after the round has ended) float serverflags; .float team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator diff --cc qcsrc/server/g_world.qc index a485b71f0,0fd5d2de3..0e990171e --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@@ -801,35 -760,16 +761,29 @@@ void spawnfunc_worldspawn (void addstat(STAT_TYPEHIT_TIME, AS_FLOAT, typehit_time); addstat(STAT_LAYED_MINES, AS_INT, minelayer_mines); - addstat(STAT_NEX_CHARGE, AS_FLOAT, nex_charge); - addstat(STAT_NEX_CHARGEPOOL, AS_FLOAT, nex_chargepool_ammo); + addstat(STAT_VORTEX_CHARGE, AS_FLOAT, vortex_charge); + addstat(STAT_VORTEX_CHARGEPOOL, AS_FLOAT, vortex_chargepool_ammo); addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load); + + 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(); + - if(g_ca || g_freezetag) - { - addstat(STAT_REDALIVE, AS_INT, redalive_stat); - addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat); - addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat); - addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat); - } - if(g_freezetag) - { - addstat(STAT_FROZEN, AS_INT, freezetag_frozen); - addstat(STAT_REVIVE_PROGRESS, AS_FLOAT, freezetag_revive_progress); - } + // freeze attacks + addstat(STAT_FROZEN, AS_INT, frozen); + addstat(STAT_REVIVE_PROGRESS, AS_FLOAT, revive_progress); // g_movementspeed hack addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw); diff --cc qcsrc/server/t_items.qc index 766c4ae1c,4455d3fb4..c1094e443 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@@ -441,172 -371,31 +371,186 @@@ void Item_Show (entity e, float mode e.SendFlags |= ISF_STATUS; } + void Item_Think() + { + self.nextthink = time; + if(self.origin != self.oldorigin) + { + self.oldorigin = self.origin; + ItemUpdate(self); + } + } + +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_Reset() +{ + 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_ResetForPlayer(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_Get(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; +} +float Item_ItemsTime_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_ItemsTime_UpdateTime(entity e, float t) +{ - if(g_minstagib) ++ if(g_instagib) + { + switch(e.items) + { + case IT_STRENGTH://"item-invis" + if(Item_ItemsTime_UpdateTime_Check(it_invisible_time, t)) + it_invisible_time = t; + break; + case IT_NAILS://"item-extralife" + if(Item_ItemsTime_UpdateTime_Check(it_extralife_time, t)) + it_extralife_time = t; + break; + case IT_INVINCIBLE://"item-speed" + if(Item_ItemsTime_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_ItemsTime_UpdateTime_Check(it_health_mega_time, t)) + it_health_mega_time = t; + break; + case IT_ARMOR: + if (e.classname == "item_armor_large") + if(Item_ItemsTime_UpdateTime_Check(it_armor_large_time, t)) + it_armor_large_time = t; + break; + case IT_STRENGTH://"item-strength" + if(Item_ItemsTime_UpdateTime_Check(it_strength_time, t)) + it_strength_time = t; + break; + case IT_INVINCIBLE://"item-shield" + if(Item_ItemsTime_UpdateTime_Check(it_shield_time, t)) + it_shield_time = t; + break; + default: - if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS)) ++ if(e.weapons & WEPSET_SUPERWEAPONS) + if(Item_ItemsTime_UpdateTime_Check(it_superweapons_time, t)) + it_superweapons_time = t; + } + } + switch(e.items) + { + case IT_FUEL_REGEN://"item-fuelregen" + if(Item_ItemsTime_UpdateTime_Check(it_fuelregen_time, t)) + it_fuelregen_time = t; + break; + case IT_JETPACK://"item-jetpack" + if(Item_ItemsTime_UpdateTime_Check(it_jetpack_time, t)) + it_jetpack_time = t; + break; + } +} +void Item_ItemsTime_GetForAll() +{ + entity e; - if(inWarmupStage) ++ if(warmup_stage) + { + FOR_EACH_REALCLIENT(e) + Item_ItemsTime_Get(e); + } + else + { + FOR_EACH_REALCLIENT(e) + { + if (e.classname != "player") + Item_ItemsTime_Get(e); + } + } +} + void Item_Respawn (void) { 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 - else if(!g_minstagib && self.items == IT_INVINCIBLE) - sound (self, CH_TRIGGER, "misc/shield_respawn.wav", VOL_BASE, ATTN_NORM); // play respawn sound + // this is ugly... + if(self.items == IT_STRENGTH) + sound (self, CH_TRIGGER, "misc/strength_respawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound + else if(self.items == IT_INVINCIBLE) + sound (self, CH_TRIGGER, "misc/shield_respawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound else - sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTN_NORM); // play respawn sound + 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 || WEPSET_CONTAINS_ANY_EA(self, WEPBIT_SUPERWEAPONS)) ++ if(self.flags & FL_POWERUP || self.classname == "item_armor_large" || self.items == IT_HEALTH || (self.weapons & WEPSET_SUPERWEAPONS)) + { + Item_ItemsTime_UpdateTime(self, 0); + Item_ItemsTime_GetForAll(); + } + + self.think = Item_Think; + self.nextthink = time; - ++ //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); } @@@ -628,36 -417,18 +572,26 @@@ void Item_RespawnCountdown (void string name; vector rgb = '1 0 1'; name = string_null; - if(g_minstagib) - { - switch(self.items) - { - case IT_STRENGTH: name = "item-invis"; rgb = '0 0 1'; break; - case IT_NAILS: name = "item-extralife"; rgb = '1 0 0'; break; - case IT_INVINCIBLE: name = "item-speed"; rgb = '1 0 1'; break; - } - } - else - { - switch(self.items) - { - 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) { - case IT_FUEL_REGEN: name = "item-fuelregen"; rgb = '1 0.5 0'; break; - case IT_JETPACK: name = "item-jetpack"; rgb = '0.5 0.5 0.5'; break; + case IT_FUEL_REGEN: name = "item-fuelregen"; rgb = '1 0.5 0'; break; + 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; + MUTATOR_CALLHOOK(Item_RespawnCountdown); + name = item_name; + rgb = item_color; if(self.flags & FL_WEAPON) { entity wi = get_weaponinfo(self.weapon); @@@ -692,59 -459,32 +626,73 @@@ } } + void Item_RespawnThink() + { + self.nextthink = time; + if(self.origin != self.oldorigin) + { + self.oldorigin = self.origin; + ItemUpdate(self); + } + + if(time >= self.wait) + Item_Respawn(); + } + void Item_ScheduleRespawnIn(entity e, float t) { - if((e.flags & FL_POWERUP) || WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS) || e.classname == "item_armor_large" || e.items == IT_HEALTH) - 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) { + entity head; e.think = Item_RespawnCountdown; e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS); + e.scheduledrespawntime = e.nextthink + ITEM_RESPAWN_TICKS; e.count = 0; - if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS)) ++ if(e.weapons & WEPSET_SUPERWEAPONS) + { + for(t = e.scheduledrespawntime, head = world; (head = nextent(head)); ) + { + if(e == head) + continue; + if(clienttype(head) == CLIENTTYPE_NOTACLIENT) - if(WEPSET_CONTAINS_ANY_EA(head, WEPBIT_SUPERWEAPONS)) ++ if(head.weapons & WEPSET_SUPERWEAPONS) + if(head.classname != "weapon_info") + { + if(head.scheduledrespawntime <= time) + { + t = 0; + break; + } + if(head.scheduledrespawntime < t) + t = head.scheduledrespawntime; + } + } + } + else + { + for(t = e.scheduledrespawntime, head = world; (head = find(head, classname, e.classname)); ) + { - // in minstagib .classname is "minstagib" for every item - if(e == head || (g_minstagib && e.items != head.items)) ++ // in instagib .classname is "instagib" for every item ++ if(e == head || (g_instagib && e.items != head.items)) + continue; + if(head.scheduledrespawntime <= time) + { + t = 0; + break; + } + if(head.scheduledrespawntime < t) + t = head.scheduledrespawntime; + } + } + Item_ItemsTime_UpdateTime(e, t); + Item_ItemsTime_GetForAll(); } else { - e.think = Item_Respawn; - e.nextthink = time + t; - e.scheduledrespawntime = e.nextthink; + e.think = Item_RespawnThink; + e.nextthink = time; ++ e.scheduledrespawntime = time + t; + e.wait = time + t; } } diff --cc qcsrc/server/waypointsprites.qc index 840858d80,736cc564c..507c0551b --- a/qcsrc/server/waypointsprites.qc +++ b/qcsrc/server/waypointsprites.qc @@@ -193,12 -193,7 +193,12 @@@ float WaypointSprite_visible_for_player return FALSE; // team waypoints - if(self.team && self.rule == SPRITERULE_DEFAULT) + if(self.rule == SPRITERULE_SPECTATOR) + { - if(!inWarmupStage && e.classname == "player") ++ if(!warmup_stage && e.classname == "player") + return FALSE; + } + else if(self.team && self.rule == SPRITERULE_DEFAULT) { if(self.team != e.team) return FALSE;