X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fmenu.qc;h=b2a85093c6ecc21a5258692ac5df1db8fa1c4ccc;hb=c14f2b067c9ab0b4fb8a5b7805c8679be61f1fe0;hp=94d167e5ed560d3de78073a9c11db770bf81ad2c;hpb=99facb38338832f539cec7022c414f7a6de458c3;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index 94d167e5e..b2a85093c 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -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 @@ -12,7 +15,7 @@ float mouseButtonsPressed; vector menuMousePos; -float menuShiftState; +int menuShiftState; float menuPrevTime; float menuAlpha; float menuLogoAlpha; @@ -77,8 +80,8 @@ void m_init() } // needs to be done so early because of the constants they create + static_init(); CALL_ACCUMULATED_FUNCTION(RegisterWeapons); - CALL_ACCUMULATED_FUNCTION(RegisterGametypes); RegisterSLCategories(); @@ -211,8 +214,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 +963,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); } } @@ -1003,3 +1009,20 @@ void m_goto(string itemname) } } } + +float menuLastFocusSoundTime; +void m_play_focus_sound() +{ + if(cvar("menu_sounds") > 1) + if(time - menuLastFocusSoundTime > 0.25) + { + localsound(MENU_SOUND_FOCUS); + menuLastFocusSoundTime = time; + } +} + +void m_play_click_sound(string soundfile) +{ + if(cvar("menu_sounds")) + localsound(soundfile); +}