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;
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)
#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
} 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_UpdateCvars(theAlpha) MACRO_BEGIN { \
+ _panel_fade_alpha = theAlpha; \
+ if(autocvar__hud_configure) \
+ _panel_fade_alpha = 1; \
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"))); \
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; \
} 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
return;
}
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
draw_beginBoldFont();
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;
}
// 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_UpdateCvars(1); // keep with the scoreboard
if ( HUD_Radar_Clickable() )
{
HUD_Scale_Enable();
else
HUD_Scale_Disable();
- HUD_Panel_DrawBg(1);
+ HUD_Panel_DrawBg();
if (!centerprint_showing)
return;
}
}
- HUD_Panel_UpdateCvars();
+ HUD_Panel_UpdateCvars(1); // can't be forced to fade with the scoreboard anyway
if(intermission == 2)
{
// 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)
{
if(!autocvar_hud_panel_engineinfo) return;
}
- HUD_Panel_UpdateCvars();
+ HUD_Panel_UpdateCvars(1);
vector pos, mySize;
pos = panel_pos;
mySize = panel_size;
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;
fuel = 20;
}
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
draw_beginBoldFont();
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;
if(!autocvar_hud_panel_infomessages) return;
}
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
vector pos, mySize;
pos = panel_pos;
mySize = panel_size;
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;
if(!HUD_ModIcons_GameType) return;
}
- HUD_Panel_UpdateCvars();
-
- draw_beginBoldFont();
if(mod_active != mod_prev) {
mod_change = time;
else
mod_alpha = bound(0, 1 - (time - mod_change) * 2, 1);
+ //if(mod_alpha <= 0)
+ // return;
+ HUD_Panel_UpdateCvars(mod_alpha);
+
+ 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)
{
if (!autocvar_hud_panel_notify)
return;
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
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)
if(autocvar_hud_panel_physics == 3 && !(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
}
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
draw_beginBoldFont();
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;
return;
// Draw panel background
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
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;
if(spectatee_status <= 0 && autocvar_hud_panel_pressedkeys < 2) return;
}
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
vector pos, mySize;
pos = panel_pos;
mySize = panel_size;
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;
mousepos.y = bound(0, mousepos.y, vid_conheight);
}
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
if(panel_bg_padding)
{
}
}
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
HUD_Scale_Disable();
- HUD_Panel_DrawBg(1);
+ HUD_Panel_DrawBg();
if(panel_bg_padding)
{
if(spectatee_status == -1) return;
}
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
vector pos, mySize;
pos = panel_pos;
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;
mousepos_y = bound(0, mousepos_y, vid_conheight);
}
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
panel_size = autocvar_hud_panel_radar_maximized_size;
if ( hud_panel_radar_temp_hidden )
return;
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
float f = 0;
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;
if(spectatee_status == -1 && (gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
}
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
vector pos, mySize;
pos = panel_pos;
mySize = panel_size;
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;
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")
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")
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")
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")
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;
+ HUD_Panel_UpdateCvars(scoreboard_fade_alpha);
sbt_bg_alpha = autocvar_hud_panel_scoreboard_table_bg_alpha * panel_fg_alpha;
sbt_highlight = autocvar_hud_panel_scoreboard_table_highlight;
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);
if(!autocvar_hud_panel_timer) return;
}
- HUD_Panel_UpdateCvars();
+ HUD_Panel_UpdateCvars(1);
draw_beginBoldFont();
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;
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();
+ HUD_Panel_UpdateCvars(a);
if(uid2name_dialog)
{
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)
{
}
// update generic hud functions
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
// figure out weapon order (how the weapons are sorted) // TODO make this configurable
if(weaponorder_bypriority != autocvar_cl_weaponpriority || !weaponorder[0])
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?
HUD_Scale_Enable();
else
HUD_Scale_Disable();
- HUD_Panel_DrawBg(1);
+ HUD_Panel_DrawBg();
if(center.x == -1)
return; // panel has gone off screen
pos.y += hud_fontsize.y * 1.5;
pos.y += hud_fontsize.y * 0.5;
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
// base for multi-column stuff...
pos.y += hud_fontsize.y;
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)
{
if ( !hud_minigame )
return;
- HUD_Panel_UpdateCvars();
+ HUD_Panel_UpdateCvars(1);
vector pos, mySize;
if ( !hud_minigame )
return;
- HUD_Panel_UpdateCvars();
+ HUD_Panel_UpdateCvars(1);
vector pos, mySize;
{
panel = HUD_PANEL(MINIGAME_MENU);
- HUD_Panel_UpdateCvars();
+ HUD_Panel_UpdateCvars(1);
if(panel_bg_padding)
{
if ( !HUD_MinigameMenu_IsOpened() )
return;
- HUD_Panel_UpdateCvars();
+ HUD_Panel_UpdateCvars(1);
HUD_Scale_Disable();
- HUD_Panel_DrawBg(1);
+ HUD_Panel_DrawBg();
if(panel_bg_padding)
{
if ( !help_message )
return;
- HUD_Panel_UpdateCvars();
+ HUD_Panel_UpdateCvars(1);
vector pos, 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);
// 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);
// 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;
// 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);
// 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);
// 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);
// 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);
// 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);
if (count == 0)
return;
- HUD_Panel_UpdateCvars();
+ if(1 - scoreboard_fade_alpha <= 0)
+ return;
+ HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
vector pos, mySize;
pos = panel_pos;
{
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)
}
HUD_Scale_Enable();
- HUD_Panel_DrawBg(1);
+ HUD_Panel_DrawBg();
float row = 0, column = 0;
bool item_available;