]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
Merge branch 'terencehill/speedpanel' into terencehill/newpanelhud
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index ccde47f7ffe3b0aa7e8963bd2dfd8c95f65248bf..ab95ec171a1ae2bc4e62f71f77259480feeccfd6 100644 (file)
@@ -1124,18 +1124,18 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
 
        if(nPrimary == K_CTRL)
        {
-               if (bInputType == 1)
+               if (bInputType == 1) //ctrl has been released
                {
                        if (tab_panel != -1)
                        {
-                               //switch to selected panel when ctrl has been released
+                               //switch to selected panel
+                               highlightedPanel = tab_panel;
                                highlightedPanel_prev = tab_panel;
                                HUD_Panel_FirstInDrawQ(highlightedPanel_prev);
                        }
+                       tab_panel = -1;
+                       reset_tab_panels();
                }
-               //reset on press AND on release
-               tab_panel = -1;
-               reset_tab_panels();
        }
 
        if(nPrimary == K_MOUSE1)
@@ -1149,10 +1149,18 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                        return true;
                }
        }
-       else if(nPrimary == K_TAB && hudShiftState & S_CTRL) //TODO: move this case down
+       else if(nPrimary == K_ESCAPE)
        {
                if (bInputType == 1)
                        return true;
+               menu_enabled = 1;
+               menu_enabled_time = time;
+               localcmd("menu_showhudexit\n");
+       }
+       else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // select and highlight another panel
+       {
+               if (bInputType == 1 || mouseClicked)
+                       return true;
 
                //FIXME: if a panel is highlighted, has the same pos_x and lays in the same level
                //of other panels then next consecutive ctrl-tab will select the highlighted panel too
@@ -1233,21 +1241,16 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
 
                tab_panels[tab_panel] = tab_panel;
        }
-       else if(nPrimary == K_ESCAPE)
-       {
-               if (bInputType == 1)
-                       return true;
-               menu_enabled = 1;
-               menu_enabled_time = time;
-               localcmd("menu_showhudexit\n");
-       }
        else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
        {
                if (bInputType == 1 || mouseClicked)
                        return true;
 
                if (highlightedPanel_prev != -1)
+               {
+                       HUD_Panel_GetName(highlightedPanel_prev);
                        cvar_set(strcat("hud_panel_", panel_name), ftos(!(panel_enabled)));
+               }
                else
                        cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
        }
@@ -1258,6 +1261,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
 
                if (highlightedPanel_prev != -1)
                {
+                       HUD_Panel_UpdatePosSizeForId(highlightedPanel_prev);
                        panel_size_copied = panel_size;
                        highlightedPanel_copied = highlightedPanel_prev;
                }
@@ -1288,6 +1292,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                highlightedPanel_backup = highlightedPanel_prev;
 
                s = strcat(ftos(tmp_size_x/vid_conwidth), " ", ftos(tmp_size_y/vid_conheight));
+               HUD_Panel_GetName(highlightedPanel_prev);
                cvar_set(strcat("hud_panel_", panel_name, "_size"), s);
        }
        else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
@@ -1529,6 +1534,12 @@ void HUD_Panel_Mouse()
 
        if(mouseClicked)
        {
+               if (tab_panel != -1)
+               {
+                       //stop ctrl-tab selection
+                       tab_panel = -1;
+                       reset_tab_panels();
+               }
                if(prevMouseClicked == 0)
                {
                        HUD_Panel_Highlight(); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
@@ -4015,12 +4026,18 @@ float vote_change; // "time" when vote_active changed
 
 void HUD_VoteWindow(void) 
 {
-    uid2name_dialog = 0;
        if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
        {
                vote_active = 1;
-               vote_called_vote = strzone(strcat("^2Name ^7instead of \"^1Unregistered player\"", " ^7in stats"));
-        uid2name_dialog = 1;
+               if (autocvar__hud_configure)
+               {
+                       vote_yescount = 0;
+                       vote_nocount = 0;
+                       print("^1You have to answer before entering hud configure mode\n");
+                       cvar_set("_hud_configure", "0");
+               }
+               vote_called_vote = strzone("^2Name ^7instead of \"^1Unregistered player^7\" in stats");
+               uid2name_dialog = 1;
        }
 
        if(!autocvar_hud_panel_vote && !autocvar__hud_configure)