]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
increased build number to 103
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index e32d0a751951dfdeac7cd593e0d912e3e94222ef..b419f8a963b8c75c55458689ec740051d1e6673d 100644 (file)
--- a/host.c
+++ b/host.c
@@ -39,7 +39,6 @@ qboolean      hostloopactive = 0;             // LordHavoc: used to turn Host_Error into Sys_Err
 
 double         host_frametime;
 double         host_realframetime;             // LordHavoc: the real frametime, before slowmo and clamping are applied (used for console scrolling)
-double         host_time;
 double         realtime;                               // without any filtering or bounding
 double         oldrealtime;                    // last frame run
 int                    host_framecount;
@@ -120,7 +119,6 @@ This shuts down both the client and server
 ================
 */
 char hosterrorstring[4096];
-extern qboolean hostloopactive;
 void Host_Error (char *error, ...)
 {
        va_list         argptr;
@@ -146,7 +144,7 @@ void Host_Error (char *error, ...)
        }
        inerror = true;
        
-       SCR_EndLoadingPlaque ();                // reenable screen updates
+//     SCR_EndLoadingPlaque ();                // reenable screen updates
 
        va_start (argptr,error);
        vsprintf (hosterrorstring,error,argptr);
@@ -255,8 +253,6 @@ void Host_InitLocal (void)
        Cvar_RegisterVariable (&timeformat);
 
        Host_FindMaxClients ();
-       
-       host_time = 1.0;                // so a think at time 0 won't get called
 }
 
 
@@ -269,13 +265,13 @@ Writes key bindings and archived cvars to config.cfg
 */
 void Host_WriteConfiguration (void)
 {
-       FILE    *f;
+       QFile   *f;
 
 // dedicated servers initialize the host but don't parse and set the
 // config.cfg cvars
        if (host_initialized & !isDedicated)
        {
-               f = fopen (va("%s/config.cfg",com_gamedir), "w");
+               f = Qopen (va("%s/config.cfg",com_gamedir), "w");
                if (!f)
                {
                        Con_Printf ("Couldn't write config.cfg.\n");
@@ -285,7 +281,7 @@ void Host_WriteConfiguration (void)
                Key_WriteBindings (f);
                Cvar_WriteVariables (f);
 
-               fclose (f);
+               Qclose (f);
        }
 }
 
@@ -444,7 +440,7 @@ void Host_ShutdownServer(qboolean crash)
                CL_Disconnect ();
 
 // flush any pending messages - like the score!!!
-       start = Sys_FloatTime();
+       start = Sys_DoubleTime();
        do
        {
                count = 0;
@@ -464,7 +460,7 @@ void Host_ShutdownServer(qboolean crash)
                                }
                        }
                }
-               if ((Sys_FloatTime() - start) > 3.0)
+               if ((Sys_DoubleTime() - start) > 3.0)
                        break;
        }
        while (count);
@@ -558,8 +554,7 @@ qboolean Host_FilterTime (double time)
                        host_frametime = (1.0 / host_minfps.value);
        }
 
-       host_frametime *= slowmo.value;
-       cl.frametime = host_frametime;
+       cl.frametime = host_frametime = bound(0, host_frametime * slowmo.value, 0.1f); // LordHavoc: the QC code relies on no less than 10fps
        
        return true;
 }
@@ -691,20 +686,18 @@ void _Host_Frame (float time)
        if (!sv.active)
                CL_SendCmd ();
 
-       host_time += host_frametime;
-
 // fetch results from server
        if (cls.state == ca_connected)
                CL_ReadFromServer ();
 
 // update video
        if (host_speeds.value)
-               time1 = Sys_FloatTime ();
+               time1 = Sys_DoubleTime ();
                
        SCR_UpdateScreen ();
 
        if (host_speeds.value)
-               time2 = Sys_FloatTime ();
+               time2 = Sys_DoubleTime ();
                
 // update audio
        if (cls.signon == SIGNONS)
@@ -720,7 +713,7 @@ void _Host_Frame (float time)
        if (host_speeds.value)
        {
                pass1 = (time1 - time3)*1000000;
-               time3 = Sys_FloatTime ();
+               time3 = Sys_DoubleTime ();
                pass2 = (time2 - time1)*1000000;
                pass3 = (time3 - time2)*1000000;
                Con_Printf ("%6ius total %6ius server %6ius gfx %6ius snd\n",
@@ -743,9 +736,9 @@ void Host_Frame (float time)
                return;
        }
        
-       time1 = Sys_FloatTime ();
+       time1 = Sys_DoubleTime ();
        _Host_Frame (time);
-       time2 = Sys_FloatTime ();       
+       time2 = Sys_DoubleTime ();      
        
        timetotal += time2 - time1;
        timecount++;
@@ -768,14 +761,14 @@ void Host_Frame (float time)
 
 //============================================================================
 
-void Render_Init();
+void Render_Init(void);
 
 /*
 ====================
 Host_Init
 ====================
 */
-void Host_Init ()
+void Host_Init (void)
 {
        int i;
        /*
@@ -831,11 +824,13 @@ void Host_Init ()
        Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
        Con_Printf ("%4.1f megabyte heap\n",host_parms.memsize/(1024*1024.0));
        
-       R_InitTextures ();              // needed even for dedicated servers
        if (cls.state != ca_dedicated)
        {
-               Palette_Init("gfx/palette.lmp");
+               VID_InitCvars();
+
+               Gamma_Init();
+
+               Palette_Init();
 
 #ifndef _WIN32 // on non win32, mouse comes before video for security reasons
                IN_Init ();