From 06a81330485d6055947c7efc468d8472db9e438e Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 12 Oct 2021 04:41:41 +0000 Subject: [PATCH] Add an extra workaround as part of dpcompat_makeshitup 2 (to handle shaders that are not terminated properly). git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6079 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/pr_csqc.c | 2 +- engine/gl/gl_shader.c | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 5c8bc4a6a..bd66d22e2 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -598,7 +598,7 @@ static void QCBUILTIN PF_cs_remove (pubprogfuncs_t *prinst, struct globalvars_s if (!ed->entnum) { - Con_Printf("Unable to remove the world. Try godmode.\n"); + Con_Printf("Unable to remove the world.\n"); PR_StackTrace (prinst, false); return; } diff --git a/engine/gl/gl_shader.c b/engine/gl/gl_shader.c index 69993d329..26dfd08e0 100644 --- a/engine/gl/gl_shader.c +++ b/engine/gl/gl_shader.c @@ -4340,7 +4340,10 @@ static const char *Shader_Skip(const char *file, const char *shadername, const c if (tok[0] == '{') { - brace_count++; + if (r_forceprogramify.ival > 1 && brace_count == 2) + Con_Printf(CON_WARNING"%s: excess indentation depth while parsing shader \"%s\" (%s==%i)\n", file, shadername, r_forceprogramify.name, r_forceprogramify.ival); + else + brace_count++; } else if (tok[0] == '}') { brace_count--; @@ -4350,7 +4353,7 @@ static const char *Shader_Skip(const char *file, const char *shadername, const c return ptr; } -void Shader_Reset(shader_t *s) +static void Shader_Reset(shader_t *s) { extern cvar_t r_refractreflect_scale; char name[MAX_QPATH]; @@ -4438,7 +4441,7 @@ void Shader_Shutdown (void) shader_reload_needed = false; } -void Shader_SetBlendmode (shaderpass_t *pass, shaderpass_t *lastpass) +static void Shader_SetBlendmode (shaderpass_t *pass, shaderpass_t *lastpass) { qboolean lightmapoverbright; if (pass->texgen == T_GEN_DELUXMAP) @@ -4493,7 +4496,7 @@ void Shader_SetBlendmode (shaderpass_t *pass, shaderpass_t *lastpass) pass->blendmode = lightmapoverbright?PBM_OVERBRIGHT:PBM_MODULATE; } -void Shader_FixupProgPasses(parsestate_t *ps, shaderpass_t *pass) +static void Shader_FixupProgPasses(parsestate_t *ps, shaderpass_t *pass) { shader_t *shader = ps->s; int i; @@ -4691,7 +4694,7 @@ static qboolean Shader_Conditional_Read(parsestate_t *ps, struct scondinfo_s *co return true; } -void Shader_Readpass (parsestate_t *ps) +static void Shader_Readpass (parsestate_t *ps) { shader_t *shader = ps->s; const char *token; @@ -4907,7 +4910,7 @@ static qboolean Shader_Parsetok(parsestate_t *ps, shaderkey_t *keys, const char return false; } -void Shader_SetPassFlush (shaderpass_t *pass, shaderpass_t *pass2) +static void Shader_SetPassFlush (shaderpass_t *pass, shaderpass_t *pass2) { if (((pass->flags & SHADER_PASS_DETAIL) && !r_detailtextures.value) || ((pass2->flags & SHADER_PASS_DETAIL) && !r_detailtextures.value) || @@ -4996,7 +4999,7 @@ void Shader_SetPassFlush (shaderpass_t *pass, shaderpass_t *pass2) */ } -const char *Shader_AlphaMaskProgArgs(shader_t *s) +static const char *Shader_AlphaMaskProgArgs(shader_t *s) { if (s->numpasses) { @@ -5018,7 +5021,7 @@ const char *Shader_AlphaMaskProgArgs(shader_t *s) return ""; } -void Shader_Programify (parsestate_t *ps) +static void Shader_Programify (parsestate_t *ps) { shader_t *s = ps->s; unsigned int reflectrefract = 0; @@ -5198,7 +5201,7 @@ void Shader_Programify (parsestate_t *ps) } } -void Shader_Finish (parsestate_t *ps) +static void Shader_Finish (parsestate_t *ps) { shader_t *s = ps->s; int i; @@ -5798,7 +5801,7 @@ done:; } } /* -void Shader_UpdateRegistration (void) +static void Shader_UpdateRegistration (void) { int i, j, l; shader_t *shader;