X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fhud_config.qc;h=654d49ba8c60f5ce9f59b3eb40bd2b24877d28fa;hb=d98bbd9428490da52da414ab39932321cacc3254;hp=be76d465376fe3e6c2c65227631f6bf43c8c6037;hpb=1cbef966e133966c5b5f0f5b58fbd1a5851ed35b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/hud/hud_config.qc b/qcsrc/client/hud/hud_config.qc index be76d4653..654d49ba8 100644 --- a/qcsrc/client/hud/hud_config.qc +++ b/qcsrc/client/hud/hud_config.qc @@ -1,6 +1,7 @@ #include "hud_config.qh" #include "hud.qh" +#include "panel/scoreboard.qh" #define HUD_Write(s) fputs(fh, s) #define HUD_Write_Cvar(cvar) HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n")) @@ -13,6 +14,9 @@ void HUD_Panel_ExportCfg(string cfgname) fh = fopen(filename, FILE_WRITE); if(fh >= 0) { + HUD_Write("//title \n"); + HUD_Write("//author \n"); + HUD_Write("\n"); HUD_Write_Cvar("hud_skin"); HUD_Write_Cvar("hud_panel_bg"); HUD_Write_Cvar("hud_panel_bg_color"); @@ -57,7 +61,6 @@ void HUD_Panel_ExportCfg(string cfgname) { panel = hud_panels_from(i); - HUD_Write_PanelCvar(""); HUD_Write_PanelCvar("_pos"); HUD_Write_PanelCvar("_size"); HUD_Write_PanelCvar("_bg"); @@ -117,6 +120,7 @@ void HUD_Panel_ExportCfg(string cfgname) HUD_Write_PanelCvar("_progressbar_armor"); HUD_Write_PanelCvar("_progressbar_gfx"); HUD_Write_PanelCvar("_progressbar_gfx_smooth"); + HUD_Write_PanelCvar("_combined"); HUD_Write_PanelCvar("_text"); break; case HUD_PANEL_NOTIFY: @@ -204,6 +208,21 @@ void HUD_Panel_ExportCfg(string cfgname) case HUD_PANEL_QUICKMENU: HUD_Write_PanelCvar("_align"); break; + case HUD_PANEL_SCOREBOARD: + HUD_Write_PanelCvar("_fadeinspeed"); + HUD_Write_PanelCvar("_fadeoutspeed"); + HUD_Write_PanelCvar("_respawntime_decimals"); + HUD_Write_PanelCvar("_table_bg_alpha"); + HUD_Write_PanelCvar("_table_bg_scale"); + HUD_Write_PanelCvar("_table_fg_alpha"); + HUD_Write_PanelCvar("_table_fg_alpha_self"); + HUD_Write_PanelCvar("_table_highlight"); + HUD_Write_PanelCvar("_table_highlight_alpha"); + HUD_Write_PanelCvar("_table_highlight_alpha_self"); + HUD_Write_PanelCvar("_bg_teams_color_team"); + HUD_Write_PanelCvar("_accuracy_doublerows"); + HUD_Write_PanelCvar("_accuracy_nocolors"); + break; } HUD_Write("\n"); } @@ -218,9 +237,9 @@ void HUD_Panel_ExportCfg(string cfgname) void HUD_Configure_Exit_Force() { - if (menu_enabled) + if (hud_configure_menu_open) { - menu_enabled = 0; + hud_configure_menu_open = 0; localcmd("togglemenu\n"); } cvar_set("_hud_configure", "0"); @@ -638,9 +657,8 @@ float tab_backward; void HUD_Panel_FirstInDrawQ(float id); void reset_tab_panels() { - int i; - for(i = 0; i < hud_panels_COUNT; ++i) - tab_panels[i] = world; + for (int i = 0; i < hud_panels_COUNT; ++i) + tab_panels[i] = NULL; } float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) { @@ -669,10 +687,8 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) } // allow console bind to work - string con_keys; - float keys; - con_keys = findkeysforcommand("toggleconsole", 0); - keys = tokenize(con_keys); // findkeysforcommand returns data for this + string con_keys = findkeysforcommand("toggleconsole", 0); + int keys = tokenize(con_keys); // findkeysforcommand returns data for this bool hit_con_bind = false; int i; @@ -704,7 +720,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) highlightedAction = 0; HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id); } - tab_panel = world; + tab_panel = NULL; reset_tab_panels(); } } @@ -727,14 +743,14 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) { if (bInputType == 1) return true; - menu_enabled = 1; + hud_configure_menu_open = 1; localcmd("menu_showhudexit\n"); } else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL) { if (bInputType == 1) return true; - if (!menu_enabled) + if (!hud_configure_menu_open) cvar_set("_hud_configure", "0"); } else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel @@ -772,11 +788,11 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) vector candidate_pos = '0 0 0'; const float LEVELS_NUM = 4; float level_height = vid_conheight / LEVELS_NUM; -:find_tab_panel +LABEL(find_tab_panel) level = floor(tab_panel_pos.y / level_height) * level_height; //starting level candidate_pos.x = (!tab_backward) ? vid_conwidth : 0; start_posX = tab_panel_pos.x; - tab_panel = world; + tab_panel = NULL; k=0; while(++k) { @@ -803,11 +819,11 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) reset_tab_panels(); if (!old_tab_panel) { - tab_panel = world; + tab_panel = NULL; return true; } starting_panel = old_tab_panel; - old_tab_panel = world; + old_tab_panel = NULL; goto find_tab_panel; //u must find tab_panel! } if (!tab_backward) @@ -888,7 +904,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s); s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight)); cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s); - highlightedPanel_backup = world; + highlightedPanel_backup = NULL; } } else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config @@ -1076,13 +1092,13 @@ void HUD_Panel_Highlight(float allow_move) return; } } - highlightedPanel = world; + highlightedPanel = NULL; highlightedAction = 0; } void HUD_Panel_EnableMenu() { - menu_enabled = 2; + hud_configure_menu_open = 2; localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n"); } float mouse_over_panel; @@ -1106,7 +1122,7 @@ void HUD_Panel_Mouse() if (tab_panel) { //stop ctrl-tab selection - tab_panel = world; + tab_panel = NULL; reset_tab_panels(); } HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin @@ -1181,7 +1197,7 @@ void HUD_Panel_Mouse() { if(prevMouseClicked) highlightedAction = 0; - if(menu_enabled == 2) + if(hud_configure_menu_open == 2) mouse_over_panel = 0; else mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true); @@ -1189,17 +1205,16 @@ void HUD_Panel_Mouse() drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL); } // 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', cursor_alpha, DRAWFLAG_NORMAL); + draw_cursor_normal(mousepos, '1 1 1', cursor_alpha); else if(mouse_over_panel == 1) - drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL); + draw_cursor(mousepos, '0.5 0.5 0', "/cursor_move", '1 1 1', cursor_alpha); else if(mouse_over_panel == 2) - drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL); + draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize", '1 1 1', cursor_alpha); else - drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL); + draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize2", '1 1 1', cursor_alpha); prevMouseClicked = mouseClicked; } @@ -1230,7 +1245,7 @@ void HUD_Configure_Frame() int i; if(autocvar__hud_configure) { - if(isdemo() || intermission == 2) + if(isdemo() || intermission == 2 || scoreboard_active) { HUD_Configure_Exit_Force(); return; @@ -1249,7 +1264,7 @@ void HUD_Configure_Frame() if(autocvar__menu_alpha != _menu_alpha_prev) { if(autocvar__menu_alpha == 0) - menu_enabled = 0; + hud_configure_menu_open = 0; _menu_alpha_prev = autocvar__menu_alpha; } @@ -1257,10 +1272,11 @@ void HUD_Configure_Frame() } else if(hud_configure_prev) { - if(menu_enabled) - menu_enabled = 0; + if(hud_configure_menu_open) + hud_configure_menu_open = 0; if(autocvar_hud_cursormode) setcursormode(0); + hud_dynamic_shake_factor = -1; } }