]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud_config.qc
Merge branch 'master' into terencehill/ca_arena_mutators
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud_config.qc
index 3ad600e41c74de9e6d42918fbae7634dcedb091d..74bf36e893a944a73301be889bc03b635da26008 100644 (file)
@@ -64,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");
@@ -80,6 +80,10 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_aspect");
                                        HUD_Write_PanelCvar_q("_timeout");
                                        HUD_Write_PanelCvar_q("_timeout_effect");
+                                       HUD_Write_PanelCvar_q("_timeout_fadebgmin");
+                                       HUD_Write_PanelCvar_q("_timeout_fadefgmin");
+                                       HUD_Write_PanelCvar_q("_timeout_speed_in");
+                                       HUD_Write_PanelCvar_q("_timeout_speed_out");
                                        HUD_Write_PanelCvar_q("_onlyowned");
                                        break;
                                case HUD_PANEL_AMMO:
@@ -113,7 +117,6 @@ void HUD_Panel_ExportCfg(string cfgname)
                                case HUD_PANEL_NOTIFY:
                                        HUD_Write_PanelCvar_q("_flip");
                                        HUD_Write_PanelCvar_q("_fontsize");
-                                       HUD_Write_PanelCvar_q("_print");
                                        HUD_Write_PanelCvar_q("_time");
                                        HUD_Write_PanelCvar_q("_fadetime");
                                        break;
@@ -127,6 +130,8 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_scale");
                                        HUD_Write_PanelCvar_q("_maximized_scale");
                                        HUD_Write_PanelCvar_q("_maximized_size");
+                                       HUD_Write_PanelCvar_q("_maximized_rotation");
+                                       HUD_Write_PanelCvar_q("_maximized_zoommode"); 
                                        break;
                                case HUD_PANEL_SCORE:
                                        HUD_Write_PanelCvar_q("_rankings");
@@ -135,10 +140,13 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_alreadyvoted_alpha");
                                        break;
                                case HUD_PANEL_MODICONS:
+                                       HUD_Write_PanelCvar_q("_ca_layout");
                                        HUD_Write_PanelCvar_q("_dom_layout");
+                                       HUD_Write_PanelCvar_q("_freezetag_layout");
                                        break;
                                case HUD_PANEL_PRESSEDKEYS:
                                        HUD_Write_PanelCvar_q("_aspect");
+                                       HUD_Write_PanelCvar_q("_attack");
                                        break;
                                case HUD_PANEL_ENGINEINFO:
                                        HUD_Write_PanelCvar_q("_framecounter_time");
@@ -159,8 +167,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");
@@ -189,6 +200,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)
 {
@@ -621,20 +642,30 @@ 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", 0);
        keys = tokenize(con_keys); // findkeysforcommand returns data for this
 
-       float hit_con_bind, i;
+       float hit_con_bind = 0, i;
        for (i = 0; i < keys; ++i)
        {
                if(nPrimary == stof(argv(i)))
@@ -726,8 +757,8 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                }
                tab_backward = (hudShiftState & S_SHIFT);
 
-               float k, level, start_pos_x;
-               vector candidate_pos;
+               float k, level = 0, start_pos_x;
+               vector candidate_pos = '0 0 0';
                const float LEVELS_NUM = 4;
                float level_height = vid_conheight / LEVELS_NUM;
 :find_tab_panel
@@ -878,7 +909,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
 
 float HUD_Panel_Check_Mouse_Pos(float allow_move)
 {
-       float i, j, border;
+       float i, j = 0, border;
 
        while(j < HUD_PANEL_NUM)
        {
@@ -890,7 +921,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;
                }
@@ -945,7 +976,7 @@ void HUD_Panel_FirstInDrawQ(float id)
        panel_order[0] = id;
        
        // let's save them into the cvar by some strcat trickery
-       string s;
+       string s = "";
        for(i = 0; i < HUD_PANEL_NUM; ++i)
        {
                s = strcat(s, ftos(panel_order[i]), " ");
@@ -958,7 +989,7 @@ void HUD_Panel_FirstInDrawQ(float id)
 
 void HUD_Panel_Highlight(float allow_move)
 {
-       float i, j, border;
+       float i, j = 0, border;
 
        while(j < HUD_PANEL_NUM)
        {
@@ -970,7 +1001,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);
@@ -1049,16 +1080,16 @@ void HUD_Panel_Mouse()
        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 not(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);
+       }
 
        if(mouseClicked)
        {
@@ -1118,7 +1149,7 @@ void HUD_Panel_Mouse()
                        HUD_Panel_SetPos(mousepos - panel_click_distance);
                else if(highlightedAction == 2)
                {
-                       vector mySize;
+                       vector mySize = '0 0 0';
                        if(resizeCorner == 1) {
                                mySize_x = panel_click_resizeorigin_x - (mousepos_x - panel_click_distance_x);
                                mySize_y = panel_click_resizeorigin_y - (mousepos_y - panel_click_distance_y);
@@ -1146,15 +1177,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;
 }