From b07ff2a3cacf64dcd774499ec63e4b59c6bd849e Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Fri, 22 Dec 2023 22:00:57 -0600 Subject: [PATCH] OpenGL2: Fix parsing q3gl2_sun without two additional tokens If mapLightScale and shadowScale weren't included at the end of q3gl2_sun, the next shader line was skipped by SkipRestOfLine(). COM_ParseExt() with allowLineBreaks=qfalse, returns "" once and then goes to the next line anyway. (Doesn't work well multiple "optional" tokens. It looks like a vanilla bug.) --- code/renderergl2/tr_shader.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index c899363e..4b9fa991 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -1841,12 +1841,17 @@ static qboolean ParseShader( char **text ) tr.sunShadowScale = atof(token); // parse twice, since older shaders may include mapLightScale before sunShadowScale - token = COM_ParseExt( text, qfalse ); - if (token[0]) - tr.sunShadowScale = atof(token); + if (token[0]) { + token = COM_ParseExt( text, qfalse ); + if (token[0]) { + tr.sunShadowScale = atof(token); + } + } } - SkipRestOfLine( text ); + if (token[0]) { + SkipRestOfLine( text ); + } continue; } // tonemap parms