]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
Merge branch 'master' into Mario/ext_entityparam
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index 20a4b4392ab0b418b51dc1941e4cccbfa31db061..4930bf8b50007455c404f1543e2a738cd6ebe13e 100644 (file)
--- a/host.c
+++ b/host.c
@@ -129,7 +129,7 @@ void Host_Error (const char *error, ...)
        dpvsnprintf (hosterrorstring1,sizeof(hosterrorstring1),error,argptr);
        va_end (argptr);
 
-       Con_Printf("Host_Error: %s\n", hosterrorstring1);
+       Con_Errorf("Host_Error: %s\n", hosterrorstring1);
 
        // LadyHavoc: if crashing very early, or currently shutting down, do
        // Sys_Error instead
@@ -290,7 +290,7 @@ static void Host_SaveConfig_to(const char *file)
                f = FS_OpenRealFile(file, "wb", false);
                if (!f)
                {
-                       Con_Printf("Couldn't write %s.\n", file);
+                       Con_Errorf("Couldn't write %s.\n", file);
                        return;
                }
 
@@ -501,6 +501,8 @@ void SV_DropClient(qboolean crash)
                host_client->clientconnectcalled = false;
                PRVM_serverglobalfloat(time) = sv.time;
                PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
+               // optional entity parameter for self (EXT_ENTITYPARAM)
+               PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(host_client->edict);
                prog->ExecuteProgram(prog, PRVM_serverfunction(ClientDisconnect), "QC function ClientDisconnect is missing");
                PRVM_serverglobaledict(self) = saveSelf;
        }
@@ -696,12 +698,12 @@ void Host_Main(void)
                {
                        // warn if it's significant
                        if (deltacleantime < -0.01)
-                               Con_Printf("Host_Mingled: time stepped backwards (went from %f to %f, difference %f)\n", olddirtytime, dirtytime, deltacleantime);
+                               Con_Warnf("Host_Mingled: time stepped backwards (went from %f to %f, difference %f)\n", olddirtytime, dirtytime, deltacleantime);
                        deltacleantime = 0;
                }
                else if (deltacleantime >= 1800)
                {
-                       Con_Printf("Host_Mingled: time stepped forward (went from %f to %f, difference %f)\n", olddirtytime, dirtytime, deltacleantime);
+                       Con_Warnf("Host_Mingled: time stepped forward (went from %f to %f, difference %f)\n", olddirtytime, dirtytime, deltacleantime);
                        deltacleantime = 0;
                }
                realtime += deltacleantime;
@@ -781,6 +783,7 @@ void Host_Main(void)
                        // process console commands
 //                     R_TimeReport("preconsole");
                        CL_VM_PreventInformationLeaks();
+                       Cbuf_Frame(&cmd_clientfromserver);
                        Cbuf_Frame(&cmd_client);
                        Cbuf_Frame(&cmd_server);
 
@@ -789,11 +792,6 @@ void Host_Main(void)
                                Cbuf_Frame(&cmd_serverfromclient);
                        }
 
-                       if(cls.netcon)
-                       {
-                               Cbuf_Frame(&cmd_clientfromserver);
-                       }
-
 //                     R_TimeReport("console");
                }
 
@@ -1036,7 +1034,6 @@ void Host_Main(void)
                        R_TimeReport("client");
 
                        CL_UpdateScreen();
-                       CL_MeshEntities_Reset();
                        R_TimeReport("render");
 
                        if (host_speeds.integer)
@@ -1142,7 +1139,7 @@ void Host_LockSession(void)
                {
                        if(locksession.integer == 2)
                        {
-                               Con_Printf("WARNING: session lock %s could not be acquired. Please run with -sessionid and an unique session name. Continuing anyway.\n", p);
+                               Con_Warnf("WARNING: session lock %s could not be acquired. Please run with -sessionid and an unique session name. Continuing anyway.\n", p);
                        }
                        else
                        {
@@ -1167,6 +1164,8 @@ void Host_UnlockSession(void)
        }
 }
 
+extern hook_t *csqc_concmd;
+
 /*
 ====================
 Host_Init
@@ -1234,6 +1233,8 @@ static void Host_Init (void)
        // initialize memory subsystem cvars/commands
        Memory_Init_Commands();
 
+       Hook_Init();
+       csqc_concmd = Hook_Register(csqc_concmd,CL_VM_ConsoleCommand,1);
        // initialize console and logging and its cvars/commands
        Con_Init();
 
@@ -1335,6 +1336,8 @@ static void Host_Init (void)
                Cbuf_Execute(cmd);
        }
 
+       Log_Start();
+       
        // put up the loading image so the user doesn't stare at a black screen...
        SCR_BeginLoadingPlaque(true);