]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make map/gametype voting screen a panel; apply a background to it in the default...
authorterencehill <piuntn@gmail.com>
Mon, 27 Jul 2015 18:28:12 +0000 (20:28 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 27 Jul 2015 18:28:12 +0000 (20:28 +0200)
12 files changed:
_hud_descriptions.cfg
hud_luma.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/mapvoting.qc
qcsrc/client/miscfunctions.qh
qcsrc/client/view.qc

index a47884ef05f586d66da20ad330a33b864eb3d017..ad767409145855d75b4594fd37f1c2fa8cef63eb 100644 (file)
@@ -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"
index 4f801509eb8681932a3ca0e9cdd98cd9fb9daf60..4f016240e0111b0924e5a0ecacbaeefc8188cb33 100644 (file)
@@ -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
index 34db2beb663e7cdf118e8cdb3814575a18529ef1..6b8a2634294a569e0ce6537ef35d47f066600af4 100644 (file)
@@ -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
index 39a6fd2eddbcb8547c9be24ca5cc983ad6ac0c7c..f54b93b2d13bc3594ea5ef03220e259461a5e9c7 100644 (file)
@@ -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
index 4b6b7e4a74288362ce8761363045f4d2e8767042..8cc9ea15e0db3e0e28191bab29157ccb9d1d8d59 100644 (file)
@@ -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
index 20650899e77de25e7e1e33d485fbeb5beb2e243f..0f06e80595f39ad6c3596593df0f6dbb8de6e988 100644 (file)
@@ -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
index 2d86881f5fa81c7827cf133718987757fd0da4df..117ab9dc47c714ba6d9b829f46110b391badc9dd 100644 (file)
@@ -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
index 6845ce415e9b1de1b3201708181d698e8e97feea..2323ae58816c8abc496d372bb3cc518d4afc7e6a 100644 (file)
@@ -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();
 
index 3b61cb4539643c06b1e66dcc89b9fccbee6546f0..2c2a3fbc4121247fce6e3ee63c5670df2b11fa97 100644 (file)
@@ -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;                                                                                                                                                                                   \
index fc872056a7178c086af2ca5a51703eccb9f48d24..0f54af4898399343bb622d05d1ac0381e1b7400c 100644 (file)
@@ -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)
index 6c643962a65678ab19643cc48a2300536aab2ee0..fbdcc5db3719a0411577154f0f50da44b3316097 100644 (file)
@@ -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;                                                                                    \
index d3bcf92447bc928f8c26680f18a230cd60915eb9..5282c17f8fd78ffed46bae1ce353ce2c9b423c29 100644 (file)
@@ -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();
-       }
 }