sz = 0.8 + (a / 5);
- if(centerprint_num * cvar("scr_centersize") > 24 && HUD_WouldDrawScoreboard()) // 24 = height of Scoreboard text
- {
+ if(centerprint_num * cvar("scr_centersize") > 24 && scoreboard_active) // 24 = height of Scoreboard text
centerprint_start_y = scoreboard_bottom + centerprint_fontsize_y;
- }
+
pos = centerprint_start;
for (i=0; i<centerprint_num; i = i + 1)
{
float prevMouseClickedTime; // time during previous mouse click, to check for doubleclicks
vector prevMouseClickedPos; // pos during previous mouse click, to check for doubleclicks
-float menu_enabled;
-float menu_enabled_time;
float pressed_key_time;
void HUD_Panel_Arrow_Action(float nPrimary)
{
{
if (bInputType == 1)
return true;
- disable_menu_alphacheck = 1;
menu_enabled = 1;
menu_enabled_time = time;
localcmd("menu_showhudexit\n");
void HUD_Panel_Mouse()
{
// TODO: needs better check... is there any float that contains the current state of the menu? _menu_alpha isn't apparently updated the frame the menu gets enabled
- if (menu_enabled == 0) // menu dialog closed, enable normal alpha stuff again
- disable_menu_alphacheck = 0;
if (autocvar__menu_alpha == 0 && time - menu_enabled_time > 0.5)
menu_enabled = 0;
/*
- print("Disable menu_alphacheck: ", ftos(disable_menu_alphacheck), "\n");
+ print("menu_enabled: ", ftos(menu_enabled), "\n");
print("Highlighted: ", ftos(highlightedPanel), "\n");
print("Menu alpha: ", cvar_string("_menu_alpha"), "\n");
*/
- if(mouseClicked == 0 && disable_menu_alphacheck != 2 && highlightedPanel >= 0) { // don't reset these variables in disable_menu_alphacheck mode 2!
+ // this makes instantly hide the editor cursor, it's needed in case we
+ // open the HUDExit dialog as hud_fade_alpha doesn't decrease to 0
+ // TODO: find a way to fade the cursor out even in this case
+ if(menu_enabled)
+ return;
+
+ if(mouseClicked == 0 && menu_enabled != 2 && highlightedPanel >= 0) { // don't reset these variables in menu_enabled mode 2!
highlightedPanel = -1;
highlightedAction = 0;
}
if(time - prevMouseClickedTime < 0.4 && prevMouseClicked == 0 && prevMouseClickedPos == mousepos && highlightedPanel >= 0)
{
mouseClicked = 0; // to prevent spam, I guess.
- disable_menu_alphacheck = 2;
- menu_enabled = 1;
+ menu_enabled = 2;
menu_enabled_time = time;
HUD_Panel_GetName(highlightedPanel)
localcmd("menu_showhudoptions ", panel_name, "\n");
cursorsize = '32 32 0';
if(highlightcheck == 0)
- drawpic(mousepos, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor.tga"), '32 32 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+ drawpic(mousepos, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor.tga"), '32 32 0', '1 1 1', hud_fade_alpha, DRAWFLAG_NORMAL);
else if(highlightcheck == 1)
- drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor_move.tga"), '32 32 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+ drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor_move.tga"), '32 32 0', '1 1 1', hud_fade_alpha, DRAWFLAG_NORMAL);
else if(highlightcheck == 2)
- drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor_resize.tga"), '32 32 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+ drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor_resize.tga"), '32 32 0', '1 1 1', hud_fade_alpha, DRAWFLAG_NORMAL);
else
- drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor_resize2.tga"), '32 32 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+ drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor_resize2.tga"), '32 32 0', '1 1 1', hud_fade_alpha, DRAWFLAG_NORMAL);
prevMouseClicked = mouseClicked;
}
case WEP_UZI: return 1;
case WEP_CAMPINGRIFLE: return 1;
case WEP_GRENADE_LAUNCHER: return 2;
+ case WEP_MINE_LAYER: return 2;
case WEP_ELECTRO: return 3;
case WEP_CRYLINK: return 3;
case WEP_HLAC: return 3;
vector wpnpos;
vector wpnsize;
+ float show_accuracy;
+ if(autocvar_hud_panel_weapons_accuracy && acc_levels)
+ show_accuracy = true;
+
for(i = 0; i < weapon_cnt; ++i)
{
wpnpos = panel_pos + eX * column * panel_size_x*(1/columns) + eY * row * panel_size_y*(1/rows);
drawpic_aspect_skin(wpnpos, "weapon_current_bg", wpnsize, '1 1 1', fade * panel_fg_alpha, DRAWFLAG_NORMAL);
// draw the weapon accuracy
- if(acc_levels)
+ if(show_accuracy)
{
float weapon_hit, weapon_damage;
weapon_damage = weapon_fired[self.weapon-WEP_FIRST];
mySize -= '2 2 0' * panel_bg_padding;
}
- float armor, health;
+ float armor, health, fuel;
armor = getstati(STAT_ARMOR);
health = getstati(STAT_HEALTH);
-
- float fuel;
- fuel = getstati(GetAmmoStat(4)); // how much fuel do we have?
+ fuel = getstati(STAT_FUEL);
if(autocvar__hud_configure)
{
f = bound(0, f * 10, 1);
acc_avg = acc_avg * (1 - f) + acceleration * f;
acceleration = acc_avg / getstatf(STAT_MOVEVARS_MAXSPEED);
+ if (acceleration == 0)
+ return;
pos = top - sz/2 * eY + (cvar("cl_showacceleration_position") * vid_conheight) * eY;
if (cvar("cl_showacceleration_color_custom"))
rgb = stov(cvar_string("cl_showacceleration_color"));
else {
- rgb = '1 1 1';
- if (acceleration < 0) {
+ if (acceleration < 0)
rgb = '1 .5 .5' - '0 .5 .5' * bound(0, -acceleration * 0.2, 1);
- } else if (acceleration > 0) {
+ else
rgb = '.5 1 .5' - '.5 0 .5' * bound(0, +acceleration * 0.2, 1);
- }
}
if (acceleration > 0)
HUD_Panel_DrawProgressBar(pos, 0, acceleration * scale * '40 0 0' + sz * eY, rgb, alpha * autocvar_hud_panel_fg_alpha, DRAWFLAG_NORMAL);
- else if (acceleration < 0)
+ else
HUD_Panel_DrawProgressBar(pos + acceleration * scale * '40 0 0', 0, -acceleration * scale * '40 0 0' + sz * eY, rgb, alpha * autocvar_hud_panel_fg_alpha, DRAWFLAG_NORMAL);
}
hud_skin_path = strcat("gfx/hud/", autocvar_hud_skin);
// global hud alpha fade
- if(disable_menu_alphacheck == 1)
+ if(menu_enabled == 1)
hud_fade_alpha = 1;
else
hud_fade_alpha = (1 - autocvar__menu_alpha);
hud_accuracy_border_thickness = bound(0, cvar_or("hud_accuracy_border_thickness", 1), 5);
hud_fontsize = HUD_GetFontsize("hud_fontsize");
- hud_fontsize_spec = HUD_GetFontsize("hud_fontsize_spec");
// Drawing stuff
}
}
- float f;
- vector color;
- if((teamplay) && autocvar_hud_dock_color_team) {
- f = stof(getplayerkey(player_localentnum - 1, "colors"));
- color = colormapPaletteColor(mod(f, 16), 1) * autocvar_hud_dock_color_team;
- }
- else if(autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && autocvar_hud_dock_color_team) {
- color = '1 0 0' * autocvar_hud_dock_color_team;
- }
- else if(autocvar_hud_dock_color == "shirt") {
- f = stof(getplayerkey(player_localentnum - 1, "colors"));
- color = colormapPaletteColor(floor(f / 16), 0);
- }
- else if(autocvar_hud_dock_color == "pants") {
- f = stof(getplayerkey(player_localentnum - 1, "colors"));
- color = colormapPaletteColor(mod(f, 16), 1);
- }
- else
- color = stov(autocvar_hud_dock_color);
-
// draw the dock
if(autocvar_hud_dock != "" && autocvar_hud_dock != "0")
{
+ float f;
+ vector color;
+ if((teamplay) && autocvar_hud_dock_color_team) {
+ f = stof(getplayerkey(player_localentnum - 1, "colors"));
+ color = colormapPaletteColor(mod(f, 16), 1) * autocvar_hud_dock_color_team;
+ }
+ else if(autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && autocvar_hud_dock_color_team) {
+ color = '1 0 0' * autocvar_hud_dock_color_team;
+ }
+ else if(autocvar_hud_dock_color == "shirt") {
+ f = stof(getplayerkey(player_localentnum - 1, "colors"));
+ color = colormapPaletteColor(floor(f / 16), 0);
+ }
+ else if(autocvar_hud_dock_color == "pants") {
+ f = stof(getplayerkey(player_localentnum - 1, "colors"));
+ color = colormapPaletteColor(mod(f, 16), 1);
+ }
+ else
+ color = stov(autocvar_hud_dock_color);
+
string pic;
pic = strcat(hud_skin_path, "/", autocvar_hud_dock);
if(precache_pic(pic) == "") {
hud_configure_prev = autocvar__hud_configure;
if (!autocvar__hud_configure) // hud config mode disabled, enable normal alpha stuff again
- disable_menu_alphacheck = 0;
+ if (menu_enabled)
+ menu_enabled = 0;
}