Skip to content

Commit

Permalink
A few small changes (cl_filterGames + MAX_PATCH_PLANES increase) (#1188)
Browse files Browse the repository at this point in the history
* [MP] Add cl_filterGames cvar to discard servers that use an fs_game matching one listed in the cvar (separated by spaces).

* [MP] Use known MB2 (incompatible mod using the default serverlist) fs_game values as default for cl_filterGames to filter them out.

* [Shared] Increase MAX_PATCH_PLANES from 2048 to 4096.

Due to precision/rounding differences the vanilla engine on Windows, Linux and Mac effectively treated this limit different and the behavior for never consistent. For that reason jk2mv doubled the value back in 2015 and by now some maps require the limit to be increased.

* [MP] Improve cl_filterGames.

Skip cl_filterGames entry if it matches the current fs_game.
Add support for filtering servers without fs_game set (BASEGAME).
  • Loading branch information
Daggolin authored Feb 8, 2024
1 parent 2ed26b3 commit 58ad339
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/qcommon/cm_patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ properly.


#define MAX_FACETS 1024
#define MAX_PATCH_PLANES 2048
#define MAX_PATCH_PLANES 4096 // Was 2048 on vanilla jka

typedef struct {
float plane[4];
Expand Down
21 changes: 21 additions & 0 deletions codemp/client/cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ cvar_t *cl_lanForcePackets;

cvar_t *cl_drawRecording;

cvar_t *cl_filterGames;

vec3_t cl_windVec;


Expand Down Expand Up @@ -2774,6 +2776,8 @@ void CL_Init( void ) {
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60 0xb2", CVAR_ARCHIVE, "Which keys are used to toggle the console");
cl_consoleUseScanCode = Cvar_Get( "cl_consoleUseScanCode", "1", CVAR_ARCHIVE, "Use native console key detection" );

cl_filterGames = Cvar_Get( "cl_filterGames", "MBII MBIIOpenBeta", CVAR_ARCHIVE_ND, "List of fs_game to filter (space separated)" );

// userinfo
Cvar_Get ("name", "Padawan", CVAR_USERINFO | CVAR_ARCHIVE_ND, "Player name" );
Cvar_Get ("rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE, "Data rate" );
Expand Down Expand Up @@ -2991,6 +2995,23 @@ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
return;
}

if ( cl_filterGames && cl_filterGames->string && cl_filterGames->string[0] ) {
const char *gameFolder = Info_ValueForKey( infoString, "game" );

// If no game folder was specified the server is using base. Use the BASEGAME string so we can filter for it.
if ( !gameFolder[0] ) gameFolder = BASEGAME;

// NOTE: As the command tokenization doesn't support nested quotes we can't filter fs_game with spaces using
// this approach, but fs_game with spaces cause other issues as well, like downloads not working and at
// the time of writing this no public servers actually use an fs_game with spaces...
Cmd_TokenizeString( cl_filterGames->string );
for ( i = 0; i < Cmd_Argc(); i++ ) {
if ( !Q_stricmp(Cmd_Argv(i), gameFolder) && Q_stricmp(Cmd_Argv(i), FS_GetCurrentGameDir(false)) ) {
return;
}
}
}

// iterate servers waiting for ping response
for (i=0; i<MAX_PINGREQUESTS; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion codemp/qcommon/cm_patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ properly.


#define MAX_FACETS 1024
#define MAX_PATCH_PLANES 2048
#define MAX_PATCH_PLANES 4096 // Was 2048 on vanilla jka

typedef struct patchPlane_s {
float plane[4];
Expand Down

0 comments on commit 58ad339

Please sign in to comment.