From a57143d4c38754ab9ddb262769978f839a13d200 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Sat, 5 May 2018 03:23:14 +0200 Subject: [PATCH 1/1] filter non-shader texture paths at the same place also filter more known suffixes --- libs/shaderlib.h | 22 +--------------------- radiant/texwindow.cpp | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/libs/shaderlib.h b/libs/shaderlib.h index 1d9f5e0a..ee972437 100644 --- a/libs/shaderlib.h +++ b/libs/shaderlib.h @@ -50,25 +50,6 @@ bool operator()( const CopiedString& shader, const CopiedString& other ) const { } }; -static inline bool shader_is_diffuse( const char *shader ){ - return - /* Quetoo */ - !string_equal_suffix( shader, "_h" ) - && !string_equal_suffix( shader, "_local" ) - && !string_equal_suffix( shader, "_nm" ) - && !string_equal_suffix( shader, "_s" ) - /* DarkPlaces */ - && !string_equal_suffix( shader, "_bump" ) - && !string_equal_suffix( shader, "_glow" ) - && !string_equal_suffix( shader, "_gloss" ) - && !string_equal_suffix( shader, "_luma" ) - && !string_equal_suffix( shader, "_norm" ) - && !string_equal_suffix( shader, "_pants" ) - && !string_equal_suffix( shader, "_shirt" ) - && !string_equal_suffix( shader, "_reflect" ) - ; -} - inline bool shader_valid( const char* shader ){ return string_is_ascii( shader ) && strchr( shader, ' ' ) == 0 @@ -76,8 +57,7 @@ inline bool shader_valid( const char* shader ){ && strchr( shader, '\r' ) == 0 && strchr( shader, '\t' ) == 0 && strchr( shader, '\v' ) == 0 - && strchr( shader, '\\' ) == 0 - && shader_is_diffuse( shader ); + && strchr( shader, '\\' ) == 0; } inline const char* GlobalTexturePrefix_get(){ diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index e6afb71d..d088c0da 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -775,14 +775,27 @@ bool texture_name_ignore(const char *name) endswith(strTemp.c_str(), ".diffuse") || endswith(strTemp.c_str(), ".blend") || endswith(strTemp.c_str(), ".alpha") || - endswith(strTemp.c_str(), "_norm") || + endswith(strTemp.c_str(), "_alpha") || + /* Quetoo */ + endswith(strTemp.c_str(), "_h") || + endswith(strTemp.c_str(), "_local") || + endswith(strTemp.c_str(), "_nm") || + endswith(strTemp.c_str(), "_s") || + /* DarkPlaces */ endswith(strTemp.c_str(), "_bump") || endswith(strTemp.c_str(), "_glow") || endswith(strTemp.c_str(), "_gloss") || + endswith(strTemp.c_str(), "_luma") || + endswith(strTemp.c_str(), "_norm") || endswith(strTemp.c_str(), "_pants") || endswith(strTemp.c_str(), "_shirt") || endswith(strTemp.c_str(), "_reflect") || - endswith(strTemp.c_str(), "_alpha") || + /* Unvanquished */ + endswith(strTemp.c_str(), "_d") || + endswith(strTemp.c_str(), "_n") || + endswith(strTemp.c_str(), "_p") || + endswith(strTemp.c_str(), "_g") || + endswith(strTemp.c_str(), "_a") || 0; } -- 2.39.2