- parseUndefPalookupRange

This commit is contained in:
Christoph Oelckers 2021-04-13 20:51:19 +02:00
parent 276fd19462
commit 1518156386
2 changed files with 26 additions and 21 deletions

View file

@ -1326,27 +1326,8 @@ static int32_t defsparser(scriptfile *script)
}
break;
case T_UNDEFPALOOKUPRANGE:
{
int32_t id0, id1;
if (scriptfile_getsymbol(script,&id0))
break;
if (scriptfile_getsymbol(script,&id1))
break;
if (id0 > id1 || (unsigned)id0 >= MAXPALOOKUPS || (unsigned)id1 >= MAXPALOOKUPS)
{
pos.Message(MSG_ERROR, "undefpalookuprange: Invalid range");
break;
}
for (bssize_t i = id0; i <= id1; i++)
lookups.clearTable(i);
if (id0 == 0)
paletteloaded &= ~PALETTE_SHADE;
}
break;
parseUndefPalookupRange(*script, pos);
break;
case T_RFFDEFINEID:
parseRffDefineId(*script, pos);
break;

View file

@ -1336,3 +1336,27 @@ void parseMakePalookup(FScanner& sc, FScriptPosition& pos)
remappal == 0 ? 1 : (nofloorpal == -1 ? lookups.tables[remappal].noFloorPal : nofloorpal));
}
}
//===========================================================================
//
//
//
//===========================================================================
void parseUndefPalookupRange(FScanner& sc, FScriptPosition& pos)
{
int id0, id1;
if (!sc.GetNumber(id0, true)) return;
if (!sc.GetNumber(id1, true)) return;
if (id0 > id1 || (unsigned)id0 >= MAXPALOOKUPS || (unsigned)id1 >= MAXPALOOKUPS)
{
pos.Message(MSG_ERROR, "undefpalookuprange: Invalid range");
}
else
{
for (int i = id0; i <= id1; i++) lookups.clearTable(i);
if (id0 == 0) paletteloaded &= ~PALETTE_SHADE;
}
}