]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/hud_config.qc
Merge branch 'master' into martin-t/limit
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / hud_config.qc
index 4897ba55176d6e4e47fa8ec5b9e508467c0199d3..27a33c408b50de484b40dbbd9722b47972756e4e 100644 (file)
@@ -2,15 +2,20 @@
 
 #include "hud.qh"
 #include "panel/scoreboard.qh"
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
+#include <client/view.qh>
 
 #define HUD_Write(s) fputs(fh, s)
 #define HUD_Write_Cvar(cvar) HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n"))
-#define HUD_Write_PanelCvar(cvar_suf) HUD_Write_Cvar(strcat("hud_panel_", panel.panel_name, cvar_suf))
+#define HUD_Write_PanelCvar(cvar_suf) str = strcat("hud_panel_", panel.panel_name, cvar_suf), HUD_Write_Cvar(str)
 // Save the config
 void HUD_Panel_ExportCfg(string cfgname)
 {
        float fh;
        string filename = strcat("hud_", autocvar_hud_skin, "_", cfgname, ".cfg");
+       string str = "";
        fh = fopen(filename, FILE_WRITE);
        if(fh >= 0)
        {
@@ -40,6 +45,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                HUD_Write_Cvar("hud_progressbar_health_color");
                HUD_Write_Cvar("hud_progressbar_armor_color");
                HUD_Write_Cvar("hud_progressbar_fuel_color");
+               HUD_Write_Cvar("hud_progressbar_oxygen_color");
                HUD_Write_Cvar("hud_progressbar_nexball_color");
                HUD_Write_Cvar("hud_progressbar_speed_color");
                HUD_Write_Cvar("hud_progressbar_acceleration_color");
@@ -71,157 +77,163 @@ void HUD_Panel_ExportCfg(string cfgname)
                        HUD_Write_PanelCvar("_bg_padding");
                        switch(panel) {
                                case HUD_PANEL_WEAPONS:
-                                       HUD_Write_PanelCvar("_accuracy");
-                                       HUD_Write_PanelCvar("_label");
-                                       HUD_Write_PanelCvar("_label_scale");
-                                       HUD_Write_PanelCvar("_complainbubble");
-                                       HUD_Write_PanelCvar("_complainbubble_padding");
-                                       HUD_Write_PanelCvar("_complainbubble_time");
-                                       HUD_Write_PanelCvar("_complainbubble_fadetime");
-                                       HUD_Write_PanelCvar("_complainbubble_color_outofammo");
-                                       HUD_Write_PanelCvar("_complainbubble_color_donthave");
-                                       HUD_Write_PanelCvar("_complainbubble_color_unavailable");
-                                       HUD_Write_PanelCvar("_ammo");
-                                       HUD_Write_PanelCvar("_ammo_color");
-                                       HUD_Write_PanelCvar("_ammo_alpha");
-                                       HUD_Write_PanelCvar("_aspect");
-                                       HUD_Write_PanelCvar("_timeout");
-                                       HUD_Write_PanelCvar("_timeout_effect");
-                                       HUD_Write_PanelCvar("_timeout_fadebgmin");
-                                       HUD_Write_PanelCvar("_timeout_fadefgmin");
-                                       HUD_Write_PanelCvar("_timeout_speed_in");
-                                       HUD_Write_PanelCvar("_timeout_speed_out");
-                                       HUD_Write_PanelCvar("_onlyowned");
-                                       HUD_Write_PanelCvar("_noncurrent_alpha");
-                                       HUD_Write_PanelCvar("_noncurrent_scale");
+                                       HUD_Write_Cvar("hud_panel_weapons_accuracy");
+                                       HUD_Write_Cvar("hud_panel_weapons_label");
+                                       HUD_Write_Cvar("hud_panel_weapons_label_scale");
+                                       HUD_Write_Cvar("hud_panel_weapons_complainbubble");
+                                       HUD_Write_Cvar("hud_panel_weapons_complainbubble_padding");
+                                       HUD_Write_Cvar("hud_panel_weapons_complainbubble_time");
+                                       HUD_Write_Cvar("hud_panel_weapons_complainbubble_fadetime");
+                                       HUD_Write_Cvar("hud_panel_weapons_complainbubble_color_outofammo");
+                                       HUD_Write_Cvar("hud_panel_weapons_complainbubble_color_donthave");
+                                       HUD_Write_Cvar("hud_panel_weapons_complainbubble_color_unavailable");
+                                       HUD_Write_Cvar("hud_panel_weapons_ammo");
+                                       HUD_Write_Cvar("hud_panel_weapons_ammo_color");
+                                       HUD_Write_Cvar("hud_panel_weapons_ammo_alpha");
+                                       HUD_Write_Cvar("hud_panel_weapons_aspect");
+                                       HUD_Write_Cvar("hud_panel_weapons_timeout");
+                                       HUD_Write_Cvar("hud_panel_weapons_timeout_effect");
+                                       HUD_Write_Cvar("hud_panel_weapons_timeout_fadebgmin");
+                                       HUD_Write_Cvar("hud_panel_weapons_timeout_fadefgmin");
+                                       HUD_Write_Cvar("hud_panel_weapons_timeout_speed_in");
+                                       HUD_Write_Cvar("hud_panel_weapons_timeout_speed_out");
+                                       HUD_Write_Cvar("hud_panel_weapons_onlyowned");
+                                       HUD_Write_Cvar("hud_panel_weapons_orderbyimpulse");
+                                       HUD_Write_Cvar("hud_panel_weapons_noncurrent_alpha");
+                                       HUD_Write_Cvar("hud_panel_weapons_noncurrent_scale");
+                                       HUD_Write_Cvar("hud_panel_weapons_selection_radius");
+                                       HUD_Write_Cvar("hud_panel_weapons_selection_speed");
                                        break;
                                case HUD_PANEL_AMMO:
-                                       HUD_Write_PanelCvar("_onlycurrent");
-                                       HUD_Write_PanelCvar("_noncurrent_alpha");
-                                       HUD_Write_PanelCvar("_noncurrent_scale");
-                                       HUD_Write_PanelCvar("_iconalign");
-                                       HUD_Write_PanelCvar("_progressbar");
-                                       HUD_Write_PanelCvar("_progressbar_name");
-                                       HUD_Write_PanelCvar("_progressbar_xoffset");
-                                       HUD_Write_PanelCvar("_text");
+                                       HUD_Write_Cvar("hud_panel_ammo_onlycurrent");
+                                       HUD_Write_Cvar("hud_panel_ammo_noncurrent_alpha");
+                                       HUD_Write_Cvar("hud_panel_ammo_noncurrent_scale");
+                                       HUD_Write_Cvar("hud_panel_ammo_iconalign");
+                                       HUD_Write_Cvar("hud_panel_ammo_progressbar");
+                                       HUD_Write_Cvar("hud_panel_ammo_progressbar_name");
+                                       HUD_Write_Cvar("hud_panel_ammo_progressbar_xoffset");
+                                       HUD_Write_Cvar("hud_panel_ammo_text");
                                        break;
                                case HUD_PANEL_POWERUPS:
-                                       HUD_Write_PanelCvar("_iconalign");
-                                       HUD_Write_PanelCvar("_baralign");
-                                       HUD_Write_PanelCvar("_progressbar");
-                                       HUD_Write_PanelCvar("_text");
+                                       HUD_Write_Cvar("hud_panel_powerups_iconalign");
+                                       HUD_Write_Cvar("hud_panel_powerups_baralign");
+                                       HUD_Write_Cvar("hud_panel_powerups_progressbar");
+                                       HUD_Write_Cvar("hud_panel_powerups_text");
                                        break;
                                case HUD_PANEL_HEALTHARMOR:
-                                       HUD_Write_PanelCvar("_flip");
-                                       HUD_Write_PanelCvar("_iconalign");
-                                       HUD_Write_PanelCvar("_baralign");
-                                       HUD_Write_PanelCvar("_progressbar");
-                                       HUD_Write_PanelCvar("_progressbar_health");
-                                       HUD_Write_PanelCvar("_progressbar_armor");
-                                       HUD_Write_PanelCvar("_progressbar_gfx");
-                                       HUD_Write_PanelCvar("_progressbar_gfx_smooth");
-                                       HUD_Write_PanelCvar("_combined");
-                                       HUD_Write_PanelCvar("_text");
+                                       HUD_Write_Cvar("hud_panel_healtharmor_combined");
+                                       HUD_Write_Cvar("hud_panel_healtharmor_flip");
+                                       HUD_Write_Cvar("hud_panel_healtharmor_iconalign");
+                                       HUD_Write_Cvar("hud_panel_healtharmor_baralign");
+                                       HUD_Write_Cvar("hud_panel_healtharmor_progressbar");
+                                       HUD_Write_Cvar("hud_panel_healtharmor_progressbar_health");
+                                       HUD_Write_Cvar("hud_panel_healtharmor_progressbar_armor");
+                                       HUD_Write_Cvar("hud_panel_healtharmor_progressbar_gfx");
+                                       HUD_Write_Cvar("hud_panel_healtharmor_progressbar_gfx_smooth");
+                                       HUD_Write_Cvar("hud_panel_healtharmor_text");
                                        break;
                                case HUD_PANEL_NOTIFY:
-                                       HUD_Write_PanelCvar("_flip");
-                                       HUD_Write_PanelCvar("_fontsize");
-                                       HUD_Write_PanelCvar("_time");
-                                       HUD_Write_PanelCvar("_fadetime");
-                                       HUD_Write_PanelCvar("_icon_aspect");
+                                       HUD_Write_Cvar("hud_panel_notify_flip");
+                                       HUD_Write_Cvar("hud_panel_notify_fontsize");
+                                       HUD_Write_Cvar("hud_panel_notify_time");
+                                       HUD_Write_Cvar("hud_panel_notify_fadetime");
+                                       HUD_Write_Cvar("hud_panel_notify_icon_aspect");
                                        break;
                                case HUD_PANEL_TIMER:
                                        break;
                                case HUD_PANEL_RADAR:
-                                       HUD_Write_PanelCvar("_foreground_alpha");
-                                       HUD_Write_PanelCvar("_rotation");
-                                       HUD_Write_PanelCvar("_zoommode");
-                                       HUD_Write_PanelCvar("_scale");
-                                       HUD_Write_PanelCvar("_maximized_scale");
-                                       HUD_Write_PanelCvar("_maximized_size");
-                                       HUD_Write_PanelCvar("_maximized_rotation");
-                                       HUD_Write_PanelCvar("_maximized_zoommode");
+                                       HUD_Write_Cvar("hud_panel_radar_foreground_alpha");
+                                       HUD_Write_Cvar("hud_panel_radar_rotation");
+                                       HUD_Write_Cvar("hud_panel_radar_zoommode");
+                                       HUD_Write_Cvar("hud_panel_radar_scale");
+                                       HUD_Write_Cvar("hud_panel_radar_maximized_scale");
+                                       HUD_Write_Cvar("hud_panel_radar_maximized_size");
+                                       HUD_Write_Cvar("hud_panel_radar_maximized_rotation");
+                                       HUD_Write_Cvar("hud_panel_radar_maximized_zoommode");
                                        break;
                                case HUD_PANEL_SCORE:
-                                       HUD_Write_PanelCvar("_rankings");
+                                       HUD_Write_Cvar("hud_panel_score_rankings");
                                        break;
                                case HUD_PANEL_VOTE:
-                                       HUD_Write_PanelCvar("_alreadyvoted_alpha");
+                                       HUD_Write_Cvar("hud_panel_vote_alreadyvoted_alpha");
                                        break;
                                case HUD_PANEL_MODICONS:
-                                       HUD_Write_PanelCvar("_ca_layout");
-                                       HUD_Write_PanelCvar("_dom_layout");
-                                       HUD_Write_PanelCvar("_freezetag_layout");
+                                       HUD_Write_Cvar("hud_panel_modicons_ca_layout");
+                                       HUD_Write_Cvar("hud_panel_modicons_dom_layout");
+                                       HUD_Write_Cvar("hud_panel_modicons_freezetag_layout");
                                        break;
                                case HUD_PANEL_PRESSEDKEYS:
-                                       HUD_Write_PanelCvar("_aspect");
-                                       HUD_Write_PanelCvar("_attack");
+                                       HUD_Write_Cvar("hud_panel_pressedkeys_aspect");
+                                       HUD_Write_Cvar("hud_panel_pressedkeys_attack");
                                        break;
                                case HUD_PANEL_ENGINEINFO:
-                                       HUD_Write_PanelCvar("_framecounter_time");
-                                       HUD_Write_PanelCvar("_framecounter_decimals");
+                                       HUD_Write_Cvar("hud_panel_engineinfo_framecounter_time");
+                                       HUD_Write_Cvar("hud_panel_engineinfo_framecounter_decimals");
                                        break;
                                case HUD_PANEL_INFOMESSAGES:
-                                       HUD_Write_PanelCvar("_flip");
+                                       HUD_Write_Cvar("hud_panel_infomessages_flip");
                                        break;
                                case HUD_PANEL_PHYSICS:
-                                       HUD_Write_PanelCvar("_speed_unit_show");
-                                       HUD_Write_PanelCvar("_speed_max");
-                                       HUD_Write_PanelCvar("_speed_vertical");
-                                       HUD_Write_PanelCvar("_topspeed");
-                                       HUD_Write_PanelCvar("_topspeed_time");
-                                       HUD_Write_PanelCvar("_acceleration_max");
-                                       HUD_Write_PanelCvar("_acceleration_vertical");
-                                       HUD_Write_PanelCvar("_flip");
-                                       HUD_Write_PanelCvar("_baralign");
-                                       HUD_Write_PanelCvar("_progressbar");
-                                       HUD_Write_PanelCvar("_acceleration_progressbar_mode");
-                                       HUD_Write_PanelCvar("_acceleration_progressbar_scale");
-                                       HUD_Write_PanelCvar("_acceleration_progressbar_nonlinear");
-                                       HUD_Write_PanelCvar("_text");
-                                       HUD_Write_PanelCvar("_text_scale");
+                                       HUD_Write_Cvar("hud_panel_physics_speed_unit_show");
+                                       HUD_Write_Cvar("hud_panel_physics_speed_max");
+                                       HUD_Write_Cvar("hud_panel_physics_speed_vertical");
+                                       HUD_Write_Cvar("hud_panel_physics_topspeed");
+                                       HUD_Write_Cvar("hud_panel_physics_topspeed_time");
+                                       HUD_Write_Cvar("hud_panel_physics_acceleration_max");
+                                       HUD_Write_Cvar("hud_panel_physics_acceleration_vertical");
+                                       HUD_Write_Cvar("hud_panel_physics_flip");
+                                       HUD_Write_Cvar("hud_panel_physics_baralign");
+                                       HUD_Write_Cvar("hud_panel_physics_progressbar");
+                                       HUD_Write_Cvar("hud_panel_physics_acceleration_progressbar_mode");
+                                       HUD_Write_Cvar("hud_panel_physics_acceleration_progressbar_scale");
+                                       HUD_Write_Cvar("hud_panel_physics_acceleration_progressbar_nonlinear");
+                                       HUD_Write_Cvar("hud_panel_physics_text");
+                                       HUD_Write_Cvar("hud_panel_physics_text_scale");
                                        break;
                                case HUD_PANEL_CENTERPRINT:
-                                       HUD_Write_PanelCvar("_align");
-                                       HUD_Write_PanelCvar("_flip");
-                                       HUD_Write_PanelCvar("_fontscale");
-                                       HUD_Write_PanelCvar("_time");
-                                       HUD_Write_PanelCvar("_fade_in");
-                                       HUD_Write_PanelCvar("_fade_out");
-                                       HUD_Write_PanelCvar("_fade_subsequent");
-                                       HUD_Write_PanelCvar("_fade_subsequent_passone");
-                                       HUD_Write_PanelCvar("_fade_subsequent_passone_minalpha");
-                                       HUD_Write_PanelCvar("_fade_subsequent_passtwo");
-                                       HUD_Write_PanelCvar("_fade_subsequent_passtwo_minalpha");
-                                       HUD_Write_PanelCvar("_fade_subsequent_minfontsize");
-                                       HUD_Write_PanelCvar("_fade_minfontsize");
+                                       HUD_Write_Cvar("hud_panel_centerprint_align");
+                                       HUD_Write_Cvar("hud_panel_centerprint_flip");
+                                       HUD_Write_Cvar("hud_panel_centerprint_fontscale");
+                                       HUD_Write_Cvar("hud_panel_centerprint_time");
+                                       HUD_Write_Cvar("hud_panel_centerprint_fade_in");
+                                       HUD_Write_Cvar("hud_panel_centerprint_fade_out");
+                                       HUD_Write_Cvar("hud_panel_centerprint_fade_subsequent");
+                                       HUD_Write_Cvar("hud_panel_centerprint_fade_subsequent_passone");
+                                       HUD_Write_Cvar("hud_panel_centerprint_fade_subsequent_passone_minalpha");
+                                       HUD_Write_Cvar("hud_panel_centerprint_fade_subsequent_passtwo");
+                                       HUD_Write_Cvar("hud_panel_centerprint_fade_subsequent_passtwo_minalpha");
+                                       HUD_Write_Cvar("hud_panel_centerprint_fade_subsequent_minfontsize");
+                                       HUD_Write_Cvar("hud_panel_centerprint_fade_minfontsize");
                                        break;
                                case HUD_PANEL_ITEMSTIME:
-                                       HUD_Write_PanelCvar("_iconalign");
-                                       HUD_Write_PanelCvar("_progressbar");
-                                       HUD_Write_PanelCvar("_progressbar_name");
-                                       HUD_Write_PanelCvar("_progressbar_reduced");
-                                       HUD_Write_PanelCvar("_text");
-                                       HUD_Write_PanelCvar("_ratio");
-                                       HUD_Write_PanelCvar("_dynamicsize");
+                                       HUD_Write_Cvar("hud_panel_itemstime_iconalign");
+                                       HUD_Write_Cvar("hud_panel_itemstime_progressbar");
+                                       HUD_Write_Cvar("hud_panel_itemstime_progressbar_name");
+                                       HUD_Write_Cvar("hud_panel_itemstime_progressbar_reduced");
+                                       HUD_Write_Cvar("hud_panel_itemstime_text");
+                                       HUD_Write_Cvar("hud_panel_itemstime_ratio");
+                                       HUD_Write_Cvar("hud_panel_itemstime_dynamicsize");
+                                       break;
+                               case HUD_PANEL_MAPVOTE:
+                                       HUD_Write_Cvar("hud_panel_mapvote_highlight_border");
                                        break;
                                case HUD_PANEL_QUICKMENU:
-                                       HUD_Write_PanelCvar("_align");
+                                       HUD_Write_Cvar("hud_panel_quickmenu_align");
                                        break;
                                case HUD_PANEL_SCOREBOARD:
-                                       HUD_Write_PanelCvar("_fadeinspeed");
-                                       HUD_Write_PanelCvar("_fadeoutspeed");
-                                       HUD_Write_PanelCvar("_respawntime_decimals");
-                                       HUD_Write_PanelCvar("_table_bg_alpha");
-                                       HUD_Write_PanelCvar("_table_bg_scale");
-                                       HUD_Write_PanelCvar("_table_fg_alpha");
-                                       HUD_Write_PanelCvar("_table_fg_alpha_self");
-                                       HUD_Write_PanelCvar("_table_highlight");
-                                       HUD_Write_PanelCvar("_table_highlight_alpha");
-                                       HUD_Write_PanelCvar("_table_highlight_alpha_self");
-                                       HUD_Write_PanelCvar("_bg_teams_color_team");
-                                       HUD_Write_PanelCvar("_accuracy_doublerows");
-                                       HUD_Write_PanelCvar("_accuracy_nocolors");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_fadeinspeed");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_fadeoutspeed");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_respawntime_decimals");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_table_bg_alpha");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_table_bg_scale");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_table_fg_alpha");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_table_fg_alpha_self");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_table_highlight");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_table_highlight_alpha");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_table_highlight_alpha_self");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_bg_teams_color_team");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_accuracy_doublerows");
+                                       HUD_Write_Cvar("hud_panel_scoreboard_accuracy_nocolors");
                                        break;
                        }
                        HUD_Write("\n");
