From bf83c8a5e43befb0e3e3945dc2b6abd6c4c1bdb0 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Sat, 20 Jun 2020 01:00:27 +0000 Subject: [PATCH] Defer menu initialization until after stuffcmds. Implemented MP_Start_f Also start loading plaque in CL_Init. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12703 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_main.c | 6 ++++++ host.c | 14 +------------- menu.c | 12 ++++++++++++ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/cl_main.c b/cl_main.c index 4f875743..fa2e66e5 100644 --- a/cl_main.c +++ b/cl_main.c @@ -2778,5 +2778,11 @@ void CL_Init (void) CL_Video_Init(); Host_StartVideo(); + // put up the loading image so the user doesn't stare at a black screen... + SCR_BeginLoadingPlaque(true); + + #ifdef CONFIG_MENU + Cbuf_InsertText(&cmd_client,"menu_start\n"); + #endif } } diff --git a/host.c b/host.c index a6387bff..d315a399 100644 --- a/host.c +++ b/host.c @@ -1294,23 +1294,13 @@ static void Host_Init (void) // if quake.rc is missing, use default if (!FS_FileExists("quake.rc")) { - Cbuf_AddText(cmd, "exec default.cfg\nexec " CONFIGFILENAME "\nexec autoexec.cfg\n"); + Cbuf_InsertText(cmd, "exec default.cfg\nexec " CONFIGFILENAME "\nexec autoexec.cfg\n"); Cbuf_Execute(cmd); } host.state = host_active; Log_Start(); - - // put up the loading image so the user doesn't stare at a black screen... - SCR_BeginLoadingPlaque(true); - -#ifdef CONFIG_MENU - if (cls.state != ca_dedicated) - { - MR_Init(); - } -#endif // check for special benchmark mode // COMMANDLINEOPTION: Client: -benchmark runs a timedemo and quits, results of any timedemo can be found in gamedir/benchmark.log (for example id1/benchmark.log) @@ -1360,8 +1350,6 @@ static void Host_Init (void) Con_DPrint("========Initialized=========\n"); - //Host_StartVideo(); - if (cls.state != ca_dedicated) SV_StartThread(); } diff --git a/menu.c b/menu.c index 1cf4f7c6..141d9e20 100644 --- a/menu.c +++ b/menu.c @@ -5467,12 +5467,23 @@ static void Call_MR_ToggleMenu_f(cmd_state_t *cmd) MR_ToggleMenu(m); } +static qboolean menu_active; + +static void MR_Start_f(cmd_state_t *cmd) +{ + if(menu_active || cls.state == ca_dedicated) + return; + MR_Init(); + +} + void MR_Init_Commands(void) { // set router console commands Cvar_RegisterVariable (&forceqmenu); Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue); Cvar_RegisterVariable (&menu_progs); + Cmd_AddCommand(CMD_CLIENT, "menu_start", MR_Start_f, "initialize the menu system"); Cmd_AddCommand(CMD_CLIENT, "menu_restart", MR_Restart_f, "restart menu system (reloads menu.dat)"); Cmd_AddCommand(CMD_CLIENT, "togglemenu", Call_MR_ToggleMenu_f, "opens or closes menu"); } @@ -5613,4 +5624,5 @@ void MR_Init(void) MR_SetRouting (true); else MR_SetRouting (false); + menu_active = true; } -- 2.39.2