#include <time.h>
#include "libcurl.h"
+#ifdef CONFIG_CD
#include "cdaudio.h"
+#endif
#include "cl_video.h"
#include "progsvm.h"
#include "csprogs.h"
aborts the current host frame and goes on with the next one
================
*/
+void Host_AbortCurrentFrame(void) DP_FUNC_NORETURN;
void Host_AbortCurrentFrame(void)
{
// in case we were previously nice, make us mean again
buf.data = bufdata;
buf.maxsize = sizeof(bufdata);
MSG_WriteByte(&buf, svc_disconnect);
- NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000, false);
- NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000, false);
- NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000, false);
+ NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000, 0, false);
+ NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000, 0, false);
+ NetConn_SendUnreliableMessage(host_client->netconnection, &buf, sv.protocol, 10000, 0, false);
}
}
double wait;
int pass1, pass2, pass3, i;
char vabuf[1024];
+ qboolean playing;
Host_Init();
realtime = 0;
- dirtytime = Sys_DirtyTime();
for (;;)
{
if (setjmp(host_abortframe))
// Look for clients who have spawned
playing = false;
for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
- if(host_client->spawned)
+ if(host_client->begun)
if(host_client->netconnection)
playing = true;
- if(svs.perf_acc_realtime > 5)
+ if(sv.time < 10)
+ {
+ // don't accumulate time for the first 10 seconds of a match
+ // so things can settle
+ svs.perf_acc_realtime = svs.perf_acc_sleeptime = svs.perf_acc_lost = svs.perf_acc_offset = svs.perf_acc_offset_squared = svs.perf_acc_offset_max = svs.perf_acc_offset_samples = 0;
+ }
+ else if(svs.perf_acc_realtime > 5)
{
svs.perf_cpuload = 1 - svs.perf_acc_sleeptime / svs.perf_acc_realtime;
svs.perf_lost = svs.perf_acc_lost / svs.perf_acc_realtime;
SV_SendClientMessages();
if (sv.paused == 1 && realtime > sv.pausedstart && sv.pausedstart > 0) {
- prog->globals.generic[OFS_PARM0] = realtime - sv.pausedstart;
+ prog->globals.fp[OFS_PARM0] = realtime - sv.pausedstart;
PRVM_serverglobalfloat(time) = sv.time;
prog->ExecuteProgram(prog, PRVM_serverfunction(SV_PausedTic), "QC function SV_PausedTic is missing");
}
{
R_TimeReport("---");
Collision_Cache_NewFrame();
- R_TimeReport("collisioncache");
+ R_TimeReport("photoncache");
// decide the simulation time
if (cls.capturevideo.active)
{
if (cls.demopaused)
clframetime = 0;
}
+ else
+ {
+ // host_framerate overrides all else
+ if (host_framerate.value)
+ clframetime = host_framerate.value;
- // host_framerate overrides all else
- if (host_framerate.value)
- clframetime = host_framerate.value;
-
- if (cl.paused || (cl.islocalgame && (key_dest != key_game || key_consoleactive || cl.csqc_paused)))
- clframetime = 0;
+ if (cl.paused || (cl.islocalgame && (key_dest != key_game || key_consoleactive || cl.csqc_paused)))
+ clframetime = 0;
+ }
if (cls.timedemo)
clframetime = cl.realframetime = cl_timer;
else
S_Update(&r_refdef.view.matrix);
+#ifdef CONFIG_CD
CDAudio_Update();
R_TimeReport("audio");
+#endif
// reset gathering of mouse input
in_mouse_x = in_mouse_y = 0;
// make sure we open sockets before opening video because the Windows Firewall "unblock?" dialog can screw up the graphics context on some graphics drivers
NetConn_UpdateSockets();
VID_Start();
+#ifdef CONFIG_CD
CDAudio_Startup();
+#endif
}
}
if(locksession_run)
return;
locksession_run = true;
- if(locksession.integer != 0)
+ if(locksession.integer != 0 && !COM_CheckParm("-readonly"))
{
char vabuf[1024];
char *p = va(vabuf, sizeof(vabuf), "%slock%s", *fs_userdir ? fs_userdir : fs_basedir, sessionid.string);
VID_Init();
Render_Init();
S_Init();
+#ifdef CONFIG_CD
CDAudio_Init();
+#endif
Key_Init();
CL_Init();
}
}
// put up the loading image so the user doesn't stare at a black screen...
- SCR_BeginLoadingPlaque();
+ SCR_BeginLoadingPlaque(true);
if (cls.state != ca_dedicated)
{
Host_SaveConfig();
+#ifdef CONFIG_CD
CDAudio_Shutdown ();
+#endif
S_Terminate ();
Curl_Shutdown ();
NetConn_Shutdown ();