From 1ef99383201a8409c387391c68d7ef48c2b58eb0 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 15 Jul 2018 23:34:58 +0200 Subject: [PATCH] - fix user defines and textures not working --- src/r_data/gldefs.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/r_data/gldefs.cpp b/src/r_data/gldefs.cpp index 04abc8a93a..a25eb0c940 100644 --- a/src/r_data/gldefs.cpp +++ b/src/r_data/gldefs.cpp @@ -1171,8 +1171,7 @@ class GLDefsParser UserShaderDesc usershader; TArray texNameList; - TArray texNameIndex; - FString texnameDefs = ""; + TArray texNameIndex; float speed = 1.f; FTexture *textures[6]; @@ -1278,7 +1277,7 @@ class GLDefsParser sc.MustGetString(); defineValue = sc.String; } - texnameDefs.AppendFormat("#define %s %s\n", defineName.GetChars(), defineValue.GetChars()); + usershader.defines.AppendFormat("#define %s %s\n", defineName.GetChars(), defineValue.GetChars()); } else { @@ -1356,7 +1355,7 @@ class GLDefsParser for (unsigned int i = 0; i < texNameList.Size(); i++) { - texnameDefs.AppendFormat("#define %s texture%d\n", texNameList[i].GetChars(), texNameIndex[i] + firstUserTexture); + usershader.defines.AppendFormat("#define %s texture%d\n", texNameList[i].GetChars(), texNameIndex[i] + firstUserTexture); } if (tex->bWarped != 0) @@ -1369,7 +1368,7 @@ class GLDefsParser { if (!usershaders[i].shader.CompareNoCase(usershader.shader) && usershaders[i].shaderType == usershader.shaderType && - !usershaders[i].defines.Compare(texnameDefs)) + !usershaders[i].defines.Compare(usershader.defines)) { tex->shaderindex = i + FIRST_USER_SHADER; return; @@ -1486,8 +1485,7 @@ class GLDefsParser UserShaderDesc desc; desc.shaderType = SHADER_Default; TArray texNameList; - TArray texNameIndex; - FString texnameDefs = ""; + TArray texNameIndex; float speed = 1.f; sc.MustGetString(); @@ -1570,7 +1568,7 @@ class GLDefsParser sc.MustGetString(); defineValue = sc.String; } - texnameDefs.AppendFormat("#define %s %s\n", defineName.GetChars(), defineValue.GetChars()); + desc.defines.AppendFormat("#define %s %s\n", defineName.GetChars(), defineValue.GetChars()); } } if (!tex) @@ -1592,7 +1590,7 @@ class GLDefsParser for (unsigned int i = 0; i < texNameList.Size(); i++) { - texnameDefs.AppendFormat("#define %s texture%d\n", texNameList[i].GetChars(), texNameIndex[i] + firstUserTexture); + desc.defines.AppendFormat("#define %s texture%d\n", texNameList[i].GetChars(), texNameIndex[i] + firstUserTexture); } if (desc.shader.IsNotEmpty()) @@ -1607,7 +1605,7 @@ class GLDefsParser { if (!usershaders[i].shader.CompareNoCase(desc.shader) && usershaders[i].shaderType == desc.shaderType && - !usershaders[i].defines.Compare(texnameDefs)) + !usershaders[i].defines.Compare(desc.defines)) { tex->shaderindex = i + FIRST_USER_SHADER; return;