mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 14:42:13 +00:00
Trying to fix mvd recording/playback a little.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3811 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
0d17471975
commit
f66110b5e6
17 changed files with 95 additions and 51 deletions
|
@ -76,10 +76,6 @@ void CL_StopPlayback (void)
|
|||
CL_FinishTimeDemo ();
|
||||
}
|
||||
|
||||
#define dem_cmd 0
|
||||
#define dem_read 1
|
||||
#define dem_set 2
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_WriteDemoCmd
|
||||
|
@ -170,8 +166,12 @@ int demo_preparsedemo(unsigned char *buffer, int bytes)
|
|||
{
|
||||
switch(buffer[1]&dem_mask)
|
||||
{
|
||||
case dem_cmd:
|
||||
ofs = -(sizeof(q1usercmd_t));
|
||||
ofs = 0;
|
||||
break;
|
||||
case dem_set:
|
||||
ofs = -10;
|
||||
ofs = -(8);
|
||||
break;
|
||||
case dem_multiple:
|
||||
ofs = 6;
|
||||
|
@ -270,7 +270,11 @@ void demo_flushbytes(int bytes)
|
|||
Sys_Error("demo_flushbytes: flushed too much!\n");
|
||||
memmove(demobuffer, demobuffer+bytes, demobuffersize - bytes);
|
||||
demobuffersize -= bytes;
|
||||
demopreparsedbytes -= bytes;
|
||||
|
||||
if (demopreparsedbytes < bytes)
|
||||
demopreparsedbytes = 0;
|
||||
else
|
||||
demopreparsedbytes -= bytes;
|
||||
}
|
||||
|
||||
void demo_flushcache(void)
|
||||
|
|
|
@ -3733,6 +3733,9 @@ void Host_FinishInit(void)
|
|||
Cbuf_AddText ("exec autoexec.cfg\n", RESTRICT_LOCAL);
|
||||
}
|
||||
Cbuf_AddText ("exec fte.cfg\n", RESTRICT_LOCAL);
|
||||
|
||||
if (COM_FCheckExists ("frontend.cfg"))
|
||||
Cbuf_AddText ("exec frontend.cfg\n", RESTRICT_LOCAL);
|
||||
Cbuf_AddText ("cl_warncmd 1\n", RESTRICT_LOCAL); //and then it's allowed to start moaning.
|
||||
|
||||
{
|
||||
|
|
|
@ -4899,6 +4899,11 @@ void CL_ParseServerMessage (void)
|
|||
case svc_disconnect:
|
||||
if (cls.demoplayback == DPB_EZTV) //eztv fails to detect the end of demos.
|
||||
MSG_ReadString();
|
||||
else if (cls.demoplayback)
|
||||
{
|
||||
CL_Disconnect_f();
|
||||
return;
|
||||
}
|
||||
else if (cls.state == ca_connected)
|
||||
{
|
||||
Host_EndGame ("Server disconnected\n"
|
||||
|
|
|
@ -1864,7 +1864,7 @@ void IN_StartupJoystick (void)
|
|||
// abort startup if we didn't find a valid joystick
|
||||
if (mmr != JOYERR_NOERROR)
|
||||
{
|
||||
Con_Printf ("joystick not found -- no valid joysticks (%x)\n", mmr);
|
||||
// Con_Printf ("joystick not found -- no valid joysticks (%x)\n", mmr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1700,21 +1700,17 @@ TRACE(("dbg: R_ApplyRenderer: efrags\n"));
|
|||
switch (qrenderer)
|
||||
{
|
||||
case QR_NONE:
|
||||
Con_Printf( "\n"
|
||||
"-----------------------------\n"
|
||||
"Dedicated console created\n");
|
||||
Con_Printf( "Dedicated console created\n");
|
||||
break;
|
||||
|
||||
#ifdef GLQUAKE
|
||||
case QR_OPENGL:
|
||||
Con_Printf( "\n"
|
||||
"-----------------------------\n"
|
||||
"OpenGL renderer initialized\n");
|
||||
Con_Printf( "OpenGL renderer initialized\n");
|
||||
break;
|
||||
#endif
|
||||
|
||||
case QR_DIRECT3D:
|
||||
Con_Printf( "\n"
|
||||
"-----------------------------\n"
|
||||
"Direct3d renderer initialized\n");
|
||||
Con_Printf( "Direct3d renderer initialized\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1617,7 +1617,6 @@ void COM_Gamedir (const char *dir)
|
|||
Cbuf_InsertText("cl_warncmd 0\n"
|
||||
"exec config.cfg\n"
|
||||
"exec fte.cfg\n"
|
||||
"exec frontend.cfg\n"
|
||||
"cl_warncmd 1\n", RESTRICT_LOCAL, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3277,8 +3277,6 @@ void NET_Init (void)
|
|||
if (r)
|
||||
Sys_Error ("Winsock initialization failed.");
|
||||
#endif
|
||||
|
||||
Con_TPrintf(TL_UDPINITED);
|
||||
}
|
||||
#define STRINGIFY2(s) #s
|
||||
#define STRINGIFY(s) STRINGIFY2(s)
|
||||
|
|
|
@ -142,7 +142,6 @@ static char *defaultlanguagetext =
|
|||
"TL_NETSENDERROR \"NET_SendPacket ERROR: %i\\n\"\n"
|
||||
"TL_NETBINDINTERFACE \"Binding to IP Interface Address of %s\\n\"\n"
|
||||
"TL_IPADDRESSIS \"IP address %s\\n\"\n"
|
||||
"TL_UDPINITED \"UDP Initialized\\n\"\n"
|
||||
"TL_SERVERPORTINITED \"Server port Initialized\\n\"\n"
|
||||
"TL_CLIENTPORTINITED \"Client port Initialized\\n\"\n"
|
||||
"TL_OUTMESSAGEOVERFLOW \"%s:Outgoing message overflow\\n\"\n"
|
||||
|
|
|
@ -170,7 +170,6 @@
|
|||
NAME(TL_NETSENDERROR)
|
||||
NAME(TL_NETBINDINTERFACE)
|
||||
NAME(TL_IPADDRESSIS)
|
||||
NAME(TL_UDPINITED)
|
||||
NAME(TL_SERVERPORTINITED)
|
||||
NAME(TL_CLIENTPORTINITED)
|
||||
|
||||
|
|
|
@ -4229,8 +4229,6 @@ void Shader_DoReload(void)
|
|||
|
||||
if (shader_rescan_needed && ruleset_allow_shaders.ival)
|
||||
{
|
||||
Con_Printf ( "Initializing Shaders.\n" );
|
||||
|
||||
COM_EnumerateFiles("materials/*.mtr", Shader_InitCallback, NULL);
|
||||
COM_EnumerateFiles("shaders/*.shader", Shader_InitCallback, NULL);
|
||||
COM_EnumerateFiles("scripts/*.shader", Shader_InitCallback, NULL);
|
||||
|
@ -4244,7 +4242,6 @@ void Shader_DoReload(void)
|
|||
return;
|
||||
shader_reload_needed = false;
|
||||
Font_InvalidateColour();
|
||||
Con_Printf("Reloading all shaders\n");
|
||||
|
||||
for (s = r_shaders, i = 0; i < MAX_SHADERS; i++, s++)
|
||||
{
|
||||
|
|
|
@ -364,10 +364,17 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name), float ver)
|
|||
{
|
||||
GLint profile = 0;
|
||||
#define GL_CONTEXT_PROFILE_MASK 0x9126
|
||||
#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
|
||||
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
|
||||
qglGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profile);
|
||||
|
||||
gl_config.nofixedfunc = !(profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT);
|
||||
if (!profile)
|
||||
{
|
||||
Con_DPrintf("Driver reports invalid profile, assuming compatibility support\n");
|
||||
gl_config.nofixedfunc = false;
|
||||
}
|
||||
else
|
||||
gl_config.nofixedfunc = !(profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT);
|
||||
}
|
||||
else if (gl_config.glversion == 3.1)
|
||||
gl_config.nofixedfunc = !GL_CheckExtension("GL_ARB_compatibility");
|
||||
|
|
|
@ -1268,6 +1268,7 @@ typedef struct mvddest_s {
|
|||
struct mvddest_s *nextdest;
|
||||
} mvddest_t;
|
||||
void SV_MVDPings (void);
|
||||
void SV_MVD_FullClientUpdate(sizebuf_t *msg, client_t *player);
|
||||
void SV_MVDWriteToDisk(int type, int to, float time);
|
||||
qboolean MVDWrite_Begin(qbyte type, int to, int size);
|
||||
void MVDSetMsgBuf(demobuf_t *prev,demobuf_t *cur);
|
||||
|
|
|
@ -1570,10 +1570,13 @@ void SV_ConSay_f(void)
|
|||
|
||||
if (sv.mvdrecording)
|
||||
{
|
||||
MVDWrite_Begin (dem_all, 0, strlen(text)+3);
|
||||
MVDWrite_Begin (dem_all, 0, strlen(text)+4);
|
||||
MSG_WriteByte (&demo.dbuf->sb, svc_print);
|
||||
MSG_WriteByte (&demo.dbuf->sb, PRINT_CHAT);
|
||||
MSG_WriteString (&demo.dbuf->sb, text);
|
||||
for (j = 0; text[j]; j++)
|
||||
MSG_WriteChar(&demo.dbuf->sb, text[j]);
|
||||
MSG_WriteChar(&demo.dbuf->sb, '\n');
|
||||
MSG_WriteChar(&demo.dbuf->sb, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -600,6 +600,7 @@ void SV_DropClient (client_t *drop)
|
|||
#ifdef NQPROT
|
||||
SVNQ_FullClientUpdate (drop, &sv.nqreliable_datagram);
|
||||
#endif
|
||||
SV_MVD_FullClientUpdate(NULL, drop);
|
||||
}
|
||||
|
||||
if (drop->controlled)
|
||||
|
|
|
@ -774,6 +774,57 @@ void SV_MVDPings (void)
|
|||
MSG_WriteByte (&demo.dbuf->sb, client->lossage);
|
||||
}
|
||||
}
|
||||
void SV_MVD_FullClientUpdate(sizebuf_t *msg, client_t *player)
|
||||
{
|
||||
char info[MAX_INFO_STRING];
|
||||
qboolean dosizes;
|
||||
if (!sv.mvdrecording)
|
||||
return;
|
||||
|
||||
if (msg)
|
||||
dosizes = false;
|
||||
else
|
||||
{
|
||||
dosizes = true;
|
||||
msg = &demo.dbuf->sb;
|
||||
}
|
||||
|
||||
if (dosizes)
|
||||
MVDWrite_Begin (dem_all, 0, 4);
|
||||
MSG_WriteByte (msg, svc_updatefrags);
|
||||
MSG_WriteByte (msg, player - svs.clients);
|
||||
MSG_WriteShort (msg, player->old_frags);
|
||||
|
||||
if (dosizes)
|
||||
MVDWrite_Begin (dem_all, 0, 4);
|
||||
MSG_WriteByte (msg, svc_updateping);
|
||||
MSG_WriteByte (msg, player - svs.clients);
|
||||
MSG_WriteShort (msg, SV_CalcPing(player, false));
|
||||
|
||||
if (dosizes)
|
||||
MVDWrite_Begin (dem_all, 0, 3);
|
||||
MSG_WriteByte (msg, svc_updatepl);
|
||||
MSG_WriteByte (msg, player - svs.clients);
|
||||
MSG_WriteByte (msg, player->lossage);
|
||||
|
||||
if (dosizes)
|
||||
MVDWrite_Begin (dem_all, 0, 6);
|
||||
MSG_WriteByte (msg, svc_updateentertime);
|
||||
MSG_WriteByte (msg, player - svs.clients);
|
||||
MSG_WriteFloat (msg, realtime - player->connection_started);
|
||||
|
||||
Q_strncpyz (info, player->userinfo, MAX_INFO_STRING);
|
||||
Info_RemovePrefixedKeys (info, '_'); // server passwords, etc
|
||||
Info_RemoveKey(info, "password");
|
||||
Info_RemoveKey(info, "*ip");
|
||||
|
||||
if (dosizes)
|
||||
MVDWrite_Begin (dem_all, 0, 7 + strlen(info));
|
||||
MSG_WriteByte (msg, svc_updateuserinfo);
|
||||
MSG_WriteByte (msg, player - svs.clients);
|
||||
MSG_WriteLong (msg, player->userid);
|
||||
MSG_WriteString (msg, info);
|
||||
}
|
||||
|
||||
void MVDBuffer_Init(dbuffer_t *dbuffer, qbyte *buf, size_t size)
|
||||
{
|
||||
|
@ -1620,7 +1671,7 @@ void SV_MVD_SendInitialGamestate(mvddest_t *dest)
|
|||
sizebuf_t buf;
|
||||
char buf_data[MAX_QWMSGLEN];
|
||||
int n, i;
|
||||
char *s, info[MAX_INFO_STRING];
|
||||
char *s;
|
||||
|
||||
client_t *player;
|
||||
char *gamedir;
|
||||
|
@ -1851,29 +1902,7 @@ void SV_MVD_SendInitialGamestate(mvddest_t *dest)
|
|||
{
|
||||
player = svs.clients + i;
|
||||
|
||||
MSG_WriteByte (&buf, svc_updatefrags);
|
||||
MSG_WriteByte (&buf, i);
|
||||
MSG_WriteShort (&buf, player->old_frags);
|
||||
|
||||
MSG_WriteByte (&buf, svc_updateping);
|
||||
MSG_WriteByte (&buf, i);
|
||||
MSG_WriteShort (&buf, SV_CalcPing(player, false));
|
||||
|
||||
MSG_WriteByte (&buf, svc_updatepl);
|
||||
MSG_WriteByte (&buf, i);
|
||||
MSG_WriteByte (&buf, player->lossage);
|
||||
|
||||
MSG_WriteByte (&buf, svc_updateentertime);
|
||||
MSG_WriteByte (&buf, i);
|
||||
MSG_WriteFloat (&buf, realtime - player->connection_started);
|
||||
|
||||
Q_strncpyz (info, player->userinfo, MAX_INFO_STRING);
|
||||
Info_RemovePrefixedKeys (info, '_'); // server passwords, etc
|
||||
|
||||
MSG_WriteByte (&buf, svc_updateuserinfo);
|
||||
MSG_WriteByte (&buf, i);
|
||||
MSG_WriteLong (&buf, player->userid);
|
||||
MSG_WriteString (&buf, info);
|
||||
SV_MVD_FullClientUpdate(&buf, player);
|
||||
|
||||
if (buf.cursize > MAX_QWMSGLEN/2)
|
||||
{
|
||||
|
|
|
@ -1687,6 +1687,7 @@ void SV_UpdateClientStats (client_t *client, int pnum)
|
|||
/*make sure statsf is correct*/
|
||||
client->statsi[i] = statsf[i];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1388,6 +1388,7 @@ void SV_Spawn_f (void)
|
|||
// normally this could overflow, but no need to check due to backbuf
|
||||
for (i=0, client = svs.clients ; i<MAX_CLIENTS ; i++, client++)
|
||||
SV_FullClientUpdateToClient (client, host_client);
|
||||
SV_MVD_FullClientUpdate(NULL, host_client);
|
||||
|
||||
// send all current light styles
|
||||
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
|
||||
|
@ -4444,6 +4445,7 @@ void SVNQ_Spawn_f (void)
|
|||
// normally this could overflow, but no need to check due to backbuf
|
||||
for (i=0, client = svs.clients; i<sv.allocated_client_slots ; i++, client++)
|
||||
SV_FullClientUpdateToClient (client, host_client);
|
||||
SV_MVD_FullClientUpdate(NULL, host_client);
|
||||
|
||||
// send all current light styles
|
||||
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
|
||||
|
|
Loading…
Reference in a new issue