@@ -230,11 +242,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
 
-               LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
+               LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)"), filename);
                fclose(fh);
        }
        else
-               LOG_INFOF(_("^1Couldn't write to %s\n"), filename);
+               LOG_INFOF(_("^1Couldn't write to %s"), filename);
 }
 
 void HUD_Configure_Exit_Force()
@@ -244,6 +256,7 @@ void HUD_Configure_Exit_Force()
                hud_configure_menu_open = 0;
                localcmd("togglemenu\n");
        }
+       cursor_type = CURSOR_NORMAL;
        cvar_set("_hud_configure", "0");
 }
 
@@ -651,12 +664,10 @@ void HUD_Panel_Arrow_Action(float nPrimary)
        }
 }
 
-void HUD_Panel_EnableMenu();
 entity tab_panels[hud_panels_MAX];
 entity tab_panel;
 vector tab_panel_pos;
 float tab_backward;
-void HUD_Panel_FirstInDrawQ(float id);
 void reset_tab_panels()
 {
        for (int i = 0; i < hud_panels_COUNT; ++i)
@@ -753,7 +764,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                if (bInputType == 1)
                        return true;
                if (!hud_configure_menu_open)
-                       cvar_set("_hud_configure", "0");
+                       HUD_Configure_Exit_Force();
        }
        else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
        {
@@ -944,7 +955,7 @@ LABEL(find_tab_panel)
        return true;
 }
 
