Moved infoblobs extension to a cvar.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5288 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-08-09 06:21:39 +00:00
parent 98b71860ed
commit c33c8a97a4
5 changed files with 36 additions and 13 deletions

View File

@ -5207,7 +5207,7 @@ static void CL_ParseSetInfo (void)
slot = MSG_ReadByte ();
if (slot == 255)
if (slot == 255 && (cls.fteprotocolextensions2 & PEXT2_INFOBLOBS))
{
slot = MSG_ReadByte();
offset = MSG_ReadLong();
@ -5221,10 +5221,16 @@ static void CL_ParseSetInfo (void)
}
temp = MSG_ReadString();
key = InfoBuf_DecodeString(temp, temp+strlen(temp), &keysize);
if (cls.fteprotocolextensions2 & PEXT2_INFOBLOBS)
key = InfoBuf_DecodeString(temp, temp+strlen(temp), &keysize);
else
key = Z_StrDup(temp);
temp = MSG_ReadString();
val = InfoBuf_DecodeString(temp, temp+strlen(temp), &valsize);
if (cls.fteprotocolextensions2 & PEXT2_INFOBLOBS)
val = InfoBuf_DecodeString(temp, temp+strlen(temp), &valsize);
else
val = Z_StrDup(temp);
if (slot == 255)
InfoBuf_SyncReceive(&cl.serverinfo, key, keysize, val, valsize, offset, final);

View File

@ -1047,10 +1047,12 @@ menucheck_t *MC_AddCheckBox(menu_t *menu, int tx, int cx, int y, const char *tex
#ifdef _DEBUG
if (var)
{
if (!(var->flags & CVAR_ARCHIVE))
Con_Printf("Warning: %s is not set for archiving\n", var->name);
else if (var->flags & (CVAR_RENDERERLATCH|CVAR_VIDEOLATCH))
Con_Printf("Warning: %s requires a vid_restart\n", var->name);
}
#endif
n->common.next = menu->options;

View File

@ -87,6 +87,7 @@ cvar_t qport = CVARF("qport_", "0", CVAR_NOSAVE);
cvar_t net_mtu = CVARD("net_mtu", "1440", "Specifies a maximum udp payload size, above which packets will be fragmented. If routers all worked properly this could be some massive value, and some massive value may work really nicely for lans. Use smaller values than the default if you're connecting through nested tunnels through routers that fail with IP fragmentation.");
cvar_t net_compress = CVARD("net_compress", "0", "Enables huffman compression of network packets.");
cvar_t pext_infoblobs = CVARD("_pext_infoblobs", "0", "RENAME ME WHEN STABLE. Enables the use of very large infokeys containing potentially invalid chars. Note that the userinfo is still limited by sv_userinfo_bytelimit and sv_userinfo_keylimit.");
cvar_t pext_replacementdeltas = CVARD("pext_replacementdeltas", "1", "Enables the use of alternative nack-based entity deltas");
cvar_t pext_predinfo = CVARD("pext_predinfo", "1", "Enables some extra things to support prediction over NQ protocols.");
@ -199,20 +200,20 @@ unsigned int Net_PextMask(int maskset, qboolean fornq)
mask |= PEXT2_VOICECHAT;
#endif
mask |= PEXT2_SETANGLEDELTA;
// mask |= PEXT2_INFOBLOBS;
if (pext_replacementdeltas.ival)
{
mask |= PEXT2_REPLACEMENTDELTAS;
if (/*fornq &&*/ pext_predinfo.ival)
mask |= PEXT2_PREDINFO;
if (/*fornq &&*/ pext_predinfo.ival)
mask |= PEXT2_PREDINFO;
}
if (pext_infoblobs.ival)
mask |= PEXT2_INFOBLOBS;
if (MAX_CLIENTS != QWMAX_CLIENTS)
mask |= PEXT2_MAXPLAYERS;
//kinda depenant
if (mask & PEXT2_PREDINFO)
mask |= PEXT2_REPLACEMENTDELTAS;
if (mask & PEXT2_REPLACEMENTDELTAS)
mask |= PEXT2_NEWSIZEENCODING; //use if we can
@ -252,6 +253,7 @@ void Netchan_Init (void)
Cvar_Register (&pext_predinfo, "Protocol Extensions");
Cvar_Register (&pext_replacementdeltas, "Protocol Extensions");
Cvar_Register (&pext_infoblobs, "Protocol Extensions");
Cvar_Register (&showpackets, "Networking");
Cvar_Register (&showdrop, "Networking");
Cvar_Register (&qport, "Networking");

View File

@ -4439,6 +4439,8 @@ static qboolean Mod_LoadClipnodes (model_t *loadmodel, qbyte *mod_base, lump_t *
if (hexen2map)
{ //hexen2.
hexen2map=false;
//compatible with Q1.
hull = &loadmodel->hulls[1];
hull->clipnodes = out;
hull->firstclipnode = 0;
@ -4452,6 +4454,7 @@ static qboolean Mod_LoadClipnodes (model_t *loadmodel, qbyte *mod_base, lump_t *
hull->clip_maxs[2] = 32;
hull->available = true;
//NOT compatible with Q1
hull = &loadmodel->hulls[2];
hull->clipnodes = out;
hull->firstclipnode = 0;

View File

@ -4300,7 +4300,7 @@ void SV_SetInfo_f (void)
return;
}
if (Cmd_Argc() == 4)
if (Cmd_Argc() == 4 && (host_client->fteprotocolextensions2 & PEXT2_INFOBLOBS))
{
offset = strtoul(Cmd_Argv(3), &t, 0);
final = (*t != '+');
@ -4325,8 +4325,18 @@ void SV_SetInfo_f (void)
val = Cmd_Argv(2);
if (strstr(key, "\\") || strstr(val, "\\"))
return; // illegal char, at least at this point.
key = InfoBuf_DecodeString(key, key+strlen(key), &keysize);
val = InfoBuf_DecodeString(val, val+strlen(val), &valsize);
if (host_client->fteprotocolextensions2 & PEXT2_INFOBLOBS)
{
key = InfoBuf_DecodeString(key, key+strlen(key), &keysize);
val = InfoBuf_DecodeString(val, val+strlen(val), &valsize);
}
else
{
keysize = strlen(key);
key = Z_StrDup(key);
valsize = strlen(val);
val = Z_StrDup(val);
}
if (key[0] == '*')
SV_ClientPrintf(host_client, PRINT_HIGH, "setinfo: %s may not be changed mid-game\n", key);