]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/hud_config.qc
Add a hook to save custom HUD cvars from a mutator
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / hud_config.qc
index 654d49ba8c60f5ce9f59b3eb40bd2b24877d28fa..c358cf6438a1f734fde5729995d2cf0e0682d47f 100644 (file)
@@ -226,6 +226,8 @@ void HUD_Panel_ExportCfg(string cfgname)
                        }
                        HUD_Write("\n");
                }
+               MUTATOR_CALLHOOK(HUD_WriteCvars);
+
                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);
@@ -848,7 +850,10 @@ LABEL(find_tab_panel)
                        return true;
 
                if (highlightedPanel)
-                       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
+               {
+                       if(panel.panel_configflags & PANEL_CONFIG_CANBEOFF)
+                               cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
+               }
                else
                        cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
        }
@@ -1108,12 +1113,7 @@ void HUD_Panel_Mouse()
                return;
 
        if (!autocvar_hud_cursormode)
-       {
-               mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
-
-               mousepos.x = bound(0, mousepos.x, vid_conwidth);
-               mousepos.y = bound(0, mousepos.y, vid_conheight);
-       }
+               update_mousepos();
 
        if(mouseClicked)
        {