-float HUD_Panel_Check_Mouse_Pos(float allow_move)
+int HUD_Panel_Check_Mouse_Pos(bool allow_move)
 {
        int i, j = 0;
        while(j < hud_panels_COUNT)
@@ -961,30 +972,30 @@ float HUD_Panel_Check_Mouse_Pos(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)
                {
-                       return 1;
+                       return CURSOR_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)
                {
-                       return 2;
+                       return CURSOR_RESIZE;
                }
                // 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)
                {
-                       return 3;
+                       return CURSOR_RESIZE2;
                }
                // 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)
                {
-                       return 3;
+                       return CURSOR_RESIZE2;
                }
                // 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)
                {
-                       return 2;
+                       return CURSOR_RESIZE;
                }
        }
-       return 0;
+       return CURSOR_NORMAL;
 }
 
 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
@@ -1020,9 +1031,7 @@ void HUD_Panel_FirstInDrawQ(float id)
                s = strcat(s, ftos(panel_order[i]), " ");
        }
        cvar_set("_hud_panelorder", s);
-       if(hud_panelorder_prev)
-               strunzone(hud_panelorder_prev);
-       hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
+       strcpy(hud_panelorder_prev, autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
 }
 
 void HUD_Panel_Highlight(float allow_move)
@@ -1106,15 +1115,11 @@ void HUD_Panel_EnableMenu()
        hud_configure_menu_open = 2;
        localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
 }
