]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make some float variables (panel ids) into entities (panels)
authorterencehill <piuntn@gmail.com>
Mon, 25 Mar 2013 09:33:33 +0000 (10:33 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 25 Mar 2013 09:33:33 +0000 (10:33 +0100)
qcsrc/client/Main.qc
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/hud_config.qc

index 3d286b31dbe0db264819b6ece1476e6c6e878ea8..5b9429ebf070b2b2dcbbc59fff447897bcb04613 100644 (file)
@@ -212,7 +212,6 @@ void CSQC_Init(void)
 
        hud_skin_path = strzone(strcat("gfx/hud/", autocvar_hud_skin));
        hud_configure_prev = -1;
-       tab_panel = -1;
 
        draw_currentSkin = strzone(strcat("gfx/menu/", cvar_string("menu_skin")));
 }
index eb529c094f8d981db4e691277da6cb9ac1582975..03ba971781019141d466209ca994ed7c8d3945dc 100644 (file)
@@ -4503,15 +4503,15 @@ void HUD_Main (void)
 
        if(autocvar__hud_configure)
        {
-               if(tab_panel != -1)
+               if(tab_panel)
                {
-                       panel = hud_panel[tab_panel];
+                       panel = tab_panel;
                        HUD_Panel_UpdatePosSize()
                        drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
                }
-               if(highlightedPanel != -1)
+               if(highlightedPanel)
                {
-                       panel = hud_panel[highlightedPanel];
+                       panel = highlightedPanel;
                        HUD_Panel_UpdatePosSize()
                        HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha));
                }
index 9c8a9128cbbc4efc354b8065ee91bc3cd8eb3618..30f93d498505265192f2e4693c1f31162a4182a8 100644 (file)
@@ -14,7 +14,7 @@ vector mousepos;
 vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click)
 vector panel_click_resizeorigin; // coordinates for opposite point when resizing
 float resizeCorner; // 1 = topleft, 2 = topright, 3 = bottomleft, 4 = bottomright
-var float highlightedPanel = -1;
+entity highlightedPanel;
 float highlightedAction; // 0 = nothing, 1 = move, 2 = resize
 
 const float BORDER_MULTIPLIER = 0.25;
@@ -56,11 +56,10 @@ string hud_skin_prev;
 
 var vector progressbar_color;
 
-var float highlightedPanel_backup = -1;
+entity highlightedPanel_backup;
 var vector panel_pos_backup;
 var vector panel_size_backup;
 
-var float highlightedPanel_copied = -1; //this is good only to know if there is something copied
 var vector panel_size_copied;
 
 entity panel;
@@ -214,7 +213,7 @@ if(panel_bg_color_team_str == "") {\
 
 // the check doesn't allow to fade this panel when showing the panel-specific menu dialog
 #define HUD_Panel_ApplyFadeAlpha()\
-if(!(menu_enabled == 2 && panel.panel_id == highlightedPanel))\
+if(!(menu_enabled == 2 && panel == highlightedPanel))\
 {\
        panel_bg_alpha *= hud_fade_alpha;\
        panel_fg_alpha *= hud_fade_alpha;\
@@ -230,7 +229,7 @@ panel_bg_alpha = stof(panel_bg_alpha_str);\
 if(autocvar__hud_configure) {\
        if(!panel_enabled)\
                panel_bg_alpha = 0.25;\
-       else if(menu_enabled == 2 && panel.panel_id == highlightedPanel)\
+       else if(menu_enabled == 2 && panel == highlightedPanel)\
                panel_bg_alpha = (1 - autocvar__menu_alpha) * max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha) + autocvar__menu_alpha * panel_bg_alpha;\
        else\
                panel_bg_alpha = max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha);\
@@ -329,7 +328,7 @@ if(panel.update_time < time) { \
        panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \
        panel_bg_padding_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_padding")); \
        HUD_Panel_GetStringVars()\
-       if(menu_enabled == 2 && panel.panel_id == highlightedPanel) {\
+       if(menu_enabled == 2 && panel == highlightedPanel) {\
                HUD_Panel_GetMenuSize()\
                HUD_Panel_GetMenuPos()\
        } \
@@ -361,7 +360,7 @@ if(panel.update_time < time) { \
 panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \
 panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size"))); \
 HUD_Panel_GetScaledVectors()\
