40 #define QM_TAG_TITLE "T" 41 #define QM_TAG_SUBMENU "S" 42 #define QM_TAG_COMMAND "C" 43 #define QM_TAG_PLCOMMAND "P" 45 #define QuickMenu_Buffer_Set(tag, string) bufstr_set(QuickMenu_Buffer, QuickMenu_Buffer_Size, strcat(tag, string)) 46 #define QuickMenu_Buffer_Get() bufstr_get(QuickMenu_Buffer, QuickMenu_Buffer_Index) 90 if(file ==
"" || file ==
"0")
98 if(file ==
"" || file ==
"0")
99 LOG_INFO(
"No file name is set in hud_panel_quickmenu_file, loading default quickmenu");
104 LOG_INFOF(
"Couldn't open file \"%s\", loading default quickmenu", file);
110 if(mode ==
"default")
118 else if(mode ==
"file")
133 if(argc == 0 ||
argv(0) ==
"")
148 float teamplayers = 0, without_me = 0;
151 case "ALLPLAYERS_BUT_ME": without_me = 1;
152 case "ALLPLAYERS": teamplayers = 0;
break;
153 case "OWNTEAMPLAYERS_BUT_ME": without_me = 1;
154 case "OWNTEAMPLAYERS": teamplayers = 1;
break;
155 case "ENEMYTEAMPLAYERS": teamplayers = 2;
break;
251 TC(
int, teamplayers);
TC(
bool, without_me);
285 z_submenu =
strzone(target_submenu);
307 LOG_WARNF(
"Couldn't find submenu \"%s\"", z_submenu);
319 if(z_submenu !=
"" &&
substring(s, 1, -1) == z_submenu)
325 if(entry_num >= first_entry)
342 if(entry_num >= first_entry)
349 if(entry_num >= first_entry)
352 string command_code =
substring(cmd, 0, 1);
450 bool key_pressed = (bInputType == 0);
469 if(nPrimary ==
K_ESCAPE && key_pressed)
473 else if(nPrimary >=
'0' && nPrimary <=
'9' && key_pressed)
480 string con_keys = findkeysforcommand(
"toggleconsole", 0);
483 for (i = 0; i < keys; ++i)
517 float first_entry_pos, entries_height;
539 entry_pos.y = first_entry_pos + entry_num * fontsize.y;
562 pic =
strcat(
"gfx/hud/default/", option);
563 vector option_size =
'1 1 0' * fontsize.y * 0.8;
564 desc_width -= option_size.x;
566 desc_width -= fontsize.x / 4;
571 float real_desc_width = stringwidth_colors(entry, fontsize);
578 if(offset + real_desc_width + extra_offset < desc_width)
579 offset += extra_offset;
581 offset =
max(0, desc_width - real_desc_width);
666 float ON_value = 1, OFF_value = 0;
673 OFF_value = !ON_value;
676 if(value == ON_value)
677 option =
"checkbox_checked";
678 else if(value == OFF_value)
679 option =
"checkbox_empty";
681 option =
"checkbox_undefined";
703 QuickMenu_Page_ActivatedEntry = -1;
709 #define QUICKMENU_SMENU(submenu,eng_submenu) { \ 710 if(target_submenu == eng_submenu && target_submenu_found) \ 712 if(QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES) \ 713 QuickMenu_Buffer_Set(QM_TAG_SUBMENU, submenu); \ 714 ++QuickMenu_Buffer_Size; \ 715 if(target_submenu == eng_submenu && !target_submenu_found) { \ 716 QuickMenu_Buffer_Size = 0; \ 717 target_submenu_found = true; \ 721 #define QUICKMENU_ENTRY(title,command) { \ 722 if(QuickMenu_Buffer_Size + 1 < QUICKMENU_BUFFER_MAXENTRIES) \ 724 QuickMenu_Buffer_Set(QM_TAG_TITLE, title); \ 725 ++QuickMenu_Buffer_Size; \ 726 QuickMenu_Buffer_Set(QM_TAG_COMMAND, command); \ 728 ++QuickMenu_Buffer_Size; \ 731 #define QUICKMENU_SMENU_PL(submenu,eng_submenu,command,teamplayers,without_me) { \ 732 if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES) {\ 733 QUICKMENU_SMENU(submenu,eng_submenu) \ 734 QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); \ 735 ++QuickMenu_Buffer_Size; \ 736 QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, command); \ 737 ++QuickMenu_Buffer_Size; \ 738 QUICKMENU_SMENU(submenu,eng_submenu) \ 745 #define QUICKMENU_ENTRY_TC(title,command,text,translated_text) {\ 746 if(prvm_language == "en") { \ 748 tc_cmd = sprintf(command, text); \ 750 else if(!autocvar_hud_panel_quickmenu_translatecommands || translated_text == text) { \ 751 tc_title = strcat("(en)", title); \ 752 tc_cmd = sprintf(command, text); \ 755 tc_title = strcat("(", prvm_language, ")", title); \ 756 tc_cmd = sprintf(command, translated_text); \ 758 QUICKMENU_ENTRY(tc_title, tc_cmd) \ 763 TC(
int, teamplayers);
TC(
bool, without_me);
768 for(pl =
players.sort_next; pl; pl = pl.sort_next)
770 if(teamplayers == 1 && (pl.team != myteam || pl.team ==
NUM_SPECTATOR))
772 if(teamplayers == 2 && (pl.team == myteam || pl.team ==
NUM_SPECTATOR))
776 QUICKMENU_ENTRY(
strcat(
"^7", entcs_GetName(pl.sv_entnum)), sprintf(cmd, entcs_GetName(pl.sv_entnum)))
790 bool target_submenu_found =
false;
791 if(target_submenu !=
"")
798 QUICKMENU_SMENU_PL(
CTX(_(
"QMCMD^Send public message to")),
"Send public message to",
"commandmode say %s:^7", 0, 1)
801 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^hi / good luck")),
"say %s",
"hi / good luck and have fun",
CTX(_(
"QMCMD^hi / good luck and have fun")))
803 QUICKMENU_ENTRY(
CTX(_(
"QMCMD^Send in English")),
"toggle hud_panel_quickmenu_translatecommands 0 1; quickmenu; wait; quickmenu default Chat")
810 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^free item, icon")),
"say_team %s; g_waypointsprite_team_here_p",
"free item %x^7 (l:%y^7)",
CTX(_(
"QMCMD^free item %x^7 (l:%y^7)")))
811 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^took item, icon")),
"say_team %s; g_waypointsprite_team_here",
"took item (l:%l^7)",
CTX(_(
"QMCMD^took item (l:%l^7)")))
814 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^need help, icon")),
"say_team %s; g_waypointsprite_team_helpme; cmd voice needhelp",
"need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)",
CTX(_(
"QMCMD^need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
815 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^enemy seen, icon")),
"say_team %s; g_waypointsprite_team_danger_p; cmd voice incoming",
"enemy seen (l:%y^7)",
CTX(_(
"QMCMD^enemy seen (l:%y^7)")))
816 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^flag seen, icon")),
"say_team %s; g_waypointsprite_team_here_p; cmd voice seenflag",
"flag seen (l:%y^7)",
CTX(_(
"QMCMD^flag seen (l:%y^7)")))
817 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^defending, icon")),
"say_team %s; g_waypointsprite_team_here",
"defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)",
CTX(_(
"QMCMD^defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
818 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^roaming, icon")),
"say_team %s; g_waypointsprite_team_here",
"roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)",
CTX(_(
"QMCMD^roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
819 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^attacking, icon")),
"say_team %s; g_waypointsprite_team_here",
"attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)",
CTX(_(
"QMCMD^attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
820 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^killed flagcarrier, icon")),
"say_team %s; g_waypointsprite_team_here_p",
"killed flagcarrier (l:%y^7)",
CTX(_(
"QMCMD^killed flagcarrier (l:%y^7)")))
821 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^dropped flag, icon")),
"say_team %s; g_waypointsprite_team_here_d",
"dropped flag (l:%d^7)",
CTX(_(
"QMCMD^dropped flag (l:%d^7)")))
822 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^drop weapon, icon")),
"say_team %s; g_waypointsprite_team_here; wait; dropweapon",
"dropped gun %w^7 (l:%l^7)",
CTX(_(
"QMCMD^dropped weapon %w^7 (l:%l^7)")))
823 QUICKMENU_ENTRY_TC(
CTX(_(
"QMCMD^drop flag/key, icon")),
"say_team %s; g_waypointsprite_team_here; wait; use",
"dropped flag/key %w^7 (l:%l^7)",
CTX(_(
"QMCMD^dropped flag/key %w^7 (l:%l^7)")))
827 QUICKMENU_SMENU_PL(
CTX(_(
"QMCMD^Send private message to")),
"Send private message to",
"commandmode tell \"%s^7\"", 0, 1)
832 QUICKMENU_ENTRY(
CTX(_(
"QMCMD^Player models like mine")),
"toggle cl_forceplayermodels")
864 if(STAT(TIMELIMIT) > 0)
875 QUICKMENU_SMENU_PL(
CTX(_(
"QMCMD^Spectate a player")),
"Spectate a player",
"spectate \"%s^7\"", 0, 1)
878 if(target_submenu !=
"" && !target_submenu_found)
880 LOG_INFOF(
"Couldn't find submenu \"%s\"", target_submenu);
882 LOG_INFO(
"^3Warning: submenu title must be in English");
886 #undef QUICKMENU_SMENU 887 #undef QUICKMENU_ENTRY 888 #undef QUICKMENU_ENTRY_TC
spree_inf s1 s2 s3loc s2 s1
bool HUD_MinigameMenu_IsOpened()
bool autocvar__hud_configure
string textShortenToWidth(string theText, float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
const float DRAWFLAG_ADDITIVE
#define HUD_Panel_DrawBg()
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
const float DRAWFLAG_NORMAL
vector(float skel, float bonenum) _skel_get_boneabs_hidden
ERASEABLE string CTX(string s)
#define HUD_Write_Cvar(cvar)
void HUD_Panel_LoadCvars()