-float mouse_over_panel;
 void HUD_Panel_Mouse()
 {
        if(autocvar__menu_alpha == 1)
                return;
 
-       if (!autocvar_hud_cursormode)
-               update_mousepos();
-
        if(mouseClicked)
        {
                if(prevMouseClicked == 0)
@@ -1145,7 +1150,7 @@ void HUD_Panel_Mouse()
                                        prevMouseClickedTime = time;
                                        prevMouseClickedPos = mousepos;
                                }
-                               mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
+                               cursor_type = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
                        }
                }
                else
@@ -1198,25 +1203,12 @@ void HUD_Panel_Mouse()
                if(prevMouseClicked)
                        highlightedAction = 0;
                if(hud_configure_menu_open == 2)
-                       mouse_over_panel = 0;
+                       cursor_type = CURSOR_NORMAL;
                else
-                       mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
-               if (mouse_over_panel && !tab_panel)
+                       cursor_type = HUD_Panel_Check_Mouse_Pos(true);
+               if (cursor_type != CURSOR_NORMAL && !tab_panel) // mouse over a 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
-       float cursor_alpha = 1 - autocvar__menu_alpha;
-
-       if(!mouse_over_panel)
-               draw_cursor_normal(mousepos, '1 1 1', cursor_alpha);
-       else if(mouse_over_panel == 1)
-               draw_cursor(mousepos, '0.5 0.5 0', "/cursor_move", '1 1 1', cursor_alpha);
-       else if(mouse_over_panel == 2)
-               draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize", '1 1 1', cursor_alpha);
-       else
-               draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize2", '1 1 1', cursor_alpha);
-
-       prevMouseClicked = mouseClicked;
 }
 void HUD_Configure_DrawGrid()
 {
@@ -1229,11 +1221,11 @@ void HUD_Configure_DrawGrid()
                hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
                vector s;
                // x-axis
-               s = eX + eY * vid_conheight;
+               s = vec2(1, vid_conheight);
                for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
                        drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
                // y-axis
-               s = eY + eX * vid_conwidth;
+               s = vec2(vid_conwidth, 1);
                for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
                        drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
        }
