2 #include "oo/classes.qc"
3 #include "xonotic/util.qh"
5 #include "../common/items/all.qh"
6 #include "../common/weapons/all.qh"
7 #include "../common/mapinfo.qh"
8 #include "../common/mutators/base.qh"
10 ///////////////////////////////////////////////
12 ///////////////////////
13 // This file belongs to dpmod/darkplaces
14 // AK contains all menu functions (especially the required ones)
15 ///////////////////////////////////////////////
17 float mouseButtonsPressed;
24 float menuInitialized;
25 float menuNotTheFirstFrame;
28 float conwidth_s, conheight_s, vidwidth_s, vidheight_s, vidpixelheight_s,
29 realconwidth, realconheight;
34 vidwidth_s = vidheight_s = vidpixelheight_s = 0; // Force updateConwidths on next draw.
43 gamestatus = gamestatus | GAME_ISSERVER;
44 if(clientstate() == CS_CONNECTED || isdemo())
45 gamestatus = gamestatus | GAME_CONNECTED;
47 gamestatus = gamestatus | GAME_DEVELOPER;
53 cvar_set("_menu_alpha", "0");
54 prvm_language = cvar_string("prvm_language");
55 if(prvm_language == "")
58 cvar_set("prvm_language", prvm_language);
59 localcmd("\nmenu_restart\n");
62 prvm_language = strzone(prvm_language);
63 cvar_set("_menu_prvm_language", prvm_language);
66 LOG_TRACEF("^4MQC Build information: ^1%s\n", WATERMARK);
69 // list all game dirs (TEST)
76 s = getgamedirinfo(i, GETGAMEDIRINFO_NAME);
79 LOG_TRACE(s, ": ", getgamedirinfo(i, GETGAMEDIRINFO_DESCRIPTION));
83 // needs to be done so early because of the constants they create
86 RegisterSLCategories();
88 float ddsload = cvar("r_texture_dds_load");
89 float texcomp = cvar("gl_texturecompression");
91 if(ddsload != cvar("r_texture_dds_load") || texcomp != cvar("gl_texturecompression"))
92 localcmd("\nr_restart\n");
96 if(cvar("_menu_initialized")) // always show menu after menu_restart
100 cvar_set("_menu_initialized", "1");
105 const float MENU_ASPECT = 1.25; // 1280x1024
107 void draw_reset_cropped()
109 draw_reset(conwidth, conheight, 0.5 * (realconwidth - conwidth), 0.5 * (realconheight - conheight));
111 void draw_reset_full()
113 draw_reset(realconwidth, realconheight, 0, 0);
116 void UpdateConWidthHeight(float w, float h, float p)
118 if (w != vidwidth_s || h != vidheight_s || p != vidpixelheight_s)
120 if (updateConwidths(w, h, p))
121 localcmd(sprintf("\nexec %s\n", cvar_string("menu_font_cfg")));
124 vidpixelheight_s = p;
126 conwidth_s = conwidth;
127 conheight_s = conheight;
128 realconwidth = cvar("vid_conwidth");
129 realconheight = cvar("vid_conheight");
130 if(realconwidth / realconheight > MENU_ASPECT)
133 conwidth = realconheight * MENU_ASPECT;
134 conheight = realconheight;
139 conwidth = realconwidth;
140 conheight = realconwidth / MENU_ASPECT;
144 if(conwidth_s != conwidth || conheight_s != conheight)
146 draw_reset_cropped();
147 main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
152 vidwidth_s = vidheight_s = vidpixelheight_s = 0; // retry next frame
156 string m_goto_buffer;
157 void m_init_delayed()
159 float fh, glob, n, i;
162 draw_reset_cropped();
170 if(cvar_string("menu_skin") != "")
172 draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
173 fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
176 if(cvar_defstring("menu_skin") != "")
178 cvar_set("menu_skin", cvar_defstring("menu_skin"));
179 draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
180 fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
184 draw_currentSkin = "gfx/menu/default";
185 fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
189 error("cannot load any menu skin\n");
191 draw_currentSkin = strzone(draw_currentSkin);
192 while((s = fgets(fh)))
194 // these two are handled by skinlist.qc
195 if(substring(s, 0, 6) == "title ")
197 if(substring(s, 0, 7) == "author ")
199 n = tokenize_console(s);
201 Skin_ApplySetting(argv(0), substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
205 glob = search_begin(strcat(draw_currentSkin, "/*.tga"), true, true);
208 n = search_getsize(glob);
209 for(i = 0; i < n; ++i)
210 precache_pic(search_getfilename(glob, i));
214 draw_setMousePointer(SKINGFX_CURSOR, SKINSIZE_CURSOR, SKINOFFSET_CURSOR);
216 anim = NEW(AnimHost);
217 main = NEW(MainWindow); main.configureMainWindow(main);
219 main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
222 menuMousePos = '0.5 0.5 0';
228 m_goto(m_goto_buffer);
229 strunzone(m_goto_buffer);
230 m_goto_buffer = string_null;
234 m_display(); // delayed menu display
237 void m_keyup (float key, float ascii)
243 draw_reset_cropped();
244 main.keyUp(main, key, ascii, menuShiftState);
245 if(key >= K_MOUSE1 && key <= K_MOUSE3)
247 --mouseButtonsPressed;
248 if(!mouseButtonsPressed)
249 main.mouseRelease(main, menuMousePos);
250 if(mouseButtonsPressed < 0)
252 mouseButtonsPressed = 0;
253 LOG_TRACE("Warning: released an already released button\n");
256 if(key == K_ALT) menuShiftState -= (menuShiftState & S_ALT);
257 if(key == K_CTRL) menuShiftState -= (menuShiftState & S_CTRL);
258 if(key == K_SHIFT) menuShiftState -= (menuShiftState & S_SHIFT);
261 void m_keydown(float key, float ascii)
269 if(key >= K_MOUSE1 && key <= K_MOUSE3)
271 // detect a click outside of the game window
272 vector p = getmousepos();
273 if(p.x < 0 || p.x > realconwidth || p.y < 0 || p.y > realconheight)
275 ++mouseButtonsPressed;
285 e.keyGrabbed(e, key, ascii);
289 draw_reset_cropped();
290 if(key >= K_MOUSE1 && key <= K_MOUSE3)
291 if(!mouseButtonsPressed)
292 main.mousePress(main, menuMousePos);
293 if(!main.keyDown(main, key, ascii, menuShiftState))
295 if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)) // don't back out to console only
296 m_hide(); // disable menu on unhandled ESC
298 if(key >= K_MOUSE1 && key <= K_MOUSE3)
300 ++mouseButtonsPressed;
301 if(mouseButtonsPressed > 10)
303 mouseButtonsPressed = 10;
304 LOG_TRACE("Warning: pressed an already pressed button\n");
307 if(key == K_ALT) menuShiftState |= S_ALT;
308 if(key == K_CTRL) menuShiftState |= S_CTRL;
309 if(key == K_SHIFT) menuShiftState |= S_SHIFT;
312 const float SCALEMODE_CROP = 0;
313 const float SCALEMODE_LETTERBOX = 1;
314 const float SCALEMODE_WIDTH = 2;
315 const float SCALEMODE_HEIGHT = 3;
316 const float SCALEMODE_STRETCH = 4;
317 void draw_Picture_Aligned(vector algn, float scalemode, string img, float a)
319 vector sz, org, isz, isz_w, isz_h;
320 float width_is_larger;
322 sz = draw_PictureSize(img);
323 width_is_larger = (sz.x * draw_scale.y >= sz.y * draw_scale.x);
324 isz_w = '1 0 0' + '0 1 0' * ((sz.y / sz.x) * (draw_scale.x / draw_scale.y));
325 isz_h = '0 1 0' + '1 0 0' * ((sz.x / sz.y) * (draw_scale.y / draw_scale.x));
331 isz = (width_is_larger ? isz_h : isz_w);
333 case SCALEMODE_LETTERBOX:
334 isz = (width_is_larger ? isz_w : isz_h);
336 case SCALEMODE_WIDTH:
339 case SCALEMODE_HEIGHT:
342 case SCALEMODE_STRETCH:
347 org = eX * (algn.x * (1 - isz.x)) + eY * (algn.y * (1 - isz.y));
348 draw_Picture(org, img, isz, '1 1 1', a);
351 void drawBackground(string img, float a, string algn, float force1)
353 if(main.mainNexposee.ModalController_state == 0)
363 scalemode = SCALEMODE_CROP;
366 for(i = 0; i < strlen(algn); ++i)
368 c = substring(algn, i, 1);
371 case "c": scalemode = SCALEMODE_CROP; goto nopic;
372 case "l": scalemode = SCALEMODE_LETTERBOX; goto nopic;
373 case "h": scalemode = SCALEMODE_HEIGHT; goto nopic;
374 case "w": scalemode = SCALEMODE_WIDTH; goto nopic;
375 case "s": scalemode = SCALEMODE_STRETCH; goto nopic;
376 case "1": case "4": case "7": v.x = 0.0; break;
377 case "2": case "5": case "8": v.x = 0.5; break;
378 case "3": case "6": case "9": v.x = 1.0; break;
379 default: v.x = random(); break;
383 case "7": case "8": case "9": v.y = 0.0; break;
384 case "4": case "5": case "6": v.y = 0.5; break;
385 case "1": case "2": case "3": v.y = 1.0; break;
386 default: v.y = random(); break;
389 draw_Picture_Aligned(v, scalemode, img, a);
391 // force all secondary layers to use alpha 1. Prevents ugly issues
392 // with overlap. It's a flag because it cannot be used for the
394 draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l+1)), 1);
396 draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l+1)), a);
403 float menu_tooltips_old;
404 vector menuTooltipAveragedMousePos;
405 entity menuTooltipItem;
406 vector menuTooltipOrigin;
407 vector menuTooltipSize;
408 float menuTooltipAlpha;
409 string menuTooltipText;
410 float menuTooltipState; // 0: static, 1: fading in, 2: fading out, 3: forced fading out
411 float m_testmousetooltipbox(vector pos)
413 if(pos.x >= menuTooltipOrigin.x && pos.x < menuTooltipOrigin.x + menuTooltipSize.x)
414 if(pos.y >= menuTooltipOrigin.y && pos.y < menuTooltipOrigin.y + menuTooltipSize.y)
418 float m_testtooltipbox(vector tooltippos)
424 if(tooltippos.x + menuTooltipSize.x > 1)
426 if(tooltippos.y + menuTooltipSize.y > 1)
428 menuTooltipOrigin = tooltippos;
431 float m_allocatetooltipbox(vector pos)
433 vector avoidplus, avoidminus;
436 avoidplus.x = (SKINAVOID_TOOLTIP_x + SKINSIZE_CURSOR_x - SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth;
437 avoidplus.y = (SKINAVOID_TOOLTIP_y + SKINSIZE_CURSOR_y - SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight;
440 avoidminus.x = (SKINAVOID_TOOLTIP_x + SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth + menuTooltipSize.x;
441 avoidminus.y = (SKINAVOID_TOOLTIP_y + SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight + menuTooltipSize.y;
446 if(m_testtooltipbox(v))
450 v.x = pos.x - menuTooltipSize.x * 0.5;
451 if(m_testtooltipbox(v))
455 v.x = pos.x - avoidminus.x;
456 if(m_testtooltipbox(v))
460 v.y = pos.y - avoidminus.y;
461 if(m_testtooltipbox(v))
465 v.x = pos.x - menuTooltipSize.x * 0.5;
466 if(m_testtooltipbox(v))
470 v.x = pos.x + avoidplus.x;
471 if(m_testtooltipbox(v))
476 entity m_findtooltipitem(entity root, vector pos)
484 while(it.instanceOfContainer)
486 while(it.instanceOfNexposee && it.focusedChild)
488 it = it.focusedChild;
489 pos = globalToBox(pos, it.Container_origin, it.Container_size);
491 if(it.instanceOfNexposee)
493 it = it.itemFromPoint(it, pos);
496 else if(menu_tooltips == 2 && (it.cvarName || it.onClickCommand))
500 else if(it.instanceOfModalController)
501 it = it.focusedChild;
503 it = it.itemFromPoint(it, pos);
508 else if(menu_tooltips == 2 && (it.cvarName || it.onClickCommand))
510 pos = globalToBox(pos, it.Container_origin, it.Container_size);
517 if (menu_tooltips == 2)
520 if (menuTooltipItem.cvarName)
522 if (getCvarsMulti(menuTooltipItem))
523 s = strcat("[", menuTooltipItem.cvarName, " ", getCvarsMulti(menuTooltipItem), "]");
525 s = strcat("[", menuTooltipItem.cvarName, "]");
527 else if (menuTooltipItem.onClickCommand)
528 s = strcat("<", menuTooltipItem.onClickCommand, ">");
530 return menuTooltipItem.tooltip;
531 if (menuTooltipItem.tooltip)
532 return strcat(menuTooltipItem.tooltip, " ", s);
535 return menuTooltipItem.tooltip;
538 void m_tooltip(vector pos)
545 menu_tooltips = cvar("menu_tooltips");
548 // don't return immediately, fade out the active tooltip first
549 if (menuTooltipItem == NULL)
552 menu_tooltips_old = menu_tooltips;
556 f = bound(0, frametime * 2, 1);
557 menuTooltipAveragedMousePos = menuTooltipAveragedMousePos * (1 - f) + pos * f;
558 f = vlen(pos - menuTooltipAveragedMousePos);
561 it = m_findtooltipitem(main, pos);
563 if(it.instanceOfListBox && it.isScrolling(it))
566 if(it && prev_tooltip != it.tooltip)
568 // fade out if tooltip of a certain item has changed
569 menuTooltipState = 3;
571 strunzone(prev_tooltip);
572 prev_tooltip = strzone(it.tooltip);
574 else if(menuTooltipItem && !m_testmousetooltipbox(pos))
575 menuTooltipState = 3; // fade out if mouse touches it
581 fontsize = '1 0 0' * (SKINFONTSIZE_TOOLTIP / conwidth) + '0 1 0' * (SKINFONTSIZE_TOOLTIP / conheight);
583 // float menuTooltipState; // 0: static, 1: fading in, 2: fading out, 3: forced fading out
584 if(it != menuTooltipItem)
586 switch(menuTooltipState)
591 // another item: fade out first
592 menuTooltipState = 2;
597 menuTooltipState = 1;
598 menuTooltipItem = it;
600 menuTooltipOrigin.x = -1; // unallocated
603 strunzone(menuTooltipText);
604 menuTooltipText = strzone(gettooltip());
608 getWrappedLine_remaining = menuTooltipText;
609 while(getWrappedLine_remaining)
611 s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
613 f = draw_TextWidth(s, false, fontsize);
617 menuTooltipSize.x = w + 2 * (SKINMARGIN_TOOLTIP_x / conwidth);
618 menuTooltipSize.y = i * fontsize.y + 2 * (SKINMARGIN_TOOLTIP_y / conheight);
619 menuTooltipSize.z = 0;
623 // changing item while fading in: fade out first
624 menuTooltipState = 2;
627 // changing item while fading out: can't
631 else if(menuTooltipState == 2) // re-fade in?
632 menuTooltipState = 1;
634 switch(menuTooltipState)
637 menuTooltipAlpha = bound(0, menuTooltipAlpha + 5 * frametime, 1);
638 if(menuTooltipAlpha == 1)
639 menuTooltipState = 0;
642 case 3: // forced fade out
643 menuTooltipAlpha = bound(0, menuTooltipAlpha - 2 * frametime, 1);
644 if(menuTooltipAlpha == 0)
646 menuTooltipState = 0;
647 menuTooltipItem = NULL;
652 if(menuTooltipItem == NULL)
656 strunzone(menuTooltipText);
657 menuTooltipText = string_null;
663 if(menu_tooltips != menu_tooltips_old)
665 if (menu_tooltips != 0 && menu_tooltips_old != 0)
666 menuTooltipItem = NULL; // reload tooltip next frame
667 menu_tooltips_old = menu_tooltips;
669 else if(menuTooltipOrigin.x < 0) // unallocated?
670 m_allocatetooltipbox(pos);
672 if(menuTooltipOrigin.x >= 0)
675 p = SKINBORDER_TOOLTIP;
677 p.y *= 1 / conheight;
678 draw_BorderPicture(menuTooltipOrigin, SKINGFX_TOOLTIP, menuTooltipSize, '1 1 1', menuTooltipAlpha, p);
679 p = menuTooltipOrigin;
680 p.x += SKINMARGIN_TOOLTIP_x / conwidth;
681 p.y += SKINMARGIN_TOOLTIP_y / conheight;
682 getWrappedLine_remaining = menuTooltipText;
683 while(getWrappedLine_remaining)
685 s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
686 draw_Text(p, s, fontsize, SKINCOLOR_TOOLTIP, SKINALPHA_TOOLTIP * menuTooltipAlpha, false);
693 void m_draw(float width, float height)
700 execute_next_frame();
702 menuMouseMode = cvar("menu_mouse_absolute");
707 UpdateConWidthHeight(width, height, cvar("vid_pixelheight"));
711 // TODO draw an info image about this situation
715 if(!menuNotTheFirstFrame)
717 menuNotTheFirstFrame = 1;
719 if(!cvar("menu_video_played"))
721 localcmd("cd loop $menu_cdtrack; play sound/announcer/default/welcome.wav\n");
722 menuLogoAlpha = -0.8; // no idea why, but when I start this at zero, it jumps instead of fading FIXME
724 // ALWAYS set this cvar; if we start but menu is not active, this means we want no background music!
725 localcmd("set menu_video_played 1\n");
729 realFrametime = frametime = min(0.2, t - menuPrevTime);
733 t = cvar("menu_slowmo");
744 if(getmousetarget() == (menuMouseMode ? MT_CLIENT : MT_MENU) && (getkeydest() == KEY_MENU || getkeydest() == KEY_MENU_GRABBED))
745 setkeydest(keyGrabber ? KEY_MENU_GRABBED : KEY_MENU);
750 if(cvar("cl_capturevideo"))
751 frametime = t / cvar("cl_capturevideo_fps"); // make capturevideo work smoothly
753 prevMenuAlpha = menuAlpha;
756 if(menuAlpha == 0 && menuLogoAlpha < 2)
758 menuLogoAlpha = menuLogoAlpha + frametime * 2;
762 menuAlpha = min(1, menuAlpha + frametime * 5);
768 menuAlpha = max(0, menuAlpha - frametime * 5);
772 draw_reset_cropped();
774 if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
776 if(menuLogoAlpha > 0)
779 draw_Fill('0 0 0', '1 1 0', SKINCOLOR_BACKGROUND, 1);
780 drawBackground(SKINGFX_BACKGROUND, bound(0, menuLogoAlpha, 1), SKINALIGN_BACKGROUND, true);
781 draw_reset_cropped();
782 if(menuAlpha <= 0 && SKINALPHA_CURSOR_INTRO > 0)
784 draw_alpha = SKINALPHA_CURSOR_INTRO * bound(0, menuLogoAlpha, 1);
785 draw_drawMousePointer(menuMousePos);
790 else if(SKINALPHA_BACKGROUND_INGAME)
795 drawBackground(SKINGFX_BACKGROUND_INGAME, menuAlpha * SKINALPHA_BACKGROUND_INGAME, SKINALIGN_BACKGROUND_INGAME, false);
796 draw_reset_cropped();
800 if(menuAlpha != prevMenuAlpha)
801 cvar_set("_menu_alpha", ftos(menuAlpha));
803 draw_reset_cropped();
805 draw_reset_cropped();
809 if(prevMenuAlpha > 0)
810 main.initializeDialog(main, main.firstChild);
811 draw_reset_cropped();
816 draw_alpha *= menuAlpha;
820 // do not update mouse position
821 // it prevents mouse jumping to '0 0 0' when menu is fading out
823 else if(menuMouseMode)
826 newMouse = globalToBox(getmousepos(), draw_shift, draw_scale);
827 if(newMouse != '0 0 0')
828 if(newMouse != menuMousePos)
830 menuMousePos = newMouse;
831 if(mouseButtonsPressed)
832 main.mouseDrag(main, menuMousePos);
834 main.mouseMove(main, menuMousePos);
841 vector dMouse, minpos, maxpos;
842 dMouse = getmousepos() * (frametime / realFrametime); // for capturevideo
843 if(dMouse != '0 0 0')
845 minpos = globalToBox('0 0 0', draw_shift, draw_scale);
846 maxpos = globalToBox(eX * (realconwidth - 1) + eY * (realconheight - 1), draw_shift, draw_scale);
847 dMouse = globalToBoxSize(dMouse, draw_scale);
848 menuMousePos += dMouse * cvar("menu_mouse_speed");
849 menuMousePos.x = bound(minpos.x, menuMousePos.x, maxpos.x);
850 menuMousePos.y = bound(minpos.y, menuMousePos.y, maxpos.y);
851 if(mouseButtonsPressed)
852 main.mouseDrag(main, menuMousePos);
854 main.mouseMove(main, menuMousePos);
860 m_tooltip(menuMousePos);
862 draw_alpha = max(draw_alpha, SKINALPHA_CURSOR_INTRO * bound(0, menuLogoAlpha, 1));
864 draw_drawMousePointer(menuMousePos);
866 draw_reset_cropped();
875 setkeydest(KEY_MENU);
876 setmousetarget((menuMouseMode ? MT_CLIENT : MT_MENU));
881 if(mouseButtonsPressed)
882 main.mouseRelease(main, menuMousePos);
883 mouseButtonsPressed = 0;
885 main.focusEnter(main);
886 main.showNotify(main);
892 setkeydest(KEY_GAME);
893 setmousetarget(MT_CLIENT);
898 main.focusLeave(main);
899 main.hideNotify(main);
902 void m_toggle(float mode)
923 for(e = NULL; (e = nextent(e)) != NULL; )
925 if(e.classname != "vtbl")
931 void m_focus_item_chain(entity outermost, entity innermost)
933 if(innermost.parent != outermost)
934 m_focus_item_chain(outermost, innermost.parent);
935 innermost.parent.setFocus(innermost.parent, innermost);
938 void m_activate_window(entity wnd)
943 m_activate_window(par);
945 if(par.instanceOfModalController)
947 if(wnd.tabSelectingButton)
949 TabButton_Click(wnd.tabSelectingButton, wnd);
952 par.initializeDialog(par, wnd);
954 else if(par.instanceOfNexposee)
956 // nexposee (sorry for violating abstraction here)
957 par.selectedChild = wnd;
958 par.animationState = 1;
959 Container_setFocus(par, NULL);
961 else if(par.instanceOfContainer)
965 par.setFocus(par, wnd);
969 void m_setpointerfocus(entity wnd)
971 if(wnd.instanceOfContainer)
973 entity focus = wnd.preferredFocusedGrandChild(wnd);
976 menuMousePos = focus.origin + 0.5 * focus.size;
977 menuMousePos.x *= 1 / conwidth;
978 menuMousePos.y *= 1 / conheight;
979 entity par = wnd.parent;
981 par.setFocus(par, wnd);
983 m_focus_item_chain(wnd, focus);
988 void m_goto(string itemname)
994 strunzone(m_goto_buffer);
995 m_goto_buffer = strzone(itemname);
998 if(itemname == "") // this can be called by GameCommand
1000 if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED))
1006 m_activate_window(main.mainNexposee);
1012 for(e = NULL; (e = find(e, name, itemname)); )
1013 if(e.classname != "vtbl")
1016 if((e) && (!e.requiresConnection || (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))))
1019 m_activate_window(e);
1020 m_setpointerfocus(e);
1026 float menuLastFocusSoundTime;
1027 void m_play_focus_sound()
1029 if(cvar("menu_sounds") > 1)
1030 if(time - menuLastFocusSoundTime > 0.25)
1032 localsound(MENU_SOUND_FOCUS);
1033 menuLastFocusSoundTime = time;
1037 void m_play_click_sound(string soundfile)
1039 if(cvar("menu_sounds"))
1040 localsound(soundfile);