]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Restore old video init behavior, pending better solution. Fixes Steel Storm crash...
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 17 Sep 2020 05:18:04 +0000 (05:18 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 17 Sep 2020 05:18:04 +0000 (05:18 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12929 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
cmd.c
host.c
menu.c
model_shared.c

index 6ded36842ef017b744ea36f72aa1de7944761c40..b7f26af02e1e126d8869ad12b70f1527d3ad2bb4 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -3056,9 +3056,5 @@ void CL_Init (void)
                CL_Video_Init();
 
                host.hook.ConnectLocal = CL_EstablishConnection_Local;
-
-               #ifdef CONFIG_MENU
-               Cbuf_InsertText(&cmd_client,"menu_start\n");
-               #endif
        }
 }
diff --git a/cmd.c b/cmd.c
index a6d76726085c02d72bfad40226ca8797d4292bcd..3b3fdfd146745b184669b9952f337763517363a8 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -524,10 +524,6 @@ static void Cmd_StuffCmds_f (cmd_state_t *cmd)
        int             i, j, l;
        // this is for all commandline options combined (and is bounds checked)
        char    build[MAX_INPUTLINE];
-       
-       // come back later so we don't crash
-       if(host.state == host_init)
-               return;
 
        if (Cmd_Argc (cmd) != 1)
        {
diff --git a/host.c b/host.c
index fbab532d00bf6a58f920aa6ca43aafc3befcbc8a..65c22bc856d48fe9b7beca1dcb60946890cac924 100644 (file)
--- a/host.c
+++ b/host.c
@@ -721,28 +721,27 @@ static void Host_Init (void)
                return;
        }
 
-       Host_StartVideo();
-
        Host_AddConfigText(cmd);
 
        // if quake.rc is missing, use default
        if (!FS_FileExists("quake.rc"))
        {
-               Cbuf_InsertText(cmd, "exec default.cfg\nexec " CONFIGFILENAME "\nexec autoexec.cfg\n");
+               Cbuf_AddText(cmd, "exec default.cfg\nexec " CONFIGFILENAME "\nexec autoexec.cfg\n");
                Cbuf_Execute(cmd->cbuf);
        }
 
        host.state = host_active;
 
-       // run stuffcmds now, deferred previously because it can crash if a server starts that early
-       Cbuf_AddText(cmd,"stuffcmds\n");
-       Cbuf_Execute(cmd->cbuf);
+       Host_StartVideo();
 
        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)
        i = Sys_CheckParm("-benchmark");
diff --git a/menu.c b/menu.c
index 33e01caac9a576e3f3de7b7202280e03e17914f2..481be8784393b9455046bf412bfb0ae8e816b2a2 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -5472,23 +5472,12 @@ static void Call_MR_ToggleMenu_f(cmd_state_t *cmd)
                MR_ToggleMenu(m);
 }
 
-static qbool 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(CF_CLIENT, "menu_start", MR_Start_f, "initialize the menu system");
        Cmd_AddCommand(CF_CLIENT, "menu_restart", MR_Restart_f, "restart menu system (reloads menu.dat)");
        Cmd_AddCommand(CF_CLIENT, "togglemenu", Call_MR_ToggleMenu_f, "opens or closes menu");
 }
@@ -5629,5 +5618,4 @@ void MR_Init(void)
                MR_SetRouting (true);
        else
                MR_SetRouting (false);
-       menu_active = true;
 }
index 4c66d78e3fa422d6fa82fe56c14169f34bcd9319..91ba91e0c887b8d3c119cb1d95391c94beb4017f 100644 (file)
@@ -626,6 +626,8 @@ dp_model_t *Mod_FindName(const char *name, const char *parentname)
        return mod;
 }
 
+extern qbool vid_opened;
+
 /*
 ==================
 Mod_ForName
@@ -636,6 +638,11 @@ Loads in a model for the given name
 dp_model_t *Mod_ForName(const char *name, qbool crash, qbool checkdisk, const char *parentname)
 {
        dp_model_t *model;
+
+       // FIXME: So we don't crash if a server is started early.
+       if(!vid_opened)
+               Host_StartVideo();
+
        model = Mod_FindName(name, parentname);
        if (!model->loaded || checkdisk)
                Mod_LoadModel(model, crash, checkdisk);