Skip to content

Commit

Permalink
SERVER: Disable FTE_PEXT_TRANS if client is outdated.
Browse files Browse the repository at this point in the history
As outdated clients have a broken implementation of FTE_PEXT_TRANS
these will not read the PF_EXTRA_PFS byte and the network protocol
will go out of sync unless this extension is disabled.

Once disabled, the client will work just fine, just that transparent
entities will be opaque.

Another workaround is for the client to set cl_pext_alpha to 0.
  • Loading branch information
dsvensson committed Nov 13, 2024
1 parent bcdf979 commit 4b1008f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ cvar_t sv_pext_mvdsv_serversideweapon = { "sv_pext_mvdsv_serversideweapon", "1"

cvar_t sv_extlimits = { "sv_extlimits", "2" };

#if defined(FTE_PEXT_TRANS)
cvar_t sv_pext_ezquake_verfortrans = {"pext_ezquake_verfortrans", "7814", CVAR_NONE};
#endif

qbool sv_error = false;

client_t *WatcherId = NULL; // QW262
Expand Down Expand Up @@ -3507,6 +3511,10 @@ void SV_InitLocal (void)
Cvar_Register (&sv_pext_mvdsv_serversideweapon);
#endif

#ifdef FTE_PEXT_TRANS
Cvar_Register(&sv_pext_ezquake_verfortrans);
#endif

Cvar_Register (&sv_reliable_sound);

Cvar_Register(&qws_name);
Expand Down
27 changes: 27 additions & 0 deletions src/sv_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,33 @@ static void Cmd_New_f (void)
}
#endif

#if defined(FTE_PEXT_TRANS)
if (sv_client->fteprotocolextensions & FTE_PEXT_TRANS)
{
const char *client_string = Info_Get(&sv_client->_userinfo_ctx_, "*client");
char *ptr = strchr(client_string, ' ');
if (ptr != NULL) {
ptr++;
if (strncmp(client_string, "ezQuake", 7) == 0 && *ptr != '\0')
{
extern cvar_t sv_pext_ezquake_verfortrans;
char *endptr;
long revision = strtol(ptr, &endptr, 10);
if (*endptr != '\0' || (revision > 0 && revision < sv_pext_ezquake_verfortrans.value))
{
SV_ClientPrintf(sv_client, PRINT_HIGH, "\n\nWARNING:\n"
"Alpha support disabled due to buggy client, "
"if the map contains transparency you may be at a disadvantage.\n"
"Please upgrade to one of the following:\n"
"> ezQuake (https://www.ezquake.com)\n"
"> FTEQW (http://fte.triptohell.info/)\n");
sv_client->fteprotocolextensions &= ~FTE_PEXT_TRANS;
}
}
}
}
#endif

//NOTE: This doesn't go through ClientReliableWrite since it's before the user
//spawns. These functions are written to not overflow
if (sv_client->num_backbuf)
Expand Down

0 comments on commit 4b1008f

Please sign in to comment.