add SHADERS comment support

This commit is contained in:
Jaime Passos 2019-03-19 18:52:41 -03:00
parent dd4e5ea373
commit 9451b10ac5

View file

@ -5995,6 +5995,13 @@ void HWR_LoadShaders(UINT16 wadnum, boolean PK3)
stoken = strtok(line, "\r\n "); stoken = strtok(line, "\r\n ");
while (stoken) while (stoken)
{ {
if ((stoken[0] == '/' && stoken[1] == '/')
|| (stoken[0] == '#'))// skip comments
{
stoken = strtok(NULL, "\r\n");
goto skip_field;
}
if (!stricmp(stoken, "GLSL")) if (!stricmp(stoken, "GLSL"))
{ {
value = strtok(NULL, "\r\n "); value = strtok(NULL, "\r\n ");
@ -6019,14 +6026,14 @@ skip_lump:
value = strtok(NULL, "\r\n= "); value = strtok(NULL, "\r\n= ");
if (!value) if (!value)
{ {
CONS_Alert(CONS_WARNING, "HWR_LoadShaders: Missing shader source (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum); CONS_Alert(CONS_WARNING, "HWR_LoadShaders: Missing shader target (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum);
stoken = strtok(NULL, "\r\n"); // skip end of line stoken = strtok(NULL, "\r\n"); // skip end of line
goto skip_field; goto skip_field;
} }
if (!shadertype) if (!shadertype)
{ {
CONS_Alert(CONS_ERROR, "HWR_LoadShaders: Missing shader target (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum); CONS_Alert(CONS_ERROR, "HWR_LoadShaders: Missing shader type (file %s, line %d)\n", wadfiles[wadnum]->filename, linenum);
Z_Free(line); Z_Free(line);
return; return;
} }