seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_new_weight 0.1 "weight of latest data point"
seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold 0.5 "threshold for fps change when to update instantly, to make big fps changes update faster"
+seta hud_panel_quickmenu_file quickmenu.txt "load the quick menu from this file"
+
// hud panel aliases
alias hud_panel_radar_rotate "toggle hud_panel_radar_rotation 0 1 2 3 4"
alias +hud_panel_radar_maximized "cl_cmd hud radar 1"
seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "" "minimum factor that the second pass can fade to"
seta hud_panel_centerprint_fade_subsequent_minfontsize "" "minimum factor for the font size from the subsequent fading effects"
seta hud_panel_centerprint_fade_minfontsize "" "minimum factor for the font size from the fading in/out effects"
+
+seta hud_panel_quickmenu "" "enable/disable this panel"
+seta hud_panel_quickmenu_pos "" "position of this base of the panel"
+seta hud_panel_quickmenu_size "" "size of this panel"
+seta hud_panel_quickmenu_bg "" "if set to something else than \"\" = override default background"
+seta hud_panel_quickmenu_bg_color "" "if set to something else than \"\" = override default panel background color"
+seta hud_panel_quickmenu_bg_color_team "" "override panel color with team color in team based games"
+seta hud_panel_quickmenu_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
+seta hud_panel_quickmenu_bg_border "" "if set to something else than \"\" = override default size of border around the background"
+seta hud_panel_quickmenu_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
+seta hud_panel_quickmenu_align "text alignment: 0 left, 0.5 center, 1 right"
bind F12 screenshot
bind F4 ready
bind ALT +showaccuracy
+alias quickmenu "cl_cmd hud quickmenu"
+bind b quickmenu
// Gamepad defaults. Tested with Logitech Rumblepad 2, I hope similar ones works as well.
bind JOY1 "+crouch"
seta hud_progressbar_acceleration_color "0.5 0.75 1"
seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
-seta _hud_panelorder "15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 "
+seta _hud_panelorder "15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 17 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
+seta hud_panel_quickmenu 1
+seta hud_panel_quickmenu_pos "0.000000 0.430000"
+seta hud_panel_quickmenu_size "0.210000 0.250000"
+seta hud_panel_quickmenu_bg ""
+seta hud_panel_quickmenu_bg_color ""
+seta hud_panel_quickmenu_bg_color_team ""
+seta hud_panel_quickmenu_bg_alpha ""
+seta hud_panel_quickmenu_bg_border ""
+seta hud_panel_quickmenu_bg_padding ""
+seta hud_panel_quickmenu_align "0"
+
menu_sync
seta hud_progressbar_acceleration_color "0.5 0.75 1"
seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
-seta _hud_panelorder "10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 "
+seta _hud_panelorder "10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 17 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
+seta hud_panel_quickmenu 1
+seta hud_panel_quickmenu_pos "0.000000 0.430000"
+seta hud_panel_quickmenu_size "0.210000 0.250000"
+seta hud_panel_quickmenu_bg ""
+seta hud_panel_quickmenu_bg_color ""
+seta hud_panel_quickmenu_bg_color_team ""
+seta hud_panel_quickmenu_bg_alpha ""
+seta hud_panel_quickmenu_bg_border ""
+seta hud_panel_quickmenu_bg_padding ""
+seta hud_panel_quickmenu_align "0"
+
menu_sync
seta hud_progressbar_acceleration_color "0.5 0.75 1"
seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
-seta _hud_panelorder "15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 "
+seta _hud_panelorder "15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 17 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
+seta hud_panel_quickmenu 1
+seta hud_panel_quickmenu_pos "0.000000 0.430000"
+seta hud_panel_quickmenu_size "0.210000 0.250000"
+seta hud_panel_quickmenu_bg ""
+seta hud_panel_quickmenu_bg_color ""
+seta hud_panel_quickmenu_bg_color_team ""
+seta hud_panel_quickmenu_bg_alpha ""
+seta hud_panel_quickmenu_bg_border ""
+seta hud_panel_quickmenu_bg_padding ""
+seta hud_panel_quickmenu_align "0"
+
menu_sync
seta hud_progressbar_acceleration_color "0.5 0.75 1"
seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
-seta _hud_panelorder "15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 "
+seta _hud_panelorder "15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 17 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
+seta hud_panel_quickmenu 1
+seta hud_panel_quickmenu_pos "0.700000 0.460000"
+seta hud_panel_quickmenu_size "0.210000 0.250000"
+seta hud_panel_quickmenu_bg ""
+seta hud_panel_quickmenu_bg_color ""
+seta hud_panel_quickmenu_bg_color_team ""
+seta hud_panel_quickmenu_bg_alpha ""
+seta hud_panel_quickmenu_bg_border ""
+seta hud_panel_quickmenu_bg_padding ""
+seta hud_panel_quickmenu_align "1"
+
menu_sync
seta hud_progressbar_acceleration_color "0.5 0.75 1"
seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
-seta _hud_panelorder "15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 "
+seta _hud_panelorder "15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 17 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.01"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
+seta hud_panel_quickmenu 1
+seta hud_panel_quickmenu_pos "0.000000 0.380000"
+seta hud_panel_quickmenu_size "0.210000 0.250000"
+seta hud_panel_quickmenu_bg ""
+seta hud_panel_quickmenu_bg_color ""
+seta hud_panel_quickmenu_bg_color_team ""
+seta hud_panel_quickmenu_bg_alpha ""
+seta hud_panel_quickmenu_bg_border ""
+seta hud_panel_quickmenu_bg_padding ""
+seta hud_panel_quickmenu_align "0"
+
menu_sync
"ready" "ready"
"" ""
"" "Client"
+"quickmenu" "quick menu"
"+show_info" "server info"
"toggleconsole" "enter console"
"disconnect" "disconnect"
if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
return true;
+ if (HUD_QuickMenu_InputEvent(bInputType, nPrimary, nSecondary))
+ return true;
+
if (MapVote_InputEvent(bInputType, nPrimary, nSecondary))
return true;
}
// do lockview after event chase camera so that it still applies whenever necessary.
- if(autocvar_cl_lockview || (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1)))
+ if(autocvar_cl_lockview || (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1 || HUD_QuickMenu_IsOpened())))
{
setproperty(VF_ORIGIN, freeze_org);
setproperty(VF_ANGLES, freeze_ang);
if(autocvar__hud_configure)
HUD_Panel_Mouse();
-
- if(hud && !intermission)
- {
- if(hud == HUD_SPIDERBOT)
- CSQC_SPIDER_HUD();
- else if(hud == HUD_WAKIZASHI)
- CSQC_WAKIZASHI_HUD();
- else if(hud == HUD_RAPTOR)
- CSQC_RAPTOR_HUD();
- else if(hud == HUD_BUMBLEBEE)
- CSQC_BUMBLE_HUD();
- else if(hud == HUD_BUMBLEBEE_GUN)
- CSQC_BUMBLE_GUN_HUD();
- }
-
+ else if (HUD_QuickMenu_IsOpened())
+ HUD_QuickMenu_Mouse();
+
+ if(hud && !intermission)
+ {
+ if(hud == HUD_SPIDERBOT)
+ CSQC_SPIDER_HUD();
+ else if(hud == HUD_WAKIZASHI)
+ CSQC_WAKIZASHI_HUD();
+ else if(hud == HUD_RAPTOR)
+ CSQC_RAPTOR_HUD();
+ else if(hud == HUD_BUMBLEBEE)
+ CSQC_BUMBLE_HUD();
+ else if(hud == HUD_BUMBLEBEE_GUN)
+ CSQC_BUMBLE_GUN_HUD();
+ }
+
cl_notice_run();
-
+
// let's reset the view back to normal for the end
setproperty(VF_MIN, '0 0 0');
setproperty(VF_SIZE, '1 0 0' * w + '0 1 0' * h);
float autocvar_hud_panel_pressedkeys;
float autocvar_hud_panel_pressedkeys_aspect;
float autocvar_hud_panel_pressedkeys_attack;
+string autocvar_hud_panel_quickmenu_file;
float autocvar_hud_panel_racetimer;
float autocvar_hud_panel_radar;
float autocvar_hud_panel_radar_foreground_alpha;
float autocvar_hud_panel_weapons_timeout_fadefgmin;
var float autocvar_hud_panel_weapons_timeout_speed_in = 0.25;
var float autocvar_hud_panel_weapons_timeout_speed_out = 0.75;
+float autocvar_hud_panel_quickmenu;
+float autocvar_hud_panel_quickmenu_align;
float autocvar_hud_progressbar_alpha;
float autocvar_hud_showbinds;
float autocvar_hud_showbinds_limit;
cvar_set("_hud_configure", ftos(!autocvar__hud_configure));
return;
}
-
+
+ case "quickmenu":
+ {
+ if(argc == 2 && HUD_QuickMenu_IsOpened())
+ HUD_QuickMenu_Close();
+ else
+ if (HUD_QuickMenu_Buffer_Init())
+ HUD_QuickMenu_Open("", 0);
+ return;
+ }
+
case "save":
{
if(argv(2))
break; // go to usage, we're missing the paramater needed here.
}
}
-
+
case "scoreboard_columns_set":
{
- Cmd_HUD_SetFields(argc);
+ Cmd_HUD_SetFields(argc);
return;
}
Cmd_HUD_Help();
return;
}
-
+
case "radar":
{
if(argv(2))
}
}
}
-
+
default:
print("Incorrect parameters for ^2hud^7\n");
case CMD_REQUEST_USAGE:
}
}
+
+// QUICKMENU_MAXLINES must be <= 10
+#define QUICKMENU_MAXLINES 10
+#define QUICKMENU_MAXENTRIES 256
+string QuickMenu_Command[QUICKMENU_MAXLINES];
+string QuickMenu_Description[QUICKMENU_MAXLINES];
+float QuickMenu_CurrentPage;
+float QuickMenu_IsLastPage;
+var float QuickMenu_Buffer = -1;
+float QuickMenu_Buffer_Size;
+float QuickMenu_Buffer_Index;
+string QuickMenu_CurrentSubMenu;
+float QuickMenu_CurrentPage_FirstEntry;
+var float QuickMenu_Entries;
+void HUD_QuickMenu_load_entry(float i, string s, string s1)
+{
+ //print(sprintf("^xc80 entry %d: %s, %s\n", i, s, s1));
+ if (QuickMenu_Description[i])
+ strunzone(QuickMenu_Description[i]);
+ QuickMenu_Description[i] = strzone(s);
+ if (QuickMenu_Command[i])
+ strunzone(QuickMenu_Command[i]);
+ QuickMenu_Command[i] = strzone(s1);
+}
+void HUD_QuickMenu_clear_entry(float i)
+{
+ if (QuickMenu_Description[i])
+ strunzone(QuickMenu_Description[i]);
+ QuickMenu_Description[i] = string_null;
+ if (QuickMenu_Command[i])
+ strunzone(QuickMenu_Command[i]);
+ QuickMenu_Command[i] = string_null;
+}
+
+float HUD_QuickMenu_Buffer_Init()
+{
+ float fh, i;
+ string s;
+ fh = fopen(autocvar_hud_panel_quickmenu_file, FILE_READ);
+ if(fh < 0)
+ {
+ print(sprintf(_("Error: Couldn't open file %s!\n"), autocvar_hud_panel_quickmenu_file));
+ return false;
+ }
+
+ QuickMenu_Buffer = buf_create();
+ if (QuickMenu_Buffer < 0)
+ {
+ fclose(fh);
+ return false;
+ }
+
+ i = 0;
+ while((s = fgets(fh)) && i < QUICKMENU_MAXENTRIES)
+ {
+ // first skip invalid entries, so we don't check them anymore
+ float argc;
+ argc = tokenize_console(s);
+ if(argc == 0 || argc > 2)
+ continue;
+
+ bufstr_set(QuickMenu_Buffer, i, s);
+ ++i;
+ }
+ QuickMenu_Buffer_Size = i;
+
+ if (QuickMenu_Buffer_Size <= 0)
+ {
+ buf_del(QuickMenu_Buffer);
+ QuickMenu_Buffer = -1;
+ }
+ fclose(fh);
+ return true;
+}
+void HUD_QuickMenu_Buffer_Close()
+{
+ if (QuickMenu_Buffer >= 0)
+ {
+ buf_del(QuickMenu_Buffer);
+ QuickMenu_Buffer = -1;
+ QuickMenu_Buffer_Size = 0;
+ }
+}
+void HUD_QuickMenu_Close()
+{
+ if (QuickMenu_CurrentSubMenu)
+ strunzone(QuickMenu_CurrentSubMenu);
+ QuickMenu_CurrentSubMenu = string_null;
+ float i;
+ for (i = 0; i < QUICKMENU_MAXLINES; ++i)
+ HUD_QuickMenu_clear_entry(i);
+ QuickMenu_Entries = 0;
+ hud_panel_quickmenu = 0;
+ mouseClicked = 0;
+ prevMouseClicked = 0;
+ HUD_QuickMenu_Buffer_Close();
+}
+
+// It assumes submenu open tag is already detected
+void HUD_QuickMenu_skip_submenu(string submenu)
+{
+ string s, z_submenu;
+ z_submenu = strzone(submenu);
+ for(++QuickMenu_Buffer_Index ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+ {
+ s = bufstr_get(QuickMenu_Buffer, QuickMenu_Buffer_Index);
+ float argc;
+ argc = tokenize_console(s);
+ if(argc == 2)
+ continue;
+ if (argv(0) == "")
+ continue;
+ if (argv(0) == z_submenu) // submenu end
+ break;
+ HUD_QuickMenu_skip_submenu(argv(0));
+ }
+ strunzone(z_submenu);
+}
+
+
+float HUD_QuickMenu_IsOpened()
+{
+ return (QuickMenu_Entries > 0);
+}
+
+// new_page 0 means page 0, new_page != 0 means next page
+float QuickMenu_Buffer_Index_Prev;
+void HUD_QuickMenu_Open(string target_submenu, float new_page)
+{
+ float total, i;
+ string s, z_submenu;
+
+ if (new_page == 0)
+ QuickMenu_CurrentPage = 0;
+ else
+ ++QuickMenu_CurrentPage;
+ QuickMenu_CurrentPage_FirstEntry = QuickMenu_CurrentPage * (QUICKMENU_MAXLINES - 2);
+
+ z_submenu = strzone(target_submenu);
+ if (QuickMenu_CurrentSubMenu)
+ strunzone(QuickMenu_CurrentSubMenu);
+ QuickMenu_CurrentSubMenu = strzone(z_submenu);
+
+ QuickMenu_IsLastPage = TRUE;
+ QuickMenu_Entries = 0;
+
+ QuickMenu_Buffer_Index = 0;
+ if (z_submenu != "")
+ {
+ // skip everything until the submenu open tag is found
+ for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+ {
+ s = bufstr_get(QuickMenu_Buffer, QuickMenu_Buffer_Index);
+ if (tokenize_console(s) == 1 && argv(0) == z_submenu)
+ {
+ // print(sprintf("^3 beginning of %s\n", z_submenu));
+ ++QuickMenu_Buffer_Index;
+ break;
+ }
+ // print(sprintf("^1 skipping %s\n", s));
+ }
+ }
+ for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+ {
+ s = bufstr_get(QuickMenu_Buffer, QuickMenu_Buffer_Index);
+ float argc;
+ argc = tokenize_console(s);
+
+ if (z_submenu != "" && z_submenu == argv(0))
+ {
+ // print(sprintf("^3 end of %s\n", z_submenu));
+ break;
+ }
+
+ if (total - QuickMenu_CurrentPage_FirstEntry >= 0)
+ {
+ ++QuickMenu_Entries;
+ if(QuickMenu_Entries == QUICKMENU_MAXLINES - 2)
+ QuickMenu_Buffer_Index_Prev = QuickMenu_Buffer_Index;
+ else if(QuickMenu_Entries == QUICKMENU_MAXLINES)
+ {
+ HUD_QuickMenu_clear_entry(QUICKMENU_MAXLINES - 1);
+ QuickMenu_Buffer_Index = QuickMenu_Buffer_Index_Prev;
+ QuickMenu_IsLastPage = FALSE;
+ break;
+ }
+ }
+
+ // NOTE: entries are loaded starting from 1, not from 0
+ if (argc == 1 && argv(0) != "") // submenu
+ {
+ if (total - QuickMenu_CurrentPage_FirstEntry >= 0)
+ HUD_QuickMenu_load_entry(QuickMenu_Entries, argv(0), "");
+ HUD_QuickMenu_skip_submenu(argv(0));
+ }
+ else if (total - QuickMenu_CurrentPage_FirstEntry >= 0)
+ HUD_QuickMenu_load_entry(QuickMenu_Entries, argv(0), argv(1));
+
+ ++total;
+ }
+ strunzone(z_submenu);
+ if (QuickMenu_Entries == 0)
+ HUD_QuickMenu_Close();
+ else
+ hud_panel_quickmenu = 1;
+}
+
+float HUD_QuickMenu_ActionForNumber(float num)
+{
+ if (!QuickMenu_IsLastPage)
+ {
+ if (num < 0 || num >= QUICKMENU_MAXLINES)
+ return 0;
+ if (num == QUICKMENU_MAXLINES - 1)
+ return 0;
+ if (num == 0)
+ {
+ HUD_QuickMenu_Open(QuickMenu_CurrentSubMenu, +1);
+ return 0;
+ }
+ } else if (num <= 0 || num > QuickMenu_Entries)
+ return 0;
+
+ if (QuickMenu_Command[num] != "")
+ {
+ localcmd(strcat("\n", QuickMenu_Command[num], "\n"));
+ return 1;
+ }
+ if (QuickMenu_Description[num] != "")
+ HUD_QuickMenu_Open(QuickMenu_Description[num], 0);
+ return 0;
+}
+float HUD_QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary)
+{
+ string s;
+
+ // we only care for keyboard events
+ if(bInputType != 0 && bInputType != 1)
+ return false;
+
+ if(!HUD_QuickMenu_IsOpened() || autocvar__hud_configure)
+ return false;
+
+ // 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;
+ for (i = 0; i < keys; ++i)
+ {
+ if(nPrimary == stof(argv(i)))
+ hit_con_bind = 1;
+ }
+
+ if(bInputType == 0) {
+ if(nPrimary == K_ALT) hudShiftState |= S_ALT;
+ if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
+ if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
+ }
+ else if(bInputType == 1) {
+ if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
+ if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
+ if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
+ }
+
+ if(nPrimary == K_ESCAPE)
+ {
+ if (bInputType == 1)
+ return true;
+ HUD_QuickMenu_Close();
+ }
+ else if(nPrimary >= '0' && nPrimary <= '9')
+ {
+ if (bInputType == 1)
+ return true;
+ HUD_QuickMenu_ActionForNumber(stof(chr2str(nPrimary)));
+ }
+ if(nPrimary == K_MOUSE1)
+ {
+ if(bInputType == 0) // key pressed
+ mouseClicked |= S_MOUSE1;
+ else if(bInputType == 1) // key released
+ mouseClicked -= (mouseClicked & S_MOUSE1);
+ }
+ else if(nPrimary == K_MOUSE2)
+ {
+ if(bInputType == 0) // key pressed
+ mouseClicked |= S_MOUSE2;
+ else if(bInputType == 1) // key released
+ mouseClicked -= (mouseClicked & S_MOUSE2);
+ }
+ else if(hit_con_bind)
+ return false;
+
+ return true;
+}
+void HUD_QuickMenu_Mouse()
+{
+ if(!mouseClicked)
+ if(prevMouseClicked & S_MOUSE2)
+ {
+ HUD_QuickMenu_Close();
+ return;
+ }
+
+ mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
+
+ mousepos_x = bound(0, mousepos_x, vid_conwidth);
+ mousepos_y = bound(0, mousepos_y, vid_conheight);
+
+ HUD_Panel_UpdatePosSize(quickmenu)
+
+ float first_entry_pos, entries_height;
+ vector fontsize;
+ fontsize = '1 1 0' * (panel_size_y / QUICKMENU_MAXLINES);
+ first_entry_pos = panel_pos_y + ((QUICKMENU_MAXLINES - QuickMenu_Entries) * fontsize_y) / 2;
+ entries_height = panel_size_y - ((QUICKMENU_MAXLINES - QuickMenu_Entries) * fontsize_y);
+
+ if (mousepos_x >= panel_pos_x && mousepos_y >= first_entry_pos && mousepos_x <= panel_pos_x + panel_size_x && mousepos_y <= first_entry_pos + entries_height)
+ {
+ float entry_num;
+ entry_num = floor((mousepos_y - first_entry_pos) / fontsize_y);
+ if (QuickMenu_IsLastPage || entry_num != QUICKMENU_MAXLINES - 2)
+ {
+ panel_pos_y = first_entry_pos + entry_num * fontsize_y;
+ vector color;
+ if(mouseClicked & S_MOUSE1)
+ color = '0.5 1 0.5';
+ else if(hudShiftState & S_CTRL)
+ color = '1 1 0.3';
+ else
+ color = '1 1 1';
+ drawfill(panel_pos, eX * panel_size_x + eY * fontsize_y, color, .2, DRAWFLAG_NORMAL);
+
+ if(!mouseClicked && prevMouseClicked & S_MOUSE1)
+ {
+ float f;
+ if (entry_num < QUICKMENU_MAXLINES - 1)
+ f = HUD_QuickMenu_ActionForNumber(entry_num + 1);
+ else
+ f = HUD_QuickMenu_ActionForNumber(0);
+ if(f && !(hudShiftState & S_CTRL))
+ HUD_QuickMenu_Close();
+ }
+ }
+ }
+
+ const vector cursorsize = '32 32 0';
+ drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', 0.8, DRAWFLAG_NORMAL);
+
+ prevMouseClicked = mouseClicked;
+}
+void HUD_QuickMenu_DrawEntry(vector pos, string s, vector fontsize)
+{
+ string entry;
+ float offset;
+ entry = textShortenToWidth(s, panel_size_x, fontsize, stringwidth_colors);
+ if (autocvar_hud_panel_quickmenu_align > 0)
+ {
+ offset = (panel_size_x - stringwidth_colors(entry, fontsize)) * min(autocvar_hud_panel_quickmenu_align, 1);
+ drawcolorcodedstring(pos + eX * offset, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
+ }
+ else
+ drawcolorcodedstring(pos, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
+}
+void HUD_QuickMenu(void)
+{
+ if(!autocvar__hud_configure)
+ {
+ if (hud_configure_prev && hud_configure_prev != -1)
+ HUD_QuickMenu_Close();
+
+ if(!hud_draw_maximized) return;
+ //if(!autocvar_hud_panel_quickmenu) return; // autocvar exists only for conformity with other panels
+ if(!hud_panel_quickmenu) return;
+ }
+ else
+ {
+ if(!HUD_QuickMenu_IsOpened())
+ {
+ QuickMenu_Entries = 1;
+ HUD_QuickMenu_load_entry(QuickMenu_Entries, sprintf(_("Submenu%d"), QuickMenu_Entries), "");
+ ++QuickMenu_Entries;
+ HUD_QuickMenu_load_entry(QuickMenu_Entries, sprintf(_("Submenu%d"), QuickMenu_Entries), "");
+ ++QuickMenu_Entries;
+ // although real command doesn't matter here, it must not be empty
+ // otherwise the entry is displayed like a submenu
+ for (; QuickMenu_Entries < QUICKMENU_MAXLINES - 1; ++QuickMenu_Entries)
+ HUD_QuickMenu_load_entry(QuickMenu_Entries, sprintf(_("Command%d"), QuickMenu_Entries), "-");
+ ++QuickMenu_Entries;
+ HUD_QuickMenu_clear_entry(QuickMenu_Entries);
+ QuickMenu_IsLastPage = FALSE;
+ }
+
+ hud_configure_active_panel = HUD_PANEL_QUICKMENU;
+ }
+
+ HUD_Panel_UpdateCvars(quickmenu);
+ HUD_Panel_ApplyFadeAlpha();
+
+ HUD_Panel_DrawBg(1);
+
+ if(panel_bg_padding)
+ {
+ panel_pos += '1 1 0' * panel_bg_padding;
+ panel_size -= '2 2 0' * panel_bg_padding;
+ }
+
+ float i;
+ vector fontsize;
+ string color;
+ fontsize = '1 1 0' * (panel_size_y / QUICKMENU_MAXLINES);
+
+ if (!QuickMenu_IsLastPage)
+ {
+ color = "^5";
+ HUD_QuickMenu_DrawEntry(panel_pos + eY * (panel_size_y - fontsize_y), sprintf("%d: %s%s", 0, color, _("Continue...")), fontsize);
+ }
+ else
+ panel_pos_y += ((QUICKMENU_MAXLINES - QuickMenu_Entries) * fontsize_y) / 2;
+
+ for (i = 1; i <= QuickMenu_Entries; ++i) {
+ if (QuickMenu_Description[i] == "")
+ break;
+ if (QuickMenu_Command[i] == "")
+ color = "^4";
+ else
+ color = "^3";
+ HUD_QuickMenu_DrawEntry(panel_pos, sprintf("%d: %s%s", i, color, QuickMenu_Description[i]), fontsize);
+ panel_pos_y += fontsize_y;
+ }
+}
+
/*
==================
Main HUD system
HUD_Physics(); break;\
case (HUD_PANEL_CENTERPRINT):\
HUD_CenterPrint(); break;\
+ case (HUD_PANEL_QUICKMENU):\
+ HUD_QuickMenu(); break;\
} ENDS_WITH_CURLY_BRACE
void HUD_Main (void)
HUD_Radar();
if(autocvar__con_chat_maximized)
HUD_Chat();
+ if(hud_panel_quickmenu)
+ HUD_QuickMenu();
if(autocvar__hud_configure)
{
float hud_draw_maximized;
float hud_panel_radar_maximized;
+float hud_panel_quickmenu;
vector mousepos;
vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click)
case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdateCvars(infomessages) break; \
case HUD_PANEL_PHYSICS: HUD_Panel_UpdateCvars(physics); break;\
case HUD_PANEL_CENTERPRINT: HUD_Panel_UpdateCvars(centerprint); break;\
+ case HUD_PANEL_QUICKMENU: HUD_Panel_UpdateCvars(quickmenu); break;\
}
#define HUD_Panel_UpdateCvarsForId(id) \
case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdatePosSize(infomessages) break;\
case HUD_PANEL_PHYSICS: HUD_Panel_UpdatePosSize(physics); break;\
case HUD_PANEL_CENTERPRINT: HUD_Panel_UpdatePosSize(centerprint); break;\
+ case HUD_PANEL_QUICKMENU: HUD_Panel_UpdatePosSize(quickmenu); break;\
}
#define HUD_Panel_UpdatePosSizeForId(id) \
HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
HUD_Write_PanelCvar_q("_fade_minfontsize");
break;
+ case HUD_PANEL_QUICKMENU:
+ HUD_Write_PanelCvar_q("_align");
+ break;
}
HUD_Write("\n");
}
float WR_PLAYERDEATH = 13; // (SVQC) does not need to do anything
float WR_GONETHINK = 14; // (SVQC) logic to run every frame, also if no longer having the weapon as long as the switch away has not been performed
-float HUD_PANEL_WEAPONS = 0;
-float HUD_PANEL_AMMO = 1;
-float HUD_PANEL_POWERUPS = 2;
-float HUD_PANEL_HEALTHARMOR = 3;
-float HUD_PANEL_NOTIFY = 4;
-float HUD_PANEL_TIMER = 5;
-float HUD_PANEL_RADAR = 6;
-float HUD_PANEL_SCORE = 7;
-float HUD_PANEL_RACETIMER = 8;
-float HUD_PANEL_VOTE = 9;
-float HUD_PANEL_MODICONS = 10;
-float HUD_PANEL_PRESSEDKEYS = 11;
-float HUD_PANEL_CHAT = 12;
-float HUD_PANEL_ENGINEINFO = 13;
+float HUD_PANEL_WEAPONS = 0;
+float HUD_PANEL_AMMO = 1;
+float HUD_PANEL_POWERUPS = 2;
+float HUD_PANEL_HEALTHARMOR = 3;
+float HUD_PANEL_NOTIFY = 4;
+float HUD_PANEL_TIMER = 5;
+float HUD_PANEL_RADAR = 6;
+float HUD_PANEL_SCORE = 7;
+float HUD_PANEL_RACETIMER = 8;
+float HUD_PANEL_VOTE = 9;
+float HUD_PANEL_MODICONS = 10;
+float HUD_PANEL_PRESSEDKEYS = 11;
+float HUD_PANEL_CHAT = 12;
+float HUD_PANEL_ENGINEINFO = 13;
float HUD_PANEL_INFOMESSAGES = 14;
-float HUD_PANEL_PHYSICS = 15;
-float HUD_PANEL_CENTERPRINT = 16;
-float HUD_PANEL_NUM = 17; // always last panel id + 1, please increment when adding a new panel
-
-string HUD_PANELNAME_WEAPONS = "weapons";
-string HUD_PANELNAME_AMMO = "ammo";
-string HUD_PANELNAME_POWERUPS = "powerups";
-string HUD_PANELNAME_HEALTHARMOR = "healtharmor";
-string HUD_PANELNAME_NOTIFY = "notify";
-string HUD_PANELNAME_TIMER = "timer";
-string HUD_PANELNAME_RADAR = "radar";
-string HUD_PANELNAME_SCORE = "score";
-string HUD_PANELNAME_RACETIMER = "racetimer";
-string HUD_PANELNAME_VOTE = "vote";
-string HUD_PANELNAME_MODICONS = "modicons";
-string HUD_PANELNAME_PRESSEDKEYS = "pressedkeys";
-string HUD_PANELNAME_CHAT = "chat";
-string HUD_PANELNAME_ENGINEINFO = "engineinfo";
+float HUD_PANEL_PHYSICS = 15;
+float HUD_PANEL_CENTERPRINT = 16;
+float HUD_PANEL_QUICKMENU = 17;
+float HUD_PANEL_NUM = 18; // always last panel id + 1, please increment when adding a new panel
+
+string HUD_PANELNAME_WEAPONS = "weapons";
+string HUD_PANELNAME_AMMO = "ammo";
+string HUD_PANELNAME_POWERUPS = "powerups";
+string HUD_PANELNAME_HEALTHARMOR = "healtharmor";
+string HUD_PANELNAME_NOTIFY = "notify";
+string HUD_PANELNAME_TIMER = "timer";
+string HUD_PANELNAME_RADAR = "radar";
+string HUD_PANELNAME_SCORE = "score";
+string HUD_PANELNAME_RACETIMER = "racetimer";
+string HUD_PANELNAME_VOTE = "vote";
+string HUD_PANELNAME_MODICONS = "modicons";
+string HUD_PANELNAME_PRESSEDKEYS = "pressedkeys";
+string HUD_PANELNAME_CHAT = "chat";
+string HUD_PANELNAME_ENGINEINFO = "engineinfo";
string HUD_PANELNAME_INFOMESSAGES = "infomessages";
-string HUD_PANELNAME_PHYSICS = "physics";
+string HUD_PANELNAME_PHYSICS = "physics";
string HUD_PANELNAME_CENTERPRINT = "centerprint";
+string HUD_PANELNAME_QUICKMENU = "quickmenu";
#define SERVERFLAG_ALLOW_FULLBRIGHT 1
#define SERVERFLAG_TEAMPLAY 2
case HUD_PANEL_INFOMESSAGES: panel_name = HUD_PANELNAME_INFOMESSAGES; break; \
case HUD_PANEL_PHYSICS: panel_name = HUD_PANELNAME_PHYSICS; break; \
case HUD_PANEL_CENTERPRINT: panel_name = HUD_PANELNAME_CENTERPRINT; break; \
+ case HUD_PANEL_QUICKMENU: panel_name = HUD_PANELNAME_QUICKMENU; break; \
} ENDS_WITH_CURLY_BRACE
// Get name of specified panel id
#include "xonotic/dialog_hudpanel_weapons.c"
#include "xonotic/dialog_hudpanel_physics.c"
#include "xonotic/dialog_hudpanel_centerprint.c"
+#include "xonotic/dialog_hudpanel_quickmenu.c"
#include "xonotic/slider_picmip.c"
--- /dev/null
+#ifdef INTERFACE
+CLASS(XonoticHUDQuickMenuDialog) EXTENDS(XonoticRootDialog)
+ METHOD(XonoticHUDQuickMenuDialog, fill, void(entity))
+ ATTRIB(XonoticHUDQuickMenuDialog, title, string, _("Quick Menu Panel"))
+ ATTRIB(XonoticHUDQuickMenuDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDQuickMenuDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDQuickMenuDialog, rows, float, 15)
+ ATTRIB(XonoticHUDQuickMenuDialog, columns, float, 4)
+ ATTRIB(XonoticHUDQuickMenuDialog, name, string, "HUDquickmenu")
+ENDCLASS(XonoticHUDQuickMenuDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDQuickMenuDialog_fill(entity me)
+{
+ entity e;
+ string panelname = "quickmenu";
+
+ DIALOG_HUDPANEL_COMMON_NOTOGGLE();
+
+ me.TR(me);
+ me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Text alignment:")));
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_quickmenu_align", "0", _("Left")));
+ me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_quickmenu_align", "0.5", _("Center")));
+ me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_quickmenu_align", "1", _("Right")));
+}
+#endif
i = spawnXonoticHUDCenterprintDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
+
+ i = spawnXonoticHUDQuickMenuDialog();
+ i.configureDialog(i);
+ me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+
// dialogs used by settings
me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
i.configureDialog(i);
--- /dev/null
+"Chat"
+"nice one" "say :-) / nice one"
+"good game" "say good game"
+"hi / good luck" "say hi / good luck and have fun"
+"Chat"
+"Team chat"
+"quad soon" "say_team quad soon"
+"free item, icon" "say_team free item %x^7 (l:%y^7); g_waypointsprite_team_here_p"
+"took item, icon" "say_team took item (l:%l^7); g_waypointsprite_team_here"
+"negative" "say_team negative"
+"positive" "say_team positive"
+"need help, icon" "say_team need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_helpme; cmd voice needhelp"
+"enemy seen, icon" "say_team enemy seen (l:%y^7); g_waypointsprite_team_danger_p; cmd voice incoming"
+"flag seen, icon" "say_team flag seen (l:%y^7); g_waypointsprite_team_here_p; cmd voice seenflag"
+"defending, icon" "say_team defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here"
+"roaming, icon" "say_team roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here"
+"attacking, icon" "say_team attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here"
+"killed flag, icon" "say_team killed flagcarrier (l:%y^7); g_waypointsprite_team_here_p"
+"dropped flag, icon" "say_team dropped flag (l:%d^7); g_waypointsprite_team_here_d"
+"drop gun, icon" "say_team dropped gun %w^7 (l:%l^7); g_waypointsprite_team_here; wait; dropweapon"
+"drop flag/key, icon" "say_team dropped flag/key %w^7 (l:%l^7); g_waypointsprite_team_here; wait; +use"
+"Team chat"
+"screenshot" "wait; screenshot"
+"toggle recording .avi" "wait; toggle cl_capturevideo"
+"toggle fullscreen" "toggle vid_fullscreen; vid_restart"