]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
fix reflections not working when just reflective stuff, but no water, is on the map
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index bba739c7070bf0c23603274594a057aa8deabf50..7888bffd8d57babefadea2d6cf56d3baf6bdbd7e 100644 (file)
--- a/host.c
+++ b/host.c
@@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "cl_video.h"
 #include "progsvm.h"
 #include "csprogs.h"
+#include "sv_demo.h"
 
 /*
 
@@ -58,6 +59,7 @@ cvar_t host_framerate = {0, "host_framerate","0", "locks frame timing to this va
 cvar_t host_speeds = {0, "host_speeds","0", "reports how much time is used in server/graphics/sound"};
 // LordHavoc: framerate upper cap
 cvar_t cl_maxfps = {CVAR_SAVE, "cl_maxfps", "1000", "maximum fps cap, if game is running faster than this it will wait before running another frame (useful to make cpu time available to other programs)"};
+cvar_t cl_maxidlefps = {CVAR_SAVE, "cl_maxidlefps", "20", "maximum fps cap when the game is not the active window (makes cpu time available to other programs"};
 
 cvar_t developer = {0, "developer","0", "prints additional debugging messages and information (recommended for modders and level designers)"};
 cvar_t developer_entityparsing = {0, "developer_entityparsing", "0", "prints detailed network entities information each time a packet is received"};
@@ -199,6 +201,7 @@ static void Host_InitLocal (void)
        Cvar_RegisterVariable (&host_framerate);
        Cvar_RegisterVariable (&host_speeds);
        Cvar_RegisterVariable (&cl_maxfps);
+       Cvar_RegisterVariable (&cl_maxidlefps);
 
        Cvar_RegisterVariable (&developer);
        Cvar_RegisterVariable (&developer_entityparsing);
@@ -371,6 +374,8 @@ void SV_DropClient(qboolean crash)
        int i;
        Con_Printf("Client \"%s\" dropped\n", host_client->name);
 
+       SV_StopDemoRecording(host_client);
+
        // make sure edict is not corrupt (from a level change for example)
        host_client->edict = PRVM_EDICT_NUM(host_client - svs.clients + 1);
 
@@ -612,6 +617,8 @@ void Host_Main(void)
 
                NetConn_UpdateSockets();
 
+               Log_DestBuffer_Flush();
+
                // receive packets on each main loop iteration, as the main loop may
                // be undersleeping due to select() detecting a new packet
                if (sv.active)
@@ -712,7 +719,7 @@ void Host_Main(void)
 
                        if(advancetime > 0)
                        {
-                               offset = sv_timer;
+                               offset = sv_timer + (Sys_DoubleTime() - realtime);
                                ++svs.perf_acc_offset_samples;
                                svs.perf_acc_offset += offset;
                                svs.perf_acc_offset_squared += offset * offset;
@@ -776,7 +783,7 @@ void Host_Main(void)
                        else if (vid_activewindow)
                                clframetime = cl.realframetime = max(cl_timer, 1.0 / cl_maxfps.value);
                        else
-                               clframetime = cl.realframetime = 0.1;
+                               clframetime = cl.realframetime = max(cl_timer, 1.0 / cl_maxidlefps.value);
 
                        // apply slowmo scaling
                        clframetime *= cl.movevars_timescale;