]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
clean up script init a bit, now starts nexuiz logo video and such only if there's...
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index b771602ca7b4382748fa54aacd68f54bdb096e32..58988498edf2d9728161c40d23dd4efa3988dae7 100644 (file)
--- a/host.c
+++ b/host.c
@@ -152,8 +152,6 @@ void Host_Error (const char *error, ...)
        longjmp (host_abortserver, 1);
 }
 
-mempool_t *sv_clients_mempool = NULL;
-
 void Host_ServerOptions (void)
 {
        int i, numplayers;
@@ -216,8 +214,7 @@ void Host_ServerOptions (void)
                Cvar_SetValueQuick(&deathmatch, 1);
 
        svs.maxclients = numplayers;
-       sv_clients_mempool = Mem_AllocPool("server clients", 0, NULL);
-       svs.clients = Mem_Alloc(sv_clients_mempool, sizeof(client_t) * svs.maxclients);
+       svs.clients = Mem_Alloc(sv_mempool, sizeof(client_t) * svs.maxclients);
 }
 
 /*
@@ -811,7 +808,7 @@ void _Host_Frame (float time)
                time2 = Sys_DoubleTime();
 
        // update audio
-       if (cls.signon == SIGNONS && cl.viewentity >= 0 && cl.viewentity < MAX_EDICTS && cl_entities[cl.viewentity].state_current.active)
+       if (cls.signon == SIGNONS && cl_entities[cl.viewentity].state_current.active)
        {
                // LordHavoc: this used to use renderer variables (eww)
                S_Update(&cl_entities[cl.viewentity].render.matrix);
@@ -899,18 +896,18 @@ void Host_Init (void)
 
        Cmd_Init();
        Memory_Init_Commands();
-       R_Modules_Init();
+       Con_Init();
        Cbuf_Init();
+       R_Modules_Init();
        V_Init();
        COM_Init();
-       Host_InitLocal();
        Key_Init();
-       Con_Init();
        PR_Init();
        PRVM_Init();
        Mod_Init();
        NetConn_Init();
        SV_Init();
+       Host_InitLocal();
 
        Con_Printf("Builddate: %s\n", buildstring);
 
@@ -927,11 +924,16 @@ void Host_Init (void)
                CL_Init();
        }
 
+       Cbuf_Execute();
+
        // only cvars are executed when host_initialized == false
        if (gamemode == GAME_TEU)
                Cbuf_InsertText("exec teu.rc\n");
        else
                Cbuf_InsertText("exec quake.rc\n");
+
+       Cbuf_Execute();
+       Cbuf_Execute();
        Cbuf_Execute();
 
        host_initialized = true;
@@ -981,22 +983,37 @@ void Host_Init (void)
        Cbuf_Execute();
        Cbuf_Execute();
 
-       if (!sv.active && (cls.state == ca_dedicated || COM_CheckParm("-listen")))
+       // We must wait for the log_file cvar to be initialized to start the log
+       Log_Start ();
+
+       if (cls.state == ca_dedicated || COM_CheckParm("-listen"))
+       if (!sv.active && !cls.demoplayback && !cls.connect_trying)
                Cbuf_InsertText ("startmap_dm\n");
 
+       Cbuf_Execute();
+
        // 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 = COM_CheckParm("-benchmark");
-       if (i && i + 1 < com_argc && !sv.active)
+       if (i && i + 1 < com_argc)
+       if (!sv.active && !cls.demoplayback && !cls.connect_trying)
                Cbuf_InsertText(va("timedemo %s\n", com_argv[i + 1]));
 
+       Cbuf_Execute();
+
        if (!sv.active && !cls.demoplayback && !cls.connect_trying)
+       {
                Cbuf_InsertText("togglemenu\n");
+               if (gamemode == GAME_NEXUIZ)
+               {
+                       Cbuf_InsertText("playvideo logo\n");
+                       Cbuf_InsertText("cd loop 1\n");
+               }
+       }
 
        Cbuf_Execute();
-
-       // We must wait for the log_file cvar to be initialized to start the log
-       Log_Start ();
+       Cbuf_Execute();
+       Cbuf_Execute();
 }