Browse Source

engine: add mask to sanitize possible engine features bits

pull/2/head
Alibek Omarov 11 months ago
parent
commit
d41a80bc2c
  1. 12
      common/enginefeatures.h
  2. 1
      engine/client/cl_parse.c
  3. 2
      engine/server/sv_phys.c

12
common/enginefeatures.h

@ -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_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 #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 #endif//FEATURES_H

1
engine/client/cl_parse.c

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

2
engine/server/sv_phys.c

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

Loading…
Cancel
Save