X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fmenu.qc;h=2dc73a8d22675d78d36d789408b907d6b40f2d75;hb=fc0e4c6f26156858a71e0ec62eb974fa11eec2f9;hp=c46069a3c436297cdaeb1ff8f23ba5d9a28df171;hpb=3f028dbc0081b865d85d97555788685e46dd82ec;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index c46069a3c..2dc73a8d2 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -16,8 +16,6 @@ float menuInitialized; float menuNotTheFirstFrame; float menuMouseMode; -void SUB_Null() { } - void m_sync() { updateCompression(); @@ -26,15 +24,28 @@ void m_sync() loadAllCvars(main); } +void m_gamestatus() +{ + gamestatus = 0; + if(isserver()) + gamestatus = gamestatus | GAME_ISSERVER; + if(clientstate() == CS_CONNECTED || isdemo()) + gamestatus = gamestatus | GAME_CONNECTED; + if(cvar("developer")) + gamestatus = gamestatus | GAME_DEVELOPER; +} + void m_init() { + float restarting = 0; cvar_set("_menu_alpha", "0"); prvm_language = cvar_string("prvm_language"); if(prvm_language == "") { prvm_language = "en"; cvar_set("prvm_language", prvm_language); - localcmd("\nmenu_restart; togglemenu\n"); + localcmd("\nmenu_restart\n"); + restarting = 1; } prvm_language = strzone(prvm_language); cvar_set("_menu_prvm_language", prvm_language); @@ -42,7 +53,7 @@ void m_init() check_unacceptable_compiler_bugs(); #ifdef WATERMARK - print(sprintf(_("^4MQC Build information: ^1%s\n"), WATERMARK())); + print(sprintf(_("^4MQC Build information: ^1%s\n"), WATERMARK)); #endif // list all game dirs (TEST) @@ -60,8 +71,8 @@ void m_init() } // needs to be done so early because of the constants they create - RegisterWeapons(); - RegisterGametypes(); + CALL_ACCUMULATED_FUNCTION(RegisterWeapons); + CALL_ACCUMULATED_FUNCTION(RegisterGametypes); float ddsload = cvar("r_texture_dds_load"); float texcomp = cvar("gl_texturecompression"); @@ -69,6 +80,15 @@ void m_init() if(ddsload != cvar("r_texture_dds_load") || texcomp != cvar("gl_texturecompression")) localcmd("\nr_restart\n"); initConwidths(); + + if(!restarting) + { + if(cvar("_menu_initialized")) // always show menu after menu_restart + m_display(); + else + m_hide(); + cvar_set("_menu_initialized", "1"); + } } float MENU_ASPECT = 1.25; // 1280x1024 @@ -122,6 +142,7 @@ void UpdateConWidthHeight() } } +string m_goto_buffer; void m_init_delayed() { float fh, glob, n, i; @@ -195,6 +216,13 @@ void m_init_delayed() m_sync(); + if(m_goto_buffer) + { + m_goto(m_goto_buffer); + strunzone(m_goto_buffer); + m_goto_buffer = string_null; + } + if(Menu_Active) m_display(); // delayed menu display } @@ -276,6 +304,9 @@ void draw_Picture_Aligned(vector algn, float scalemode, string img, float a) isz_w = '1 0 0' + '0 1 0' * ((sz_y / sz_x) * (draw_scale_x / draw_scale_y)); isz_h = '0 1 0' + '1 0 0' * ((sz_x / sz_y) * (draw_scale_y / draw_scale_x)); +#ifdef GMQCC + isz = '0 0 0'; +#endif switch(scalemode) { default: @@ -314,6 +345,7 @@ void drawBackground(string img, float a, string algn, float force1) scalemode = SCALEMODE_CROP; + l = 0; for(i = 0; i < strlen(algn); ++i) { c = substring(algn, i, 1); @@ -631,6 +663,8 @@ void m_draw() float t; float realFrametime; + m_gamestatus(); + execute_next_frame(); menuMouseMode = cvar("menu_mouse_absolute"); @@ -653,7 +687,7 @@ void m_draw() if(Menu_Active) if(!cvar("menu_video_played")) { - localcmd("cd loop $menu_cdtrack; play sound/announcer/default/welcome.ogg\n"); + localcmd("cd loop $menu_cdtrack; play sound/announcer/default/welcome.wav\n"); menuLogoAlpha = -0.8; // no idea why, but when I start this at zero, it jumps instead of fading FIXME } // ALWAYS set this cvar; if we start but menu is not active, this means we want no background music! @@ -685,14 +719,6 @@ void m_draw() if(cvar("cl_capturevideo")) frametime = t / cvar("cl_capturevideo_fps"); // make capturevideo work smoothly - gamestatus = 0; - if(isserver()) - gamestatus = gamestatus | GAME_ISSERVER; - if(clientstate() == CS_CONNECTED) - gamestatus = gamestatus | GAME_CONNECTED; - if(cvar("developer")) - gamestatus = gamestatus | GAME_DEVELOPER; - prevMenuAlpha = menuAlpha; if(Menu_Active) { @@ -924,11 +950,18 @@ void m_goto(string itemname) { entity e; if(!menuInitialized) + { + if(m_goto_buffer) + strunzone(m_goto_buffer); + m_goto_buffer = strzone(itemname); return; + } if(itemname == "") // this can be called by GameCommand { if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)) + { m_hide(); + } else { m_activate_window(main.mainNexposee); @@ -949,27 +982,3 @@ void m_goto(string itemname) } } } - -void m_goto_skin_selector() -{ - if(!menuInitialized) - return; - // TODO add code to switch back to the skin selector (no idea how to do it now) - m_goto("skinselector"); -} - -void m_goto_language_selector() -{ - if(!menuInitialized) - return; - // TODO add code to switch back to the language selector (no idea how to do it now) - m_goto("languageselector"); -} - -void m_goto_video_settings() -{ - if(!menuInitialized) - return; - // TODO add code to switch back to the video settings (no idea how to do it now) - m_goto("videosettings"); -}