Skip to content

Commit

Permalink
OpenGL2: Fix parsing q3gl2_sun without two additional tokens
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
zturtleman committed Dec 23, 2023
1 parent ae0878c commit b07ff2a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions code/renderergl2/tr_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b07ff2a

Please sign in to comment.