mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[nq] Clean up Host_Frame_ a little
This simplifies the logic around dedicated servers and clients connecting to remote servers.
This commit is contained in:
parent
6b81a4b882
commit
8d725a1d0a
2 changed files with 33 additions and 35 deletions
|
@ -155,6 +155,11 @@ CL_ClearMemory (void)
|
||||||
{
|
{
|
||||||
VID_ClearMemory ();
|
VID_ClearMemory ();
|
||||||
SCR_SetFullscreen (0);
|
SCR_SetFullscreen (0);
|
||||||
|
|
||||||
|
cls.signon = 0;
|
||||||
|
__auto_type cam = cl.viewstate.camera_transform;
|
||||||
|
memset (&cl, 0, sizeof (cl));
|
||||||
|
cl.viewstate.camera_transform = cam;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -503,12 +503,6 @@ Host_ClearMemory (void)
|
||||||
Mod_ClearAll ();
|
Mod_ClearAll ();
|
||||||
if (host_hunklevel)
|
if (host_hunklevel)
|
||||||
Hunk_FreeToLowMark (0, host_hunklevel);
|
Hunk_FreeToLowMark (0, host_hunklevel);
|
||||||
|
|
||||||
cls.signon = 0;
|
|
||||||
memset (&sv, 0, sizeof (sv));
|
|
||||||
__auto_type cam = cl.viewstate.camera_transform;
|
|
||||||
memset (&cl, 0, sizeof (cl));
|
|
||||||
cl.viewstate.camera_transform = cam;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -575,19 +569,25 @@ Host_ServerFrame (void)
|
||||||
SV_SendClientMessages ();
|
SV_SendClientMessages ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
write_capture (tex_t *tex, void *data)
|
||||||
|
{
|
||||||
|
QFile *file = QFS_Open (va (0, "%s/qfmv%06d.png",
|
||||||
|
qfs_gamedir->dir.shots,
|
||||||
|
cls.demo_capture++), "wb");
|
||||||
|
if (file) {
|
||||||
|
WritePNG (file, tex);
|
||||||
|
Qclose (file);
|
||||||
|
}
|
||||||
|
free (tex);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Host_ClientFrame (void)
|
Host_ClientFrame (void)
|
||||||
{
|
{
|
||||||
static double time1 = 0, time2 = 0, time3 = 0;
|
static double time1 = 0, time2 = 0, time3 = 0;
|
||||||
int pass1, pass2, pass3;
|
int pass1, pass2, pass3;
|
||||||
|
|
||||||
// if running the server remotely, send intentions now after
|
|
||||||
// the incoming messages have been read
|
|
||||||
if (!sv.active)
|
|
||||||
CL_SendCmd ();
|
|
||||||
|
|
||||||
host_time += host_frametime;
|
|
||||||
|
|
||||||
// fetch results from server
|
// fetch results from server
|
||||||
if (cls.state >= ca_connected)
|
if (cls.state >= ca_connected)
|
||||||
CL_ReadFromServer ();
|
CL_ReadFromServer ();
|
||||||
|
@ -631,19 +631,10 @@ Host_ClientFrame (void)
|
||||||
Sys_Printf ("%3i tot %3i server %3i gfx %3i snd\n",
|
Sys_Printf ("%3i tot %3i server %3i gfx %3i snd\n",
|
||||||
pass1 + pass2 + pass3, pass1, pass2, pass3);
|
pass1 + pass2 + pass3, pass1, pass2, pass3);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
if (cls.demo_capture) {
|
||||||
write_capture (tex_t *tex, void *data)
|
r_funcs->capture_screen (write_capture, 0);
|
||||||
{
|
|
||||||
QFile *file = QFS_Open (va (0, "%s/qfmv%06d.png",
|
|
||||||
qfs_gamedir->dir.shots,
|
|
||||||
cls.demo_capture++), "wb");
|
|
||||||
if (file) {
|
|
||||||
WritePNG (file, tex);
|
|
||||||
Qclose (file);
|
|
||||||
}
|
}
|
||||||
free (tex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -675,12 +666,13 @@ _Host_Frame (float time)
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
host_time += host_frametime; //FIXME is this needed? vcr stuff
|
||||||
|
|
||||||
if (!net_is_dedicated)
|
if (net_is_dedicated) {
|
||||||
IN_ProcessEvents ();
|
|
||||||
|
|
||||||
if (net_is_dedicated)
|
|
||||||
Con_ProcessInput ();
|
Con_ProcessInput ();
|
||||||
|
} else {
|
||||||
|
IN_ProcessEvents ();
|
||||||
|
}
|
||||||
|
|
||||||
GIB_Thread_Execute ();
|
GIB_Thread_Execute ();
|
||||||
cmd_source = src_command;
|
cmd_source = src_command;
|
||||||
|
@ -703,18 +695,19 @@ _Host_Frame (float time)
|
||||||
|
|
||||||
NET_Poll ();
|
NET_Poll ();
|
||||||
|
|
||||||
if (sv.active) {
|
if (!net_is_dedicated) {
|
||||||
|
// Whether or not the server is active, if this is not a dedicated
|
||||||
|
// server, then the client always needs to be able to process input
|
||||||
|
// and send commands to the server before the server runs a frame.
|
||||||
CL_SendCmd ();
|
CL_SendCmd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sv.active) {
|
||||||
Host_ServerFrame ();
|
Host_ServerFrame ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!net_is_dedicated)
|
if (!net_is_dedicated) {
|
||||||
Host_ClientFrame ();
|
Host_ClientFrame ();
|
||||||
else
|
|
||||||
host_time += host_frametime; //FIXME is this needed? vcr stuff
|
|
||||||
|
|
||||||
if (cls.demo_capture) {
|
|
||||||
r_funcs->capture_screen (write_capture, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
host_framecount++;
|
host_framecount++;
|
||||||
|
|
Loading…
Reference in a new issue