mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Defs: Add "artfile" token, which loads an ART file. You can use the "tile" sub-token to overwrite the starting tilenum of the file from def.
artfile { file "whatever.art" } // loads whatever.art just as if it had been named TILES020.ART artfile { file "whatever.art" tile 2000 } // loads whatever.art starting at index 2000 instead of the tilestart value contained within it This is useful because ART files will load faster than images loaded through tilefromtexture (which must undergo a color matching process), and because tiles making use of palette indices which have duplicate colors in the stock Duke 3D palette but not in other palettes (such as the 3D Realms screen) are negatively affected by the aforementioned process. git-svn-id: https://svn.eduke32.com/eduke32@5180 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6091a842db
commit
bfc9941101
1 changed files with 62 additions and 0 deletions
|
@ -91,6 +91,7 @@ enum scripttoken_t
|
|||
T_IMPORTTILE,
|
||||
T_MUSIC,T_ID,T_SOUND,
|
||||
T_TILEFROMTEXTURE, T_XOFFSET, T_YOFFSET, T_TEXHITSCAN, T_NOFULLBRIGHT,
|
||||
T_ARTFILE,
|
||||
T_INCLUDEDEFAULT,
|
||||
T_ANIMSOUNDS,
|
||||
T_CUTSCENE,
|
||||
|
@ -358,6 +359,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
{ "cachesize", T_CACHESIZE },
|
||||
{ "dummytilefrompic",T_IMPORTTILE },
|
||||
{ "tilefromtexture", T_TILEFROMTEXTURE },
|
||||
{ "artfile", T_ARTFILE },
|
||||
{ "mapinfo", T_MAPINFO },
|
||||
{ "echo", T_ECHO },
|
||||
{ "globalflags", T_GLOBALFLAGS },
|
||||
|
@ -583,6 +585,66 @@ static int32_t defsparser(scriptfile *script)
|
|||
if (scriptfile_getnumber(script,&j)) break;
|
||||
}
|
||||
break;
|
||||
case T_ARTFILE:
|
||||
{
|
||||
char *blockend, *fn = NULL;
|
||||
int32_t tile = -1, havetile = 0;
|
||||
|
||||
static const tokenlist artfiletokens[] =
|
||||
{
|
||||
{ "file", T_FILE },
|
||||
{ "tile", T_TILE },
|
||||
};
|
||||
|
||||
if (scriptfile_getbraces(script,&blockend)) break;
|
||||
while (script->textptr < blockend)
|
||||
{
|
||||
int32_t token = getatoken(script,artfiletokens,ARRAY_SIZE(artfiletokens));
|
||||
switch (token)
|
||||
{
|
||||
case T_FILE:
|
||||
scriptfile_getstring(script,&fn);
|
||||
break;
|
||||
case T_TILE:
|
||||
havetile = 1;
|
||||
scriptfile_getsymbol(script,&tile);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(!fn))
|
||||
{
|
||||
initprintf("Error: missing 'file name' for artfile definition near line %s:%d\n",
|
||||
script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||
break;
|
||||
}
|
||||
|
||||
int32_t const fil = kopen4load(fn, 0);
|
||||
if (fil == -1)
|
||||
break;
|
||||
|
||||
artheader_t local;
|
||||
int32_t headerval = E_ReadArtFileHeader(fil, fn, &local);
|
||||
if (headerval != 0)
|
||||
break;
|
||||
|
||||
if (havetile)
|
||||
{
|
||||
if (!check_tile("artfile", tile, script, cmdtokptr))
|
||||
{
|
||||
local.tilestart = tile;
|
||||
local.tileend = tile + local.numtiles - 1;
|
||||
}
|
||||
}
|
||||
|
||||
E_ReadArtFileTileInfo(fil, &local);
|
||||
E_ReadArtFileIntoFakeData(fil, &local);
|
||||
|
||||
kclose(fil);
|
||||
}
|
||||
break;
|
||||
case T_SETUPTILE:
|
||||
{
|
||||
int32_t tile, tmp;
|
||||
|
|
Loading…
Reference in a new issue