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
87 RegisterSLCategories();
89 float ddsload = cvar("r_texture_dds_load");
90 float texcomp = cvar("gl_texturecompression");
92 if(ddsload != cvar("r_texture_dds_load") || texcomp != cvar("gl_texturecompression"))
93 localcmd("\nr_restart\n");
97 if(cvar("_menu_initialized")) // always show menu after menu_restart
101 cvar_set("_menu_initialized", "1");
106 const float MENU_ASPECT = 1.25; // 1280x1024
108 void draw_reset_cropped()
110 draw_reset(conwidth, conheight, 0.5 * (realconwidth - conwidth), 0.5 * (realconheight - conheight));
112 void draw_reset_full()
114 draw_reset(realconwidth, realconheight, 0, 0);
117 void UpdateConWidthHeight(float w, float h, float p)
119 if (w != vidwidth_s || h != vidheight_s || p != vidpixelheight_s)
121 if (updateConwidths(w, h, p))
122 localcmd(sprintf("\nexec %s\n", cvar_string("menu_font_cfg")));
125 vidpixelheight_s = p;
127 conwidth_s = conwidth;
128 conheight_s = conheight;
129 realconwidth = cvar("vid_conwidth");
130 realconheight = cvar("vid_conheight");
131 if(realconwidth / realconheight > MENU_ASPECT)
134 conwidth = realconheight * MENU_ASPECT;
135 conheight = realconheight;
140 conwidth = realconwidth;
141 conheight = realconwidth / MENU_ASPECT;
145 if(conwidth_s != conwidth || conheight_s != conheight)
147 draw_reset_cropped();
148 main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
153 vidwidth_s = vidheight_s = vidpixelheight_s = 0; // retry next frame
157 string m_goto_buffer;
158 void m_init_delayed()
160 float fh, glob, n, i;
163 draw_reset_cropped();
171 if(cvar_string("menu_skin") != "")
173 draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
174 fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
177 if(cvar_defstring("menu_skin") != "")
179 cvar_set("menu_skin", cvar_defstring("menu_skin"));
180 draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
181 fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
185 draw_currentSkin = "gfx/menu/default";
186 fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
190 error("cannot load any menu skin\n");
192 draw_currentSkin = strzone(draw_currentSkin);
193 while((s = fgets(fh)))
195 // these two are handled by skinlist.qc
196 if(substring(s, 0, 6) == "title ")
198 if(substring(s, 0, 7) == "author ")
200 n = tokenize_console(s);
202 Skin_ApplySetting(argv(0), substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
206 glob = search_begin(strcat(draw_currentSkin, "/*.tga"), true, true);
209 n = search_getsize(glob);
210 for(i = 0; i < n; ++i)
211 precache_pic(search_getfilename(glob, i));
215 draw_setMousePointer(SKINGFX_CURSOR, SKINSIZE_CURSOR, SKINOFFSET_CURSOR);
217 anim = NEW(AnimHost);
218 main = NEW(MainWindow); main.configureMainWindow(main);
220 main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
223 menuMousePos = '0.5 0.5 0';
229 m_goto(m_goto_buffer);
230 strunzone(m_goto_buffer);
231 m_goto_buffer = string_null;
235 m_display(); // delayed menu display
238 void m_keyup (float key, float ascii)
244 draw_reset_cropped();
245 main.keyUp(main, key, ascii, menuShiftState);
246 if(key >= K_MOUSE1 && key <= K_MOUSE3)
248 --mouseButtonsPressed;
249 if(!mouseButtonsPressed)
250 main.mouseRelease(main, menuMousePos);
251 if(mouseButtonsPressed < 0)
253 mouseButtonsPressed = 0;
254 LOG_TRACE("Warning: released an already released button\n");
257 if(key == K_ALT) menuShiftState -= (menuShiftState & S_ALT);
258 if(key == K_CTRL) menuShiftState -= (menuShiftState & S_CTRL);
259 if(key == K_SHIFT) menuShiftState -= (menuShiftState & S_SHIFT);
262 void m_keydown(float key, float ascii)
270 if(key >= K_MOUSE1 && key <= K_MOUSE3)
272 // detect a click outside of the game window
273 vector p = getmousepos();
274 if(p.x < 0 || p.x > realconwidth || p.y < 0 || p.y > realconheight)
276 ++mouseButtonsPressed;
286 e.keyGrabbed(e, key, ascii);
290 draw_reset_cropped();
291 if(key >= K_MOUSE1 && key <= K_MOUSE3)
292 if(!mouseButtonsPressed)
293 main.mousePress(main, menuMousePos);
294 if(!main.keyDown(main, key, ascii, menuShiftState))
296 if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)) // don't back out to console only
297 m_hide(); // disable menu on unhandled ESC
299 if(key >= K_MOUSE1 && key <= K_MOUSE3)
301 ++mouseButtonsPressed;
302 if(mouseButtonsPressed > 10)
304 mouseButtonsPressed = 10;
305 LOG_TRACE("Warning: pressed an already pressed button\n");
308 if(key == K_ALT) menuShiftState |= S_ALT;
309 if(key == K_CTRL) menuShiftState |= S_CTRL;
310 if(key == K_SHIFT) menuShiftState |= S_SHIFT;
313 const float SCALEMODE_CROP = 0;
314 const float SCALEMODE_LETTERBOX = 1;
315 const float SCALEMODE_WIDTH = 2;
316 const float SCALEMODE_HEIGHT = 3;
317 const float SCALEMODE_STRETCH = 4;
318 void draw_Picture_Aligned(vector algn, float scalemode, string img, float a)
320 vector sz, org, isz, isz_w, isz_h;
321 float width_is_larger;
323 sz = draw_PictureSize(img);
324 width_is_larger = (sz.x * draw_scale.y >= sz.y * draw_scale.x);
325 isz_w = '1 0 0' + '0 1 0' * ((sz.y / sz.x) * (draw_scale.x / draw_scale.y));
326 isz_h = '0 1 0' + '1 0 0' * ((sz.x / sz.y) * (draw_scale.y / draw_scale.x));
332 isz = (width_is_larger ? isz_h : isz_w);
334 case SCALEMODE_LETTERBOX:
335 isz = (width_is_larger ? isz_w : isz_h);
337 case SCALEMODE_WIDTH:
340 case SCALEMODE_HEIGHT:
343 case SCALEMODE_STRETCH:
348 org = eX * (algn.x * (1 - isz.x)) + eY * (algn.y * (1 - isz.y));
349 draw_Picture(org, img, isz, '1 1 1', a);
352 void drawBackground(string img, float a, string algn, float force1)
354 if(main.mainNexposee.ModalController_state == 0)
364 scalemode = SCALEMODE_CROP;
367 for(i = 0; i < strlen(algn); ++i)
369 c = substring(algn, i, 1);
372 case "c": scalemode = SCALEMODE_CROP; goto nopic;
373 case "l": scalemode = SCALEMODE_LETTERBOX; goto nopic;
374 case "h": scalemode = SCALEMODE_HEIGHT; goto nopic;
375 case "w": scalemode = SCALEMODE_WIDTH; goto nopic;
376 case "s": scalemode = SCALEMODE_STRETCH; goto nopic;
377 case "1": case "4": case "7": v.x = 0.0; break;
378 case "2": case "5": case "8": v.x = 0.5; break;
379 case "3": case "6": case "9": v.x = 1.0; break;
380 default: v.x = random(); break;
384 case "7": case "8": case "9": v.y = 0.0; break;
385 case "4": case "5": case "6": v.y = 0.5; break;
386 case "1": case "2": case "3": v.y = 1.0; break;
387 default: v.y = random(); break;
390 draw_Picture_Aligned(v, scalemode, img, a);
392 // force all secondary layers to use alpha 1. Prevents ugly issues
393 // with overlap. It's a flag because it cannot be used for the
395 draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l+1)), 1);
397 draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l+1)), a);
404 float menu_tooltips_old;
405 vector menuTooltipAveragedMousePos;
406 entity menuTooltipItem;
407 vector menuTooltipOrigin;
408 vector menuTooltipSize;
409 float menuTooltipAlpha;
410 string menuTooltipText;
411 float menuTooltipState; // 0: static, 1: fading in, 2: fading out, 3: forced fading out
412 float m_testmousetooltipbox(vector pos)
414 if(pos.x >= menuTooltipOrigin.x && pos.x < menuTooltipOrigin.x + menuTooltipSize.x)
415 if(pos.y >= menuTooltipOrigin.y && pos.y < menuTooltipOrigin.y + menuTooltipSize.y)
419 float m_testtooltipbox(vector tooltippos)
425 if(tooltippos.x + menuTooltipSize.x > 1)
427 if(tooltippos.y + menuTooltipSize.y > 1)
429 menuTooltipOrigin = tooltippos;
432 float m_allocatetooltipbox(vector pos)
434 vector avoidplus, avoidminus;
437 avoidplus.x = (SKINAVOID_TOOLTIP_x + SKINSIZE_CURSOR_x - SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth;
438 avoidplus.y = (SKINAVOID_TOOLTIP_y + SKINSIZE_CURSOR_y - SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight;
441 avoidminus.x = (SKINAVOID_TOOLTIP_x + SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth + menuTooltipSize.x;
442 avoidminus.y = (SKINAVOID_TOOLTIP_y + SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight + menuTooltipSize.y;
447 if(m_testtooltipbox(v))
451 v.x = pos.x - menuTooltipSize.x * 0.5;
452 if(m_testtooltipbox(v))
456 v.x = pos.x - avoidminus.x;
457 if(m_testtooltipbox(v))
461 v.y = pos.y - avoidminus.y;
462 if(m_testtooltipbox(v))
466 v.x = pos.x - menuTooltipSize.x * 0.5;
467 if(m_testtooltipbox(v))
471 v.x = pos.x + avoidplus.x;
472 if(m_testtooltipbox(v))
477 entity m_findtooltipitem(entity root, vector pos)
485 while(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);
497 else if(menu_tooltips == 2 && (it.cvarName || it.onClickCommand))
501 else if(it.instanceOfModalController)
502 it = it.focusedChild;
504 it = it.itemFromPoint(it, pos);
509 else if(menu_tooltips == 2 && (it.cvarName || it.onClickCommand))
511 pos = globalToBox(pos, it.Container_origin, it.Container_size);
518 if (menu_tooltips == 2)
521 if (menuTooltipItem.cvarName)
523 if (getCvarsMulti(menuTooltipItem))
524 s = strcat("[", menuTooltipItem.cvarName, " ", getCvarsMulti(menuTooltipItem), "]");
526 s = strcat("[", menuTooltipItem.cvarName, "]");
528 else if (menuTooltipItem.onClickCommand)
529 s = strcat("<", menuTooltipItem.onClickCommand, ">");
531 return menuTooltipItem.tooltip;
532 if (menuTooltipItem.tooltip)
533 return strcat(menuTooltipItem.tooltip, " ", s);
536 return menuTooltipItem.tooltip;
539 void m_tooltip(vector pos)
546 menu_tooltips = cvar("menu_tooltips");
549 // don't return immediately, fade out the active tooltip first
550 if (menuTooltipItem == NULL)
553 menu_tooltips_old = menu_tooltips;
557 f = bound(0, frametime * 2, 1);
558 menuTooltipAveragedMousePos = menuTooltipAveragedMousePos * (1 - f) + pos * f;
559 f = vlen(pos - menuTooltipAveragedMousePos);
562 it = m_findtooltipitem(main, pos);
564 if(it.instanceOfListBox && it.isScrolling(it))
567 if(it && prev_tooltip != it.tooltip)
569 // fade out if tooltip of a certain item has changed
570 menuTooltipState = 3;
572 strunzone(prev_tooltip);
573 prev_tooltip = strzone(it.tooltip);
575 else if(menuTooltipItem && !m_testmousetooltipbox(pos))
576 menuTooltipState = 3; // fade out if mouse touches it
582 fontsize = '1 0 0' * (SKINFONTSIZE_TOOLTIP / conwidth) + '0 1 0' * (SKINFONTSIZE_TOOLTIP / conheight);
584 // float menuTooltipState; // 0: static, 1: fading in, 2: fading out, 3: forced fading out
585 if(it != menuTooltipItem)
587 switch(menuTooltipState)
592 // another item: fade out first
593 menuTooltipState = 2;
598 menuTooltipState = 1;
599 menuTooltipItem = it;
601 menuTooltipOrigin.x = -1; // unallocated
604 strunzone(menuTooltipText);
605 menuTooltipText = strzone(gettooltip());
609 getWrappedLine_remaining = menuTooltipText;
610 while(getWrappedLine_remaining)
612 s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
614 f = draw_TextWidth(s, false, fontsize);
618 menuTooltipSize.x = w + 2 * (SKINMARGIN_TOOLTIP_x / conwidth);
619 menuTooltipSize.y = i * fontsize.y + 2 * (SKINMARGIN_TOOLTIP_y / conheight);
620 menuTooltipSize.z = 0;
624 // changing item while fading in: fade out first
625 menuTooltipState = 2;
628 // changing item while fading out: can't
632 else if(menuTooltipState == 2) // re-fade in?
633 menuTooltipState = 1;
635 switch(menuTooltipState)
638 menuTooltipAlpha = bound(0, menuTooltipAlpha + 5 * frametime, 1);
639 if(menuTooltipAlpha == 1)
640 menuTooltipState = 0;
643 case 3: // forced fade out
644 menuTooltipAlpha = bound(0, menuTooltipAlpha - 2 * frametime, 1);
645 if(menuTooltipAlpha == 0)
647 menuTooltipState = 0;
648 menuTooltipItem = NULL;
653 if(menuTooltipItem == NULL)
657 strunzone(menuTooltipText);
658 menuTooltipText = string_null;
664 if(menu_tooltips != menu_tooltips_old)
666 if (menu_tooltips != 0 && menu_tooltips_old != 0)
667 menuTooltipItem = NULL; // reload tooltip next frame
668 menu_tooltips_old = menu_tooltips;
670 else if(menuTooltipOrigin.x < 0) // unallocated?
671 m_allocatetooltipbox(pos);
673 if(menuTooltipOrigin.x >= 0)
676 p = SKINBORDER_TOOLTIP;
678 p.y *= 1 / conheight;
679 draw_BorderPicture(menuTooltipOrigin, SKINGFX_TOOLTIP, menuTooltipSize, '1 1 1', menuTooltipAlpha, p);
680 p = menuTooltipOrigin;
681 p.x += SKINMARGIN_TOOLTIP_x / conwidth;
682 p.y += SKINMARGIN_TOOLTIP_y / conheight;
683 getWrappedLine_remaining = menuTooltipText;
684 while(getWrappedLine_remaining)
686 s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
687 draw_Text(p, s, fontsize, SKINCOLOR_TOOLTIP, SKINALPHA_TOOLTIP * menuTooltipAlpha, false);
694 void m_draw(float width, float height)
701 execute_next_frame();
703 menuMouseMode = cvar("menu_mouse_absolute");
708 UpdateConWidthHeight(width, height, cvar("vid_pixelheight"));
712 // TODO draw an info image about this situation
716 if(!menuNotTheFirstFrame)
718 menuNotTheFirstFrame = 1;
720 if(!cvar("menu_video_played"))
722 localcmd("cd loop $menu_cdtrack; play sound/announcer/default/welcome.wav\n");
723 menuLogoAlpha = -0.8; // no idea why, but when I start this at zero, it jumps instead of fading FIXME
725 // ALWAYS set this cvar; if we start but menu is not active, this means we want no background music!
726 localcmd("set menu_video_played 1\n");
730 realFrametime = frametime = min(0.2, t - menuPrevTime);
734 t = cvar("menu_slowmo");
745 if(getmousetarget() == (menuMouseMode ? MT_CLIENT : MT_MENU) && (getkeydest() == KEY_MENU || getkeydest() == KEY_MENU_GRABBED))
746 setkeydest(keyGrabber ? KEY_MENU_GRABBED : KEY_MENU);
751 if(cvar("cl_capturevideo"))
752 frametime = t / cvar("cl_capturevideo_fps"); // make capturevideo work smoothly
754 prevMenuAlpha = menuAlpha;
757 if(menuAlpha == 0 && menuLogoAlpha < 2)
759 menuLogoAlpha = menuLogoAlpha + frametime * 2;
763 menuAlpha = min(1, menuAlpha + frametime * 5);
769 menuAlpha = max(0, menuAlpha - frametime * 5);
773 draw_reset_cropped();
775 if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
777 if(menuLogoAlpha > 0)
780 draw_Fill('0 0 0', '1 1 0', SKINCOLOR_BACKGROUND, 1);
781 drawBackground(SKINGFX_BACKGROUND, bound(0, menuLogoAlpha, 1), SKINALIGN_BACKGROUND, true);
782 draw_reset_cropped();
783 if(menuAlpha <= 0 && SKINALPHA_CURSOR_INTRO > 0)
785 draw_alpha = SKINALPHA_CURSOR_INTRO * bound(0, menuLogoAlpha, 1);
786 draw_drawMousePointer(menuMousePos);
791 else if(SKINALPHA_BACKGROUND_INGAME)
796 drawBackground(SKINGFX_BACKGROUND_INGAME, menuAlpha * SKINALPHA_BACKGROUND_INGAME, SKINALIGN_BACKGROUND_INGAME, false);
797 draw_reset_cropped();
801 if(menuAlpha != prevMenuAlpha)
802 cvar_set("_menu_alpha", ftos(menuAlpha));
804 draw_reset_cropped();
806 draw_reset_cropped();
810 if(prevMenuAlpha > 0)
811 main.initializeDialog(main, main.firstChild);
812 draw_reset_cropped();
817 draw_alpha *= menuAlpha;
821 // do not update mouse position
822 // it prevents mouse jumping to '0 0 0' when menu is fading out
824 else if(menuMouseMode)
827 newMouse = globalToBox(getmousepos(), draw_shift, draw_scale);
828 if(newMouse != '0 0 0')
829 if(newMouse != menuMousePos)
831 menuMousePos = newMouse;
832 if(mouseButtonsPressed)
833 main.mouseDrag(main, menuMousePos);
835 main.mouseMove(main, menuMousePos);
842 vector dMouse, minpos, maxpos;
843 dMouse = getmousepos() * (frametime / realFrametime); // for capturevideo
844 if(dMouse != '0 0 0')
846 minpos = globalToBox('0 0 0', draw_shift, draw_scale);
847 maxpos = globalToBox(eX * (realconwidth - 1) + eY * (realconheight - 1), draw_shift, draw_scale);
848 dMouse = globalToBoxSize(dMouse, draw_scale);
849 menuMousePos += dMouse * cvar("menu_mouse_speed");
850 menuMousePos.x = bound(minpos.x, menuMousePos.x, maxpos.x);
851 menuMousePos.y = bound(minpos.y, menuMousePos.y, maxpos.y);
852 if(mouseButtonsPressed)
853 main.mouseDrag(main, menuMousePos);
855 main.mouseMove(main, menuMousePos);
861 m_tooltip(menuMousePos);
863 draw_alpha = max(draw_alpha, SKINALPHA_CURSOR_INTRO * bound(0, menuLogoAlpha, 1));
865 draw_drawMousePointer(menuMousePos);
867 draw_reset_cropped();
876 setkeydest(KEY_MENU);
877 setmousetarget((menuMouseMode ? MT_CLIENT : MT_MENU));
882 if(mouseButtonsPressed)
883 main.mouseRelease(main, menuMousePos);
884 mouseButtonsPressed = 0;
886 main.focusEnter(main);
887 main.showNotify(main);
893 setkeydest(KEY_GAME);
894 setmousetarget(MT_CLIENT);
899 main.focusLeave(main);
900 main.hideNotify(main);
903 void m_toggle(float mode)
924 for(e = NULL; (e = nextent(e)) != NULL; )
926 if(e.classname != "vtbl")
932 void m_focus_item_chain(entity outermost, entity innermost)
934 if(innermost.parent != outermost)
935 m_focus_item_chain(outermost, innermost.parent);
936 innermost.parent.setFocus(innermost.parent, innermost);
939 void m_activate_window(entity wnd)
944 m_activate_window(par);
946 if(par.instanceOfModalController)
948 if(wnd.tabSelectingButton)
950 TabButton_Click(wnd.tabSelectingButton, wnd);
953 par.initializeDialog(par, wnd);
955 else if(par.instanceOfNexposee)
957 // nexposee (sorry for violating abstraction here)
958 par.selectedChild = wnd;
959 par.animationState = 1;
960 Container_setFocus(par, NULL);
962 else if(par.instanceOfContainer)
966 par.setFocus(par, wnd);
970 void m_setpointerfocus(entity wnd)
972 if(wnd.instanceOfContainer)
974 entity focus = wnd.preferredFocusedGrandChild(wnd);
977 menuMousePos = focus.origin + 0.5 * focus.size;
978 menuMousePos.x *= 1 / conwidth;
979 menuMousePos.y *= 1 / conheight;
980 entity par = wnd.parent;
982 par.setFocus(par, wnd);
984 m_focus_item_chain(wnd, focus);
989 void m_goto(string itemname)
995 strunzone(m_goto_buffer);
996 m_goto_buffer = strzone(itemname);
999 if(itemname == "") // this can be called by GameCommand
1001 if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED))
1007 m_activate_window(main.mainNexposee);
1013 for(e = NULL; (e = find(e, name, itemname)); )
1014 if(e.classname != "vtbl")
1017 if((e) && (!e.requiresConnection || (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))))
1020 m_activate_window(e);
1021 m_setpointerfocus(e);
1027 float menuLastFocusSoundTime;
1028 void m_play_focus_sound()
1030 if(cvar("menu_sounds") > 1)
1031 if(time - menuLastFocusSoundTime > 0.25)
1033 localsound(MENU_SOUND_FOCUS);
1034 menuLastFocusSoundTime = time;
1038 void m_play_click_sound(string soundfile)
1040 if(cvar("menu_sounds"))
1041 localsound(soundfile);