Skip to content

Commit

Permalink
fix: demo compatibility magic is back, added magic for VOIP, not quit…
Browse files Browse the repository at this point in the history
…e perfect since it still result in incompatible demo if you receive VIOP packet, well, you now also have cl_voip_demorecord which will not allow VOIP in qwd, by default it recorded.
  • Loading branch information
qqshka committed Mar 13, 2011
1 parent 40067e4 commit 4e08306
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
35 changes: 29 additions & 6 deletions cl_demo.c
Expand Up @@ -394,17 +394,38 @@ static char *TrimModelName (const char *full)

void CL_WriteServerdata (sizebuf_t *msg)
{
int ignore_extensions;

MSG_WriteByte (msg, svc_serverdata);


// Maintain demo compatibility.
ignore_extensions = 0;
#ifdef FTE_PEXT_CHUNKEDDOWNLOADS
// this is OK, since download data skipped anyway
ignore_extensions |= FTE_PEXT_CHUNKEDDOWNLOADS;
#endif
#ifdef FTE_PEXT_256PACKETENTITIES
// this is probably OK, since engine should ignore more than 64 entities if not supported.
ignore_extensions |= FTE_PEXT_256PACKETENTITIES;
#endif

#ifdef PROTOCOL_VERSION_FTE
if (cls.fteprotocolextensions)
if (cls.fteprotocolextensions &~ ignore_extensions)
{
MSG_WriteLong (msg, PROTOCOL_VERSION_FTE);
MSG_WriteLong (msg, cls.fteprotocolextensions);
}
#endif // PROTOCOL_VERSION_FTE

// Maintain demo pseudo-compatibility,
ignore_extensions = 0;
#ifdef FTE_PEXT2_VOICECHAT
// not really OK, if you receive voice packet then this demo will not be playable by older clients anyway.
ignore_extensions |= FTE_PEXT2_VOICECHAT;
#endif

#ifdef PROTOCOL_VERSION_FTE2
if (cls.fteprotocolextensions2)
if (cls.fteprotocolextensions2 & ~ignore_extensions)
{
MSG_WriteLong (msg, PROTOCOL_VERSION_FTE2);
MSG_WriteLong (msg, cls.fteprotocolextensions2);
Expand Down Expand Up @@ -2291,10 +2312,12 @@ void CL_Record_f (void)
return;
}

if (cls.fteprotocolextensions || cls.fteprotocolextensions2)
if ( (cls.fteprotocolextensions &~ (FTE_PEXT_CHUNKEDDOWNLOADS|FTE_PEXT_256PACKETENTITIES)) // that OK.
|| (cls.fteprotocolextensions2 & ~FTE_PEXT2_VOICECHAT) // that not OK since if you receive VOIP packet demo will be non compatible, but this warning is annoying.
)
{
Com_Printf ("WARNING: FTE protocol extensions enabled; this demo may not be playable in older clients. "
"Use cl_pext 0 for 100% compatible demos. But do NOT forget set it to 1 later or you will lack useful features!\n");
Com_Printf ("WARNING: FTE protocol extensions enabled; this demo most likely will be unplayable in older clients. "
"Use cl_pext 0 for 100%% compatible demos. But do NOT forget set it to 1 later or you will lack useful features!\n");
}

switch(Cmd_Argc())
Expand Down
9 changes: 9 additions & 0 deletions cl_parse.c
Expand Up @@ -3627,6 +3627,9 @@ void CL_ParseServerMessage (void)

if (cls.demorecording)
{
#ifdef FTE_PEXT2_VOICECHAT
extern cvar_t cl_voip_demorecord;
#endif
// Init the demo message buffer if it hasn't been done.
if (!cls.demomessage.cursize)
{
Expand All @@ -3641,6 +3644,12 @@ void CL_ParseServerMessage (void)
else if (cmd == svc_download) {
// there's no point in writing it to the demo
}
#ifdef FTE_PEXT2_VOICECHAT
else if(cmd == svc_fte_voicechat && !cl_voip_demorecord.integer)
{
// user does not want it to be recorded
}
#endif
else if (cmd == svc_serverdata)
CL_WriteServerdata(&cls.demomessage);
else
Expand Down
3 changes: 3 additions & 0 deletions snd_dma.c
Expand Up @@ -156,6 +156,8 @@ cvar_t cl_voip_showmeter_y = {"cl_voip_showmeter_y", "0"};
cvar_t cl_voip_play = {"cl_voip_play", "1", CVAR_NONE, S_Voip_Play_Callback};
// Amplifies your microphone when using voip.
cvar_t cl_voip_micamp = {"cl_voip_micamp", "2"};
// Record VOIP in demo.
cvar_t cl_voip_demorecord = {"cl_voip_demorecord", "1"};
#endif

static void S_SoundInfo_f (void)
Expand Down Expand Up @@ -320,6 +322,7 @@ static void S_Register_RegularCvarsAndCommands(void)
Cvar_Register(&cl_voip_showmeter_y);
Cvar_Register(&cl_voip_play);
Cvar_Register(&cl_voip_micamp);
Cvar_Register(&cl_voip_demorecord);

Cmd_AddCommand("+voip", S_Voip_Enable_f);
Cmd_AddCommand("-voip", S_Voip_Disable_f);
Expand Down

0 comments on commit 4e08306

Please sign in to comment.