-if(menu_enabled == 2 && panel.panel_id == highlightedPanel) {\
+if(menu_enabled == 2 && panel == highlightedPanel) {\
        HUD_Panel_GetMenuSize()\
        HUD_Panel_GetMenuPos()\
 }\
index 0cba085679a9aa64145336f7eeb354bc77915669..abe28920c5daec44b7983355d52096beeb3082e6 100644 (file)
@@ -217,7 +217,7 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
        myTarget = myPos;
 
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
-               if(i == highlightedPanel || !panel_enabled)
+               if(hud_panel[i] == highlightedPanel || !panel_enabled)
                        continue;
 
                panel = hud_panel[i];
@@ -281,7 +281,7 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
 
 void HUD_Panel_SetPos(vector pos)
 {
-       panel = hud_panel[highlightedPanel];
+       panel = highlightedPanel;
        HUD_Panel_UpdatePosSize()
        vector mySize;
        mySize = panel_size;
@@ -304,7 +304,7 @@ void HUD_Panel_SetPos(vector pos)
        string s;
        s = strcat(ftos(pos_x/vid_conwidth), " ", ftos(pos_y/vid_conheight));
 
-       cvar_set(strcat("hud_panel_", hud_panel[highlightedPanel].panel_name, "_pos"), s);
+       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
 }
 
 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
@@ -318,7 +318,7 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
        ratio = mySize_x/mySize_y;
 
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
-               if(i == highlightedPanel || !panel_enabled)
+               if(hud_panel[i] == highlightedPanel || !panel_enabled)
                        continue;
 
                panel = hud_panel[i];
@@ -421,7 +421,7 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
 
 void HUD_Panel_SetPosSize(vector mySize)
 {
-       panel = hud_panel[highlightedPanel];
+       panel = highlightedPanel;
        HUD_Panel_UpdatePosSize()
        vector resizeorigin;
        resizeorigin = panel_click_resizeorigin;
@@ -431,7 +431,7 @@ void HUD_Panel_SetPosSize(vector mySize)
        mySize_x = max(0.025 * vid_conwidth, mySize_x);
        mySize_y = max(0.025 * vid_conheight, mySize_y);
 
-       if(highlightedPanel == HUD_PANEL_CHAT) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
+       if(highlightedPanel == HUD_PANEL(CHAT)) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
        {
                mySize_x = max(17 * autocvar_con_chatsize, mySize_x);
                mySize_y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize_y);
@@ -502,20 +502,19 @@ void HUD_Panel_SetPosSize(vector mySize)
        //if(cvar("hud_configure_checkcollisions_debug"))
                //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
 
-       entity e = hud_panel[highlightedPanel];
        string s;
        s = strcat(ftos(mySize_x/vid_conwidth), " ", ftos(mySize_y/vid_conheight));
-       cvar_set(strcat("hud_panel_", e.panel_name, "_size"), s);
+       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
 
        s = strcat(ftos(myPos_x/vid_conwidth), " ", ftos(myPos_y/vid_conheight));
-       cvar_set(strcat("hud_panel_", e.panel_name, "_pos"), s);
+       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
 }
 
 float pressed_key_time;
 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
 void HUD_Panel_Arrow_Action(float nPrimary)
 {
-       if (highlightedPanel == -1)
+       if(!highlightedPanel)
                return;
 
        hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
@@ -550,7 +549,7 @@ void HUD_Panel_Arrow_Action(float nPrimary)
                        step = (step / 64) * (1 + 2 * (time - pressed_key_time));
        }
 
-       panel = hud_panel[highlightedPanel];
+       panel = highlightedPanel;
        HUD_Panel_UpdatePosSize()
 
        highlightedPanel_initial_pos = panel_pos;
@@ -610,7 +609,7 @@ void HUD_Panel_Arrow_Action(float nPrimary)
                HUD_Panel_SetPos(pos);
        }
 
-       panel = hud_panel[highlightedPanel];
+       panel = highlightedPanel;
        HUD_Panel_UpdatePosSize()
 
        if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
@@ -631,15 +630,16 @@ float prevMouseClickedTime; // time during previous left mouse click, to check f
 vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
 
 void HUD_Panel_EnableMenu();
-float tab_panels[HUD_PANEL_MAX];
-float tab_panel, tab_backward;
+entity tab_panels[HUD_PANEL_MAX];
+entity tab_panel;
 vector tab_panel_pos;
