]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Defer menu initialization until after stuffcmds. Implemented MP_Start_f
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 20 Jun 2020 01:00:27 +0000 (01:00 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 20 Jun 2020 01:00:27 +0000 (01:00 +0000)
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
host.c
menu.c

index 4f87574316b38ea2198a24cb6b87acfd9db05ea1..fa2e66e515a2dfb9365ae6247e083504dc0882a2 100644 (file)
--- 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 a6387bffee57f89a752dd3452370eeec8698b2ab..d315a3996d81613c86eed59e6d8807789e5319e1 100644 (file)
--- 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 <demoname> 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 1cf4f7c6716e91b156f0cbcd71ef0286b3c8f433..141d9e20262e06edae88b1ec493a0bac36e3554f 100644 (file)
--- 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;
 }