From 4e3b16dc66ad77909eff9d1daf22cccb7defd177 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Sun, 3 Nov 2024 21:11:04 +0100 Subject: [PATCH] SERVER: Disable FTE_PEXT_TRANS if client is outdated. 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. --- src/sv_main.c | 8 ++++++++ src/sv_user.c | 27 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/sv_main.c b/src/sv_main.c index 7bf151f0..77477c59 100644 --- a/src/sv_main.c +++ b/src/sv_main.c @@ -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 @@ -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); diff --git a/src/sv_user.c b/src/sv_user.c index 71f6d70d..79da10e3 100644 --- a/src/sv_user.c +++ b/src/sv_user.c @@ -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)