- let tileDelete create a new null texture instead of using the default one.

This is to ensure that marker textures are still unique.
This commit is contained in:
Christoph Oelckers 2022-12-06 08:30:53 +01:00
parent 028cf2daf5
commit bfef616981
2 changed files with 9 additions and 4 deletions

View file

@ -504,8 +504,7 @@ int tileImportFromTexture(const char* fn, int tilenum, int alphacut, int istextu
// create a new game texture here - we want to give it a different name!
tex = MakeGameTexture(tex->GetTexture(), FStringf("#%05d", tilenum), ETextureType::Override);
TexMan.AddGameTexture(tex);
TileFiles.tiledata[tilenum].texture = tex;
TileFiles.AddTile(tilenum, tex);
if (istexture)
tileSetHightileReplacement(tilenum, 0, fn, (float)(255 - alphacut) * (1.f / 255.f), 1.0f, 1.0f, 1.0, 1.0);
return 0;
@ -570,13 +569,17 @@ void tileCopy(int tile, int source, int pal, int xoffset, int yoffset, int flags
//
//
//==========================================================================
FImageSource* CreateEmptyTexture();
void tileDelete(int tile)
{
if (TileFiles.locked)
I_FatalError("Modifying tiles after startup is not allowed.");
TileFiles.tiledata[tile].texture = TexMan.GameByIndex(0);
TileFiles.tiledata[tile].replacement = ReplacementType::Art; // whatever this was, now it isn't anymore. (SW tries to nuke camera textures with this, :( )
// explicitly deleted textures must be unique null textures
auto nulltex = MakeGameTexture(new FImageTexture(CreateEmptyTexture()), FStringf("#%05d", tile), ETextureType::Null);
TileFiles.AddTile(tile, nulltex);
TileFiles.tiledata[tile].replacement = ReplacementType::Art; // whatever this was, now it isn't anymore.
tiletovox[tile] = -1; // clear the link but don't clear the voxel. It may be in use for another tile.
modelManager.UndefineTile(tile);
}

View file

@ -310,11 +310,13 @@ void PreloadCache()
seqPrecacheId(dudeInfo[31].seqStartID + 17, 0);
seqPrecacheId(dudeInfo[31].seqStartID + 18, 0);
/* fixme: cache the composite sky. These are useless.
if (skyTile > -1 && skyTile < kMaxTiles)
{
for (int i = 1; i < gSkyCount; i++)
tilePrecacheTile(skyTile + i, 0, 0);
}
*/
WeaponPrecache();
viewPrecacheTiles();