]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/hud_updates 353/head
authorterencehill <piuntn@gmail.com>
Mon, 22 Aug 2016 13:10:10 +0000 (15:10 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 22 Aug 2016 13:10:10 +0000 (15:10 +0200)
Conflicts:
qcsrc/client/hud/hud.qc

37 files changed:
qcsrc/client/autocvars.qh
qcsrc/client/defs.qh
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/client/hud/hud_config.qc
qcsrc/client/hud/panel/ammo.qc
qcsrc/client/hud/panel/centerprint.qc
qcsrc/client/hud/panel/chat.qc
qcsrc/client/hud/panel/engineinfo.qc
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/hud/panel/minigame.qc
qcsrc/client/hud/panel/modicons.qc
qcsrc/client/hud/panel/notify.qc
qcsrc/client/hud/panel/physics.qc
qcsrc/client/hud/panel/powerups.qc
qcsrc/client/hud/panel/pressedkeys.qc
qcsrc/client/hud/panel/quickmenu.qc
qcsrc/client/hud/panel/racetimer.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/client/hud/panel/score.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/timer.qc
qcsrc/client/hud/panel/vote.qc
qcsrc/client/hud/panel/weapons.qc
qcsrc/client/mapvoting.qc
qcsrc/client/view.qc
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/minigames/minigame/bd.qc
qcsrc/common/minigames/minigame/c4.qc
qcsrc/common/minigames/minigame/nmm.qc
qcsrc/common/minigames/minigame/pong.qc
qcsrc/common/minigames/minigame/pp.qc
qcsrc/common/minigames/minigame/ps.qc
qcsrc/common/minigames/minigame/snake.qc
qcsrc/common/minigames/minigame/ttt.qc
qcsrc/common/mutators/mutator/itemstime/itemstime.qc

index 65a21972074e6806c5a864db6ed6dbe118fa421f..25ab0e2a053fcfe0ff45703a880a62f87d5724c3 100644 (file)
@@ -324,7 +324,6 @@ bool autocvar_hud_panel_timer_increment;
 float autocvar_hud_panel_update_interval;
 bool autocvar_hud_panel_vote;
 float autocvar_hud_panel_vote_alreadyvoted_alpha;
-string autocvar_hud_panel_vote_bg_alpha;
 bool autocvar_hud_panel_weapons;
 bool autocvar_hud_panel_weapons_accuracy;
 bool autocvar_hud_panel_weapons_ammo;
index e62f0704f16119b2236c847d90abeba704347da5..182f6ace743c71437f9a9f6fb6d323abf6bf21cc 100644 (file)
@@ -120,6 +120,8 @@ int serverflags;
 
 float uid2name_dialog;
 
+float gameover_time;
+
 .bool csqcmodel_isdead; // used by shownames and miscfunctions (entcs_IsDead) to know when a player is dead
 
 #define player_currententnum (spectatee_status > 0 ? spectatee_status : player_localnum + 1)
index f9ac20627518e16b4fbcec3b225b8540a6908e21..d200e2c6c522e67f05b009f301f9a03f5677d9db 100644 (file)
@@ -1,7 +1,6 @@
 #include "hud.qh"
 
 #include "panel/scoreboard.qh"
-
 #include "hud_config.qh"
 #include "../mapvoting.qh"
 #include "../teamradar.qh"
@@ -359,26 +358,45 @@ void HUD_Vehicle()
 
 bool HUD_Minigame_Showpanels();
 
-bool HUD_Panel_CheckFlags(int showflags)
-{
-    TC(int, showflags);
-       if ( HUD_Minigame_Showpanels() )
-               return showflags & PANEL_SHOW_MINIGAME;
-       if(intermission == 2)
-               return showflags & PANEL_SHOW_MAPVOTE;
-       return showflags & PANEL_SHOW_MAINGAME;
-}
-
 void HUD_Panel_Draw(entity panent)
 {
        panel = panent;
-       if(autocvar__hud_configure)
+       if (autocvar__hud_configure)
+       {
+               if (!(panel.panel_configflags & PANEL_CONFIG_MAIN))
+                       return;
+               panel_fade_alpha = 1;
+               Hud_Panel_GetPanelEnabled();
+               panel.panel_draw();
+               return;
+       }
+
+       bool draw_allowed = false;
+       if (HUD_Minigame_Showpanels())
        {
-               if(panel.panel_configflags & PANEL_CONFIG_MAIN)
-                       panel.panel_draw();
+               if (panel.panel_showflags & PANEL_SHOW_MINIGAME)
+                       draw_allowed = true;
        }
-       else if(HUD_Panel_CheckFlags(panel.panel_showflags))
+       else if(intermission == 2)
+       {
+               if(panel.panel_showflags & PANEL_SHOW_MAPVOTE)
+                       draw_allowed = true;
+       }
+       else if (panel.panel_showflags & PANEL_SHOW_MAINGAME)
+               draw_allowed = true;
+
+       if (draw_allowed)
+       {
+               if (panel.panel_showflags & PANEL_SHOW_WITH_SB)
+                       panel_fade_alpha = 1;
+               else
+               {
+                       panel_fade_alpha = 1 - scoreboard_fade_alpha;
+                       if(!panel_fade_alpha)
+                               return;
+               }
                panel.panel_draw();
+       }
 }
 
 void HUD_Reset()
@@ -495,11 +513,8 @@ void Hud_Dynamic_Frame()
 void HUD_Main()
 {
        int i;
-       // global hud alpha fade (scoreboard-related panels behave differently and override it temporarly)
        if(hud_configure_menu_open == 1)
                hud_fade_alpha = 1;
-       else if(!autocvar__hud_configure)
-               hud_fade_alpha = (1 - scoreboard_fade_alpha) * (1 - autocvar__menu_alpha);
        else
                hud_fade_alpha = 1 - autocvar__menu_alpha;
 
@@ -507,27 +522,9 @@ void HUD_Main()
 
        Hud_Dynamic_Frame();
 
-       // panels that we want to be active together with the scoreboard
-       // they must fade only when the menu does
        if(scoreboard_fade_alpha == 1)
-       {
                if(autocvar__menu_alpha == 1)
                        return;
-               if(scoreboard_fade_alpha == 1)
-               {
-                       HUD_Panel_Draw(HUD_PANEL(SCOREBOARD));
-                       HUD_Panel_Draw(HUD_PANEL(CENTERPRINT));
-                       return;
-               }
-       }
-
-       if(!autocvar__hud_configure && !hud_fade_alpha)
-       {
-               hud_fade_alpha = 1;
-               HUD_Panel_Draw(HUD_PANEL(VOTE));
-               hud_fade_alpha = 0;
-               return;
-       }
 
        // Drawing stuff
        if (hud_skin_prev != autocvar_hud_skin)
@@ -638,8 +635,9 @@ void HUD_Main()
                HUD_Panel_Draw(HUD_PANEL(CHAT));
        if(hud_panel_quickmenu)
                HUD_Panel_Draw(HUD_PANEL(QUICKMENU));
+       HUD_Panel_Draw(HUD_PANEL(SCOREBOARD));
 
-       if (scoreboard_active || intermission == 2)
+       if (intermission == 2)
                HUD_Reset();
 
        HUD_Configure_PostDraw();
index 3aa5d8f8c9071996445568e3d33f0621ba61f27d..5087fa526929a086937b16d0dadb3463739045a1 100644 (file)
@@ -22,14 +22,13 @@ REGISTER_REGISTRY(hud_panels)
 #define HUD_PANEL(NAME) HUD_PANEL_##NAME
 
 // draw the background/borders
-#define HUD_Panel_DrawBg(theAlpha) MACRO_BEGIN { \
+#define HUD_Panel_DrawBg() MACRO_BEGIN { \
        if(panel.current_panel_bg != "0" && panel.current_panel_bg != "") \
                draw_BorderPicture( \
                        HUD_Shift(panel_pos - '1 1 0' * panel_bg_border), \
                        panel.current_panel_bg, \
                        HUD_Scale(panel_size + '1 1 0' * 2 * panel_bg_border), \
-                       panel_bg_color, \
-                       panel_bg_alpha * theAlpha, \
+                       panel_bg_color, panel_bg_alpha, \
                        HUD_Scale('1 1 0' * (panel_bg_border/BORDER_MULTIPLIER)) \
                ); \
 } MACRO_END
@@ -182,12 +181,13 @@ const int PANEL_SHOW_NEVER    = 0x00;
 const int PANEL_SHOW_MAINGAME = 0x01;
 const int PANEL_SHOW_MINIGAME = 0x02;
 const int PANEL_SHOW_MAPVOTE  = 0x04;
+const int PANEL_SHOW_WITH_SB  = 0x08;
 const int PANEL_SHOW_ALWAYS   = 0xff;
-bool HUD_Panel_CheckFlags(int showflags);
 
 .int panel_configflags;
-const int PANEL_CONFIG_NO    = 0x00;
-const int PANEL_CONFIG_MAIN  = 0x01;
+const int PANEL_CONFIG_NO        = 0x00;
+const int PANEL_CONFIG_MAIN      = 0x01;
+const int PANEL_CONFIG_CANBEOFF  = 0x02; // panel can be disabled (if disabled it's displayed with a low alpha)
 
 
 // prev_* vars contain the health/armor at the previous FRAME
@@ -204,31 +204,31 @@ int prev_p_health, prev_p_armor;
 
 void HUD_ItemsTime();
 
-REGISTER_HUD_PANEL(WEAPONS,         HUD_Weapons,        weapons,        PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(AMMO,            HUD_Ammo,           ammo,           PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(POWERUPS,        HUD_Powerups,       powerups,       PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(HEALTHARMOR,     HUD_HealthArmor,    healtharmor,    PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(NOTIFY,          HUD_Notify,         notify,         PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS & ~PANEL_SHOW_MAPVOTE)
-REGISTER_HUD_PANEL(TIMER,           HUD_Timer,          timer,          PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS & ~PANEL_SHOW_MAPVOTE)
-REGISTER_HUD_PANEL(RADAR,           HUD_Radar,          radar,          PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(SCORE,           HUD_Score,          score,          PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS & ~PANEL_SHOW_MAPVOTE)
-REGISTER_HUD_PANEL(RACETIMER,       HUD_RaceTimer,      racetimer,      PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(VOTE,            HUD_Vote,           vote,           PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS  )
-REGISTER_HUD_PANEL(MODICONS,        HUD_ModIcons,       modicons,       PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(PRESSEDKEYS,     HUD_PressedKeys,    pressedkeys,    PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(CHAT,            HUD_Chat,           chat,           PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS  )
-REGISTER_HUD_PANEL(ENGINEINFO,      HUD_EngineInfo,     engineinfo,     PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS  )
-REGISTER_HUD_PANEL(INFOMESSAGES,    HUD_InfoMessages,   infomessages,   PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(PHYSICS,         HUD_Physics,        physics,        PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(CENTERPRINT,     HUD_CenterPrint,    centerprint,    PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(MINIGAME_BOARD,  HUD_MinigameBoard,  minigameboard,  PANEL_CONFIG_NO  , PANEL_SHOW_MINIGAME)
-REGISTER_HUD_PANEL(MINIGAME_STATUS, HUD_MinigameStatus, minigamestatus, PANEL_CONFIG_NO  , PANEL_SHOW_MINIGAME)
-REGISTER_HUD_PANEL(MINIGAME_HELP,   HUD_MinigameHelp,   minigamehelp,   PANEL_CONFIG_NO  , PANEL_SHOW_MINIGAME)
-REGISTER_HUD_PANEL(MINIGAME_MENU,   HUD_MinigameMenu,   minigamemenu,   PANEL_CONFIG_NO  , PANEL_SHOW_ALWAYS  )
-REGISTER_HUD_PANEL(MAPVOTE,         MapVote_Draw,       mapvote,        PANEL_CONFIG_NO  , PANEL_SHOW_MAPVOTE )
-REGISTER_HUD_PANEL(ITEMSTIME,       HUD_ItemsTime,      itemstime,      PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(SCOREBOARD,      Scoreboard_Draw,    scoreboard,     PANEL_CONFIG_NO  , PANEL_SHOW_ALWAYS  )
+REGISTER_HUD_PANEL(WEAPONS,         HUD_Weapons,        weapons,        PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // WEAPONS
+REGISTER_HUD_PANEL(AMMO,            HUD_Ammo,           ammo,           PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // AMMO
+REGISTER_HUD_PANEL(POWERUPS,        HUD_Powerups,       powerups,       PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // POWERUPS
+REGISTER_HUD_PANEL(HEALTHARMOR,     HUD_HealthArmor,    healtharmor,    PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // HEALTHARMOR
+REGISTER_HUD_PANEL(NOTIFY,          HUD_Notify,         notify,         PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                                          ) // NOTIFY
+REGISTER_HUD_PANEL(TIMER,           HUD_Timer,          timer,          PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // TIMER
+REGISTER_HUD_PANEL(RADAR,           HUD_Radar,          radar,          PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // RADAR
+REGISTER_HUD_PANEL(SCORE,           HUD_Score,          score,          PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                                          ) // SCORE
+REGISTER_HUD_PANEL(RACETIMER,       HUD_RaceTimer,      racetimer,      PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // RACETIMER
+REGISTER_HUD_PANEL(VOTE,            HUD_Vote,           vote,           PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // VOTE
+REGISTER_HUD_PANEL(MODICONS,        HUD_ModIcons,       modicons,       PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                            | PANEL_SHOW_WITH_SB) // MODICONS
+REGISTER_HUD_PANEL(PRESSEDKEYS,     HUD_PressedKeys,    pressedkeys,    PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // PRESSEDKEYS
+REGISTER_HUD_PANEL(CHAT,            HUD_Chat,           chat,           PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // CHAT
+REGISTER_HUD_PANEL(ENGINEINFO,      HUD_EngineInfo,     engineinfo,     PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // ENGINEINFO
+REGISTER_HUD_PANEL(INFOMESSAGES,    HUD_InfoMessages,   infomessages,   PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // INFOMESSAGES
+REGISTER_HUD_PANEL(PHYSICS,         HUD_Physics,        physics,        PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // PHYSICS
+REGISTER_HUD_PANEL(CENTERPRINT,     HUD_CenterPrint,    centerprint,    PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                            | PANEL_SHOW_WITH_SB) // CENTERPRINT
+REGISTER_HUD_PANEL(MINIGAME_BOARD,  HUD_MinigameBoard,  minigameboard,  PANEL_CONFIG_NO                          ,                       PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // MINIGAME_BOARD
+REGISTER_HUD_PANEL(MINIGAME_STATUS, HUD_MinigameStatus, minigamestatus, PANEL_CONFIG_NO                          ,                       PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // MINIGAME_STATUS
+REGISTER_HUD_PANEL(MINIGAME_HELP,   HUD_MinigameHelp,   minigamehelp,   PANEL_CONFIG_NO                          ,                       PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // MINIGAME_HELP
+REGISTER_HUD_PANEL(MINIGAME_MENU,   HUD_MinigameMenu,   minigamemenu,   PANEL_CONFIG_NO                          , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // MINIGAME_MENU
+REGISTER_HUD_PANEL(MAPVOTE,         MapVote_Draw,       mapvote,        PANEL_CONFIG_NO                          ,                                             PANEL_SHOW_MAPVOTE                     ) // MAPVOTE
+REGISTER_HUD_PANEL(ITEMSTIME,       HUD_ItemsTime,      itemstime,      PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // ITEMSTIME
+REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CONFIG_MAIN                        , PANEL_SHOW_MAINGAME                                                                ) // QUICKMENU
+REGISTER_HUD_PANEL(SCOREBOARD,      Scoreboard_Draw,    scoreboard,     PANEL_CONFIG_NO                          , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // SCOREBOARD
 // always add new panels to the end of list
 
 // Because calling lots of functions in QC apparently cuts fps in half on many machines:
@@ -366,9 +366,9 @@ REGISTER_HUD_PANEL(SCOREBOARD,      Scoreboard_Draw,    scoreboard,     PANEL_CO
 } MACRO_END
 
 // NOTE: in hud_configure mode cvars must be reloaded every frame
-#define HUD_Panel_UpdateCvars() MACRO_BEGIN {                                                                       \
+float panel_fade_alpha;
+#define HUD_Panel_LoadCvars() MACRO_BEGIN { \
        if (panel.update_time <= time) {                                                                                \
-               if (autocvar__hud_configure) panel_enabled = cvar(strcat("hud_panel_", panel.panel_name));                  \
                panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos")));                              \
                panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size")));                            \
                HUD_Panel_ScalePosSize();                                                                                   \
@@ -392,8 +392,8 @@ REGISTER_HUD_PANEL(SCOREBOARD,      Scoreboard_Draw,    scoreboard,     PANEL_CO
                if (hud_configure_menu_open == 2 && panel == highlightedPanel) {                                                       \
                        HUD_Panel_UpdatePosSize_ForMenu();                                                                      \
                } else {                                                                                                    \
-                       panel_bg_alpha *= hud_fade_alpha;                                                                       \
-                       panel_fg_alpha *= hud_fade_alpha;                                                                       \
+                       panel_bg_alpha *= hud_fade_alpha * panel_fade_alpha;                                                                       \
+                       panel_fg_alpha *= hud_fade_alpha * panel_fade_alpha;                                                                       \
                }                                                                                                           \
                panel.current_panel_pos = panel_pos;                                                                        \
                panel.current_panel_size = panel_size;                                                                      \
@@ -405,17 +405,21 @@ REGISTER_HUD_PANEL(SCOREBOARD,      Scoreboard_Draw,    scoreboard,     PANEL_CO
        } else {                                                                                                        \
                panel_pos = panel.current_panel_pos;                                                                        \
                panel_size = panel.current_panel_size;                                                                      \
-               panel_bg_alpha = panel.current_panel_bg_alpha * hud_fade_alpha;                                             \
+               panel_bg_alpha = panel.current_panel_bg_alpha * hud_fade_alpha * panel_fade_alpha;                                             \
                panel_bg_border = panel.current_panel_bg_border;                                                            \
                panel_bg_color = panel.current_panel_bg_color;                                                              \
                panel_bg_color_team = panel.current_panel_bg_color_team;                                                    \
                panel_bg_padding = panel.current_panel_bg_padding;                                                          \
-               panel_fg_alpha = panel.current_panel_fg_alpha * hud_fade_alpha;                                             \
+               panel_fg_alpha = panel.current_panel_fg_alpha * hud_fade_alpha * panel_fade_alpha;                                             \
        }                                                                                                               \
 } MACRO_END
 
+#define Hud_Panel_GetPanelEnabled() \
+       panel_enabled = ((panel.panel_configflags & PANEL_CONFIG_CANBEOFF) \
+                                       ? cvar(strcat("hud_panel_", panel.panel_name)) : true)
+
 #define HUD_Panel_UpdatePosSize() MACRO_BEGIN {                                                                     \
-       panel_enabled = cvar(strcat("hud_panel_", panel.panel_name));                                                   \
+       Hud_Panel_GetPanelEnabled(); \
        panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos")));                                  \
        panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size")));                                \
        HUD_Panel_ScalePosSize();                                                                                       \
index 654d49ba8c60f5ce9f59b3eb40bd2b24877d28fa..4f116d724fb35a8203132f7ff43cec23504ab142 100644 (file)
@@ -848,7 +848,10 @@ LABEL(find_tab_panel)
                        return true;
 
                if (highlightedPanel)
-                       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
+               {
+                       if(panel.panel_configflags & PANEL_CONFIG_CANBEOFF)
+                               cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
+               }
                else
                        cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
        }
index bd3ccd068160d9130db8f308fe28548a4c092dad..e299d1416ea1485da0cd4dee153aa1afc835dd4f 100644 (file)
@@ -104,7 +104,7 @@ void HUD_Ammo()
                        return;
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        draw_beginBoldFont();
 
@@ -116,7 +116,7 @@ void HUD_Ammo()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
index 9dd5f05ff57d6152ba66c05ebdd154a1c2beb79c..5b80690101b089e0e2cd15df07d40aa05bb9356a 100644 (file)
@@ -153,15 +153,7 @@ void HUD_CenterPrint ()
                }
        }
 
-       // this panel fades only when the menu does
-       float hud_fade_alpha_save = hud_fade_alpha;
-       if(hud_configure_menu_open == 1)
-               hud_fade_alpha = 1;
-       else
-               hud_fade_alpha = 1 - autocvar__menu_alpha;
-
-       HUD_Panel_UpdateCvars();
-       hud_fade_alpha = hud_fade_alpha_save;
+       HUD_Panel_LoadCvars();
 
        if ( HUD_Radar_Clickable() )
        {
@@ -189,7 +181,7 @@ void HUD_CenterPrint ()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
 
        if (!centerprint_showing)
                return;
index 5817142ae609d79ab7359fb5b91a7f4354fa1faa..f3655e940107f101933d096b791a60239b1652f9 100644 (file)
@@ -1,5 +1,7 @@
 #include "chat.qh"
-/** Handle chat as a panel (#12) */
+
+// Chat (#12)
+
 void HUD_Chat()
 {
        if(!autocvar__hud_configure)
@@ -21,7 +23,7 @@ void HUD_Chat()
                }
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        if(intermission == 2)
        {
@@ -56,7 +58,7 @@ void HUD_Chat()
 
        // chat messages don't scale properly since they are displayed directly by the engine
        HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
 
        if(panel_bg_padding)
        {
index 773c751d82680fd826b00ece67514a3891134935..c8b7203eee9cfc240c09ac0556c3709aeaea7b32 100644 (file)
@@ -1,5 +1,6 @@
 #include "engineinfo.qh"
-// Engine info panel (#13)
+
+// Engine info (#13)
 
 float prevfps;
 float prevfps_time;
@@ -18,7 +19,7 @@ void HUD_EngineInfo()
                if(!autocvar_hud_panel_engineinfo) return;
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
        vector pos, mySize;
        pos = panel_pos;
        mySize = panel_size;
@@ -27,7 +28,7 @@ void HUD_EngineInfo()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
index b56e390b35824802dc07db5bbe60c5f22541ae66..7f5e4c1709c8486a1d591d7703a31ec5c4c963ad 100644 (file)
@@ -2,7 +2,8 @@
 
 #include <common/deathtypes/all.qh>
 
-/** Health/armor (#3) */
+// Health/armor (#3)
+
 void HUD_HealthArmor()
 {
        int armor, health, fuel;
@@ -56,7 +57,7 @@ void HUD_HealthArmor()
                fuel = 20;
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        draw_beginBoldFont();
 
@@ -68,7 +69,7 @@ void HUD_HealthArmor()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
index d341b6492efdecf606dffde7229e770113b5f1fe..cd49f09adc769bc0a5cd66450e8178b04a943e4c 100644 (file)
@@ -3,7 +3,7 @@
 #include <common/ent_cs.qh>
 #include <common/mapinfo.qh>
 
-// Info messages panel (#14)
+// Info messages (#14)
 
 float autocvar_hud_panel_infomessages_group0 = 1;
 float autocvar_hud_panel_infomessages_group_fadetime = 0.4;
@@ -60,7 +60,7 @@ void HUD_InfoMessages()
                if(!autocvar_hud_panel_infomessages) return;
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
        vector pos, mySize;
        pos = panel_pos;
        mySize = panel_size;
@@ -69,7 +69,7 @@ void HUD_InfoMessages()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
index 933528a495f72f20d47b1f76dae0e9c50d05af4c..618f30b1080fa67ae0f4285ee7cc214313bcb0c5 100644 (file)
@@ -1,4 +1,5 @@
 #include "minigame.qh"
-// Minigame
+
+// Minigame (#17, #18, #19, #20)
 
 #include <common/minigames/cl_minigames_hud.qc>
index 2c99485731ebbf1acef68f063a4c4867bb5bb8b5..2a12e81c25e140db54908ee2bc4710aabe7d2f5b 100644 (file)
@@ -4,7 +4,7 @@
 #include <common/ent_cs.qh>
 #include <server/mutators/mutator/gamemode_ctf.qh> // TODO: remove
 
-// Mod icons panel (#10)
+// Mod icons (#10)
 
 bool mod_active; // is there any active mod icon?
 
@@ -758,9 +758,6 @@ void HUD_ModIcons()
                if(!HUD_ModIcons_GameType) return;
        }
 
-       HUD_Panel_UpdateCvars();
-
-       draw_beginBoldFont();
 
        if(mod_active != mod_prev) {
                mod_change = time;
@@ -772,12 +769,19 @@ void HUD_ModIcons()
        else
                mod_alpha = bound(0, 1 - (time - mod_change) * 2, 1);
 
+       //if(mod_alpha <= 0)
+       //      return;
+       panel_fade_alpha *= mod_alpha;
+       HUD_Panel_LoadCvars();
+
+       draw_beginBoldFont();
+
        if (autocvar_hud_panel_modicons_dynamichud)
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       if(mod_alpha)
-               HUD_Panel_DrawBg(mod_alpha);
+
+       HUD_Panel_DrawBg();
 
        if(panel_bg_padding)
        {
index a5e923825a989fc13e9b76b9c077de5b4ce97c31..a49d262a4f9075a9ff615d7435974c6a62e39f20 100644 (file)
@@ -1,5 +1,7 @@
 #include "notify.qh"
-// Notification area (#4)
+
+
+// Notifications (#4)
 
 void HUD_Notify_Push(string icon, string attacker, string victim)
 {
@@ -47,12 +49,13 @@ void HUD_Notify()
                if (!autocvar_hud_panel_notify)
                        return;
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
+
        if (autocvar_hud_panel_notify_dynamichud)
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
 
        if (!autocvar__hud_configure)
                if (notify_count == 0)
index 5fc8c1ca9018cba6b656bf6628d4c59a9edd59bc..6befd1a30a4fe161ea57e386def9eb33f0e2bbfe 100644 (file)
@@ -4,7 +4,7 @@
 #include <common/mapinfo.qh>
 #include <lib/csqcmodel/cl_player.qh>
 
-// Physics panel (#15)
+// Physics (#15)
 
 vector acc_prevspeed;
 float acc_prevtime, acc_avg, top_speed, top_speed_time;
@@ -18,7 +18,7 @@ void HUD_Physics()
                if(autocvar_hud_panel_physics == 3 && !(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        draw_beginBoldFont();
 
@@ -26,7 +26,7 @@ void HUD_Physics()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                panel_pos += '1 1 0' * panel_bg_padding;
index 4779ab747999365cf458f889304a06893484cdef..7c454f9f9001ff695115234408f7c571f8d93a25 100644 (file)
@@ -109,12 +109,13 @@ void HUD_Powerups()
                return;
 
        // Draw panel background
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
+
        if (autocvar_hud_panel_powerups_dynamichud)
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
 
        // Set drawing area
        vector pos = panel_pos;
index d0a4f39fdfd8fc956ce202376af7f5b55f90ac17..abb9ccef9aa56910fae3fd52fb1b3e5699e512ab 100644 (file)
@@ -1,5 +1,8 @@
 #include "pressedkeys.qh"
-/** Draw pressed keys (#11) */
+
+
+// Pressed keys (#11)
+
 void HUD_PressedKeys()
 {
        if(!autocvar__hud_configure)
@@ -8,7 +11,7 @@ void HUD_PressedKeys()
                if(spectatee_status <= 0 && autocvar_hud_panel_pressedkeys < 2) return;
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
        vector pos, mySize;
        pos = panel_pos;
        mySize = panel_size;
@@ -17,7 +20,7 @@ void HUD_PressedKeys()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
index 22a9827acc3f2a12b6b305db7bc4dc7aaac0a636..65997f46ebb0a9199ff8dde59756e88663b6d593 100644 (file)
@@ -1,10 +1,11 @@
 #include "quickmenu.qh"
-// QuickMenu (#23)
 
 #include <common/ent_cs.qh>
 #include <client/hud/_mod.qh>
 #include <client/mapvoting.qh>
 
+// QuickMenu (#23)
+
 // QUICKMENU_MAXLINES must be <= 10
 const int QUICKMENU_MAXLINES = 10;
 // visible entries are loaded from QuickMenu_Buffer into QuickMenu_Page_* arrays
@@ -503,7 +504,7 @@ void QuickMenu_Mouse()
                mousepos.y = bound(0, mousepos.y, vid_conheight);
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        if(panel_bg_padding)
        {
@@ -617,10 +618,10 @@ void HUD_QuickMenu()
                }
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
 
        if(panel_bg_padding)
        {
index dd8bbdfec9375597df95e0f755309b21454af9e7..02b631b3000932cbd2ee69f812e5cc8446f2aed1 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <common/mapinfo.qh>
 
-/** Race timer (#8) */
+// Race timer (#6)
 
 // return the string of the onscreen race timer
 string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
@@ -83,7 +83,7 @@ void HUD_RaceTimer ()
                if(spectatee_status == -1) return;
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        vector pos, mySize;
        pos = panel_pos;
@@ -93,7 +93,7 @@ void HUD_RaceTimer ()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
index e935d0cb2b27eba1b395593ca192b412afc13c2e..1119187c86dabbd8ffeb4eb5a0a643234b40604b 100644 (file)
@@ -145,7 +145,7 @@ void HUD_Radar_Mouse()
                mousepos_y = bound(0, mousepos_y, vid_conheight);
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
 
        panel_size = autocvar_hud_panel_radar_maximized_size;
@@ -197,7 +197,7 @@ void HUD_Radar()
        if ( hud_panel_radar_temp_hidden )
                return;
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        float f = 0;
 
@@ -284,7 +284,7 @@ void HUD_Radar()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
index cd0d6fa32a887e6448fe25350ff896e1b185275b..4b5df98d19892d237ba925b62f7439afd398eabe 100644 (file)
@@ -140,7 +140,7 @@ void HUD_Score()
                if(spectatee_status == -1 && (gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
        vector pos, mySize;
        pos = panel_pos;
        mySize = panel_size;
@@ -149,7 +149,7 @@ void HUD_Score()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
index 22be8b195c34076ec706b9f3680f14d114210605..b4a0680bf7ba8f113f08e680219ab16d0cc7714d 100644 (file)
@@ -8,6 +8,8 @@
 #include <common/stats.qh>
 #include <common/teams.qh>
 
+// Scoreboard (#24)
+
 float sbt_bg_alpha;
 float sbt_fg_alpha;
 float sbt_fg_alpha_self;
@@ -930,7 +932,7 @@ vector Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_size)
        panel_pos = pos;
        panel_size.y = 1.25 * hud_fontsize.y * (1 + max(1, tm.team_size));
        panel_size.y += panel_bg_padding * 2;
-       HUD_Panel_DrawBg(scoreboard_fade_alpha);
+       HUD_Panel_DrawBg();
 
        vector end_pos = panel_pos + eY * (panel_size.y + hud_fontsize.y);
        if(panel.current_panel_bg != "0")
@@ -1035,7 +1037,7 @@ vector Scoreboard_AccuracyStats_Draw(vector pos, vector rgb, vector bg_size)
        panel_pos = pos;
        panel_size.y = height * rows;
        panel_size.y += panel_bg_padding * 2;
-       HUD_Panel_DrawBg(scoreboard_fade_alpha);
+       HUD_Panel_DrawBg();
 
        vector end_pos = panel_pos + eY * (panel_size.y + hud_fontsize.y);
        if(panel.current_panel_bg != "0")
@@ -1176,7 +1178,7 @@ vector Scoreboard_MapStats_Draw(vector pos, vector rgb, vector bg_size) {
        panel_pos = pos;
        panel_size.y = hud_fontsize.y * rows;
        panel_size.y += panel_bg_padding * 2;
-       HUD_Panel_DrawBg(scoreboard_fade_alpha);
+       HUD_Panel_DrawBg();
 
        vector end_pos = panel_pos + eY * (panel_size.y + hud_fontsize.y);
        if(panel.current_panel_bg != "0")
@@ -1235,7 +1237,7 @@ vector Scoreboard_Rankings_Draw(vector pos, entity pl, vector rgb, vector bg_siz
        panel_pos = pos;
        panel_size.y = 1.25 * hud_fontsize.y * RANKINGS_RECEIVED_CNT;
        panel_size.y += panel_bg_padding * 2;
-       HUD_Panel_DrawBg(scoreboard_fade_alpha);
+       HUD_Panel_DrawBg();
 
        vector end_pos = panel_pos + eY * (panel_size.y + hud_fontsize.y);
        if(panel.current_panel_bg != "0")
@@ -1281,6 +1283,8 @@ void Scoreboard_Draw()
 {
        if(!autocvar__hud_configure)
        {
+               if(!hud_draw_maximized) return;
+
                // frametime checks allow to toggle the scoreboard even when the game is paused
                if(scoreboard_active) {
                        if(hud_configure_menu_open == 1)
@@ -1310,12 +1314,10 @@ void Scoreboard_Draw()
        else
                HUD_Scale_Disable();
 
-       float hud_fade_alpha_save = hud_fade_alpha;
-       if(hud_configure_menu_open == 1)
-               hud_fade_alpha = 1;
-       else
-               hud_fade_alpha = scoreboard_fade_alpha * (1 - autocvar__menu_alpha);
-       HUD_Panel_UpdateCvars();
+       if(scoreboard_fade_alpha <= 0)
+               return;
+       panel_fade_alpha *= scoreboard_fade_alpha;
+       HUD_Panel_LoadCvars();
 
        sbt_bg_alpha = autocvar_hud_panel_scoreboard_table_bg_alpha * panel_fg_alpha;
        sbt_highlight = autocvar_hud_panel_scoreboard_table_highlight;
@@ -1324,8 +1326,6 @@ void Scoreboard_Draw()
        sbt_fg_alpha = autocvar_hud_panel_scoreboard_table_fg_alpha * panel_fg_alpha;
        sbt_fg_alpha_self = autocvar_hud_panel_scoreboard_table_fg_alpha_self * panel_fg_alpha;
 
-       hud_fade_alpha = hud_fade_alpha_save;
-
        // don't overlap with con_notify
        if(!autocvar__hud_configure)
                panel_pos.y = max((autocvar_con_notify * autocvar_con_notifysize), panel_pos.y);
index 5a7194a45849ee7967f97e2a9694fccaf3b97c0c..fab0392dc08938d19dd27046faf608e9f1241931 100644 (file)
@@ -1,4 +1,7 @@
 #include "timer.qh"
+
+// Timer (#5)
+
 void HUD_Timer()
 {
        if(!autocvar__hud_configure)
@@ -6,7 +9,7 @@ void HUD_Timer()
                if(!autocvar_hud_panel_timer) return;
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        draw_beginBoldFont();
 
@@ -18,7 +21,7 @@ void HUD_Timer()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -26,7 +29,7 @@ void HUD_Timer()
        }
 
        string timer;
-       float timelimit, elapsedTime, timeleft, minutesLeft;
+       float timelimit, timeleft, minutesLeft;
 
        timelimit = STAT(TIMELIMIT);
 
@@ -47,21 +50,20 @@ void HUD_Timer()
        }
 
        vector timer_color;
-       if(minutesLeft >= 5 || warmup_stage || timelimit == 0) //don't use red or yellow in warmup or when there is no timelimit
+       if(gameover_time || minutesLeft >= 5 || warmup_stage || timelimit == 0)
                timer_color = '1 1 1'; //white
        else if(minutesLeft >= 1)
                timer_color = '1 1 0'; //yellow
        else
                timer_color = '1 0 0'; //red
 
-       if (autocvar_hud_panel_timer_increment || (!warmup_stage && timelimit == 0) || (warmup_stage && warmup_timeleft <= 0)) {
-               if (time < STAT(GAMESTARTTIME)) {
-                       //while restart is still active, show 00:00
-                       timer = seconds_tostring(0);
-               } else {
-                       elapsedTime = floor(time - STAT(GAMESTARTTIME));
-                       timer = seconds_tostring(elapsedTime);
-               }
+       if (gameover_time) {
+               timer = seconds_tostring(max(0, floor(gameover_time - STAT(GAMESTARTTIME))));
+       } else if (autocvar_hud_panel_timer_increment || (!warmup_stage && timelimit == 0) || (warmup_stage && warmup_timeleft <= 0)) {
+               if (time < STAT(GAMESTARTTIME))
+                       timer = seconds_tostring(0); //while restart is still active, show 00:00
+               else
+                       timer = seconds_tostring(floor(time - STAT(GAMESTARTTIME)));
        } else {
                if(warmup_stage)
                        timer = seconds_tostring(warmup_timeleft);
index a732b0c5ee7a2073c8a32e00ca054633fcb2c320..1c2ea03bc8ec3a11708c7921a976855b6e4ee9fb 100644 (file)
@@ -2,17 +2,17 @@
 
 #include <common/mapinfo.qh>
 
-/** Vote window (#9) */
+// Vote (#9)
+
 void HUD_Vote()
 {
        if(autocvar_cl_allow_uid2name == -1 && (gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE || (serverflags & SERVERFLAG_PLAYERSTATS)))
        {
                // this dialog gets overriden by the uid2name menu dialog, if it exists
                // TODO remove this client side uid2name dialog in the next release
-               if(autocvar__menu_alpha)
-                       hud_fade_alpha = 0;
-               else
+               if(!autocvar__menu_alpha)
                        uid2name_dialog = 0;
+
                if (!uid2name_dialog)
                        localcmd("menu_cmd directmenu Uid2Name\n");
 
@@ -33,14 +33,12 @@ void HUD_Vote()
        if(!autocvar__hud_configure)
        {
                if(!autocvar_hud_panel_vote) return;
-
-               panel_fg_alpha = autocvar_hud_panel_fg_alpha;
-               panel_bg_alpha_str = autocvar_hud_panel_vote_bg_alpha;
-
-               if(panel_bg_alpha_str == "") {
-                       panel_bg_alpha_str = ftos(autocvar_hud_panel_bg_alpha);
-               }
-               panel_bg_alpha = stof(panel_bg_alpha_str);
+               /*
+               if(cvar("hud_panel_vote_test")) {
+                       if(vote_called_vote) strunzone(vote_called_vote); vote_called_vote = strzone("^1test the vote panel");
+                       vote_active = true; vote_yescount = 3; vote_nocount = 2; vote_needed = 4;
+               } else vote_active = false;
+               */
        }
        else
        {
@@ -61,10 +59,18 @@ void HUD_Vote()
        else
                vote_alpha = bound(0, 1 - (time - vote_change) * 2, 1);
 
-       if(!vote_alpha)
+       a = vote_alpha * (vote_highlighted ? autocvar_hud_panel_vote_alreadyvoted_alpha : 1);
+       if(a <= 0)
                return;
-
-       HUD_Panel_UpdateCvars();
+       //panel_fade_alpha *= a;
+       // nothing can hide this panel, not even the menu
+       float hud_fade_alpha_save = hud_fade_alpha;
+       if(uid2name_dialog && autocvar__menu_alpha)
+               hud_fade_alpha = 0;
+       else
+               hud_fade_alpha = a;
+       HUD_Panel_LoadCvars();
+       hud_fade_alpha = hud_fade_alpha_save;
 
        if(uid2name_dialog)
        {
@@ -76,13 +82,11 @@ void HUD_Vote()
        pos = panel_pos;
        mySize = panel_size;
 
-       a = vote_alpha * (vote_highlighted ? autocvar_hud_panel_vote_alreadyvoted_alpha : 1);
        if (autocvar_hud_panel_vote_dynamichud)
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(a);
-       a = panel_fg_alpha * a;
+       HUD_Panel_DrawBg();
 
        if(panel_bg_padding)
        {
@@ -111,42 +115,44 @@ void HUD_Vote()
        s = _("A vote has been called for:");
        if(uid2name_dialog)
                s = _("Allow servers to store and display your name?");
-       drawstring_aspect(pos, s, eX * mySize.x + eY * (2/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
+       drawstring_aspect(pos, s, eX * mySize.x + eY * (2/8) * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
        s = textShortenToWidth(vote_called_vote, mySize.x, '1 1 0' * mySize.y * (1/8), stringwidth_colors);
        if(autocvar__hud_configure)
                s = _("^1Configure the HUD");
-       drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize.y, s, eX * mySize.x + eY * (1.75/8) * mySize.y, a, DRAWFLAG_NORMAL);
+       drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize.y, s, eX * mySize.x + eY * (1.75/8) * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
 
        // print the yes/no counts
        s = sprintf("^2%s ^7(%d)", getcommandkey_forcename(_("Yes"), "vyes"), vote_yescount);
-       drawcolorcodedstring_aspect(pos + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, a, DRAWFLAG_NORMAL);
+       drawcolorcodedstring_aspect(pos + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
        s = sprintf("^1%s ^7(%d)", getcommandkey_forcename(_("No"), "vno"), vote_nocount);
-       drawcolorcodedstring_aspect(pos + eX * 0.5 * mySize.x + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, a, DRAWFLAG_NORMAL);
+       drawcolorcodedstring_aspect(pos + eX * 0.5 * mySize.x + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
 
+       pos.y += (5/8) * mySize.y;
+       vector tmp_size = eX * mySize.x + eY * (3/8) * mySize.y;
        // draw the progress bar backgrounds
-       drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_back", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
+       drawpic_skin(pos, "voteprogress_back", tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
        // draw the highlights
        if(vote_highlighted == 1) {
                drawsetcliparea(pos.x, pos.y, mySize.x * 0.5, mySize.y);
-               drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_voted", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
+               drawpic_skin(pos, "voteprogress_voted", tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
        }
        else if(vote_highlighted == -1) {
                drawsetcliparea(pos.x + 0.5 * mySize.x, pos.y, mySize.x * 0.5, mySize.y);
-               drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_voted", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
+               drawpic_skin(pos, "voteprogress_voted", tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
        }
 
        // draw the progress bars
        if(vote_yescount && vote_needed)
        {
                drawsetcliparea(pos.x, pos.y, mySize.x * 0.5 * (vote_yescount/vote_needed), mySize.y);
-               drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_prog", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
+               drawpic_skin(pos, "voteprogress_prog", tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
        }
 
        if(vote_nocount && vote_needed)
        {
                drawsetcliparea(pos.x + mySize.x - mySize.x * 0.5 * (vote_nocount/vote_needed), pos.y, mySize.x * 0.5, mySize.y);
-               drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_prog", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
+               drawpic_skin(pos, "voteprogress_prog", tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
        }
 
        drawresetcliparea();
index fe2aefc60d1c3fe5f123c49386a235ccb3cc2b8b..206bebc2f0cec146c9d0425112dfdea995a1729b 100644 (file)
@@ -1,5 +1,7 @@
 #include "weapons.qh"
-// Weapon icons (#0)
+
+
+// Weapons (#0)
 
 entity weaponorder[Weapons_MAX];
 void weaponorder_swap(int i, int j, entity pass)
@@ -81,7 +83,7 @@ void HUD_Weapons()
        }
 
        // update generic hud functions
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        // figure out weapon order (how the weapons are sorted) // TODO make this configurable
        if(weaponorder_bypriority != autocvar_cl_weaponpriority || !weaponorder[0])
@@ -152,7 +154,7 @@ void HUD_Weapons()
                if(autocvar__hud_configure)
                {
                        if(hud_configure_menu_open != 2)
-                               HUD_Panel_DrawBg(1); // also draw the bg of the entire panel
+                               HUD_Panel_DrawBg(); // also draw the bg of the entire panel
                }
 
                // do we own this weapon?
@@ -314,7 +316,7 @@ void HUD_Weapons()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
 
        if(center.x == -1)
                return; // panel has gone off screen
index 89f540778e97f21d32dbaa8d8eb09a43fab05a1a..72b60b5bd378097c74ed43b3b754328dc0b7d435 100644 (file)
@@ -84,6 +84,7 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g
                alpha = mv_top2_alpha; // Fade away if not one of the top 2 choice
        else
                alpha = 1; // Normal, full alpha
+       alpha *= panel_fg_alpha;
 
        // Bounding box details
        float rect_margin = hud_fontsize.y / 2;
@@ -101,14 +102,14 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g
        // Highlight selected item
        if(id == mv_selection && (mv_flags[id] & GTV_AVAILABLE))
        {
-               drawfill(rect_pos, rect_size, '1 1 1', 0.1, DRAWFLAG_NORMAL);
+               drawfill(rect_pos, rect_size, '1 1 1', 0.1 * panel_fg_alpha, DRAWFLAG_NORMAL);
        }
 
        // Highlight current vote
        vector rgb = MapVote_RGB(id);
        if(id == mv_ownvote)
        {
-               drawfill(rect_pos, rect_size, rgb, 0.1*alpha, DRAWFLAG_NORMAL);
+               drawfill(rect_pos, rect_size, rgb, 0.1 * alpha, DRAWFLAG_NORMAL);
                drawborderlines(autocvar_hud_panel_mapvote_highlight_border, rect_pos, rect_size, rgb, alpha, DRAWFLAG_NORMAL);
        }
 
@@ -230,16 +231,17 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin
                theAlpha = mv_top2_alpha;
        else
                theAlpha = 1;
+       theAlpha *= panel_fg_alpha;
 
        // Highlight selected item
        if(id == mv_selection && (mv_flags[id] & GTV_AVAILABLE))
-               drawfill(rect_pos, rect_size, '1 1 1', 0.1, DRAWFLAG_NORMAL);
+               drawfill(rect_pos, rect_size, '1 1 1', 0.1 * panel_fg_alpha, DRAWFLAG_NORMAL);
 
        // Highlight current vote
        vector rgb = MapVote_RGB(id);
        if(id == mv_ownvote)
        {
-               drawfill(rect_pos, rect_size, rgb, 0.1*theAlpha, DRAWFLAG_NORMAL);
+               drawfill(rect_pos, rect_size, rgb, 0.1 * theAlpha, DRAWFLAG_NORMAL);
                drawborderlines(autocvar_hud_panel_mapvote_highlight_border, rect_pos, rect_size, rgb, theAlpha, DRAWFLAG_NORMAL);
        }
 
@@ -272,7 +274,7 @@ void MapVote_DrawAbstain(vector pos, float isize, float tsize, float _count, int
        text_size = stringwidth(label, false, hud_fontsize);
 
        pos.x -= text_size*0.5;
-       drawstring(pos, label, hud_fontsize, rgb, 1, DRAWFLAG_NORMAL);
+       drawstring(pos, label, hud_fontsize, rgb, panel_fg_alpha, DRAWFLAG_NORMAL);
 }
 
 vector MapVote_GridVec(vector gridspec, int i, int m)
@@ -332,6 +334,8 @@ void MapVote_Draw()
        if(!mv_active)
                return;
 
+       HUD_Panel_LoadCvars();
+
        if (!autocvar_hud_cursormode)
        {
                vector mpos = mv_mousepos + getmousepos();
@@ -364,14 +368,14 @@ void MapVote_Draw()
 
        map = ((gametypevote) ? _("Decide the gametype") : _("Vote for a map"));
        pos.x = center - stringwidth(map, false, hud_fontsize * 2) * 0.5;
-       drawstring(pos, map, hud_fontsize * 2, '1 1 1', 1, DRAWFLAG_NORMAL);
+       drawstring(pos, map, hud_fontsize * 2, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
        pos.y += hud_fontsize.y * 2;
 
        if( mapvote_chosenmap != "" )
        {
                pos.y += hud_fontsize.y * 0.25;
                pos.x = center - stringwidth(mapvote_chosenmap, false, hud_fontsize * 1.5) * 0.5;
-               drawstring(pos, mapvote_chosenmap, hud_fontsize * 1.5, '1 1 1', 1, DRAWFLAG_NORMAL);
+               drawstring(pos, mapvote_chosenmap, hud_fontsize * 1.5, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                pos.y += hud_fontsize.y * 1.5;
        }
        pos.y += hud_fontsize.y * 0.5;
@@ -381,12 +385,10 @@ void MapVote_Draw()
        i = ceil(max(0, mv_timeout - time));
        map = sprintf(_("%d seconds left"), i);
        pos.x = center - stringwidth(map, false, hud_fontsize * 1.5) * 0.5;
-       drawstring(pos, map, hud_fontsize * 1.5, '0 1 0', 1, DRAWFLAG_NORMAL);
+       drawstring(pos, map, hud_fontsize * 1.5, '0 1 0', panel_fg_alpha, DRAWFLAG_NORMAL);
        pos.y += hud_fontsize.y * 1.5;
        pos.y += hud_fontsize.y * 0.5;
 
-       HUD_Panel_UpdateCvars();
-
        // base for multi-column stuff...
        pos.y += hud_fontsize.y;
        pos.x = xmin;
@@ -440,7 +442,7 @@ void MapVote_Draw()
        panel_pos.y = pos.y;
        panel_size.x = xmax - xmin;
        panel_size.y = ymax - ymin;
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
 
        if(panel_bg_padding)
        {
@@ -486,7 +488,7 @@ void MapVote_Draw()
                MapVote_DrawAbstain(pos, dist.x, xmax - xmin, tmp, i);
        }
 
-       draw_cursor_normal(mv_mousepos, '1 1 1', 1 - autocvar__menu_alpha);
+       draw_cursor_normal(mv_mousepos, '1 1 1', panel_fg_alpha);
 }
 
 void Cmd_MapVote_MapDownload(int argc)
index 2226200521e27683e51cc5f640324be655ce447c..db05c4fe3ff1f2fcaf21b3b412b8a749374113f3 100644 (file)
@@ -1735,6 +1735,9 @@ void CSQC_UpdateView(entity this, float w, float h)
        if(!postinit)
                PostInit();
 
+       if(intermission && !gameover_time)
+               gameover_time = time;
+
        if(intermission && !isdemo() && !(calledhooks & HOOK_END))
        {
                if(calledhooks & HOOK_START)
index 90f1b2252ec2c816bea0c566a63725be73424891..12d2f06d18caecf4bbf6f07d8f803e5ef5073544 100644 (file)
@@ -35,7 +35,7 @@ void HUD_MinigameBoard ()
        if ( !hud_minigame )
                return;
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
 
        vector pos, mySize;
@@ -61,7 +61,7 @@ void HUD_MinigameStatus ()
        if ( !hud_minigame )
                return;
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
 
        vector pos, mySize;
@@ -429,7 +429,7 @@ void HUD_MinigameMenu_MouseInput()
 {
        panel = HUD_PANEL(MINIGAME_MENU);
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        if(panel_bg_padding)
        {
@@ -475,10 +475,10 @@ void HUD_MinigameMenu ()
        if ( !HUD_MinigameMenu_IsOpened() )
                return;
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
 
        if(panel_bg_padding)
        {
@@ -545,7 +545,7 @@ void HUD_MinigameHelp()
        if ( !help_message )
                return;
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
 
        vector pos, mySize;
index a0a93b1910870b8cb4ca9ea9069a20da5a9aeed0..31ae9d947912f993571072e8ed89ab551ecfa302 100644 (file)
@@ -855,7 +855,7 @@ void bd_hud_board(vector pos, vector mySize)
 // Required function, draw the game status panel
 void bd_hud_status(vector pos, vector mySize)
 {
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        vector ts;
        ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message,
                hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5);
index 86c9f1889fd5ecc803b7789442a6cc35d1ce6046..2a6cb3d475ded6748f10715c5e5e9118e9ce6675 100644 (file)
@@ -323,7 +323,7 @@ void c4_hud_board(vector pos, vector mySize)
 // Required function, draw the game status panel
 void c4_hud_status(vector pos, vector mySize)
 {
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        vector ts;
        ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message,
                hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5);
index bdb02ab96273682819017d43864356295a3caf8d..4184c2638251f8df15f3b43a4b594166cba73221 100644 (file)
@@ -497,9 +497,8 @@ void nmm_hud_board(vector pos, vector mySize)
 // Required function, draw the game status panel
 void nmm_hud_status(vector pos, vector mySize)
 {
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        vector ts;
-
        ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message,
                hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5);
        pos_y += ts_y;
index 3574b9f74bd659c4d0fe568b5a9bec830b606701..dd57fb5c66886c846458d3991ce1eef96f1707c2 100644 (file)
@@ -543,7 +543,7 @@ void pong_hud_board(vector pos, vector mySize)
 // Required function, draw the game status panel
 void pong_hud_status(vector pos, vector mySize)
 {
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        vector ts;
        ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message,
                hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5);
index 66898838757c12278d92dc4cd4617e852e21ee6f..e05658cbf2c0b486f9ccdbeb01e2a53517c2b91b 100644 (file)
@@ -375,7 +375,7 @@ void pp_hud_board(vector pos, vector mySize)
 // Required function, draw the game status panel
 void pp_hud_status(vector pos, vector mySize)
 {
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        vector ts;
        ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message,
                hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5);
index b2831744de97fbd473a84341be2c6292db1e9dc5..cd5c001e7adf95a30802b03bf468f857692bc9df 100644 (file)
@@ -430,7 +430,7 @@ void ps_hud_board(vector pos, vector mySize)
 // Required function, draw the game status panel
 void ps_hud_status(vector pos, vector mySize)
 {
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        vector ts;
        ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message,
                hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5);
index d5f0ea0787bf63b8ec5887756b098495745a4be7..cd45ed96d6662cada5cdf4d9f669ded4a4e1e61d 100644 (file)
@@ -674,7 +674,7 @@ void snake_hud_board(vector pos, vector mySize)
 // Required function, draw the game status panel
 void snake_hud_status(vector pos, vector mySize)
 {
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        vector ts;
        ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message,
                hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5);
index 9db2201a3f98c9678de04f977b14d9d3e24fab9d..e06bb46628c5366db60f07a129feaf0cc18358f7 100644 (file)
@@ -273,7 +273,7 @@ void ttt_hud_board(vector pos, vector mySize)
 // Required function, draw the game status panel
 void ttt_hud_status(vector pos, vector mySize)
 {
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        vector ts;
        ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message,
                hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5);
index 3fe9de6d7d5f849ea9356d04b6930a59caf76769..1252c34ed75c3fab38ab84286146186c99931bf7 100644 (file)
@@ -307,7 +307,7 @@ void HUD_ItemsTime()
     if (count == 0)
         return;
 
-    HUD_Panel_UpdateCvars();
+    HUD_Panel_LoadCvars();
 
     vector pos, mySize;
     pos = panel_pos;
@@ -332,7 +332,7 @@ void HUD_ItemsTime()
     {
         if (autocvar__hud_configure)
         if (hud_configure_menu_open != 2)
-            HUD_Panel_DrawBg(1); // also draw the bg of the entire panel
+            HUD_Panel_DrawBg(); // also draw the bg of the entire panel
 
         // reduce panel to avoid spacing items
         if (itemstime_size.x / itemstime_size.y < ar)
@@ -371,7 +371,7 @@ void HUD_ItemsTime()
     }
 
     HUD_Scale_Enable();
-    HUD_Panel_DrawBg(1);
+    HUD_Panel_DrawBg();
 
     float row = 0, column = 0;
     bool item_available;