]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/hud_config.qc
Add a common handler for cursors, allowing multiple menus to be open at the same...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / hud_config.qc
index 64b951e9662564390c30b7742ffd8f85045cbc7b..1f180fc005cb853fa9eeb0b872509dbb1e631719 100644 (file)
@@ -2,6 +2,9 @@
 
 #include "hud.qh"
 #include "panel/scoreboard.qh"
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
 
 #define HUD_Write(s) fputs(fh, s)
 #define HUD_Write_Cvar(cvar) HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n"))
@@ -95,6 +98,8 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_Cvar("hud_panel_weapons_onlyowned");
                                        HUD_Write_Cvar("hud_panel_weapons_noncurrent_alpha");
                                        HUD_Write_Cvar("hud_panel_weapons_noncurrent_scale");
+                                       HUD_Write_Cvar("hud_panel_weapons_selection_radius");
+                                       HUD_Write_Cvar("hud_panel_weapons_selection_speed");
                                        break;
                                case HUD_PANEL_AMMO:
                                        HUD_Write_Cvar("hud_panel_ammo_onlycurrent");
@@ -113,6 +118,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_Cvar("hud_panel_powerups_text");
                                        break;
                                case HUD_PANEL_HEALTHARMOR:
+                                       HUD_Write_Cvar("hud_panel_healtharmor_combined");
                                        HUD_Write_Cvar("hud_panel_healtharmor_flip");
                                        HUD_Write_Cvar("hud_panel_healtharmor_iconalign");
                                        HUD_Write_Cvar("hud_panel_healtharmor_baralign");
@@ -121,7 +127,6 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_Cvar("hud_panel_healtharmor_progressbar_armor");
                                        HUD_Write_Cvar("hud_panel_healtharmor_progressbar_gfx");
                                        HUD_Write_Cvar("hud_panel_healtharmor_progressbar_gfx_smooth");
-                                       HUD_Write_Cvar("hud_panel_healtharmor_combined");
                                        HUD_Write_Cvar("hud_panel_healtharmor_text");
                                        break;
                                case HUD_PANEL_NOTIFY:
@@ -206,6 +211,9 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_Cvar("hud_panel_itemstime_ratio");
                                        HUD_Write_Cvar("hud_panel_itemstime_dynamicsize");
                                        break;
+                               case HUD_PANEL_MAPVOTE:
+                                       HUD_Write_Cvar("hud_panel_mapvote_highlight_border");
+                                       break;
                                case HUD_PANEL_QUICKMENU:
                                        HUD_Write_Cvar("hud_panel_quickmenu_align");
                                        break;
@@ -231,11 +239,11 @@ void HUD_Panel_ExportCfg(string cfgname)
 
                HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
 
-               LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
+               LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)"), filename);
                fclose(fh);
        }
        else
-               LOG_INFOF(_("^1Couldn't write to %s\n"), filename);
+               LOG_INFOF(_("^1Couldn't write to %s"), filename);
 }
 
 void HUD_Configure_Exit_Force()
@@ -652,12 +660,10 @@ void HUD_Panel_Arrow_Action(float nPrimary)
        }
 }
 
-void HUD_Panel_EnableMenu();
 entity tab_panels[hud_panels_MAX];
 entity tab_panel;
 vector tab_panel_pos;
 float tab_backward;
-void HUD_Panel_FirstInDrawQ(float id);
 void reset_tab_panels()
 {
        for (int i = 0; i < hud_panels_COUNT; ++i)
@@ -1021,9 +1027,7 @@ void HUD_Panel_FirstInDrawQ(float id)
                s = strcat(s, ftos(panel_order[i]), " ");
        }
        cvar_set("_hud_panelorder", s);
-       if(hud_panelorder_prev)
-               strunzone(hud_panelorder_prev);
-       hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
+       strcpy(hud_panelorder_prev, autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
 }
 
 void HUD_Panel_Highlight(float allow_move)
@@ -1107,15 +1111,11 @@ void HUD_Panel_EnableMenu()
        hud_configure_menu_open = 2;
        localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
 }
-float mouse_over_panel;
 void HUD_Panel_Mouse()
 {
        if(autocvar__menu_alpha == 1)
                return;
 
-       if (!autocvar_hud_cursormode)
-               update_mousepos();
-
        if(mouseClicked)
        {
                if(prevMouseClicked == 0)
@@ -1205,19 +1205,6 @@ void HUD_Panel_Mouse()
                if (mouse_over_panel && !tab_panel)
                        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
-       float cursor_alpha = 1 - autocvar__menu_alpha;
-
-       if(!mouse_over_panel)
-               draw_cursor_normal(mousepos, '1 1 1', cursor_alpha);
-       else if(mouse_over_panel == 1)
-               draw_cursor(mousepos, '0.5 0.5 0', "/cursor_move", '1 1 1', cursor_alpha);
-       else if(mouse_over_panel == 2)
-               draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize", '1 1 1', cursor_alpha);
-       else
-               draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize2", '1 1 1', cursor_alpha);
-
-       prevMouseClicked = mouseClicked;
 }
 void HUD_Configure_DrawGrid()
 {
@@ -1254,8 +1241,6 @@ void HUD_Configure_Frame()
 
                if(!hud_configure_prev)
                {
-                       if(autocvar_hud_cursormode)
-                               setcursormode(1);
                        hudShiftState = 0;
                        for(i = hud_panels_COUNT - 1; i >= 0; --i)
                                hud_panels_from(panel_order[i]).update_time = time;
@@ -1275,8 +1260,6 @@ void HUD_Configure_Frame()
        {
                if(hud_configure_menu_open)
                        hud_configure_menu_open = 0;
-               if(autocvar_hud_cursormode)
-                       setcursormode(0);
                hud_dynamic_shake_factor = -1;
        }
 }