From f9d4056e410a368552f44933907fc3b85bb8c184 Mon Sep 17 00:00:00 2001 From: myT Date: Thu, 4 May 2017 19:06:51 +0200 Subject: [PATCH] fixed the pukka3tourney2 slime not being green with r_vertexLight 1 --- changelog.txt | 2 ++ code/renderer/tr_shader.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/changelog.txt b/changelog.txt index 8403eb4..91cda14 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,8 @@ DD Mmm 17 - 1.49 +fix: the pukka3tourney2 slime wasn't green with r_vertexLight 1 + fix: the ct3ctf1 grate near quad was getting picmipped when it wasn't supposed to be fix: improved the player name look-up behavior for these commands: kick, banUser, dumpuser diff --git a/code/renderer/tr_shader.cpp b/code/renderer/tr_shader.cpp index 0b2184c..0f5f1bf 100644 --- a/code/renderer/tr_shader.cpp +++ b/code/renderer/tr_shader.cpp @@ -2056,6 +2056,18 @@ static const char* FindShaderInShaderText( const char* shadername ) } +struct vertexLightReplacementShader_t { + const char* mapName; + const char* shaderName; + const char* newShaderName; + int shaderNameHash; +}; + +static const vertexLightReplacementShader_t g_replacementShaders[] = { + { "pukka3tourney2", "textures/pukka3tourney2/acid_lm", "textures/pukka3tourney2/acid_vertex", 418 } +}; + + /* =============== R_FindShader @@ -2103,6 +2115,22 @@ shader_t* R_FindShader( const char *name, int lightmapIndex, qbool mipRawImage ) hash = Q_FileHash(strippedName, FILE_HASH_SIZE); + // replace some known shaders with more fit versions for r_vertexLight + if (r_vertexLight->integer) { + const int replacementCount = ARRAY_LEN(g_replacementShaders); + for (int i = 0; i < replacementCount; ++i) { + const vertexLightReplacementShader_t* const vlrs = g_replacementShaders + i; + if (vlrs->shaderNameHash == hash && + strcmp(vlrs->mapName, R_GetMapName()) == 0 && + strcmp(vlrs->shaderName, name) == 0) { + name = vlrs->newShaderName; + COM_StripExtension(name, strippedName, sizeof(strippedName)); + hash = Q_FileHash(strippedName, FILE_HASH_SIZE); + break; + } + } + } + // // see if the shader is already loaded //