@@ -1253,8 +1245,6 @@ void HUD_Configure_Frame()
 
                if(!hud_configure_prev)
                {
-                       if(autocvar_hud_cursormode)
-                               setcursormode(1);
                        hudShiftState = 0;
                        for(i = hud_panels_COUNT - 1; i >= 0; --i)
                                hud_panels_from(panel_order[i]).update_time = time;
@@ -1274,8 +1264,6 @@ void HUD_Configure_Frame()
        {
                if(hud_configure_menu_open)
                        hud_configure_menu_open = 0;
-               if(autocvar_hud_cursormode)
-                       setcursormode(0);
                hud_dynamic_shake_factor = -1;
        }
 }
@@ -1285,11 +1273,13 @@ const string hlBorder = "gfx/hud/default/border_highlighted";
 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
 {
-       drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
-       drawpic_tiled(panel_pos - '1 1 0' * myBorder, hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size.x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
-       drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * (panel_size.y + 2 * myBorder - hlBorderSize), hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size.x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
-       drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize, hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size.y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
-       drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize + eX * (panel_size.x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size.y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
+       vector pos = panel_pos - vec2(myBorder, myBorder);
+       drawfill(pos, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
+       drawpic_tiled(pos, hlBorder, '8 1 0' * hlBorderSize, vec2(panel_size.x + 2 * myBorder, hlBorderSize), color, theAlpha, DRAWFLAG_NORMAL);
+       drawpic_tiled(pos + eY * (panel_size.y + 2 * myBorder - hlBorderSize), hlBorder, '8 1 0' * hlBorderSize, vec2(panel_size.x + 2 * myBorder, hlBorderSize), color, theAlpha, DRAWFLAG_NORMAL);
+       pos.y += hlBorderSize;
+       drawpic_tiled(pos, hlBorder2, '1 8 0' * hlBorderSize, vec2(hlBorderSize, panel_size.y + 2 * myBorder - 2 * hlBorderSize), color, theAlpha, DRAWFLAG_NORMAL);
+       drawpic_tiled(pos + eX * (panel_size.x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, vec2(hlBorderSize, panel_size.y + 2 * myBorder - 2 * hlBorderSize), color, theAlpha, DRAWFLAG_NORMAL);
 }
 
 void HUD_Configure_PostDraw()