- tileDelete / tileSetDummy

This commit is contained in:
Christoph Oelckers 2019-10-15 23:29:47 +02:00
parent 9a52e8039c
commit bb78db71bc
5 changed files with 40 additions and 42 deletions

View file

@ -1034,7 +1034,6 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, in
void tileSetupDummy(int32_t tile);
void tileSetData(int32_t tile, int32_t tsiz, char const *buffer);
void tileDelete(int32_t tile);
void tileSetSize(int32_t picnum, int16_t dasizx, int16_t dasizy);
int32_t artReadHeader(buildvfs_kfd fil, char const *fn, artheader_t *local);
int32_t artReadHeaderFromBuffer(uint8_t const *buf, artheader_t *local);

View file

@ -1027,18 +1027,7 @@ static int32_t defsparser(scriptfile *script)
if (check_tile("dummytile", tile, script, cmdtokptr))
break;
if ((int16_t) xsiz == 0 || (int16_t) ysiz == 0)
{
tileDelete(tile);
break;
}
if (xsiz > 0 && ysiz > 0)
{
tileSetSize(tile, xsiz, ysiz);
picanm[tile] = {};
tileSetupDummy(tile);
}
tileSetDummy(tile, xsiz, ysiz);
break;
}
@ -1057,18 +1046,9 @@ static int32_t defsparser(scriptfile *script)
if (xsiz < 0 || ysiz < 0)
break; // TODO: message
if ((int16_t) xsiz == 0 || (int16_t) ysiz == 0)
{
for (i=tile1; i<=tile2; i++)
tileDelete(i);
break;
}
for (i=tile1; i<=tile2; i++)
{
tileSetSize(i, xsiz, ysiz);
picanm[i] = {};
tileSetupDummy(i);
tileSetDummy(i, xsiz, ysiz);
}
break;
@ -2281,9 +2261,7 @@ static int32_t defsparser(scriptfile *script)
if (xsiz > 0 && ysiz > 0)
{
tileSetSize(tile, xsiz, ysiz);
picanm[tile] = {};
tileSetupDummy(tile);
tileSetDummy(tile, xsiz, ysiz);
}
#ifdef USE_OPENGL
xscale = 1.0f / xscale;

View file

@ -264,22 +264,6 @@ static void tileSoftDelete(int32_t const tile)
picanm[tile] = {};
}
void tileDelete(int32_t const tile)
{
tileSoftDelete(tile);
DO_FREE_AND_NULL(faketiledata[tile]);
vox_undefine(tile);
#ifdef USE_OPENGL
for (ssize_t i=MAXPALOOKUPS-1; i>=0; --i)
hicclearsubst(tile, i);
md_undefinetile(tile);
#endif
}
void tileUpdatePicSiz(int32_t picnum)
{
int j = 15;

View file

@ -401,3 +401,38 @@ void BuildFiles::tileSetExternal(int tilenum, int width, int height, uint8_t* da
if (buffer) memcpy(buffer, data, width * height);
}
//==========================================================================
//
//
//
//==========================================================================
void tileDelete(int tile)
{
TileFiles.tiles[tile] = TileFiles.tilesbak[tile] = TileFiles.Placeholder;
vox_undefine(tile);
md_undefinetile(tile);
for (ssize_t i = MAXPALOOKUPS - 1; i >= 0; --i)
hicclearsubst(tile, i);
}
//==========================================================================
//
//
//
//==========================================================================
void tileSetDummy(int tile, int width, int height)
{
if (width == 0 || height == 0)
{
tileDelete(tile);
}
else if (width > 0 && height > 0)
{
auto dtile = new FDummyTile(width, height);
TileFiles.AddTile(tile, dtile);
}
}

View file

@ -517,6 +517,8 @@ struct BuildFiles
};
void tileSetDummy(int tile, int width, int height);
void tileDelete(int tile);
extern BuildFiles TileFiles;
inline bool tileCheck(int num)
{