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"))
182 draw_currentSkin =
"gfx/menu/wickedx";
185 if (fh < 0)
error(
"cannot load any menu skin\n");
186 draw_currentSkin =
strzone(draw_currentSkin);
187 for (
string s; (s =
fgets(fh)); )
190 if (
substring(s, 0, 6) ==
"title ")
continue;
191 if (
substring(s, 0, 7) ==
"author ")
continue;
243 LOG_TRACE(
"Warning: released an already released button");
271 e.keyGrabbed(e, key, ascii);
292 LOG_TRACE(
"Warning: pressed an already pressed button");
318 isz = (width_is_larger ? isz_h : isz_w);
321 isz = (width_is_larger ? isz_w : isz_h);
333 vector org =
eX * (algn.x * (1 - isz.x)) +
eY * (algn.y * (1 - isz.y));
339 if (
main.mainNexposee.ModalController_state == 0
346 for (
int i = 0, l = 0; i < len; ++i)
366 case "1":
case "4":
case "7":
369 case "2":
case "5":
case "8":
372 case "3":
case "6":
case "9":
381 case "7":
case "8":
case "9":
384 case "4":
case "5":
case "6":
387 case "1":
case "2":
case "3":
432 if (tooltippos.x < 0)
return false;
433 if (tooltippos.y < 0)
return false;
442 avoidplus.x = (SKINAVOID_TOOLTIP_x + SKINSIZE_CURSOR_x - SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) /
conwidth;
443 avoidplus.y = (SKINAVOID_TOOLTIP_y + SKINSIZE_CURSOR_y - SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) /
conheight;
452 vector v = pos + avoidplus;
460 v.x = pos.x - avoidminus.x;
464 v.y = pos.y - avoidminus.y;
472 v.x = pos.x + avoidplus.x;
480 for (
entity it = root; it.instanceOfContainer; )
482 while (it.instanceOfNexposee && it.focusedChild)
484 it = it.focusedChild;
485 pos =
globalToBox(pos, it.Container_origin, it.Container_size);
487 if (it.instanceOfNexposee)
489 it = it.itemFromPoint(it, pos);
490 if (it.tooltip)
best = it;
491 else if (
menu_tooltips == 2 && (it.controlledCvar || it.onClickCommand))
best = it;
494 else if (it.instanceOfModalController)
496 it = it.focusedChild;
500 it = it.itemFromPoint(it, pos);
503 if (it.tooltip)
best = it;
504 else if (
menu_tooltips == 2 && (it.controlledCvar || it.onClickCommand))
best = it;
505 pos =
globalToBox(pos, it.Container_origin, it.Container_size);
512 if (e.(cvarMin) == e.(cvarMax))
515 return sprintf(_(
"^3%s^7 not equal to \"%s\""), e.(cvarStr),
ftos_mindecimals(e.(cvarMin)));
517 return sprintf(
"^3%s^7 \"%s\"", e.(cvarStr),
ftos_mindecimals(e.(cvarMin)));
519 else if (e.(cvarMin) < e.(cvarMax))
536 s =
strcat(
"^3", cvar_list,
551 s =
strcat(s,
"\n\n", _(
"Has special requirements"));
558 string cvar1_s, cvar2_s, cvar3_s;
566 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));
569 s =
strcat(s, sprintf((
menuTooltipItem.op_setDependent &
BIT(0) ? _(
"Requires %s or %s") : _(
"Requires %s and %s")), cvar1_s, cvar2_s));
572 s =
strcat(s, sprintf(_(
"Requires %s"), cvar1_s));
583 const float MAX_TOOLTIP_LINES = 16;
584 static string prev_tooltip;
602 if (it.instanceOfListBox && it.isScrolling(it)) it =
NULL;
604 if (it && prev_tooltip != it.tooltip)
608 strcpy(prev_tooltip, it.tooltip);
646 for (
int k = 0; k < n && lines <= MAX_TOOLTIP_LINES; ++k)
656 if (lines + 1 > MAX_TOOLTIP_LINES)
717 vector p = SKINBORDER_TOOLTIP;
722 p.x += SKINMARGIN_TOOLTIP_x /
conwidth;
726 for (
int k = 0; k < n && lines <= MAX_TOOLTIP_LINES; ++k)
730 p.y += fontsize.y / 2;
736 if (lines + 1 > MAX_TOOLTIP_LINES)
750 static float connected_time;
770 localcmd(
"\nmenu_cmd directmenu Welcome RESET\n");
780 connected_time =
time;
806 localcmd(
"cd loop $menu_cdtrack\n");
823 t =
cvar(
"menu_slowmo");
870 draw_Fill(
'0 0 0',
'1 1 0', SKINCOLOR_BACKGROUND, 1);
881 else if (SKINALPHA_BACKGROUND_INGAME)
887 SKINALIGN_BACKGROUND_INGAME,
false);
922 if (dMouse !=
'0 0 0')
980 if (mode == 1)
return;
989 if (mode == 0)
return;
998 if (it.classname ==
"vtbl") continue;
1001 cvar_set(
"_menu_cmd_closemenu_available",
"0");
1007 innermost.parent.setFocus(innermost.parent, innermost);
1015 if (par.instanceOfModalController)
1017 if (wnd.tabSelectingButton)
1022 par.initializeDialog(par, wnd);
1024 else if (par.instanceOfNexposee)
1027 par.selectedChild = wnd;
1028 par.animationState = 1;
1031 else if (par.instanceOfContainer)
1034 if (par.focused) par.setFocus(par, wnd);
1040 if (!wnd.instanceOfContainer)
return;
1041 entity focus = wnd.preferredFocusedGrandChild(wnd);
1047 if (par.focused) par.setFocus(par, wnd);
1051void m_goto(
string itemname,
bool hide_menu_on_close)
1065 itemname =
"nexposee";
1068 if (itemname ==
"nexposee")
1078 if (e.classname !=
"vtbl")
break;
1086 if (hide_menu_on_close)
1088 while(e.parent && !(e.instanceOfDialog && e.isTabRoot))
1090 if (e.instanceOfDialog)
1091 e.hideMenuOnClose =
true;
1099 static float menuLastFocusSoundTime;
1100 if (
cvar(
"menu_sounds") < 2)
return;
1101 if (
time - menuLastFocusSoundTime <= 0.25)
return;
1103 menuLastFocusSoundTime =
time;
1108 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()