engine: hide ref calls under Host_IsDedicated checks, replace ref function ptr checks by \!Host_IsDedicated

This commit is contained in:
Alibek Omarov 2019-03-22 18:41:57 +03:00
parent 5f849c4823
commit 62f04137a5
4 changed files with 89 additions and 80 deletions

View file

@ -1801,8 +1801,11 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
{ {
#ifndef XASH_DEDICATED #ifndef XASH_DEDICATED
// release old sky layers first // release old sky layers first
if( !Host_IsDedicated() )
{
ref.dllFuncs.R_FreeSharedTexture( REF_ALPHASKY_TEXTURE ); ref.dllFuncs.R_FreeSharedTexture( REF_ALPHASKY_TEXTURE );
ref.dllFuncs.R_FreeSharedTexture( REF_SOLIDSKY_TEXTURE ); ref.dllFuncs.R_FreeSharedTexture( REF_SOLIDSKY_TEXTURE );
}
#endif #endif
} }
@ -1827,8 +1830,11 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
Q_strncpy( tx->name, "*default", sizeof( tx->name )); Q_strncpy( tx->name, "*default", sizeof( tx->name ));
#ifndef XASH_DEDICATED #ifndef XASH_DEDICATED
if( !Host_IsDedicated() )
{
tx->gl_texturenum = ref.dllFuncs.R_GetBuiltinTexture( REF_DEFAULT_TEXTURE ); tx->gl_texturenum = ref.dllFuncs.R_GetBuiltinTexture( REF_DEFAULT_TEXTURE );
tx->width = tx->height = 16; tx->width = tx->height = 16;
}
#endif #endif
continue; // missed continue; // missed
} }
@ -1869,6 +1875,8 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
} }
#ifndef XASH_DEDICATED #ifndef XASH_DEDICATED
if( !Host_IsDedicated() )
{
// check for multi-layered sky texture (quake1 specific) // check for multi-layered sky texture (quake1 specific)
if( bmod->isworld && !Q_strncmp( mt->name, "sky", 3 ) && (( mt->width / mt->height ) == 2 ) ) if( bmod->isworld && !Q_strncmp( mt->name, "sky", 3 ) && (( mt->width / mt->height ) == 2 ) )
{ {
@ -1964,6 +1972,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( src ) Mem_Free( src ); if( src ) Mem_Free( src );
} }
} }
}
#endif #endif
} }
@ -2242,7 +2251,7 @@ static void Mod_LoadSurfaces( dbspmodel_t *bmod )
} }
#ifndef XASH_DEDICATED // TODO: Do we need subdivide on server? #ifndef XASH_DEDICATED // TODO: Do we need subdivide on server?
if( FBitSet( out->flags, SURF_DRAWTURB )) if( FBitSet( out->flags, SURF_DRAWTURB ) && !Host_IsDedicated() )
ref.dllFuncs.GL_SubdivideSurface( out ); // cut up polygon for warps ref.dllFuncs.GL_SubdivideSurface( out ); // cut up polygon for warps
#endif #endif
} }

View file

@ -619,7 +619,7 @@ void SV_RestartDecals( void )
host.decalList = (decallist_t *)Z_Calloc( sizeof( decallist_t ) * MAX_RENDER_DECALS * 2 ); host.decalList = (decallist_t *)Z_Calloc( sizeof( decallist_t ) * MAX_RENDER_DECALS * 2 );
#ifndef XASH_DEDICATED #ifndef XASH_DEDICATED
if( ref.dllFuncs.R_CreateDecalList ) if( !Host_IsDedicated() )
{ {
host.numdecals = ref.dllFuncs.R_CreateDecalList( host.decalList ); host.numdecals = ref.dllFuncs.R_CreateDecalList( host.decalList );

View file

@ -2006,7 +2006,7 @@ const char* pfnGetModelName( int modelindex )
static const byte *GL_TextureData( unsigned int texnum ) static const byte *GL_TextureData( unsigned int texnum )
{ {
#ifndef XASH_DEDICATED #ifndef XASH_DEDICATED
return ref.dllFuncs.GL_TextureData ? ref.dllFuncs.GL_TextureData( texnum ) : NULL; return Host_IsDedicated() ? NULL : ref.dllFuncs.GL_TextureData( texnum );
#else // XASH_DEDICATED #else // XASH_DEDICATED
return NULL; return NULL;
#endif // XASH_DEDICATED #endif // XASH_DEDICATED

View file

@ -1131,7 +1131,7 @@ static void SaveClientState( SAVERESTOREDATA *pSaveData, const char *level, int
// initialize client header // initialize client header
#ifndef XASH_DEDICATED #ifndef XASH_DEDICATED
if( ref.dllFuncs.R_CreateDecalList ) if( !Host_IsDedicated() )
{ {
header.decalCount = ref.dllFuncs.R_CreateDecalList( decalList ); header.decalCount = ref.dllFuncs.R_CreateDecalList( decalList );
} }