From: terencehill Date: Mon, 27 Jul 2015 18:28:12 +0000 (+0200) Subject: Make map/gametype voting screen a panel; apply a background to it in the default... X-Git-Tag: xonotic-v0.8.1~22^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f0cadec1e7fc8857e7b4b5c387618e0ed77d54fe;p=xonotic%2Fxonotic-data.pk3dir.git Make map/gametype voting screen a panel; apply a background to it in the default hud skin --- diff --git a/_hud_descriptions.cfg b/_hud_descriptions.cfg index a47884ef0..ad7674091 100644 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@ -310,3 +310,13 @@ seta hud_panel_buffs_bg_color_team "" "override panel color with team color in t 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_mapvote "" "enable/disable this panel" +seta hud_panel_mapvote_pos "" "position of this panel" +seta hud_panel_mapvote_size "" "size of this panel" +seta hud_panel_mapvote_bg "" "if set to something else than \"\" = override default background" +seta hud_panel_mapvote_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_panel_mapvote_bg_color_team "" "override panel color with team color in team based games" +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" diff --git a/hud_luma.cfg b/hud_luma.cfg index 4f801509e..4f016240e 100644 --- a/hud_luma.cfg +++ b/hud_luma.cfg @@ -24,7 +24,7 @@ seta hud_progressbar_speed_color "0.77 0.67 0" seta hud_progressbar_acceleration_color "0.2 0.65 0.93" seta hud_progressbar_acceleration_neg_color "0.86 0.35 0" -seta _hud_panelorder "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 " seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.005000" @@ -309,4 +309,14 @@ seta hud_panel_buffs_bg_alpha "" seta hud_panel_buffs_bg_border "" seta hud_panel_buffs_bg_padding "" +seta hud_panel_mapvote 1 +seta hud_panel_mapvote_pos "0 0" +seta hud_panel_mapvote_size "1 1" +seta hud_panel_mapvote_bg "border_default" +seta hud_panel_mapvote_bg_color "" +seta hud_panel_mapvote_bg_color_team "" +seta hud_panel_mapvote_bg_alpha "" +seta hud_panel_mapvote_bg_border "" +seta hud_panel_mapvote_bg_padding "" + menu_sync diff --git a/hud_luminos.cfg b/hud_luminos.cfg index 34db2beb6..6b8a26342 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -24,7 +24,7 @@ seta hud_progressbar_speed_color "1 0.75 0" seta hud_progressbar_acceleration_color "0.5 0.75 1" seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" -seta _hud_panelorder "15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 " +seta _hud_panelorder "17 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 " seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.010000" @@ -309,4 +309,14 @@ seta hud_panel_buffs_bg_alpha "" seta hud_panel_buffs_bg_border "" seta hud_panel_buffs_bg_padding "" +seta hud_panel_mapvote 1 +seta hud_panel_mapvote_pos "0 0" +seta hud_panel_mapvote_size "1 1" +seta hud_panel_mapvote_bg "0" +seta hud_panel_mapvote_bg_color "" +seta hud_panel_mapvote_bg_color_team "" +seta hud_panel_mapvote_bg_alpha "" +seta hud_panel_mapvote_bg_border "" +seta hud_panel_mapvote_bg_padding "" + menu_sync diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index 39a6fd2ed..f54b93b2d 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -24,7 +24,7 @@ seta hud_progressbar_speed_color "1 0.75 0" seta hud_progressbar_acceleration_color "0.5 0.75 1" seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" -seta _hud_panelorder "10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 " +seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 " seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.010000" @@ -309,4 +309,14 @@ seta hud_panel_buffs_bg_alpha "" seta hud_panel_buffs_bg_border "" seta hud_panel_buffs_bg_padding "" +seta hud_panel_mapvote 1 +seta hud_panel_mapvote_pos "0 0" +seta hud_panel_mapvote_size "1 1" +seta hud_panel_mapvote_bg "0" +seta hud_panel_mapvote_bg_color "" +seta hud_panel_mapvote_bg_color_team "" +seta hud_panel_mapvote_bg_alpha "" +seta hud_panel_mapvote_bg_border "" +seta hud_panel_mapvote_bg_padding "" + menu_sync diff --git a/hud_luminos_minimal_xhair.cfg b/hud_luminos_minimal_xhair.cfg index 4b6b7e4a7..8cc9ea15e 100644 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@ -24,7 +24,7 @@ seta hud_progressbar_speed_color "1 0.75 0" seta hud_progressbar_acceleration_color "0.5 0.75 1" seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" -seta _hud_panelorder "15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 " +seta _hud_panelorder "17 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 " seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.010000" @@ -309,4 +309,14 @@ seta hud_panel_buffs_bg_alpha "" seta hud_panel_buffs_bg_border "" seta hud_panel_buffs_bg_padding "" +seta hud_panel_mapvote 1 +seta hud_panel_mapvote_pos "0 0" +seta hud_panel_mapvote_size "1 1" +seta hud_panel_mapvote_bg "0" +seta hud_panel_mapvote_bg_color "" +seta hud_panel_mapvote_bg_color_team "" +seta hud_panel_mapvote_bg_alpha "" +seta hud_panel_mapvote_bg_border "" +seta hud_panel_mapvote_bg_padding "" + menu_sync diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index 20650899e..0f06e8059 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -24,7 +24,7 @@ seta hud_progressbar_speed_color "1 0.75 0" seta hud_progressbar_acceleration_color "0.5 0.75 1" seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" -seta _hud_panelorder "15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 " +seta _hud_panelorder "17 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 " seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.010000" @@ -309,4 +309,14 @@ seta hud_panel_buffs_bg_alpha "" seta hud_panel_buffs_bg_border "" seta hud_panel_buffs_bg_padding "" +seta hud_panel_mapvote 1 +seta hud_panel_mapvote_pos "0 0" +seta hud_panel_mapvote_size "1 1" +seta hud_panel_mapvote_bg "0" +seta hud_panel_mapvote_bg_color "" +seta hud_panel_mapvote_bg_color_team "" +seta hud_panel_mapvote_bg_alpha "" +seta hud_panel_mapvote_bg_border "" +seta hud_panel_mapvote_bg_padding "" + menu_sync diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index 2d86881f5..117ab9dc4 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -24,7 +24,7 @@ seta hud_progressbar_speed_color "1 0.75 0" seta hud_progressbar_acceleration_color "0.5 0.75 1" seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" -seta _hud_panelorder "15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 " +seta _hud_panelorder "17 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 " seta hud_configure_grid "1" seta hud_configure_grid_xsize "0.01" @@ -309,4 +309,14 @@ seta hud_panel_buffs_bg_alpha "" seta hud_panel_buffs_bg_border "" seta hud_panel_buffs_bg_padding "" +seta hud_panel_mapvote 1 +seta hud_panel_mapvote_pos "0 0" +seta hud_panel_mapvote_size "1 1" +seta hud_panel_mapvote_bg "0" +seta hud_panel_mapvote_bg_color "" +seta hud_panel_mapvote_bg_color_team "" +seta hud_panel_mapvote_bg_alpha "" +seta hud_panel_mapvote_bg_border "" +seta hud_panel_mapvote_bg_padding "" + menu_sync diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 6845ce415..2323ae588 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -504,7 +504,8 @@ void HUD_Weapons(void) vector color; // check to see if we want to continue - if(hud != HUD_NORMAL) { return; } + if(intermission == 2) return; + if(hud != HUD_NORMAL) return; if(!autocvar__hud_configure) { @@ -1085,6 +1086,7 @@ int nade_prevframe; float nade_statuschange_time; void HUD_Ammo(void) { + if(intermission == 2) return; if(hud != HUD_NORMAL) return; if(!autocvar__hud_configure) { @@ -1305,6 +1307,7 @@ void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertica void HUD_Powerups(void) { float strength_time, shield_time, superweapons_time; + if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_powerups) return; @@ -1502,6 +1505,7 @@ void HUD_Powerups(void) void HUD_HealthArmor(void) { int armor, health, fuel; + if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_healtharmor) return; @@ -1803,6 +1807,7 @@ void HUD_Notify_Push(string icon, string attacker, string victim) void HUD_Notify(void) { + if(intermission == 2) return; if (!autocvar__hud_configure) if (!autocvar_hud_panel_notify) return; @@ -1928,6 +1933,7 @@ string seconds_tostring(float sec) void HUD_Timer(void) { + if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_timer) return; @@ -1987,6 +1993,7 @@ void HUD_Timer(void) // void HUD_Radar(void) { + if(intermission == 2) return; if (!autocvar__hud_configure) { if (hud_panel_radar_maximized) @@ -2298,6 +2305,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me) void HUD_Score(void) { + if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_score) return; @@ -2481,6 +2489,7 @@ void HUD_Score(void) // void HUD_RaceTimer (void) { + if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_racetimer) return; @@ -2629,6 +2638,7 @@ void HUD_RaceTimer (void) void HUD_Vote(void) { + if(intermission == 2) return; if(autocvar_cl_allow_uid2name == -1 && (gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE || (serverflags & SERVERFLAG_PLAYERSTATS))) { vote_active = 1; @@ -3475,6 +3485,7 @@ float mod_change; // "time" when mod_active changed void HUD_ModIcons(void) { + if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_modicons) return; @@ -3516,6 +3527,7 @@ void HUD_ModIcons(void) // void HUD_PressedKeys(void) { + if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_pressedkeys) return; @@ -3581,6 +3593,7 @@ void HUD_PressedKeys(void) // void HUD_Chat(void) { + //if(intermission == 2) return; if(!autocvar__hud_configure) { if (!autocvar_hud_panel_chat) @@ -3670,6 +3683,7 @@ float frametimeavg1; // 1 frame ago float frametimeavg2; // 2 frames ago void HUD_EngineInfo(void) { + //if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_engineinfo) return; @@ -3731,6 +3745,7 @@ void HUD_EngineInfo(void) } while(0) void HUD_InfoMessages(void) { + if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_infomessages) return; @@ -3912,6 +3927,7 @@ float acc_prevtime, acc_avg, top_speed, top_speed_time; float physics_update_time, discrete_speed, discrete_acceleration; void HUD_Physics(void) { + if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_physics) return; @@ -4303,6 +4319,7 @@ void reset_centerprint_messages(void) float hud_configure_cp_generation_time; void HUD_CenterPrint (void) { + if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_centerprint) return; @@ -4525,6 +4542,7 @@ void HUD_CenterPrint (void) // void HUD_Buffs(void) { + if(intermission == 2) return; int buffs = getstati(STAT_BUFFS, 0, 24); if(!autocvar__hud_configure) { @@ -4608,9 +4626,6 @@ void HUD_Main (void) HUD_Configure_Frame(); - if(intermission == 2) // no hud during mapvote - hud_fade_alpha = 0; - // panels that we want to be active together with the scoreboard // they must fade only when the menu does if(scoreboard_fade_alpha == 1) @@ -4719,7 +4734,7 @@ void HUD_Main (void) } hud_draw_maximized = 0; - // draw panels in order specified by panel_order array + // draw panels in the order specified by panel_order array for(i = HUD_PANEL_NUM - 1; i >= 0; --i) (panel = hud_panel[panel_order[i]]).panel_draw(); diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 3b61cb453..2c2a3fbc4 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -155,7 +155,9 @@ int prev_p_health, prev_p_armor; 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(MAPVOTE , MapVote_Draw , mapvote) \ + // always add new panels to the end of list #define HUD_PANEL(NAME, draw_func, name) \ int HUD_PANEL_##NAME; \ diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index fc872056a..0f54af489 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -316,6 +316,7 @@ void MapVote_Draw() float rows; vector dist = '0 0 0'; + //if(intermission != 2) return; if(!mv_active) return; @@ -380,6 +381,8 @@ void MapVote_Draw() if(mv_abstain) mv_num_maps -= 1; + HUD_Panel_UpdateCvars(); + // higher than the image itself ratio for mapvote items to reserve space for long map names int item_aspect = (gametypevote) ? 3/1 : 5/3; vector table_size = HUD_GetTableSize_BestItemAR(mv_num_maps, eX * (xmax - xmin) + eY * (ymax - ymin), item_aspect); @@ -417,6 +420,25 @@ void MapVote_Draw() offset = ((ymax - pos.y) - dist.y * rows) / 2; ymax -= 2 * offset; + // override panel_pos and panel_size + panel_pos.x = pos.x; + panel_pos.y = pos.y; + panel_size.x = xmax - xmin; + panel_size.y = ymax - ymin; + HUD_Panel_DrawBg(1); + + if(panel_bg_padding) + { + // FIXME item AR gets slightly changed here... + // it's rather hard to avoid it at this point + dist.x -= 2 * panel_bg_padding / mv_columns; + dist.y -= 2 * panel_bg_padding / rows; + xmin = pos.x += panel_bg_padding; + ymin = pos.y += panel_bg_padding; + xmax -= 2 * panel_bg_padding; + ymax -= 2 * panel_bg_padding; + } + mv_selection = MapVote_Selection(pos, dist, rows, mv_columns); if (mv_top2_time) diff --git a/qcsrc/client/miscfunctions.qh b/qcsrc/client/miscfunctions.qh index 6c643962a..fbdcc5db3 100644 --- a/qcsrc/client/miscfunctions.qh +++ b/qcsrc/client/miscfunctions.qh @@ -98,6 +98,7 @@ void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp); +// FIXME this function isn't centering the text correctly, see vote panel #define SET_POS_AND_SZ_Y_ASPECT(allow_colors) do { \ float textaspect, oldsz; \ textaspect = stringwidth(text, allow_colors, '1 1 1' * sz.y) / sz.y; \ diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index d3bcf9244..5282c17f8 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1811,13 +1811,9 @@ void CSQC_common_hud(void) HUD_Main(); // always run these functions for alpha checks HUD_DrawScoreboard(); - if (scoreboard_active) // scoreboard/accuracy + // scoreboard/accuracy, map/gametype voting screen + if (scoreboard_active || intermission == 2) HUD_Reset(); - else if (intermission == 2) // map voting screen - { - MapVote_Draw(); - HUD_Reset(); - } }