picpos = newPos;
}
- // FIXME newSize_x is unused, is that right?
-
+ // NOTE: newSize_x is always equal to 3 * mySize_y so we can use
+ // '2 1 0' * newSize_y instead of eX * (2/3) * newSize_x + eY * newSize_y
drawstring_aspect_expanding(numpos, ftos(x), '2 1 0' * newSize_y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
}
case (HUD_PANEL_ENGINEINFO):\
HUD_EngineInfo(); break;\
case (HUD_PANEL_INFOMESSAGES):\
- HUD_InfoMessages(); break;\
+ HUD_InfoMessages(); break;\
case (HUD_PANEL_PHYSICS):\
- HUD_Physics(); break;\
+ HUD_Physics(); break;\
case (HUD_PANEL_CENTERPRINT):\
- HUD_CenterPrint(); break;\
+ HUD_CenterPrint(); break;\
} ENDS_WITH_CURLY_BRACE
void HUD_Main (void)
if(scoreboard_fade_alpha)
hud_fade_alpha = (1 - scoreboard_fade_alpha);
+ if(autocvar__hud_configure)
+ if(isdemo())
+ HUD_Configure_Exit_Force();
+
if(intermission == 2) // no hud during mapvote
{
- if (autocvar__hud_configure) //force exit from hud config
- {
- if (menu_enabled)
- {
- menu_enabled = 0;
- localcmd("togglemenu\n");
- }
- cvar_set("_hud_configure", "0");
- }
+ if (autocvar__hud_configure)
+ HUD_Configure_Exit_Force();
hud_fade_alpha = 0;
}
else if(autocvar__menu_alpha == 0 && scoreboard_fade_alpha == 0)
hud_configure_gridSize_y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
hud_configure_realGridSize_x = hud_configure_gridSize_x * vid_conwidth;
hud_configure_realGridSize_y = hud_configure_gridSize_y * vid_conheight;
+ vector s;
// x-axis
- for(i = 0; i < 1/hud_configure_gridSize_x; ++i)
- drawfill(eX * i * hud_configure_realGridSize_x, eX + eY * vid_conheight, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
+ s = eX + eY * vid_conheight;
+ for(i = 1; i < 1/hud_configure_gridSize_x; ++i)
+ drawfill(eX * i * hud_configure_realGridSize_x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
// y-axis
- for(i = 0; i < 1/hud_configure_gridSize_y; ++i)
- drawfill(eY * i * hud_configure_realGridSize_y, eY + eX * vid_conwidth, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
+ s = eY + eX * vid_conwidth;
+ for(i = 1; i < 1/hud_configure_gridSize_y; ++i)
+ drawfill(eY * i * hud_configure_realGridSize_y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
}
#ifdef COMPAT_XON050_ENGINE
HUD_Panel_UpdatePosSizeForId(highlightedPanel);
HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha));
}
+ if (!hud_configure_prev)
+ hudShiftState = 0;
}
hud_configure_prev = autocvar__hud_configure;
HUD_Write_PanelCvar_q("_bg_border");
HUD_Write_PanelCvar_q("_bg_padding");
switch(i) {
- case HUD_PANEL_WEAPONS:
+ case HUD_PANEL_WEAPONS:
HUD_Write_PanelCvar_q("_accuracy");
HUD_Write_PanelCvar_q("_label");
HUD_Write_PanelCvar_q("_complainbubble");
print(sprintf(_("^1Couldn't write to %s\n"), filename));
}
+void HUD_Configure_Exit_Force()
+{
+ if (menu_enabled)
+ {
+ menu_enabled = 0;
+ localcmd("togglemenu\n");
+ }
+ cvar_set("_hud_configure", "0");
+}
+
// check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
vector HUD_Panel_CheckMove(vector myPos, vector mySize)
{
if(!autocvar__hud_configure)
return false;
+ // block any input while a menu dialog is fading
+ if(autocvar__menu_alpha)
+ return true;
+
// allow console bind to work
string con_keys;
float keys;
print("Menu theAlpha: ", ftos(autocvar__menu_alpha), "\n");
*/
- // instantly hide the editor cursor if we open the HUDExit dialog
- // as hud_fade_alpha doesn't decrease to 0 in this case
- // TODO: find a way to fade the cursor out even in this case
- if(menu_enabled == 1 || (menu_enabled == 2 && !hud_fade_alpha))
+ if(autocvar__menu_alpha == 1)
return;
mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
}
// draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
const vector cursorsize = '32 32 0';
+ float cursor_alpha = 1 - autocvar__menu_alpha;
if(!mouse_over_panel)
- drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', hud_fade_alpha, DRAWFLAG_NORMAL);
+ drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
else if(mouse_over_panel == 1)
- drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', hud_fade_alpha, DRAWFLAG_NORMAL);
+ drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
else if(mouse_over_panel == 2)
- drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', hud_fade_alpha, DRAWFLAG_NORMAL);
+ drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
else
- drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', hud_fade_alpha, DRAWFLAG_NORMAL);
+ drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
prevMouseClicked = mouseClicked;
}
if(_drawpic_sz_x/_drawpic_sz_y > _drawpic_imgaspect) {\
_drawpic_oldsz = _drawpic_sz_x;\
_drawpic_sz_x = _drawpic_sz_y * _drawpic_imgaspect;\
- drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz_x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
+ if(_drawpic_sz_x)\
+ drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz_x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
} else {\
_drawpic_oldsz = _drawpic_sz_y;\
_drawpic_sz_y = _drawpic_sz_x / _drawpic_imgaspect;\
- drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz_y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
+ if(_drawpic_sz_y)\
+ drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz_y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
}\
} while(0)
string HUD_PANELNAME_PHYSICS = "physics";
string HUD_PANELNAME_CENTERPRINT = "centerprint";
-float HUD_MENU_ENABLE = 0;
-
#define SERVERFLAG_ALLOW_FULLBRIGHT 1
#define SERVERFLAG_TEAMPLAY 2
#define SERVERFLAG_PLAYERSTATS 4