]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud_config.qc
Apply new pitch settings by TimePath
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud_config.qc
index f91fd0a8c6773eb0355f57251511714e917d7707..8ecc326b1e788441547b2fd7ec2081ffbd7bbd60 100644 (file)
@@ -119,6 +119,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_fontsize");
                                        HUD_Write_PanelCvar_q("_time");
                                        HUD_Write_PanelCvar_q("_fadetime");
+                                       HUD_Write_PanelCvar_q("_icon_aspect");
                                        break;
                                case HUD_PANEL_TIMER:
                                        HUD_Write_PanelCvar_q("_increment");
@@ -131,7 +132,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_maximized_scale");
                                        HUD_Write_PanelCvar_q("_maximized_size");
                                        HUD_Write_PanelCvar_q("_maximized_rotation");
-                                       HUD_Write_PanelCvar_q("_maximized_zoommode"); 
+                                       HUD_Write_PanelCvar_q("_maximized_zoommode");
                                        break;
                                case HUD_PANEL_SCORE:
                                        HUD_Write_PanelCvar_q("_rankings");
@@ -193,11 +194,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
 
-               print(sprintf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename));
+               printf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
                fclose(fh);
        }
        else
-               print(sprintf(_("^1Couldn't write to %s\n"), filename));
+               printf(_("^1Couldn't write to %s\n"), filename);
 }
 
 void HUD_Configure_Exit_Force()
@@ -651,10 +652,6 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
        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;
@@ -662,6 +659,15 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                return true;
        }
 
+       // block any input while a menu dialog is fading
+       // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
+       if(autocvar__menu_alpha)
+       {
+               hudShiftState = 0;
+               mouseClicked = 0;
+               return true;
+       }
+
        // allow console bind to work
        string con_keys;
        float keys;
@@ -721,7 +727,6 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                if (bInputType == 1)
                        return true;
                menu_enabled = 1;
-               menu_enabled_time = time;
                localcmd("menu_showhudexit\n");
        }
        else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
@@ -978,7 +983,7 @@ void HUD_Panel_FirstInDrawQ(float id)
        }
        // now save the new top id
        panel_order[0] = id;
-       
+
        // let's save them into the cvar by some strcat trickery
        string s = "";
        for(i = 0; i < HUD_PANEL_NUM; ++i)
@@ -1068,29 +1073,18 @@ void HUD_Panel_Highlight(float allow_move)
 void HUD_Panel_EnableMenu()
 {
        menu_enabled = 2;
-       menu_enabled_time = time;
        localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
 }
 float mouse_over_panel;
 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 (autocvar__menu_alpha == 0 && time - menu_enabled_time > 0.5)
-               menu_enabled = 0;
-
-       /*
-       print("menu_enabled: ", ftos(menu_enabled), "\n");
-       print("Highlighted: ", ftos(highlightedPanel), "\n");
-       print("Menu theAlpha: ", ftos(autocvar__menu_alpha), "\n");
-       */
-
        if(autocvar__menu_alpha == 1)
                return;
 
-       if not(autocvar_hud_cursormode)
+       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);
        }
@@ -1218,6 +1212,7 @@ void HUD_Configure_DrawGrid()
        }
 }
 
+float _menu_alpha_prev;
 void HUD_Configure_Frame()
 {
        float i;
@@ -1228,6 +1223,7 @@ void HUD_Configure_Frame()
                        HUD_Configure_Exit_Force();
                        return;
                }
+
                if(!hud_configure_prev || hud_configure_prev == -1)
                {
                        if(autocvar_hud_cursormode)
@@ -1236,6 +1232,15 @@ void HUD_Configure_Frame()
                        for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
                                hud_panel[panel_order[i]].update_time = time;
                }
+
+               // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
+               if(autocvar__menu_alpha != _menu_alpha_prev)
+               {
+                       if(autocvar__menu_alpha == 0)
+                               menu_enabled = 0;
+                       _menu_alpha_prev = autocvar__menu_alpha;
+               }
+
                HUD_Configure_DrawGrid();
        }
        else if(hud_configure_prev)