Add blood specific parameters to tilefromtexture

This commit is contained in:
nukeykt 2019-08-09 22:33:45 +09:00 committed by Christoph Oelckers
parent f6ce571075
commit 0a74187512

View file

@ -149,6 +149,12 @@ enum gametokens
T_FORCENOFILTER,
T_TEXTUREFILTER,
T_RFFDEFINEID,
T_TILEFROMTEXTURE,
T_IFCRC,
T_SURFACE,
T_VOXEL,
T_VIEW,
T_SHADE,
};
int blood_globalflags;
@ -1933,6 +1939,7 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
{ "renamefile", T_RENAMEFILE },
{ "globalgameflags", T_GLOBALGAMEFLAGS },
{ "rffdefineid", T_RFFDEFINEID },
{ "tilefromtexture", T_TILEFROMTEXTURE },
};
static const tokenlist soundTokens[] =
@ -2081,6 +2088,80 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
}
break;
case T_TILEFROMTEXTURE:
{
char *texturetokptr = pScript->ltextptr, *textureend;
int32_t tile = -1;
int32_t havesurface = 0, havevox = 0, haveview = 0, haveshade = 0;
int32_t surface = 0, vox = 0, view = 0, shade = 0;
int32_t tilecrc = 0, origcrc = 0;
static const tokenlist tilefromtexturetokens[] =
{
{ "surface", T_SURFACE },
{ "voxel", T_VOXEL },
{ "ifcrc", T_IFCRC },
{ "view", T_VIEW },
{ "shade", T_SHADE },
};
if (scriptfile_getsymbol(pScript,&tile)) break;
if (scriptfile_getbraces(pScript,&textureend)) break;
while (pScript->textptr < textureend)
{
int32_t token = getatoken(pScript,tilefromtexturetokens,ARRAY_SIZE(tilefromtexturetokens));
switch (token)
{
case T_IFCRC:
scriptfile_getsymbol(pScript, &tilecrc);
break;
case T_SURFACE:
havesurface = 1;
scriptfile_getsymbol(pScript, &surface);
break;
case T_VOXEL:
havevox = 1;
scriptfile_getsymbol(pScript, &vox);
break;
case T_VIEW:
haveview = 1;
scriptfile_getsymbol(pScript, &view);
break;
case T_SHADE:
haveshade = 1;
scriptfile_getsymbol(pScript, &shade);
break;
}
}
if (EDUKE32_PREDICT_FALSE((unsigned)tile >= MAXUSERTILES))
{
initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n",
pScript->filename, scriptfile_getlinum(pScript,texturetokptr));
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 (havesurface)
surfType[tile] = surface;
if (havevox)
voxelIndex[tile] = vox;
if (haveshade)
tileShade[tile] = shade;
if (haveview)
picanm[tile].extra = view&7;
}
break;
#if 0
case T_CUTSCENE:
{