63 bool restarting =
false;
77 LOG_TRACEF(
"^4MQC Build information: ^1%s", WATERMARK);
83 cvar_set(
"_menu_cmd_closemenu_available",
"1");
92 float ddsload =
cvar(
"r_texture_dds_load");
93 float ddsloadsw =
cvar(
"r_texture_dds_swdecode");
94 float texcomp =
cvar(
"gl_texturecompression");
96 if (ddsload !=
cvar(
"r_texture_dds_load") || ddsloadsw !=
cvar(
"r_texture_dds_swdecode") || texcomp !=
cvar(
"gl_texturecompression"))
101 if (
cvar(
"_menu_initialized"))
187 draw_currentSkin =
"gfx/menu/wickedx";
190 if (fh < 0)
error(
"cannot load any menu skin\n");
191 draw_currentSkin =
strzone(draw_currentSkin);
192 for (
string s; (s =
fgets(fh)); )
195 if (
substring(s, 0, 6) ==
"title ")
continue;
196 if (
substring(s, 0, 7) ==
"author ")
continue;
248 LOG_TRACE(
"Warning: released an already released button");
276 e.keyGrabbed(e, key, ascii);
297 LOG_TRACE(
"Warning: pressed an already pressed button");
323 isz = (width_is_larger ? isz_h : isz_w);
326 isz = (width_is_larger ? isz_w : isz_h);
338 vector org =
eX * (algn.x * (1 - isz.x)) +
eY * (algn.y * (1 - isz.y));
344 if (
main.mainNexposee.ModalController_state == 0
351 for (
int i = 0, l = 0; i < len; ++i)
371 case "1":
case "4":
case "7":
374 case "2":
case "5":
case "8":
377 case "3":
case "6":
case "9":
386 case "7":
case "8":
case "9":
389 case "4":
case "5":
case "6":
392 case "1":
case "2":
case "3":
437 if (tooltippos.x < 0)
return false;
438 if (tooltippos.y < 0)
return false;
447 avoidplus.x = (SKINAVOID_TOOLTIP_x + SKINSIZE_CURSOR_x - SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) /
conwidth;
448 avoidplus.y = (SKINAVOID_TOOLTIP_y + SKINSIZE_CURSOR_y - SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) /
conheight;
457 vector v = pos + avoidplus;
465 v.x = pos.x - avoidminus.x;
469 v.y = pos.y - avoidminus.y;
477 v.x = pos.x + avoidplus.x;
485 for (
entity it = root; it.instanceOfContainer; )
487 while (it.instanceOfNexposee && it.focusedChild)
489 it = it.focusedChild;
490 pos =
globalToBox(pos, it.Container_origin, it.Container_size);
492 if (it.instanceOfNexposee)
494 it = it.itemFromPoint(it, pos);
495 if (it.tooltip)
best = it;
496 else if (
menu_tooltips == 2 && (it.controlledCvar || it.onClickCommand))
best = it;
499 else if (it.instanceOfModalController)
501 it = it.focusedChild;
505 it = it.itemFromPoint(it, pos);
508 if (it.tooltip)
best = it;
509 else if (
menu_tooltips == 2 && (it.controlledCvar || it.onClickCommand))
best = it;
510 pos =
globalToBox(pos, it.Container_origin, it.Container_size);
517 if (e.(cvarMin) == e.(cvarMax))
520 return sprintf(_(
"^3%s^7 not equal to \"%s\""), e.(cvarStr),
ftos_mindecimals(e.(cvarMin)));
522 return sprintf(
"^3%s^7 \"%s\"", e.(cvarStr),
ftos_mindecimals(e.(cvarMin)));
524 else if (e.(cvarMin) < e.(cvarMax))
541 s =
strcat(
"^3", cvar_list,
556 s =
strcat(s,
"\n\n", _(
"Has special requirements"));
563 string cvar1_s, cvar2_s, cvar3_s;
571 s =
strcat(s, sprintf((
menuTooltipItem.op_setDependent &
BIT(0) ? _(
"Requires %s, %s, and %s") : _(
"Requires %s, %s, or %s")), cvar1_s, cvar2_s, cvar3_s));
574 s =
strcat(s, sprintf((
menuTooltipItem.op_setDependent &
BIT(0) ? _(
"Requires %s or %s") : _(
"Requires %s and %s")), cvar1_s, cvar2_s));
577 s =
strcat(s, sprintf(_(
"Requires %s"), cvar1_s));
588 const float MAX_TOOLTIP_LINES = 16;
589 static string prev_tooltip;
607 if (it.instanceOfListBox && it.isScrolling(it)) it =
NULL;
609 if (it && prev_tooltip != it.tooltip)
613 strcpy(prev_tooltip, it.tooltip);
651 for (
int k = 0; k < n && lines <= MAX_TOOLTIP_LINES; ++k)
661 if (lines + 1 > MAX_TOOLTIP_LINES)
722 vector p = SKINBORDER_TOOLTIP;
727 p.x += SKINMARGIN_TOOLTIP_x /
conwidth;
731 for (
int k = 0; k < n && lines <= MAX_TOOLTIP_LINES; ++k)
735 p.y += fontsize.y / 2;
741 if (lines + 1 > MAX_TOOLTIP_LINES)
755 static float connected_time;
775 localcmd(
"\nmenu_cmd directmenu Welcome RESET\n");
785 connected_time =
time;
811 localcmd(
"cd loop $menu_cdtrack\n");
828 t =
cvar(
"menu_slowmo");
875 draw_Fill(
'0 0 0',
'1 1 0', SKINCOLOR_BACKGROUND, 1);
886 else if (SKINALPHA_BACKGROUND_INGAME)
892 SKINALIGN_BACKGROUND_INGAME,
false);
927 if (dMouse !=
'0 0 0')
985 if (mode == 1)
return;
994 if (mode == 0)
return;
1003 if (it.classname ==
"vtbl") continue;
1006 cvar_set(
"_menu_cmd_closemenu_available",
"0");
1012 innermost.parent.setFocus(innermost.parent, innermost);
1020 if (par.instanceOfModalController)
1022 if (wnd.tabSelectingButton)
1027 par.initializeDialog(par, wnd);
1029 else if (par.instanceOfNexposee)
1032 par.selectedChild = wnd;
1033 par.animationState = 1;
1036 else if (par.instanceOfContainer)
1039 if (par.focused) par.setFocus(par, wnd);
1045 if (!wnd.instanceOfContainer)
return;
1046 entity focus = wnd.preferredFocusedGrandChild(wnd);
1052 if (par.focused) par.setFocus(par, wnd);
1056void m_goto(
string itemname,
bool hide_menu_on_close)
1070 itemname =
"nexposee";
1073 if (itemname ==
"nexposee")
1083 if (e.classname !=
"vtbl")
break;
1091 if (hide_menu_on_close)
1093 while(e.parent && !(e.instanceOfDialog && e.isTabRoot))
1095 if (e.instanceOfDialog)
1096 e.hideMenuOnClose =
true;
1104 static float menuLastFocusSoundTime;
1105 if (
cvar(
"menu_sounds") < 2)
return;
1106 if (
time - menuLastFocusSoundTime <= 0.25)
return;
1108 menuLastFocusSoundTime =
time;
1113 if (!
cvar(
"menu_sounds"))
return;
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
void CheckEngineExtensions(void)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
ERASEABLE string rgb_to_hexcolor(vector rgb)
void execute_next_frame()
string getWrappedLine(float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
string getWrappedLine_remaining
void Container_setFocus(entity me, entity other)
#define tokenizebyseparator
ERASEABLE void IL_ENDFRAME()
#define FOREACH_ENTITY_ORDERED(cond, body)
void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
void TabButton_Click(entity button, entity tab)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void RegisterSLCategories()
#define static_init_late()
#define static_init_precache()
ERASEABLE string ftos_mindecimals(float number)
Converts a number to a string with the minimum number of decimals It assumes that an extreme accuracy...
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()