From bfef616981e77af5f91cbc40700370ebeb4c85d5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 6 Dec 2022 08:30:53 +0100 Subject: [PATCH] - let tileDelete create a new null texture instead of using the default one. This is to ensure that marker textures are still unique. --- source/core/textures/buildtiles.cpp | 11 +++++++---- source/games/blood/src/preload.cpp | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/core/textures/buildtiles.cpp b/source/core/textures/buildtiles.cpp index bcc331708..137fea1a2 100644 --- a/source/core/textures/buildtiles.cpp +++ b/source/core/textures/buildtiles.cpp @@ -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); } diff --git a/source/games/blood/src/preload.cpp b/source/games/blood/src/preload.cpp index 8d84200b6..f6f6b9120 100644 --- a/source/games/blood/src/preload.cpp +++ b/source/games/blood/src/preload.cpp @@ -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();