Patch from Striker to allow selective tile redefinition in .def files based on the crc of the original tile

This only works for "tilefromtexture" for now.

git-svn-id: https://svn.eduke32.com/eduke32@7370 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-03-02 23:21:37 +00:00
parent f31f31a17e
commit e84d62416d
3 changed files with 38 additions and 0 deletions

View file

@ -121,6 +121,7 @@ enum scripttoken_t
T_DST_COLOR, T_ONE_MINUS_DST_COLOR,
T_SHADERED, T_SHADEGREEN, T_SHADEBLUE,
T_SHADEFACTOR,
T_IFCRC,
};
static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0;
@ -792,6 +793,7 @@ static int32_t defsparser(scriptfile *script)
int32_t havexoffset = 0, haveyoffset = 0;
int32_t xoffset = 0, yoffset = 0;
int32_t istexture = 0;
int32_t tilecrc = 0, origcrc = 0;
static const tokenlist tilefromtexturetokens[] =
{
@ -805,6 +807,7 @@ static int32_t defsparser(scriptfile *script)
{ "texhitscan", T_TEXHITSCAN },
{ "nofullbright", T_NOFULLBRIGHT },
{ "texture", T_TEXTURE },
{ "ifcrc", T_IFCRC },
};
if (scriptfile_getsymbol(script,&tile)) break;
@ -831,6 +834,9 @@ static int32_t defsparser(scriptfile *script)
scriptfile_getsymbol(script,&yoffset);
yoffset = clamp(yoffset, -128, 127);
break;
case T_IFCRC:
scriptfile_getsymbol(script, &tilecrc);
break;
case T_TEXHITSCAN:
flags |= PICANM_TEXHITSCAN_BIT;
break;
@ -852,6 +858,16 @@ static int32_t defsparser(scriptfile *script)
break;
}
if (tilecrc)
{
origcrc = tileCRC(tile);
if (origcrc != tilecrc)
{
//initprintf("CRC of tile %d doesn't match! CRC: %d, Expected: %d\n", tile, origcrc, tilecrc);
break;
}
}
if (!fn)
{
// tilefromtexture <tile> { texhitscan } sets the bit but doesn't change tile data