engine: add mask to sanitize possible engine features bits

This commit is contained in:
Alibek Omarov 2023-12-17 17:29:11 +03:00
parent 643bec4071
commit d41a80bc2c
3 changed files with 14 additions and 1 deletions

View File

@ -27,4 +27,16 @@ GNU General Public License for more details.
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
#define ENGINE_LINEAR_GAMMA_SPACE (1<<8) // disable influence of gamma/brightness cvars to textures/lightmaps, for mods with custom renderer
// adjust the mask when features will be added or removed
#define ENGINE_FEATURES_MASK \
( ENGINE_WRITE_LARGE_COORD \
| ENGINE_QUAKE_COMPATIBLE \
| ENGINE_LOAD_DELUXEDATA \
| ENGINE_PHYSICS_PUSHER_EXT \
| ENGINE_LARGE_LIGHTMAPS \
| ENGINE_COMPENSATE_QUAKE_BUG \
| ENGINE_IMPROVED_LINETRACE \
| ENGINE_COMPUTE_STUDIO_LERP \
| ENGINE_LINEAR_GAMMA_SPACE )
#endif//FEATURES_H

View File

@ -904,6 +904,7 @@ void CL_ParseServerData( sizebuf_t *msg, qboolean legacy )
background = MSG_ReadOneBit( msg );
Q_strncpy( gamefolder, MSG_ReadString( msg ), sizeof( gamefolder ));
host.features = (uint)MSG_ReadLong( msg );
host.features &= ENGINE_FEATURES_MASK;
if( !legacy )
{

View File

@ -2139,7 +2139,7 @@ qboolean SV_InitPhysicsAPI( void )
if( svgame.physFuncs.SV_CheckFeatures != NULL )
{
// grab common engine features (it will be shared across the network)
host.features = svgame.physFuncs.SV_CheckFeatures();
host.features = svgame.physFuncs.SV_CheckFeatures() & ENGINE_FEATURES_MASK;
Host_PrintEngineFeatures ();
}
return true;