+float tab_backward;
 void HUD_Panel_FirstInDrawQ(float id);
 void reset_tab_panels()
 {
        int i;
        for(i = 0; i < HUD_PANEL_NUM; ++i)
-               tab_panels[i] = -1;
+               tab_panels[i] = world;
 }
 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
 {
@@ -690,14 +690,14 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
        {
                if (bInputType == 1) //ctrl has been released
                {
-                       if (tab_panel != -1)
+                       if (tab_panel)
                        {
                                //switch to selected panel
                                highlightedPanel = tab_panel;
                                highlightedAction = 0;
-                               HUD_Panel_FirstInDrawQ(highlightedPanel);
+                               HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
                        }
-                       tab_panel = -1;
+                       tab_panel = world;
                        reset_tab_panels();
                }
        }
@@ -741,19 +741,18 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                //(it should only after every other panel of the hud)
                //It's a minor bug anyway, we can live with it
 
-               float starting_panel;
-               float old_tab_panel = tab_panel;
-               if (tab_panel == -1) //first press of TAB
+               entity starting_panel;
+               entity old_tab_panel = tab_panel;
+               if (!tab_panel) //first press of TAB
                {
-                       if (highlightedPanel != -1)
                        if (highlightedPanel)
                        {
-                               panel = hud_panel[highlightedPanel];
+                               panel = highlightedPanel;
                                HUD_Panel_UpdatePosSize()
                        }
                        else
                                panel_pos = '0 0 0';
-                       starting_panel = highlightedPanel; //can be -1, it means no starting panel
+                       starting_panel = highlightedPanel;
                        tab_panel_pos = panel_pos; //to compute level
                }
                else
@@ -772,36 +771,36 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                level = floor(tab_panel_pos_y / level_height) * level_height; //starting level
                candidate_pos_x = (!tab_backward) ? vid_conwidth : 0;
                start_pos_x = tab_panel_pos_x;
-               tab_panel = -1;
+               tab_panel = world;
                k=0;
                while(++k)
                {
                        for(i = 0; i < HUD_PANEL_NUM; ++i)
                        {
-                               if (i == tab_panels[i] || i == starting_panel)
-                                       continue;
                                panel = hud_panel[i];
+                               if (panel == tab_panels[i] || panel == starting_panel)
+                                       continue;
                                HUD_Panel_UpdatePosSize()
                                if (panel_pos_y >= level && (panel_pos_y - level) < level_height)
                                if (  ( !tab_backward && panel_pos_x >= start_pos_x && (panel_pos_x < candidate_pos_x || (panel_pos_x == candidate_pos_x && panel_pos_y <= candidate_pos_y)) )
                                        || ( tab_backward && panel_pos_x <= start_pos_x && (panel_pos_x > candidate_pos_x || (panel_pos_x == candidate_pos_x && panel_pos_y >= candidate_pos_y)) )  )
                                {
-                                       tab_panel = i;
+                                       tab_panel = panel;
                                        tab_panel_pos = candidate_pos = panel_pos;
                                }
                        }
-                       if (tab_panel != -1)
+                       if (tab_panel)
                                break;
                        if (k == LEVELS_NUM) //tab_panel not found
                        {
                                reset_tab_panels();
-                               if (old_tab_panel == -2) //this prevents an infinite loop (should not happen normally)
+                               if (!old_tab_panel)
                                {
-                                       tab_panel = -1;
+                                       tab_panel = world;
                                        return true;
                                }
                                starting_panel = old_tab_panel;
-                               old_tab_panel = -2;
+                               old_tab_panel = world;
                                goto find_tab_panel; //u must find tab_panel!
                        }
                        if (!tab_backward)
@@ -818,18 +817,15 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                        }
                }
 
-               tab_panels[tab_panel] = tab_panel;
+               tab_panels[tab_panel.panel_id] = tab_panel;
        }
        else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
        {
                if (bInputType == 1 || mouseClicked)
                        return true;
 
-               if (highlightedPanel != -1)
-               {
-                       entity e = hud_panel[highlightedPanel];
-                       cvar_set(strcat("hud_panel_", e.panel_name), ftos(!(panel_enabled)));
-               }
+               if (highlightedPanel)
+                       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!(panel_enabled)));
                else
                        cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
        }
@@ -838,12 +834,11 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                if (bInputType == 1 || mouseClicked)
                        return true;
 
-               if (highlightedPanel != -1)
+               if (highlightedPanel)
                {
-                       panel = hud_panel[highlightedPanel];
+                       panel = highlightedPanel;
                        HUD_Panel_UpdatePosSize()
                        panel_size_copied = panel_size;
-                       highlightedPanel_copied = highlightedPanel;
                }
        }
        else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
@@ -851,10 +846,10 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                if (bInputType == 1 || mouseClicked)
                        return true;
 
-               if (highlightedPanel_copied == -1 || highlightedPanel == -1)
+               if (panel_size_copied == '0 0 0' || !highlightedPanel)
                        return true;
 
