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"
9 ///////////////////////////////////////////////
11 ///////////////////////
12 // This file belongs to dpmod/darkplaces
13 // AK contains all menu functions (especially the required ones)
14 ///////////////////////////////////////////////
16 float mouseButtonsPressed;
23 float menuInitialized;
24 float menuNotTheFirstFrame;
27 float conwidth_s, conheight_s, vidwidth_s, vidheight_s, vidpixelheight_s,
28 realconwidth, realconheight;
33 vidwidth_s = vidheight_s = vidpixelheight_s = 0; // Force updateConwidths on next draw.
42 gamestatus = gamestatus | GAME_ISSERVER;
43 if(clientstate() == CS_CONNECTED || isdemo())
44 gamestatus = gamestatus | GAME_CONNECTED;
46 gamestatus = gamestatus | GAME_DEVELOPER;
52 cvar_set("_menu_alpha", "0");
53 prvm_language = cvar_string("prvm_language");
54 if(prvm_language == "")
57 cvar_set("prvm_language", prvm_language);
58 localcmd("\nmenu_restart\n");
61 prvm_language = strzone(prvm_language);
62 cvar_set("_menu_prvm_language", prvm_language);
65 dprintf("^4MQC Build information: ^1%s\n", WATERMARK);
68 // list all game dirs (TEST)
75 s = getgamedirinfo(i, GETGAMEDIRINFO_NAME);
78 dprint(s, ": ", getgamedirinfo(i, GETGAMEDIRINFO_DESCRIPTION));
82 // needs to be done so early because of the constants they create
83 CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
84 CALL_ACCUMULATED_FUNCTION(RegisterItems);
85 CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
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);
218 anim = NEW(AnimHost);
219 main = NEW(MainWindow); main.configureMainWindow(main);
222 main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
225 menuMousePos = '0.5 0.5 0';
231 m_goto(m_goto_buffer);
232 strunzone(m_goto_buffer);
233 m_goto_buffer = string_null;
237 m_display(); // delayed menu display
240 void m_keyup (float key, float ascii)
246 draw_reset_cropped();
247 main.keyUp(main, key, ascii, menuShiftState);
248 if(key >= K_MOUSE1 && key <= K_MOUSE3)
250 --mouseButtonsPressed;
251 if(!mouseButtonsPressed)
252 main.mouseRelease(main, menuMousePos);
253 if(mouseButtonsPressed < 0)
255 mouseButtonsPressed = 0;
256 dprint("Warning: released an already released button\n");
259 if(key == K_ALT) menuShiftState -= (menuShiftState & S_ALT);
260 if(key == K_CTRL) menuShiftState -= (menuShiftState & S_CTRL);
261 if(key == K_SHIFT) menuShiftState -= (menuShiftState & S_SHIFT);
264 void m_keydown(float key, float ascii)
272 if(key >= K_MOUSE1 && key <= K_MOUSE3)
274 // detect a click outside of the game window
275 vector p = getmousepos();
276 if(p.x < 0 || p.x > realconwidth || p.y < 0 || p.y > realconheight)
278 ++mouseButtonsPressed;
288 e.keyGrabbed(e, key, ascii);
292 draw_reset_cropped();
293 if(key >= K_MOUSE1 && key <= K_MOUSE3)
294 if(!mouseButtonsPressed)
295 main.mousePress(main, menuMousePos);
296 if(!main.keyDown(main, key, ascii, menuShiftState))
298 if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)) // don't back out to console only
299 m_hide(); // disable menu on unhandled ESC
301 if(key >= K_MOUSE1 && key <= K_MOUSE3)
303 ++mouseButtonsPressed;
304 if(mouseButtonsPressed > 10)
306 mouseButtonsPressed = 10;
307 dprint("Warning: pressed an already pressed button\n");
310 if(key == K_ALT) menuShiftState |= S_ALT;
311 if(key == K_CTRL) menuShiftState |= S_CTRL;
312 if(key == K_SHIFT) menuShiftState |= S_SHIFT;
315 const float SCALEMODE_CROP = 0;
316 const float SCALEMODE_LETTERBOX = 1;
317 const float SCALEMODE_WIDTH = 2;
318 const float SCALEMODE_HEIGHT = 3;
319 const float SCALEMODE_STRETCH = 4;
320 void draw_Picture_Aligned(vector algn, float scalemode, string img, float a)
322 vector sz, org, isz, isz_w, isz_h;
323 float width_is_larger;
325 sz = draw_PictureSize(img);
326 width_is_larger = (sz.x * draw_scale.y >= sz.y * draw_scale.x);
327 isz_w = '1 0 0' + '0 1 0' * ((sz.y / sz.x) * (draw_scale.x / draw_scale.y));
328 isz_h = '0 1 0' + '1 0 0' * ((sz.x / sz.y) * (draw_scale.y / draw_scale.x));
334 isz = (width_is_larger ? isz_h : isz_w);
336 case SCALEMODE_LETTERBOX:
337 isz = (width_is_larger ? isz_w : isz_h);
339 case SCALEMODE_WIDTH:
342 case SCALEMODE_HEIGHT:
345 case SCALEMODE_STRETCH:
350 org = eX * (algn.x * (1 - isz.x)) + eY * (algn.y * (1 - isz.y));
351 draw_Picture(org, img, isz, '1 1 1', a);
354 void drawBackground(string img, float a, string algn, float force1)
356 if(main.mainNexposee.ModalController_state == 0)
366 scalemode = SCALEMODE_CROP;
369 for(i = 0; i < strlen(algn); ++i)
371 c = substring(algn, i, 1);
374 case "c": scalemode = SCALEMODE_CROP; goto nopic;
375 case "l": scalemode = SCALEMODE_LETTERBOX; goto nopic;
376 case "h": scalemode = SCALEMODE_HEIGHT; goto nopic;
377 case "w": scalemode = SCALEMODE_WIDTH; goto nopic;
378 case "s": scalemode = SCALEMODE_STRETCH; goto nopic;
379 case "1": case "4": case "7": v.x = 0.0; break;
380 case "2": case "5": case "8": v.x = 0.5; break;
381 case "3": case "6": case "9": v.x = 1.0; break;
382 default: v.x = random(); break;
386 case "7": case "8": case "9": v.y = 0.0; break;
387 case "4": case "5": case "6": v.y = 0.5; break;
388 case "1": case "2": case "3": v.y = 1.0; break;
389 default: v.y = random(); break;
392 draw_Picture_Aligned(v, scalemode, img, a);
394 // force all secondary layers to use alpha 1. Prevents ugly issues
395 // with overlap. It's a flag because it cannot be used for the
397 draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l+1)), 1);
399 draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l+1)), a);
406 float menu_tooltips_old;
407 vector menuTooltipAveragedMousePos;
408 entity menuTooltipItem;
409 vector menuTooltipOrigin;
410 vector menuTooltipSize;
411 float menuTooltipAlpha;
412 string menuTooltipText;
413 float menuTooltipState; // 0: static, 1: fading in, 2: fading out
414 float m_testmousetooltipbox(vector pos)
416 if(pos.x >= menuTooltipOrigin.x && pos.x < menuTooltipOrigin.x + menuTooltipSize.x)
417 if(pos.y >= menuTooltipOrigin.y && pos.y < menuTooltipOrigin.y + menuTooltipSize.y)
421 float m_testtooltipbox(vector tooltippos)
427 if(tooltippos.x + menuTooltipSize.x > 1)
429 if(tooltippos.y + menuTooltipSize.y > 1)
431 menuTooltipOrigin = tooltippos;
434 float m_allocatetooltipbox(vector pos)
436 vector avoidplus, avoidminus;
439 avoidplus.x = (SKINAVOID_TOOLTIP_x + SKINSIZE_CURSOR_x - SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth;
440 avoidplus.y = (SKINAVOID_TOOLTIP_y + SKINSIZE_CURSOR_y - SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight;
443 avoidminus.x = (SKINAVOID_TOOLTIP_x + SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth + menuTooltipSize.x;
444 avoidminus.y = (SKINAVOID_TOOLTIP_y + SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight + menuTooltipSize.y;
449 if(m_testtooltipbox(v))
453 v.x = pos.x - menuTooltipSize.x * 0.5;
454 if(m_testtooltipbox(v))
458 v.x = pos.x - avoidminus.x;
459 if(m_testtooltipbox(v))
463 v.y = pos.y - avoidminus.y;
464 if(m_testtooltipbox(v))
468 v.x = pos.x - menuTooltipSize.x * 0.5;
469 if(m_testtooltipbox(v))
473 v.x = pos.x + avoidplus.x;
474 if(m_testtooltipbox(v))
479 entity m_findtooltipitem(entity root, vector pos)
487 while(it.instanceOfContainer)
489 while(it.instanceOfNexposee && it.focusedChild)
491 it = it.focusedChild;
492 pos = globalToBox(pos, it.Container_origin, it.Container_size);
494 if(it.instanceOfNexposee)
496 it = it.itemFromPoint(it, pos);
499 else if(menu_tooltips == 2 && (it.cvarName || it.onClickCommand))
503 else if(it.instanceOfModalController)
504 it = it.focusedChild;
506 it = it.itemFromPoint(it, pos);
511 else if(menu_tooltips == 2 && (it.cvarName || it.onClickCommand))
513 pos = globalToBox(pos, it.Container_origin, it.Container_size);
520 if (menu_tooltips == 2)
523 if (menuTooltipItem.cvarName)
525 if (getCvarsMulti(menuTooltipItem))
526 s = strcat("[", menuTooltipItem.cvarName, " ", getCvarsMulti(menuTooltipItem), "]");
528 s = strcat("[", menuTooltipItem.cvarName, "]");
530 else if (menuTooltipItem.onClickCommand)
531 s = strcat("<", menuTooltipItem.onClickCommand, ">");
533 return menuTooltipItem.tooltip;
534 if (menuTooltipItem.tooltip)
535 return strcat(menuTooltipItem.tooltip, " ", s);
538 return menuTooltipItem.tooltip;
540 void m_tooltip(vector pos)
547 menu_tooltips = cvar("menu_tooltips");
550 // don't return immediately, fade out the active tooltip first
551 if (menuTooltipItem == world)
554 menu_tooltips_old = menu_tooltips;
558 f = bound(0, frametime * 2, 1);
559 menuTooltipAveragedMousePos = menuTooltipAveragedMousePos * (1 - f) + pos * f;
560 f = vlen(pos - menuTooltipAveragedMousePos);
562 it = m_findtooltipitem(main, pos);
566 fontsize = '1 0 0' * (SKINFONTSIZE_TOOLTIP / conwidth) + '0 1 0' * (SKINFONTSIZE_TOOLTIP / conheight);
568 // float menuTooltipState; // 0: static, 1: fading in, 2: fading out
569 if(it != menuTooltipItem)
571 switch(menuTooltipState)
576 // another item: fade out first
577 menuTooltipState = 2;
582 menuTooltipState = 1;
583 menuTooltipItem = it;
585 menuTooltipOrigin.x = -1; // unallocated
588 strunzone(menuTooltipText);
589 menuTooltipText = strzone(gettooltip());
593 getWrappedLine_remaining = menuTooltipText;
594 while(getWrappedLine_remaining)
596 s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
598 f = draw_TextWidth(s, false, fontsize);
602 menuTooltipSize.x = w + 2 * (SKINMARGIN_TOOLTIP_x / conwidth);
603 menuTooltipSize.y = i * fontsize.y + 2 * (SKINMARGIN_TOOLTIP_y / conheight);
604 menuTooltipSize.z = 0;
608 // changing item while fading in: fade out first
609 menuTooltipState = 2;
612 // changing item while fading out: can't
616 else if(menuTooltipState == 2) // re-fade in?
617 menuTooltipState = 1;
620 if(!m_testmousetooltipbox(pos))
621 menuTooltipState = 2; // fade out if mouse touches it
623 switch(menuTooltipState)
626 menuTooltipAlpha = bound(0, menuTooltipAlpha + 5 * frametime, 1);
627 if(menuTooltipAlpha == 1)
628 menuTooltipState = 0;
631 menuTooltipAlpha = bound(0, menuTooltipAlpha - 2 * frametime, 1);
632 if(menuTooltipAlpha == 0)
634 menuTooltipState = 0;
635 menuTooltipItem = world;
640 if(menuTooltipItem == world)
644 strunzone(menuTooltipText);
645 menuTooltipText = string_null;
651 if(menu_tooltips != menu_tooltips_old)
653 if (menu_tooltips != 0 && menu_tooltips_old != 0)
654 menuTooltipItem = world; // reload tooltip next frame
655 menu_tooltips_old = menu_tooltips;
657 else if(menuTooltipOrigin.x < 0) // unallocated?
658 m_allocatetooltipbox(pos);
660 if(menuTooltipOrigin.x >= 0)
663 p = SKINBORDER_TOOLTIP;
665 p.y *= 1 / conheight;
666 draw_BorderPicture(menuTooltipOrigin, SKINGFX_TOOLTIP, menuTooltipSize, '1 1 1', menuTooltipAlpha, p);
667 p = menuTooltipOrigin;
668 p.x += SKINMARGIN_TOOLTIP_x / conwidth;
669 p.y += SKINMARGIN_TOOLTIP_y / conheight;
670 getWrappedLine_remaining = menuTooltipText;
671 while(getWrappedLine_remaining)
673 s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
674 draw_Text(p, s, fontsize, SKINCOLOR_TOOLTIP, SKINALPHA_TOOLTIP * menuTooltipAlpha, false);
681 void m_draw(float width, float height)
688 execute_next_frame();
690 menuMouseMode = cvar("menu_mouse_absolute");
695 UpdateConWidthHeight(width, height, cvar("vid_pixelheight"));
699 // TODO draw an info image about this situation
703 if(!menuNotTheFirstFrame)
705 menuNotTheFirstFrame = 1;
707 if(!cvar("menu_video_played"))
709 localcmd("cd loop $menu_cdtrack; play sound/announcer/default/welcome.wav\n");
710 menuLogoAlpha = -0.8; // no idea why, but when I start this at zero, it jumps instead of fading FIXME
712 // ALWAYS set this cvar; if we start but menu is not active, this means we want no background music!
713 localcmd("set menu_video_played 1\n");
717 realFrametime = frametime = min(0.2, t - menuPrevTime);
721 t = cvar("menu_slowmo");
732 if(getmousetarget() == (menuMouseMode ? MT_CLIENT : MT_MENU) && (getkeydest() == KEY_MENU || getkeydest() == KEY_MENU_GRABBED))
733 setkeydest(keyGrabber ? KEY_MENU_GRABBED : KEY_MENU);
738 if(cvar("cl_capturevideo"))
739 frametime = t / cvar("cl_capturevideo_fps"); // make capturevideo work smoothly
741 prevMenuAlpha = menuAlpha;
744 if(menuAlpha == 0 && menuLogoAlpha < 2)
746 menuLogoAlpha = menuLogoAlpha + frametime * 2;
750 menuAlpha = min(1, menuAlpha + frametime * 5);
756 menuAlpha = max(0, menuAlpha - frametime * 5);
760 draw_reset_cropped();
762 if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
764 if(menuLogoAlpha > 0)
767 draw_Fill('0 0 0', '1 1 0', SKINCOLOR_BACKGROUND, 1);
768 drawBackground(SKINGFX_BACKGROUND, bound(0, menuLogoAlpha, 1), SKINALIGN_BACKGROUND, true);
769 draw_reset_cropped();
770 if(menuAlpha <= 0 && SKINALPHA_CURSOR_INTRO > 0)
772 draw_alpha = SKINALPHA_CURSOR_INTRO * bound(0, menuLogoAlpha, 1);
773 draw_drawMousePointer(menuMousePos);
778 else if(SKINALPHA_BACKGROUND_INGAME)
783 drawBackground(SKINGFX_BACKGROUND_INGAME, menuAlpha * SKINALPHA_BACKGROUND_INGAME, SKINALIGN_BACKGROUND_INGAME, false);
784 draw_reset_cropped();
788 if(menuAlpha != prevMenuAlpha)
789 cvar_set("_menu_alpha", ftos(menuAlpha));
791 draw_reset_cropped();
793 draw_reset_cropped();
797 if(prevMenuAlpha > 0)
798 main.initializeDialog(main, main.firstChild);
799 draw_reset_cropped();
804 draw_alpha *= menuAlpha;
808 // do not update mouse position
809 // it prevents mouse jumping to '0 0 0' when menu is fading out
811 else if(menuMouseMode)
814 newMouse = globalToBox(getmousepos(), draw_shift, draw_scale);
815 if(newMouse != '0 0 0')
816 if(newMouse != menuMousePos)
818 menuMousePos = newMouse;
819 if(mouseButtonsPressed)
820 main.mouseDrag(main, menuMousePos);
822 main.mouseMove(main, menuMousePos);
829 vector dMouse, minpos, maxpos;
830 dMouse = getmousepos() * (frametime / realFrametime); // for capturevideo
831 if(dMouse != '0 0 0')
833 minpos = globalToBox('0 0 0', draw_shift, draw_scale);
834 maxpos = globalToBox(eX * (realconwidth - 1) + eY * (realconheight - 1), draw_shift, draw_scale);
835 dMouse = globalToBoxSize(dMouse, draw_scale);
836 menuMousePos += dMouse * cvar("menu_mouse_speed");
837 menuMousePos.x = bound(minpos.x, menuMousePos.x, maxpos.x);
838 menuMousePos.y = bound(minpos.y, menuMousePos.y, maxpos.y);
839 if(mouseButtonsPressed)
840 main.mouseDrag(main, menuMousePos);
842 main.mouseMove(main, menuMousePos);
848 m_tooltip(menuMousePos);
850 draw_alpha = max(draw_alpha, SKINALPHA_CURSOR_INTRO * bound(0, menuLogoAlpha, 1));
852 draw_drawMousePointer(menuMousePos);
854 draw_reset_cropped();
863 setkeydest(KEY_MENU);
864 setmousetarget((menuMouseMode ? MT_CLIENT : MT_MENU));
869 if(mouseButtonsPressed)
870 main.mouseRelease(main, menuMousePos);
871 mouseButtonsPressed = 0;
873 main.focusEnter(main);
874 main.showNotify(main);
880 setkeydest(KEY_GAME);
881 setmousetarget(MT_CLIENT);
886 main.focusLeave(main);
887 main.hideNotify(main);
890 void m_toggle(float mode)
911 for(e = NULL; (e = nextent(e)) != NULL; )
913 if(e.classname != "vtbl")
919 void m_focus_item_chain(entity outermost, entity innermost)
921 if(innermost.parent != outermost)
922 m_focus_item_chain(outermost, innermost.parent);
923 innermost.parent.setFocus(innermost.parent, innermost);
926 void m_activate_window(entity wnd)
931 m_activate_window(par);
933 if(par.instanceOfModalController)
935 if(wnd.tabSelectingButton)
937 TabButton_Click(wnd.tabSelectingButton, wnd);
940 par.initializeDialog(par, wnd);
942 else if(par.instanceOfNexposee)
944 // nexposee (sorry for violating abstraction here)
945 par.selectedChild = wnd;
946 par.animationState = 1;
947 Container_setFocus(par, NULL);
949 else if(par.instanceOfContainer)
953 par.setFocus(par, wnd);
957 void m_setpointerfocus(entity wnd)
959 if(wnd.instanceOfContainer)
961 entity focus = wnd.preferredFocusedGrandChild(wnd);
964 menuMousePos = focus.origin + 0.5 * focus.size;
965 menuMousePos.x *= 1 / conwidth;
966 menuMousePos.y *= 1 / conheight;
967 entity par = wnd.parent;
969 par.setFocus(par, wnd);
971 m_focus_item_chain(wnd, focus);
976 void m_goto(string itemname)
982 strunzone(m_goto_buffer);
983 m_goto_buffer = strzone(itemname);
986 if(itemname == "") // this can be called by GameCommand
988 if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED))
994 m_activate_window(main.mainNexposee);
1000 for(e = NULL; (e = find(e, name, itemname)); )
1001 if(e.classname != "vtbl")
1004 if((e) && (!e.requiresConnection || (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))))
1007 m_activate_window(e);
1008 m_setpointerfocus(e);
1014 float menuLastFocusSoundTime;
1015 void m_play_focus_sound()
1017 if(cvar("menu_sounds") > 1)
1018 if(time - menuLastFocusSoundTime > 0.25)
1020 localsound(MENU_SOUND_FOCUS);
1021 menuLastFocusSoundTime = time;
1025 void m_play_click_sound(string soundfile)
1027 if(cvar("menu_sounds"))
1028 localsound(soundfile);