X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud_config.qc;h=d1d5dfc8aec21da63dcada6245c0a9c36184f488;hp=4c12c90d2a5b8f628360793bae2bac64a136806d;hb=fcbf9538330960b989dbe84e7188349d7e8b109f;hpb=f896cf4c5da8e2f44fa45e57bb7bdc9a25bd2ad5 diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index 4c12c90d2a..d1d5dfc8ae 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -35,6 +35,9 @@ void HUD_Panel_ExportCfg(string cfgname) HUD_Write_Cvar_q("hud_progressbar_armor_color"); HUD_Write_Cvar_q("hud_progressbar_fuel_color"); HUD_Write_Cvar_q("hud_progressbar_nexball_color"); + HUD_Write_Cvar_q("hud_progressbar_speed_color"); + HUD_Write_Cvar_q("hud_progressbar_acceleration_color"); + HUD_Write_Cvar_q("hud_progressbar_acceleration_neg_color"); HUD_Write("\n"); HUD_Write_Cvar_q("_hud_panelorder"); @@ -61,7 +64,7 @@ void HUD_Panel_ExportCfg(string cfgname) 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"); @@ -94,6 +97,7 @@ void HUD_Panel_ExportCfg(string cfgname) HUD_Write_PanelCvar_q("_progressbar"); HUD_Write_PanelCvar_q("_progressbar_strength"); HUD_Write_PanelCvar_q("_progressbar_shield"); + HUD_Write_PanelCvar_q("_text"); break; case HUD_PANEL_HEALTHARMOR: HUD_Write_PanelCvar_q("_flip"); @@ -134,6 +138,7 @@ void HUD_Panel_ExportCfg(string cfgname) HUD_Write_PanelCvar_q("_dom_layout"); break; case HUD_PANEL_PRESSEDKEYS: + HUD_Write_PanelCvar_q("_attack"); HUD_Write_PanelCvar_q("_aspect"); break; case HUD_PANEL_ENGINEINFO: @@ -155,7 +160,11 @@ void HUD_Panel_ExportCfg(string cfgname) HUD_Write_PanelCvar_q("_flip"); HUD_Write_PanelCvar_q("_baralign"); HUD_Write_PanelCvar_q("_progressbar"); - HUD_Write_PanelCvar_q("_acceleration_mode"); + HUD_Write_PanelCvar_q("_progressbar_acceleration_mode"); + HUD_Write_PanelCvar_q("_progressbar_acceleration_scale"); + HUD_Write_PanelCvar_q("_progressbar_acceleration_nonlinear"); + HUD_Write_PanelCvar_q("_text"); + HUD_Write_PanelCvar_q("_text_scale"); break; case HUD_PANEL_CENTERPRINT: HUD_Write_PanelCvar_q("_align"); @@ -184,6 +193,16 @@ void HUD_Panel_ExportCfg(string cfgname) 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) { @@ -398,7 +417,7 @@ void HUD_Panel_SetPosSize(vector mySize) HUD_Panel_UpdatePosSizeForId(highlightedPanel); vector resizeorigin; resizeorigin = panel_click_resizeorigin; - vector myPos; + local noref vector myPos; // fteqcc sucks // minimum panel size cap mySize_x = max(0.025 * vid_conwidth, mySize_x); @@ -616,17 +635,27 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) { string s; - // we only care for keyboard events - if(bInputType != 0 && bInputType != 1) + if(bInputType == 2) return false; if(!autocvar__hud_configure) return false; + // block any input while a menu dialog is fading + if(autocvar__menu_alpha) + return true; + + if(bInputType == 3) + { + mousepos_x = nPrimary; + mousepos_y = nSecondary; + return true; + } + // allow console bind to work string con_keys; float keys; - con_keys = findkeysforcommand("toggleconsole"); + con_keys = findkeysforcommand("toggleconsole", 0); keys = tokenize(con_keys); // findkeysforcommand returns data for this float hit_con_bind, i; @@ -885,7 +914,7 @@ float HUD_Panel_Check_Mouse_Pos(float allow_move) border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize // move - if(allow_move && mousepos_x >= panel_pos_x && mousepos_y >= panel_pos_y && mousepos_x <= panel_pos_x + panel_size_x && mousepos_y <= panel_pos_y + panel_size_y) + if(allow_move && mousepos_x > panel_pos_x && mousepos_y > panel_pos_y && mousepos_x < panel_pos_x + panel_size_x && mousepos_y < panel_pos_y + panel_size_y) { return 1; } @@ -965,7 +994,7 @@ void HUD_Panel_Highlight(float allow_move) border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize // move - if(allow_move && mousepos_x >= panel_pos_x && mousepos_y >= panel_pos_y && mousepos_x <= panel_pos_x + panel_size_x && mousepos_y <= panel_pos_y + panel_size_y) + if(allow_move && mousepos_x > panel_pos_x && mousepos_y > panel_pos_y && mousepos_x < panel_pos_x + panel_size_x && mousepos_y < panel_pos_y + panel_size_y) { highlightedPanel = i; HUD_Panel_FirstInDrawQ(i); @@ -1041,20 +1070,12 @@ void HUD_Panel_Mouse() /* print("menu_enabled: ", ftos(menu_enabled), "\n"); print("Highlighted: ", ftos(highlightedPanel), "\n"); - print("Menu alpha: ", ftos(autocvar__menu_alpha), "\n"); + 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; - - mousepos_x = bound(0, mousepos_x, vid_conwidth); - mousepos_y = bound(0, mousepos_y, vid_conheight); - if(mouseClicked) { if(prevMouseClicked == 0) @@ -1141,15 +1162,16 @@ void HUD_Panel_Mouse() } // 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; } @@ -1157,11 +1179,11 @@ void HUD_Panel_Mouse() const float hlBorderSize = 4; const string hlBorder = "gfx/hud/default/border_highlighted"; const string hlBorder2 = "gfx/hud/default/border_highlighted2"; -void HUD_Panel_HlBorder(float myBorder, vector color, float alpha) +void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha) { - drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * alpha, DRAWFLAG_NORMAL); - drawpic_tiled(panel_pos - '1 1 0' * myBorder, hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size_x + 2 * myBorder) + eY * hlBorderSize, color, alpha, DRAWFLAG_NORMAL); - drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * (panel_size_y + 2 * myBorder - hlBorderSize), hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size_x + 2 * myBorder) + eY * hlBorderSize, color, alpha, DRAWFLAG_NORMAL); - drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize, hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size_y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, alpha, DRAWFLAG_NORMAL); - drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize + eX * (panel_size_x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size_y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, alpha, DRAWFLAG_NORMAL); + drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL); + drawpic_tiled(panel_pos - '1 1 0' * myBorder, hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size_x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); + drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * (panel_size_y + 2 * myBorder - hlBorderSize), hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size_x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); + drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize, hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size_y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); + drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize + eX * (panel_size_x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size_y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); }