- two more simple .def commands.

This commit is contained in:
Christoph Oelckers 2021-04-10 16:35:29 +02:00
parent 6b684e74ba
commit a5ed7ba8a3
2 changed files with 56 additions and 52 deletions

View file

@ -325,6 +325,19 @@ static int32_t defsparser(scriptfile *script)
case T_INCLUDEDEFAULT: case T_INCLUDEDEFAULT:
defsparser_include(G_DefaultDefFile(), script, &pos); defsparser_include(G_DefaultDefFile(), script, &pos);
break; break;
case T_LOADGRP:
case T_CACHESIZE:
case T_SHADEFACTOR:
case T_GLOBALGAMEFLAGS:
parseSkip<1>(*script, pos);
break;
case T_SPRITECOL:
case T_2DCOLIDXRANGE: // NOTE: takes precedence over 2dcol, see InitCustomColors()
parseSkip<3>(*script, pos);
break;
case T_2DCOL:
parseSkip<4>(*script, pos);
break;
case T_DEFINE: case T_DEFINE:
parseDefine(*script, pos); parseDefine(*script, pos);
break; break;
@ -343,58 +356,11 @@ static int32_t defsparser(scriptfile *script)
case T_ALPHAHACKRANGE: case T_ALPHAHACKRANGE:
parseAlphahackRange(*script, pos); parseAlphahackRange(*script, pos);
break; break;
case T_SPRITECOL:
case T_2DCOLIDXRANGE: // NOTE: takes precedence over 2dcol, see InitCustomColors()
parseSkip<3>(*script, pos);
break;
case T_2DCOL:
parseSkip<4>(*script, pos);
break;
case T_FOGPAL: case T_FOGPAL:
{ parseFogpal(*script, pos);
int32_t p,r,g,b; break;
if (scriptfile_getsymbol(script,&p)) break;
if (scriptfile_getnumber(script,&r)) break;
if (scriptfile_getnumber(script,&g)) break;
if (scriptfile_getnumber(script,&b)) break;
r = clamp(r, 0, 63);
g = clamp(g, 0, 63);
b = clamp(b, 0, 63);
lookups.makeTable(p, NULL, r<<2, g<<2, b<<2, 1);
}
break;
case T_NOFLOORPALRANGE: case T_NOFLOORPALRANGE:
{ parseNoFloorpalRange(*script, pos);
int32_t b,e,i;
if (scriptfile_getsymbol(script,&b)) break;
if (scriptfile_getsymbol(script,&e)) break;
b = max(b, 1);
e = min(e, MAXPALOOKUPS-1);
for (i = b; i <= e; i++)
lookups.tables[i].noFloorPal = true;
}
break;
case T_LOADGRP:
{
scriptfile_getstring(script,nullptr);
#if 0
if (!scriptfile_getstring(pScript, &fileName) && firstPass)
{
fileSystem.AddAdditionalFile(fileName);
}
#endif
}
break;
case T_CACHESIZE:
case T_SHADEFACTOR:
case T_GLOBALGAMEFLAGS:
parseSkip<1>(*script, pos);
break; break;
case T_ARTFILE: case T_ARTFILE:
{ {

View file

@ -48,7 +48,7 @@ void tileRemoveReplacement(int num);
template<int cnt> template<int cnt>
void parseSkip(FScanner& sc, FScriptPosition& pos) void parseSkip(FScanner& sc, FScriptPosition& pos)
{ {
for (int i = 0; i < cnt; i++) if (!sc.GetNumber(true)) return; for (int i = 0; i < cnt; i++) if (!sc.GetString()) return;
} }
void parseDefine(FScanner& sc, FScriptPosition& pos) void parseDefine(FScanner& sc, FScriptPosition& pos)
@ -365,4 +365,42 @@ void parseDefineTint(FScanner& sc, FScriptPosition& pos)
if (!sc.GetNumber(f)) return; if (!sc.GetNumber(f)) return;
lookups.setPaletteTint(pal, r, g, b, 0, 0, 0, f); lookups.setPaletteTint(pal, r, g, b, 0, 0, 0, f);
} }
//===========================================================================
//
//
//
//===========================================================================
void parseFogpal(FScanner& sc, FScriptPosition& pos)
{
int pal, r, g, b;
if (!sc.GetNumber(pal, true)) return;
if (!sc.GetNumber(r)) return;
if (!sc.GetNumber(g)) return;
if (!sc.GetNumber(b)) return;
r = clamp(r, 0, 63);
g = clamp(g, 0, 63);
b = clamp(b, 0, 63);
lookups.makeTable(pal, nullptr, r << 2, g << 2, b << 2, 1);
}
//===========================================================================
//
//
//
//===========================================================================
void parseNoFloorpalRange(FScanner& sc, FScriptPosition& pos)
{
int start, end;
if (!sc.GetNumber(start, true)) return;
if (!sc.GetNumber(end, true)) return;
if (start > 1) start = 1;
if (end > MAXPALOOKUPS - 1) end = MAXPALOOKUPS - 1;
for (int i = start; i <= end; i++)
lookups.tables[i].noFloorPal = true;
}