-               panel = hud_panel[highlightedPanel];
+               panel = highlightedPanel;
                HUD_Panel_UpdatePosSize()
 
                // reduce size if it'd go beyond screen boundaries
@@ -873,22 +868,20 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                highlightedPanel_backup = highlightedPanel;
 
                s = strcat(ftos(tmp_size_x/vid_conwidth), " ", ftos(tmp_size_y/vid_conheight));
-               entity e = hud_panel[highlightedPanel];
-               cvar_set(strcat("hud_panel_", e.panel_name, "_size"), s);
+               cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
        }
        else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
        {
                if (bInputType == 1 || mouseClicked)
                        return true;
                //restore previous values
-               if (highlightedPanel_backup != -1)
+               if (highlightedPanel_backup)
                {
-                       entity e = hud_panel[highlightedPanel_backup];
                        s = strcat(ftos(panel_pos_backup_x/vid_conwidth), " ", ftos(panel_pos_backup_y/vid_conheight));
-                       cvar_set(strcat("hud_panel_", e.panel_name, "_pos"), s);
+                       cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
                        s = strcat(ftos(panel_size_backup_x/vid_conwidth), " ", ftos(panel_size_backup_y/vid_conheight));
-                       cvar_set(strcat("hud_panel_", e.panel_name, "_size"), s);
-                       highlightedPanel_backup = -1;
+                       cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
+                       highlightedPanel_backup = world;
                }
        }
        else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
@@ -908,7 +901,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
        {
                if (bInputType == 1)
                        return true;
-               if (highlightedPanel != -1)
+               if (highlightedPanel)
                        HUD_Panel_EnableMenu();
        }
        else if(hit_con_bind)
@@ -1015,7 +1008,7 @@ void HUD_Panel_Highlight(float allow_move)
                // 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)
                {
-                       highlightedPanel = i;
+                       highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 1;
                        panel_click_distance = mousepos - panel_pos;
@@ -1024,7 +1017,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from topleft border
                else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + 0.5 * panel_size_y)
                {
-                       highlightedPanel = i;
+                       highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 1;
@@ -1035,7 +1028,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from topright border
                else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + 0.5 * panel_size_y)
                {
-                       highlightedPanel = i;
+                       highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 2;
@@ -1047,7 +1040,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from bottomleft border
                else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + panel_size_y + border)
                {
-                       highlightedPanel = i;
+                       highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 3;
@@ -1059,7 +1052,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from bottomright border
                else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + panel_size_y + border)
                {
-                       highlightedPanel = i;
+                       highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 4;
@@ -1068,7 +1061,7 @@ void HUD_Panel_Highlight(float allow_move)
                        return;
                }
        }
-       highlightedPanel = -1;
+       highlightedPanel = world;
        highlightedAction = 0;
 }
 
@@ -1076,7 +1069,7 @@ void HUD_Panel_EnableMenu()
 {
        menu_enabled = 2;
        menu_enabled_time = time;
-       localcmd("menu_showhudoptions ", hud_panel[highlightedPanel].panel_name, "\n");
+       localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
 }
 float mouse_over_panel;
 void HUD_Panel_Mouse()
@@ -1106,21 +1099,21 @@ void HUD_Panel_Mouse()
        {
                if(prevMouseClicked == 0)
                {
-                       if (tab_panel != -1)
+                       if (tab_panel)
                        {
                                //stop ctrl-tab selection
-                               tab_panel = -1;
+                               tab_panel = world;
                                reset_tab_panels();
                        }
                        HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
                                                                        // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
-                       if (highlightedPanel != -1)
+                       if (highlightedPanel)
                        {
                                highlightedPanel_initial_pos = panel_pos;
                                highlightedPanel_initial_size = panel_size;
                        }
                        // doubleclick check
-                       if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel != -1 && prevMouseClickedPos == mousepos)
+                       if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
                        {
                                mouseClicked = 0; // to prevent spam, I guess.
                                HUD_Panel_EnableMenu();
@@ -1137,11 +1130,11 @@ void HUD_Panel_Mouse()
                }
                else
                {
-                       panel = hud_panel[highlightedPanel];
+                       panel = highlightedPanel;
                        HUD_Panel_UpdatePosSize()
                }
 
-               if (highlightedPanel != -1)
+               if (highlightedPanel)
                {
                        drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
                        if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
@@ -1186,7 +1179,7 @@ void HUD_Panel_Mouse()
                        mouse_over_panel = 0;
                else
                        mouse_over_panel = HUD_Panel_Check_Mouse_Pos(TRUE);
-               if (mouse_over_panel && tab_panel == -1)
+               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