]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/menu.qc
Merge remote-tracking branch 'remotes/origin/master' into TimePath/itemsys
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / menu.qc
index e348796a0f89747b89e16fa315684d4ae0edddc7..d8a3ede2e7d8988afd29865a409af7de2defe772 100644 (file)
@@ -1,7 +1,10 @@
-#if defined(CSQC)
-#elif defined(MENUQC)
-#elif defined(SVQC)
-#endif
+#include "menu.qh"
+#include "oo/classes.qc"
+#include "xonotic/util.qh"
+
+#include "../common/items/all.qh"
+#include "../common/weapons/all.qh"
+#include "../common/mapinfo.qh"
 
 ///////////////////////////////////////////////
 // Menu Source File
@@ -78,6 +81,7 @@ void m_init()
 
        // needs to be done so early because of the constants they create
        CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
+       CALL_ACCUMULATED_FUNCTION(RegisterItems);
        CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
 
        RegisterSLCategories();
@@ -211,8 +215,8 @@ void m_init_delayed()
        draw_setMousePointer(SKINGFX_CURSOR, SKINSIZE_CURSOR, SKINOFFSET_CURSOR);
 
        loadTooltips();
-       anim = spawnAnimHost();
-       main = spawnMainWindow(); main.configureMainWindow(main);
+       anim = NEW(AnimHost);
+       main = NEW(MainWindow); main.configureMainWindow(main);
        unloadTooltips();
 
        main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
@@ -960,7 +964,10 @@ void m_setpointerfocus(entity wnd)
                        menuMousePos = focus.origin + 0.5 * focus.size;
                        menuMousePos.x *= 1 / conwidth;
                        menuMousePos.y *= 1 / conheight;
-                       if(wnd.focused) // why does this never happen?
+                       entity par = wnd.parent;
+                       if(par.focused)
+                               par.setFocus(par, wnd);
+                       if(wnd.focused)
                                m_focus_item_chain(wnd, focus);
                }
        }