- fixed a few parsing errors.

This commit is contained in:
Christoph Oelckers 2021-04-20 20:41:04 +02:00
parent aaad546729
commit 6fb09f36c7
2 changed files with 16 additions and 0 deletions

View file

@ -342,6 +342,8 @@ static int32_t defsparser(scriptfile *script)
break; break;
case T_CUTSCENE: case T_CUTSCENE:
case T_ANIMSOUNDS: case T_ANIMSOUNDS:
parseEmptyBlockWithParm(*script, pos);;
break;
case T_NEWGAMECHOICES: // stub case T_NEWGAMECHOICES: // stub
parseEmptyBlock(*script, pos); parseEmptyBlock(*script, pos);
break; break;

View file

@ -873,8 +873,20 @@ void parseEmptyBlock(FScanner& sc, FScriptPosition& pos)
if (sc.StartBraces(&blockend)) return; if (sc.StartBraces(&blockend)) return;
sc.RestorePos(blockend); sc.RestorePos(blockend);
sc.CheckString("}");
} }
void parseEmptyBlockWithParm(FScanner& sc, FScriptPosition& pos)
{
FScanner::SavedPos blockend;
sc.MustGetString();
if (sc.StartBraces(&blockend)) return;
sc.RestorePos(blockend);
sc.CheckString("}");
}
//=========================================================================== //===========================================================================
// //
// //
@ -978,6 +990,7 @@ static void parseBlendTableGlBlend(FScanner& sc, FScriptPosition& pos, int id)
{ {
int whichb = 0; int whichb = 0;
sc.MustGetString(); sc.MustGetString();
if (sc.Compare("}")) break;
if (sc.Compare({ "src", "sfactor", "top" })) whichb = 0; if (sc.Compare({ "src", "sfactor", "top" })) whichb = 0;
else if (sc.Compare({ "dst", "dfactor", "bottom" })) whichb = 1; else if (sc.Compare({ "dst", "dfactor", "bottom" })) whichb = 1;
else if (sc.Compare("alpha")) else if (sc.Compare("alpha"))
@ -987,6 +1000,7 @@ static void parseBlendTableGlBlend(FScanner& sc, FScriptPosition& pos, int id)
continue; continue;
} }
uint8_t* const factor = whichb == 0 ? &bdef.src : &bdef.dst; uint8_t* const factor = whichb == 0 ? &bdef.src : &bdef.dst;
sc.MustGetString();
if (sc.Compare("ZERO")) *factor = STYLEALPHA_Zero; if (sc.Compare("ZERO")) *factor = STYLEALPHA_Zero;
else if (sc.Compare("ONE")) *factor = STYLEALPHA_One; else if (sc.Compare("ONE")) *factor = STYLEALPHA_One;
else if (sc.Compare("SRC_COLOR")) *factor = STYLEALPHA_SrcCol; else if (sc.Compare("SRC_COLOR")) *factor = STYLEALPHA_SrcCol;