Browse Source

engine: mod_bmodel: detect water textures by texture name like LoadSurfaces does

pull/2/head
Alibek Omarov 1 year ago
parent
commit
a41902bd46
  1. 26
      engine/common/mod_bmodel.c

26
engine/common/mod_bmodel.c

@ -2012,6 +2012,20 @@ static void Mod_LoadMarkSurfaces( model_t *mod, dbspmodel_t *bmod ) @@ -2012,6 +2012,20 @@ static void Mod_LoadMarkSurfaces( model_t *mod, dbspmodel_t *bmod )
}
}
static qboolean Mod_LooksLikeWaterTexture( const char *name )
{
if(( name[0] == '*' && Q_stricmp( name, REF_DEFAULT_TEXTURE )) || name[0] == '!' )
return true;
if( !Host_IsQuakeCompatible( ))
{
if( !Q_strncmp( name, "water", 5 ) || !Q_strnicmp( name, "laser", 5 ))
return true;
}
return false;
}
static void Mod_LoadTextureData( model_t *mod, dbspmodel_t *bmod, int textureIndex )
{
#if !XASH_DEDICATED
@ -2032,6 +2046,10 @@ static void Mod_LoadTextureData( model_t *mod, dbspmodel_t *bmod, int textureInd @@ -2032,6 +2046,10 @@ static void Mod_LoadTextureData( model_t *mod, dbspmodel_t *bmod, int textureInd
if( FBitSet( host.features, ENGINE_IMPROVED_LINETRACE ) && mipTex->name[0] == '{' )
SetBits( txFlags, TF_KEEP_SOURCE ); // Paranoia2 texture alpha-tracing
// check if this is water to keep the source texture and expand it to RGBA (so ripple effect works)
if( Mod_LooksLikeWaterTexture( mipTex->name ))
SetBits( txFlags, TF_KEEP_SOURCE | TF_EXPAND_SOURCE );
usesCustomPalette = Mod_CalcMipTexUsesCustomPalette( mod, bmod, textureIndex );
// check for multi-layered sky texture (quake1 specific)
@ -2449,14 +2467,8 @@ static void Mod_LoadSurfaces( model_t *mod, dbspmodel_t *bmod ) @@ -2449,14 +2467,8 @@ static void Mod_LoadSurfaces( model_t *mod, dbspmodel_t *bmod )
if( !Q_strncmp( tex->name, "sky", 3 ))
SetBits( out->flags, SURF_DRAWSKY );
if(( tex->name[0] == '*' && Q_stricmp( tex->name, REF_DEFAULT_TEXTURE )) || tex->name[0] == '!' )
SetBits( out->flags, SURF_DRAWTURB );
if( !Host_IsQuakeCompatible( ))
{
if( !Q_strncmp( tex->name, "water", 5 ) || !Q_strnicmp( tex->name, "laser", 5 ))
if( Mod_LooksLikeWaterTexture( tex->name ))
SetBits( out->flags, SURF_DRAWTURB );
}
if( !Q_strncmp( tex->name, "scroll", 6 ))
SetBits( out->flags, SURF_CONVEYOR );

Loading…
Cancel
Save