1 ///////////////////////////////////////////////
3 ///////////////////////
4 // This file belongs to dpmod/darkplaces
5 // AK contains all menu functions (especially the required ones)
6 ///////////////////////////////////////////////
8 float mouseButtonsPressed;
15 float menuInitialized;
16 float menuNotTheFirstFrame;
19 float conwidth_s, conheight_s, vidwidth_s, vidheight_s, vidpixelheight_s,
20 realconwidth, realconheight, screenconwidth, screenconheight;
25 vidwidth_s = vidheight_s = vidpixelheight_s = 0; // Force updateConwidths on next draw.
34 gamestatus = gamestatus | GAME_ISSERVER;
35 if(clientstate() == CS_CONNECTED || isdemo())
36 gamestatus = gamestatus | GAME_CONNECTED;
38 gamestatus = gamestatus | GAME_DEVELOPER;
44 cvar_set("_menu_alpha", "0");
45 prvm_language = cvar_string("prvm_language");
46 if(prvm_language == "")
49 cvar_set("prvm_language", prvm_language);
50 localcmd("\nmenu_restart\n");
53 prvm_language = strzone(prvm_language);
54 cvar_set("_menu_prvm_language", prvm_language);
56 check_unacceptable_compiler_bugs();
59 print(sprintf(_("^4MQC Build information: ^1%s\n"), WATERMARK));
62 // list all game dirs (TEST)
69 s = getgamedirinfo(i, GETGAMEDIRINFO_NAME);
72 dprint(s, ": ", getgamedirinfo(i, GETGAMEDIRINFO_DESCRIPTION));
76 // needs to be done so early because of the constants they create
77 CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
78 CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
80 RegisterSLCategories();
82 float ddsload = cvar("r_texture_dds_load");
83 float texcomp = cvar("gl_texturecompression");
85 if(ddsload != cvar("r_texture_dds_load") || texcomp != cvar("gl_texturecompression"))
86 localcmd("\nr_restart\n");
90 if(cvar("_menu_initialized")) // always show menu after menu_restart
94 cvar_set("_menu_initialized", "1");
98 const float MENU_ASPECT = 1.25; // 1280x1024
99 const float MENU_MINHEIGHT = 600;
101 void draw_reset_cropped()
103 draw_reset(screenconwidth, screenconheight, 0.5 * (realconwidth - screenconwidth), 0.5 * (realconheight - screenconheight));
105 void draw_reset_full()
107 draw_reset(realconwidth, realconheight, 0, 0);
110 void UpdateConWidthHeight(float w, float h, float p)
112 if (w != vidwidth_s || h != vidheight_s || p != vidpixelheight_s)
114 updateConwidths(w, h, p);
117 vidpixelheight_s = p;
119 conwidth_s = conwidth;
120 conheight_s = conheight;
121 realconwidth = cvar("vid_conwidth");
122 realconheight = cvar("vid_conheight");
123 if(realconwidth / realconheight > MENU_ASPECT)
126 conwidth = realconheight * MENU_ASPECT;
127 conheight = realconheight;
132 conwidth = realconwidth;
133 conheight = realconwidth / MENU_ASPECT;
135 screenconwidth = conwidth;
136 screenconheight = conheight;
137 if(conwidth < MENU_MINHEIGHT * MENU_ASPECT)
139 conheight *= MENU_MINHEIGHT * MENU_ASPECT / conwidth;
140 conwidth = MENU_MINHEIGHT * MENU_ASPECT;
142 if(conheight < MENU_MINHEIGHT)
144 conwidth *= MENU_MINHEIGHT / conheight;
145 conheight = MENU_MINHEIGHT;
149 if(conwidth_s != conwidth || conheight_s != conheight)
151 draw_reset_cropped();
152 main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
157 vidwidth_s = vidheight_s = vidpixelheight_s = 0; // retry next frame
161 string m_goto_buffer;
162 void m_init_delayed()
164 float fh, glob, n, i;
167 draw_reset_cropped();
175 if(cvar_string("menu_skin") != "")
177 draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
178 fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
181 if(cvar_defstring("menu_skin") != "")
183 cvar_set("menu_skin", cvar_defstring("menu_skin"));
184 draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
185 fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
189 draw_currentSkin = "gfx/menu/default";
190 fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
194 error("cannot load any menu skin\n");
196 draw_currentSkin = strzone(draw_currentSkin);
197 while((s = fgets(fh)))
199 // these two are handled by skinlist.qc
200 if(substring(s, 0, 6) == "title ")
202 if(substring(s, 0, 7) == "author ")
204 n = tokenize_console(s);
206 Skin_ApplySetting(argv(0), substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
210 glob = search_begin(strcat(draw_currentSkin, "/*.tga"), TRUE, TRUE);
213 n = search_getsize(glob);
214 for(i = 0; i < n; ++i)
215 precache_pic(search_getfilename(glob, i));
219 draw_setMousePointer(SKINGFX_CURSOR, SKINSIZE_CURSOR, SKINOFFSET_CURSOR);
222 anim = spawnAnimHost();
223 main = spawnMainWindow(); main.configureMainWindow(main);
226 main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
229 menuMousePos = '0.5 0.5 0';
235 m_goto(m_goto_buffer);
236 strunzone(m_goto_buffer);
237 m_goto_buffer = string_null;
241 m_display(); // delayed menu display
244 void m_keyup (float key, float ascii)
250 draw_reset_cropped();
251 main.keyUp(main, key, ascii, menuShiftState);
252 if(key >= K_MOUSE1 && key <= K_MOUSE3)
254 --mouseButtonsPressed;
255 if(!mouseButtonsPressed)
256 main.mouseRelease(main, menuMousePos);
257 if(mouseButtonsPressed < 0)
259 mouseButtonsPressed = 0;
260 dprint("Warning: released an already released button\n");
263 if(key == K_ALT) menuShiftState -= (menuShiftState & S_ALT);
264 if(key == K_CTRL) menuShiftState -= (menuShiftState & S_CTRL);
265 if(key == K_SHIFT) menuShiftState -= (menuShiftState & S_SHIFT);
268 void m_keydown(float key, float ascii)
276 if(key >= K_MOUSE1 && key <= K_MOUSE3)
278 // detect a click outside of the game window
279 vector p = getmousepos();
280 if(p_x < 0 || p_x > realconwidth || p_y < 0 || p_y > realconheight)
282 ++mouseButtonsPressed;
292 e.keyGrabbed(e, key, ascii);
296 draw_reset_cropped();
297 if(key >= K_MOUSE1 && key <= K_MOUSE3)
298 if(!mouseButtonsPressed)
299 main.mousePress(main, menuMousePos);
300 if(!main.keyDown(main, key, ascii, menuShiftState))
302 if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)) // don't back out to console only
303 m_hide(); // disable menu on unhandled ESC
305 if(key >= K_MOUSE1 && key <= K_MOUSE3)
307 ++mouseButtonsPressed;
308 if(mouseButtonsPressed > 10)
310 mouseButtonsPressed = 10;
311 dprint("Warning: pressed an already pressed button\n");
314 if(key == K_ALT) menuShiftState |= S_ALT;
315 if(key == K_CTRL) menuShiftState |= S_CTRL;
316 if(key == K_SHIFT) menuShiftState |= S_SHIFT;
319 const float SCALEMODE_CROP = 0;
320 const float SCALEMODE_LETTERBOX = 1;
321 const float SCALEMODE_WIDTH = 2;
322 const float SCALEMODE_HEIGHT = 3;
323 const float SCALEMODE_STRETCH = 4;
324 void draw_Picture_Aligned(vector algn, float scalemode, string img, float a)
326 vector sz, org, isz, isz_w, isz_h;
327 float width_is_larger;
329 sz = draw_PictureSize(img);
330 width_is_larger = (sz_x * draw_scale_y >= sz_y * draw_scale_x);
331 isz_w = '1 0 0' + '0 1 0' * ((sz_y / sz_x) * (draw_scale_x / draw_scale_y));
332 isz_h = '0 1 0' + '1 0 0' * ((sz_x / sz_y) * (draw_scale_y / draw_scale_x));
341 isz = (width_is_larger ? isz_h : isz_w);
343 case SCALEMODE_LETTERBOX:
344 isz = (width_is_larger ? isz_w : isz_h);
346 case SCALEMODE_WIDTH:
349 case SCALEMODE_HEIGHT:
352 case SCALEMODE_STRETCH:
357 org = eX * (algn_x * (1 - isz_x)) + eY * (algn_y * (1 - isz_y));
358 draw_Picture(org, img, isz, '1 1 1', a);
361 void drawBackground(string img, float a, string algn, float force1)
363 if(main.mainNexposee.ModalController_state == 0)
373 scalemode = SCALEMODE_CROP;
376 for(i = 0; i < strlen(algn); ++i)
378 c = substring(algn, i, 1);
381 case "c": scalemode = SCALEMODE_CROP; goto nopic;
382 case "l": scalemode = SCALEMODE_LETTERBOX; goto nopic;
383 case "h": scalemode = SCALEMODE_HEIGHT; goto nopic;
384 case "w": scalemode = SCALEMODE_WIDTH; goto nopic;
385 case "s": scalemode = SCALEMODE_STRETCH; goto nopic;
386 case "1": case "4": case "7": v_x = 0.0; break;
387 case "2": case "5": case "8": v_x = 0.5; break;
388 case "3": case "6": case "9": v_x = 1.0; break;
389 default: v_x = random(); break;
393 case "7": case "8": case "9": v_y = 0.0; break;
394 case "4": case "5": case "6": v_y = 0.5; break;
395 case "1": case "2": case "3": v_y = 1.0; break;
396 default: v_y = random(); break;
399 draw_Picture_Aligned(v, scalemode, img, a);
401 // force all secondary layers to use alpha 1. Prevents ugly issues
402 // with overlap. It's a flag because it cannot be used for the
404 draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l+1)), 1);
406 draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l+1)), a);
413 float menu_tooltips_old;
414 vector menuTooltipAveragedMousePos;
415 entity menuTooltipItem;
416 vector menuTooltipOrigin;
417 vector menuTooltipSize;
418 float menuTooltipAlpha;
419 string menuTooltipText;
420 float menuTooltipState; // 0: static, 1: fading in, 2: fading out
421 float m_testmousetooltipbox(vector pos)
423 if(pos_x >= menuTooltipOrigin_x && pos_x < menuTooltipOrigin_x + menuTooltipSize_x)
424 if(pos_y >= menuTooltipOrigin_y && pos_y < menuTooltipOrigin_y + menuTooltipSize_y)
428 float m_testtooltipbox(vector tooltippos)
434 if(tooltippos_x + menuTooltipSize_x > 1)
436 if(tooltippos_y + menuTooltipSize_y > 1)
438 menuTooltipOrigin = tooltippos;
441 float m_allocatetooltipbox(vector pos)
443 vector avoidplus, avoidminus;
446 avoidplus_x = (SKINAVOID_TOOLTIP_x + SKINSIZE_CURSOR_x - SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth;
447 avoidplus_y = (SKINAVOID_TOOLTIP_y + SKINSIZE_CURSOR_y - SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight;
450 avoidminus_x = (SKINAVOID_TOOLTIP_x + SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth + menuTooltipSize_x;
451 avoidminus_y = (SKINAVOID_TOOLTIP_y + SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight + menuTooltipSize_y;
456 if(m_testtooltipbox(v))
460 v_x = pos_x - menuTooltipSize_x * 0.5;
461 if(m_testtooltipbox(v))
465 v_x = pos_x - avoidminus_x;
466 if(m_testtooltipbox(v))
470 v_y = pos_y - avoidminus_y;
471 if(m_testtooltipbox(v))
475 v_x = pos_x - menuTooltipSize_x * 0.5;
476 if(m_testtooltipbox(v))
480 v_x = pos_x + avoidplus_x;
481 if(m_testtooltipbox(v))
486 entity m_findtooltipitem(entity root, vector pos)
494 while(it.instanceOfContainer)
496 while(it.instanceOfNexposee && it.focusedChild)
498 it = it.focusedChild;
499 pos = globalToBox(pos, it.Container_origin, it.Container_size);
501 if(it.instanceOfNexposee)
503 it = it.itemFromPoint(it, pos);
506 else if(menu_tooltips == 2 && (it.cvarName || it.onClickCommand))
510 else if(it.instanceOfModalController)
511 it = it.focusedChild;
513 it = it.itemFromPoint(it, pos);
518 else if(menu_tooltips == 2 && (it.cvarName || it.onClickCommand))
520 pos = globalToBox(pos, it.Container_origin, it.Container_size);
527 if (menu_tooltips == 2)
530 if (menuTooltipItem.cvarName)
532 if (getCvarsMulti(menuTooltipItem))
533 s = strcat("[", menuTooltipItem.cvarName, " ", getCvarsMulti(menuTooltipItem), "]");
535 s = strcat("[", menuTooltipItem.cvarName, "]");
537 else if (menuTooltipItem.onClickCommand)
538 s = strcat("<", menuTooltipItem.onClickCommand, ">");
540 return menuTooltipItem.tooltip;
541 if (menuTooltipItem.tooltip)
542 return strcat(menuTooltipItem.tooltip, " ", s);
545 return menuTooltipItem.tooltip;
547 void m_tooltip(vector pos)
554 menu_tooltips = cvar("menu_tooltips");
557 // don't return immediately, fade out the active tooltip first
558 if (menuTooltipItem == world)
561 menu_tooltips_old = menu_tooltips;
565 f = bound(0, frametime * 2, 1);
566 menuTooltipAveragedMousePos = menuTooltipAveragedMousePos * (1 - f) + pos * f;
567 f = vlen(pos - menuTooltipAveragedMousePos);
569 it = m_findtooltipitem(main, pos);
573 fontsize = '1 0 0' * (SKINFONTSIZE_TOOLTIP / conwidth) + '0 1 0' * (SKINFONTSIZE_TOOLTIP / conheight);
575 // float menuTooltipState; // 0: static, 1: fading in, 2: fading out
576 if(it != menuTooltipItem)
578 switch(menuTooltipState)
583 // another item: fade out first
584 menuTooltipState = 2;
589 menuTooltipState = 1;
590 menuTooltipItem = it;
592 menuTooltipOrigin_x = -1; // unallocated
595 strunzone(menuTooltipText);
596 menuTooltipText = strzone(gettooltip());
600 getWrappedLine_remaining = menuTooltipText;
601 while(getWrappedLine_remaining)
603 s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
605 f = draw_TextWidth(s, FALSE, fontsize);
609 menuTooltipSize_x = w + 2 * (SKINMARGIN_TOOLTIP_x / conwidth);
610 menuTooltipSize_y = i * fontsize_y + 2 * (SKINMARGIN_TOOLTIP_y / conheight);
611 menuTooltipSize_z = 0;
615 // changing item while fading in: fade out first
616 menuTooltipState = 2;
619 // changing item while fading out: can't
623 else if(menuTooltipState == 2) // re-fade in?
624 menuTooltipState = 1;
627 if(!m_testmousetooltipbox(pos))
628 menuTooltipState = 2; // fade out if mouse touches it
630 switch(menuTooltipState)
633 menuTooltipAlpha = bound(0, menuTooltipAlpha + 5 * frametime, 1);
634 if(menuTooltipAlpha == 1)
635 menuTooltipState = 0;
638 menuTooltipAlpha = bound(0, menuTooltipAlpha - 2 * frametime, 1);
639 if(menuTooltipAlpha == 0)
641 menuTooltipState = 0;
642 menuTooltipItem = world;
647 if(menuTooltipItem == world)
651 strunzone(menuTooltipText);
652 menuTooltipText = string_null;
658 if(menu_tooltips != menu_tooltips_old)
660 if (menu_tooltips != 0 && menu_tooltips_old != 0)
661 menuTooltipItem = world; // reload tooltip next frame
662 menu_tooltips_old = menu_tooltips;
664 else if(menuTooltipOrigin_x < 0) // unallocated?
665 m_allocatetooltipbox(pos);
667 if(menuTooltipOrigin_x >= 0)
670 p = SKINBORDER_TOOLTIP;
672 p_y *= 1 / conheight;
673 draw_BorderPicture(menuTooltipOrigin, SKINGFX_TOOLTIP, menuTooltipSize, '1 1 1', menuTooltipAlpha, p);
674 p = menuTooltipOrigin;
675 p_x += SKINMARGIN_TOOLTIP_x / conwidth;
676 p_y += SKINMARGIN_TOOLTIP_y / conheight;
677 getWrappedLine_remaining = menuTooltipText;
678 while(getWrappedLine_remaining)
680 s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
681 draw_Text(p, s, fontsize, '1 1 1', SKINALPHA_TOOLTIP * menuTooltipAlpha, FALSE);
688 void m_draw(float width, float height)
695 execute_next_frame();
697 menuMouseMode = cvar("menu_mouse_absolute");
702 UpdateConWidthHeight(width, height, cvar("vid_pixelheight"));
706 // TODO draw an info image about this situation
710 if(!menuNotTheFirstFrame)
712 menuNotTheFirstFrame = 1;
714 if(!cvar("menu_video_played"))
716 localcmd("cd loop $menu_cdtrack; play sound/announcer/default/welcome.wav\n");
717 menuLogoAlpha = -0.8; // no idea why, but when I start this at zero, it jumps instead of fading FIXME
719 // ALWAYS set this cvar; if we start but menu is not active, this means we want no background music!
720 localcmd("set menu_video_played 1\n");
724 realFrametime = frametime = min(0.2, t - menuPrevTime);
728 t = cvar("menu_slowmo");
739 if(getmousetarget() == (menuMouseMode ? MT_CLIENT : MT_MENU) && (getkeydest() == KEY_MENU || getkeydest() == KEY_MENU_GRABBED))
740 setkeydest(keyGrabber ? KEY_MENU_GRABBED : KEY_MENU);
745 if(cvar("cl_capturevideo"))
746 frametime = t / cvar("cl_capturevideo_fps"); // make capturevideo work smoothly
748 prevMenuAlpha = menuAlpha;
751 if(menuAlpha == 0 && menuLogoAlpha < 2)
753 menuLogoAlpha = menuLogoAlpha + frametime * 2;
757 menuAlpha = min(1, menuAlpha + frametime * 5);
763 menuAlpha = max(0, menuAlpha - frametime * 5);
767 draw_reset_cropped();
769 if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
771 if(menuLogoAlpha > 0)
774 draw_Fill('0 0 0', '1 1 0', SKINCOLOR_BACKGROUND, 1);
775 drawBackground(SKINGFX_BACKGROUND, bound(0, menuLogoAlpha, 1), SKINALIGN_BACKGROUND, TRUE);
776 draw_reset_cropped();
777 if(menuAlpha <= 0 && SKINALPHA_CURSOR_INTRO > 0)
779 draw_alpha = SKINALPHA_CURSOR_INTRO * bound(0, menuLogoAlpha, 1);
780 draw_drawMousePointer(menuMousePos);
785 else if(SKINALPHA_BACKGROUND_INGAME)
790 drawBackground(SKINGFX_BACKGROUND_INGAME, menuAlpha * SKINALPHA_BACKGROUND_INGAME, SKINALIGN_BACKGROUND_INGAME, FALSE);
791 draw_reset_cropped();
795 if(menuAlpha != prevMenuAlpha)
796 cvar_set("_menu_alpha", ftos(menuAlpha));
798 draw_reset_cropped();
800 draw_reset_cropped();
804 if(prevMenuAlpha > 0)
805 main.initializeDialog(main, main.firstChild);
806 draw_reset_cropped();
811 draw_alpha *= menuAlpha;
815 // do not update mouse position
816 // it prevents mouse jumping to '0 0 0' when menu is fading out
818 else if(menuMouseMode)
821 newMouse = globalToBox(getmousepos(), draw_shift, draw_scale);
822 if(newMouse != '0 0 0')
823 if(newMouse != menuMousePos)
825 menuMousePos = newMouse;
826 if(mouseButtonsPressed)
827 main.mouseDrag(main, menuMousePos);
829 main.mouseMove(main, menuMousePos);
836 vector dMouse, minpos, maxpos;
837 dMouse = getmousepos() * (frametime / realFrametime); // for capturevideo
838 if(dMouse != '0 0 0')
840 minpos = globalToBox('0 0 0', draw_shift, draw_scale);
841 maxpos = globalToBox(eX * (realconwidth - 1) + eY * (realconheight - 1), draw_shift, draw_scale);
842 dMouse = globalToBoxSize(dMouse, draw_scale);
843 menuMousePos += dMouse * cvar("menu_mouse_speed");
844 menuMousePos_x = bound(minpos_x, menuMousePos_x, maxpos_x);
845 menuMousePos_y = bound(minpos_y, menuMousePos_y, maxpos_y);
846 if(mouseButtonsPressed)
847 main.mouseDrag(main, menuMousePos);
849 main.mouseMove(main, menuMousePos);
855 m_tooltip(menuMousePos);
857 draw_alpha = max(draw_alpha, SKINALPHA_CURSOR_INTRO * bound(0, menuLogoAlpha, 1));
859 draw_drawMousePointer(menuMousePos);
861 draw_reset_cropped();
870 setkeydest(KEY_MENU);
871 setmousetarget((menuMouseMode ? MT_CLIENT : MT_MENU));
876 if(mouseButtonsPressed)
877 main.mouseRelease(main, menuMousePos);
878 mouseButtonsPressed = 0;
880 main.focusEnter(main);
881 main.showNotify(main);
887 setkeydest(KEY_GAME);
888 setmousetarget(MT_CLIENT);
893 main.focusLeave(main);
894 main.hideNotify(main);
897 void m_toggle(float mode)
918 for(e = NULL; (e = nextent(e)) != NULL; )
920 if(e.classname != "vtbl")
926 void m_focus_item_chain(entity outermost, entity innermost)
928 if(innermost.parent != outermost)
929 m_focus_item_chain(outermost, innermost.parent);
930 innermost.parent.setFocus(innermost.parent, innermost);
933 void m_activate_window(entity wnd)
938 m_activate_window(par);
940 if(par.instanceOfModalController)
942 if(wnd.tabSelectingButton)
944 TabButton_Click(wnd.tabSelectingButton, wnd);
947 par.initializeDialog(par, wnd);
949 else if(par.instanceOfNexposee)
951 // nexposee (sorry for violating abstraction here)
952 par.selectedChild = wnd;
953 par.animationState = 1;
954 Container_setFocus(par, NULL);
956 else if(par.instanceOfContainer)
960 par.setFocus(par, wnd);
964 void m_setpointerfocus(entity wnd)
966 if(wnd.instanceOfContainer)
968 entity focus = wnd.preferredFocusedGrandChild(wnd);
971 menuMousePos = focus.origin + 0.5 * focus.size;
972 menuMousePos_x *= 1 / conwidth;
973 menuMousePos_y *= 1 / conheight;
974 if(wnd.focused) // why does this never happen?
975 m_focus_item_chain(wnd, focus);
980 void m_goto(string itemname)
986 strunzone(m_goto_buffer);
987 m_goto_buffer = strzone(itemname);
990 if(itemname == "") // this can be called by GameCommand
992 if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED))
998 m_activate_window(main.mainNexposee);
1004 for(e = NULL; (e = find(e, name, itemname)); )
1005 if(e.classname != "vtbl")
1008 if((e) && (!e.requiresConnection || (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))))
1011 m_activate_window(e);
1012 m_setpointerfocus(e);