mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[nq] Remove some more bandaids
More host cleanup. The client now processes input itself, as does the server, but only if running a dedicated server. The server no longer blocks sound when loading a map as it shouldn't know anything about sound. This will probably need something done in the client, but moving the server into a separate thread will have that effect anyway.
This commit is contained in:
parent
521f805edf
commit
e86e93551d
8 changed files with 57 additions and 51 deletions
|
@ -241,6 +241,7 @@ struct cbuf_s;
|
|||
void CL_Init (struct cbuf_s *cbuf);
|
||||
void CL_InitCvars (void);
|
||||
void CL_ClearMemory (void);
|
||||
void CL_PreFrame (void);
|
||||
void CL_Frame (void);
|
||||
int CL_ReadConfiguration (const char *cfg_name);
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ extern struct cbuf_s *host_cbuf;
|
|||
void Host_ClearMemory (void);
|
||||
void Host_SpawnServer (void);
|
||||
void Host_OnServerSpawn (void (*onSpawn)(void));
|
||||
void Host_ServerFrame (void);
|
||||
void Host_InitCommands (void);
|
||||
void Host_Init (void);
|
||||
void Host_Shutdown(void *data);
|
||||
|
|
|
@ -292,6 +292,7 @@ void SV_RunClients (void);
|
|||
void SV_User_Init_Cvars (void);
|
||||
void SV_SaveSpawnparms (void);
|
||||
void SV_SpawnServer (const char *server);
|
||||
void SV_Frame (void);
|
||||
|
||||
void SV_LoadProgs (void);
|
||||
void SV_Progs_Init (void);
|
||||
|
|
|
@ -46,6 +46,7 @@ nq_cl_plugin_LIBS= \
|
|||
|
||||
nq_client_LIBFILES= \
|
||||
libs/gib/libQFgib_client.la \
|
||||
libs/input/libQFinput.la \
|
||||
libs/audio/libQFcd.la \
|
||||
libs/audio/libQFsound.la
|
||||
|
||||
|
@ -62,7 +63,6 @@ nq_common_LIBFILES= \
|
|||
libs/ruamoko/libQFruamoko.la \
|
||||
libs/gamecode/libQFgamecode.la \
|
||||
libs/ui/libQFui.la \
|
||||
libs/input/libQFinput.la \
|
||||
libs/util/libQFutil.la
|
||||
|
||||
nq_client_LIBS= $(nq_client_LIBFILES) $(nq_common_LIBFILES)
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/draw.h"
|
||||
#include "QF/gib.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/image.h"
|
||||
#include "QF/joystick.h"
|
||||
|
@ -623,6 +624,18 @@ write_capture (tex_t *tex, void *data)
|
|||
free (tex);
|
||||
}
|
||||
|
||||
void
|
||||
CL_PreFrame (void)
|
||||
{
|
||||
IN_ProcessEvents ();
|
||||
|
||||
GIB_Thread_Execute ();
|
||||
cmd_source = src_command;
|
||||
Cbuf_Execute_Stack (host_cbuf);
|
||||
|
||||
CL_SendCmd ();
|
||||
}
|
||||
|
||||
void
|
||||
CL_Frame (void)
|
||||
{
|
||||
|
|
|
@ -669,30 +669,6 @@ Host_FilterTime (float time)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
Host_ServerFrame (void)
|
||||
{
|
||||
*sv_globals.frametime = sv_frametime = host_frametime;
|
||||
|
||||
// set the time and clear the general datagram
|
||||
SV_ClearDatagram ();
|
||||
|
||||
SV_CheckForNewClients ();
|
||||
|
||||
// read client messages
|
||||
SV_RunClients ();
|
||||
|
||||
// move things around and think
|
||||
// always pause in single player if in console or menus
|
||||
if (!sv.paused && (svs.maxclients > 1 || host_in_game)) {
|
||||
SV_Physics ();
|
||||
sv.time += host_frametime;
|
||||
}
|
||||
|
||||
// send all messages to the clients
|
||||
SV_SendClientMessages ();
|
||||
}
|
||||
|
||||
/*
|
||||
Host_Frame
|
||||
|
||||
|
@ -724,16 +700,6 @@ _Host_Frame (float time)
|
|||
}
|
||||
host_time += host_frametime; //FIXME is this needed? vcr stuff
|
||||
|
||||
if (net_is_dedicated) {
|
||||
Con_ProcessInput ();
|
||||
} else {
|
||||
IN_ProcessEvents ();
|
||||
}
|
||||
|
||||
GIB_Thread_Execute ();
|
||||
cmd_source = src_command;
|
||||
Cbuf_Execute_Stack (host_cbuf);
|
||||
|
||||
if (first) {
|
||||
first = 0;
|
||||
|
||||
|
@ -753,11 +719,11 @@ _Host_Frame (float time)
|
|||
// 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_PreFrame ();
|
||||
}
|
||||
|
||||
if (sv.active) {
|
||||
Host_ServerFrame ();
|
||||
SV_Frame ();
|
||||
}
|
||||
|
||||
if (!net_is_dedicated) {
|
||||
|
|
|
@ -51,6 +51,11 @@ int cl_writecfg;
|
|||
float demo_speed;
|
||||
int chase_active;
|
||||
|
||||
void
|
||||
CL_PreFrame (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CL_Frame (void)
|
||||
{
|
||||
|
@ -116,13 +121,3 @@ void
|
|||
CL_StopPlayback (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
S_BlockSound (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
S_UnblockSound (void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
#endif
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/gib.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/set.h"
|
||||
|
@ -1087,7 +1089,6 @@ SV_SpawnServer (const char *server)
|
|||
edict_t *ent;
|
||||
|
||||
|
||||
S_BlockSound ();
|
||||
// let's not have any servers with no name
|
||||
if (hostname[0] == 0)
|
||||
Cvar_Set ("hostname", "UNNAMED");
|
||||
|
@ -1156,7 +1157,6 @@ SV_SpawnServer (const char *server)
|
|||
if (!sv.worldmodel) {
|
||||
Sys_Printf ("Couldn't spawn server %s\n", sv.modelname);
|
||||
sv.active = false;
|
||||
S_UnblockSound ();
|
||||
return;
|
||||
}
|
||||
sv.models[1] = sv.worldmodel;
|
||||
|
@ -1230,5 +1230,36 @@ SV_SpawnServer (const char *server)
|
|||
}
|
||||
|
||||
Sys_MaskPrintf (SYS_dev, "Server spawned.\n");
|
||||
S_UnblockSound ();
|
||||
}
|
||||
|
||||
void
|
||||
SV_Frame (void)
|
||||
{
|
||||
if (net_is_dedicated) {
|
||||
Con_ProcessInput ();
|
||||
|
||||
GIB_Thread_Execute ();
|
||||
cmd_source = src_command;
|
||||
Cbuf_Execute_Stack (host_cbuf);
|
||||
}
|
||||
|
||||
*sv_globals.frametime = sv_frametime = host_frametime;
|
||||
|
||||
// set the time and clear the general datagram
|
||||
SV_ClearDatagram ();
|
||||
|
||||
SV_CheckForNewClients ();
|
||||
|
||||
// read client messages
|
||||
SV_RunClients ();
|
||||
|
||||
// move things around and think
|
||||
// always pause in single player if in console or menus
|
||||
if (!sv.paused && (svs.maxclients > 1 || host_in_game)) {
|
||||
SV_Physics ();
|
||||
sv.time += host_frametime;
|
||||
}
|
||||
|
||||
// send all messages to the clients
|
||||
SV_SendClientMessages ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue