Enable PEXT1 handshakes as well as just PEXT2.

This commit is contained in:
Shpoike 2020-09-03 09:37:49 +01:00
parent 4aee746efa
commit 78758f0868
6 changed files with 39 additions and 10 deletions

View file

@ -1232,9 +1232,9 @@ static void CL_ParseServerInfo (void)
i = MSG_ReadLong (); i = MSG_ReadLong ();
if (i == PROTOCOL_FTE_PEXT1) if (i == PROTOCOL_FTE_PEXT1)
{ {
i = MSG_ReadLong(); cl.protocol_pext1 = MSG_ReadLong();
if (i & ~PEXT1_ACCEPTED_CLIENT) if (cl.protocol_pext1& ~PEXT1_ACCEPTED_CLIENT)
Host_Error ("Server returned FTE1 protocol extensions that are not supported (%#x)", i); Host_Error ("Server returned FTE1 protocol extensions that are not supported (%#x)", cl.protocol_pext1 & ~PEXT1_SUPPORTED_CLIENT);
continue; continue;
} }
if (i == PROTOCOL_FTE_PEXT2) if (i == PROTOCOL_FTE_PEXT2)
@ -2695,6 +2695,8 @@ void CL_ParseServerMessage (void)
break; break;
case svcfte_cgamepacket: case svcfte_cgamepacket:
if (!(cl.protocol_pext1 & PEXT1_CSQC))
Host_Error ("Received svcfte_cgamepacket but extension not active");
if (cl.qcvm.extfuncs.CSQC_Parse_Event) if (cl.qcvm.extfuncs.CSQC_Parse_Event)
{ {
PR_SwitchQCVM(&cl.qcvm); PR_SwitchQCVM(&cl.qcvm);

View file

@ -252,6 +252,7 @@ typedef struct
unsigned protocol; //johnfitz unsigned protocol; //johnfitz
unsigned protocolflags; unsigned protocolflags;
unsigned protocol_pext1; //spike -- flag of fte protocol extensions
unsigned protocol_pext2; //spike -- flag of fte protocol extensions unsigned protocol_pext2; //spike -- flag of fte protocol extensions
qboolean protocol_dpdownload; qboolean protocol_dpdownload;

View file

@ -941,7 +941,11 @@ void Cmd_ForwardToServer (void)
} }
if (!strcmp(Cmd_Args(), "pext") && !cl_nopext.value) if (!strcmp(Cmd_Args(), "pext") && !cl_nopext.value)
{ //server asked us for a key+value list of the extensions+attributes we support { //server asked us for a key+value list of the extensions+attributes we support
SZ_Print (&cls.message, va("pext %#x %#x", PROTOCOL_FTE_PEXT2, PEXT2_SUPPORTED_CLIENT)); SZ_Print (&cls.message, va("pext"
" %#x %#x"
" %#x %#x",
PROTOCOL_FTE_PEXT1, PEXT1_SUPPORTED_CLIENT,
PROTOCOL_FTE_PEXT2, PEXT2_SUPPORTED_CLIENT));
return; return;
} }
} }

View file

@ -61,8 +61,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//#define PEXT1_CHUNKEDDOWNLOADS 0x20000000 //#define PEXT1_CHUNKEDDOWNLOADS 0x20000000
#define PEXT1_CSQC 0x40000000 //(full)csqc additions, required for csqc ents+events. #define PEXT1_CSQC 0x40000000 //(full)csqc additions, required for csqc ents+events.
#define PEXT1_ACCEPTED_CLIENT (/*PEXT1_SUPPORTED_CLIENT|*/PEXT1_CSQC|PEXT1_Q3BSP|PEXT1_Q2BSP|PEXT1_HLBSP) //pext1 flags that we can accept from a server (aka: partial support) #define PEXT1_ACCEPTED_CLIENT (/*PEXT1_SUPPORTED_CLIENT|*/PEXT1_CSQC|PEXT1_Q3BSP|PEXT1_Q2BSP|PEXT1_HLBSP) //pext1 flags that we can accept from a server (aka: partial support)
//#define PEXT1_SUPPORTED_CLIENT (0) //pext1 flags that we advertise to servers (aka: full support) #define PEXT1_SUPPORTED_CLIENT (0) //pext1 flags that we advertise to servers (aka: full support)
//#define PEXT1_SUPPORTED_SERVER (0) //pext1 flags that we accept from clients. #define PEXT1_SUPPORTED_SERVER (0) //pext1 flags that we accept from clients.
// PROTOCOL_FTE_PEXT2 flags // PROTOCOL_FTE_PEXT2 flags
#define PEXT2_PRYDONCURSOR 0x00000001 //a mouse cursor exposed to ssqc #define PEXT2_PRYDONCURSOR 0x00000001 //a mouse cursor exposed to ssqc

View file

@ -148,6 +148,7 @@ typedef struct client_s
unsigned int limit_sounds; // unsigned int limit_sounds; //
qboolean pextknown; qboolean pextknown;
unsigned int protocol_pext1;
unsigned int protocol_pext2; unsigned int protocol_pext2;
unsigned int resendstatsnum[MAX_CL_STATS/32]; //the stats which need to be resent. unsigned int resendstatsnum[MAX_CL_STATS/32]; //the stats which need to be resent.
unsigned int resendstatsstr[MAX_CL_STATS/32]; //the stats which need to be resent. unsigned int resendstatsstr[MAX_CL_STATS/32]; //the stats which need to be resent.

View file

@ -30,6 +30,7 @@ server_static_t svs;
static char localmodels[MAX_MODELS][8]; // inline model names for precache static char localmodels[MAX_MODELS][8]; // inline model names for precache
int sv_protocol = PROTOCOL_RMQ;//spike -- enough maps need this now that we can probably afford incompatibility with engines that still don't support 999 (vanilla was already broken) -- PROTOCOL_FITZQUAKE; //johnfitz int sv_protocol = PROTOCOL_RMQ;//spike -- enough maps need this now that we can probably afford incompatibility with engines that still don't support 999 (vanilla was already broken) -- PROTOCOL_FITZQUAKE; //johnfitz
unsigned int sv_protocol_pext1 = PEXT1_SUPPORTED_SERVER; //spike
unsigned int sv_protocol_pext2 = PEXT2_SUPPORTED_SERVER; //spike unsigned int sv_protocol_pext2 = PEXT2_SUPPORTED_SERVER; //spike
//============================================================================ //============================================================================
@ -1199,9 +1200,10 @@ static void SV_Protocol_f (void)
{ {
int i; int i;
const char *s; const char *s;
int prot, pext2; int prot, pext1, pext2;
prot = sv_protocol; prot = sv_protocol;
pext1 = sv_protocol_pext1;
pext2 = sv_protocol_pext2; pext2 = sv_protocol_pext2;
switch (Cmd_Argc()) switch (Cmd_Argc())
@ -1217,11 +1219,13 @@ static void SV_Protocol_f (void)
s += 3; s += 3;
if (*s == '+' || *s == '-') if (*s == '+' || *s == '-')
s++; s++;
pext1 = PEXT1_SUPPORTED_SERVER;
pext2 = PEXT2_SUPPORTED_SERVER; pext2 = PEXT2_SUPPORTED_SERVER;
} }
else if (!q_strncasecmp(s, "+", 3)) else if (!q_strncasecmp(s, "+", 3))
{ {
s += 1; s += 1;
pext1 = PEXT1_SUPPORTED_SERVER;
pext2 = PEXT2_SUPPORTED_SERVER; pext2 = PEXT2_SUPPORTED_SERVER;
} }
else if (!q_strncasecmp(s, "Base", 4)) else if (!q_strncasecmp(s, "Base", 4))
@ -1229,29 +1233,38 @@ static void SV_Protocol_f (void)
s+= 4; s+= 4;
if (*s == '+' || *s == '-') if (*s == '+' || *s == '-')
s++; s++;
pext1 = 0;
pext2 = 0; pext2 = 0;
} }
else if (*s == '-') else if (*s == '-')
{ {
s++; s++;
pext1 = 0;
pext2 = 0; pext2 = 0;
} }
i = strtol(s, (char**)&s, 0); i = strtol(s, (char**)&s, 0);
if (*s == '-') if (*s == '-')
{
pext1 = 0;
pext2 = 0; pext2 = 0;
}
else if (*s == '+') else if (*s == '+')
{
pext1 = PEXT1_SUPPORTED_SERVER;
pext2 = PEXT2_SUPPORTED_SERVER; pext2 = PEXT2_SUPPORTED_SERVER;
}
if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ && i != PROTOCOL_VERSION_BJP3) if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ && i != PROTOCOL_VERSION_BJP3)
Con_Printf ("sv_protocol must be %i or %i or %i or %i.\nProtocol may be prefixed with FTE+ or Base- to enable/disable FTE extensions.\n", PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ, PROTOCOL_VERSION_BJP3); Con_Printf ("sv_protocol must be %i or %i or %i or %i.\nProtocol may be prefixed with FTE+ or Base- to enable/disable FTE extensions.\n", PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ, PROTOCOL_VERSION_BJP3);
else else
{ {
sv_protocol = i; sv_protocol = i;
sv_protocol_pext1 = pext1;
sv_protocol_pext2 = pext2; sv_protocol_pext2 = pext2;
if (sv.active) if (sv.active)
{ {
if (prot == sv_protocol && pext2 == sv_protocol_pext2) if (prot == sv_protocol && pext1 == sv_protocol_pext1 && pext2 == sv_protocol_pext2)
Con_Printf ("specified protocol already active.\n"); Con_Printf ("specified protocol already active.\n");
else else
Con_Printf ("changes will not take effect until the next level load.\n"); Con_Printf ("changes will not take effect until the next level load.\n");
@ -1551,7 +1564,7 @@ void SV_SendServerinfo (client_t *client)
client->limit_models = 0; client->limit_models = 0;
client->limit_sounds = 0; client->limit_sounds = 0;
if (!sv_protocol_pext2) if (!sv_protocol_pext1 && !sv_protocol_pext2)
{ //server disabled pext completely, don't bother trying. { //server disabled pext completely, don't bother trying.
//make sure we try reenabling it again on the next map though. mwahaha. //make sure we try reenabling it again on the next map though. mwahaha.
client->pextknown = false; client->pextknown = false;
@ -1563,6 +1576,7 @@ void SV_SendServerinfo (client_t *client)
client->sendsignon = true; client->sendsignon = true;
return; return;
} }
client->protocol_pext1 &= sv_protocol_pext1;
client->protocol_pext2 &= sv_protocol_pext2; client->protocol_pext2 &= sv_protocol_pext2;
if (!(client->protocol_pext2 & PEXT2_REPLACEMENTDELTAS)) if (!(client->protocol_pext2 & PEXT2_REPLACEMENTDELTAS))
@ -1636,6 +1650,11 @@ retry:
MSG_WriteByte (&client->message, svc_serverinfo); MSG_WriteByte (&client->message, svc_serverinfo);
if (client->protocol_pext1)
{ //pext stuff takes the form of modifiers to an underlaying protocol
MSG_WriteLong (&client->message, PROTOCOL_FTE_PEXT1);
MSG_WriteLong (&client->message, client->protocol_pext1); //active extensions that the client needs to look out for
}
if (client->protocol_pext2) if (client->protocol_pext2)
{ //pext stuff takes the form of modifiers to an underlaying protocol { //pext stuff takes the form of modifiers to an underlaying protocol
MSG_WriteLong (&client->message, PROTOCOL_FTE_PEXT2); MSG_WriteLong (&client->message, PROTOCOL_FTE_PEXT2);
@ -1788,7 +1807,9 @@ void SV_Pext_f(void)
key = strtoul(Cmd_Argv(i), NULL, 0); key = strtoul(Cmd_Argv(i), NULL, 0);
value = strtoul(Cmd_Argv(i+1), NULL, 0); value = strtoul(Cmd_Argv(i+1), NULL, 0);
if (key == PROTOCOL_FTE_PEXT2) if (key == PROTOCOL_FTE_PEXT1)
host_client->protocol_pext1 = value & PEXT1_SUPPORTED_SERVER;
else if (key == PROTOCOL_FTE_PEXT2)
host_client->protocol_pext2 = value & PEXT2_SUPPORTED_SERVER; host_client->protocol_pext2 = value & PEXT2_SUPPORTED_SERVER;
//else some other extension that we don't know //else some other extension that we don't know
} }