Browse Source

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

pull/2/head
Alibek Omarov 6 years ago
parent
commit
62f04137a5
  1. 11
      engine/common/mod_bmodel.c
  2. 2
      engine/server/sv_game.c
  3. 2
      engine/server/sv_phys.c
  4. 2
      engine/server/sv_save.c

11
engine/common/mod_bmodel.c

@ -1801,8 +1801,11 @@ static void Mod_LoadTextures( dbspmodel_t *bmod ) @@ -1801,8 +1801,11 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
{
#ifndef XASH_DEDICATED
// release old sky layers first
if( !Host_IsDedicated() )
{
ref.dllFuncs.R_FreeSharedTexture( REF_ALPHASKY_TEXTURE );
ref.dllFuncs.R_FreeSharedTexture( REF_SOLIDSKY_TEXTURE );
}
#endif
}
@ -1827,8 +1830,11 @@ static void Mod_LoadTextures( dbspmodel_t *bmod ) @@ -1827,8 +1830,11 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
Q_strncpy( tx->name, "*default", sizeof( tx->name ));
#ifndef XASH_DEDICATED
if( !Host_IsDedicated() )
{
tx->gl_texturenum = ref.dllFuncs.R_GetBuiltinTexture( REF_DEFAULT_TEXTURE );
tx->width = tx->height = 16;
}
#endif
continue; // missed
}
@ -1869,6 +1875,8 @@ static void Mod_LoadTextures( dbspmodel_t *bmod ) @@ -1869,6 +1875,8 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
}
#ifndef XASH_DEDICATED
if( !Host_IsDedicated() )
{
// check for multi-layered sky texture (quake1 specific)
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 ) @@ -1964,6 +1972,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( src ) Mem_Free( src );
}
}
}
#endif
}
@ -2242,7 +2251,7 @@ static void Mod_LoadSurfaces( dbspmodel_t *bmod ) @@ -2242,7 +2251,7 @@ static void Mod_LoadSurfaces( dbspmodel_t *bmod )
}
#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
#endif
}

2
engine/server/sv_game.c

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

2
engine/server/sv_phys.c

@ -2006,7 +2006,7 @@ const char* pfnGetModelName( int modelindex ) @@ -2006,7 +2006,7 @@ const char* pfnGetModelName( int modelindex )
static const byte *GL_TextureData( unsigned int texnum )
{
#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
return NULL;
#endif // XASH_DEDICATED

2
engine/server/sv_save.c

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

Loading…
Cancel
Save