- fixed lookup for tile aliases pointing to non-existent tiles.

This commit is contained in:
Christoph Oelckers 2022-12-11 11:48:39 +01:00
parent 8c41294cb0
commit 21d4aae182
3 changed files with 10 additions and 9 deletions

View file

@ -59,6 +59,7 @@ static ClusterDef TheDefaultClusterInfo;
TArray<int> ParsedLumps(8); TArray<int> ParsedLumps(8);
constexpr int texlookupflags = FTextureManager::TEXMAN_ReturnAll | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ForceLookup;
//========================================================================== //==========================================================================
// //
// //
@ -366,7 +367,7 @@ void FMapInfoParser::ParseBreakWall()
sc.MustGetString(); sc.MustGetString();
FString basename = sc.String; // save for printing error messages. FString basename = sc.String; // save for printing error messages.
basetile = TexMan.CheckForTexture(sc.String, ETextureType::Any); basetile = TexMan.CheckForTexture(sc.String, ETextureType::Any, texlookupflags);
if (!basetile.isValid()) if (!basetile.isValid())
{ {
sc.ScriptMessage("Unknown texture '%s' in breakwall definition", sc.String); sc.ScriptMessage("Unknown texture '%s' in breakwall definition", sc.String);
@ -374,8 +375,9 @@ void FMapInfoParser::ParseBreakWall()
} }
ParseAssign(); ParseAssign();
sc.MustGetString(); sc.MustGetString();
breaktile = TexMan.CheckForTexture(sc.String, ETextureType::Any); breaktile = TexMan.CheckForTexture(sc.String, ETextureType::Any, texlookupflags);
if (*sc.String && !breaktile.isValid()) sc.ScriptMessage("Unknown texture '%s' in breakwall definition", sc.String); if (*sc.String && !breaktile.isValid())
sc.ScriptMessage("Unknown texture '%s' in breakwall definition", sc.String);
if (sc.CheckString(",")) if (sc.CheckString(","))
{ {
sc.MustGetString(); sc.MustGetString();
@ -431,7 +433,7 @@ void FMapInfoParser::ParseBreakCeiling()
sc.MustGetString(); sc.MustGetString();
FString basename = sc.String; // save for printing error messages. FString basename = sc.String; // save for printing error messages.
basetile = TexMan.CheckForTexture(sc.String, ETextureType::Any); basetile = TexMan.CheckForTexture(sc.String, ETextureType::Any, texlookupflags);
if (!basetile.isValid()) if (!basetile.isValid())
{ {
sc.ScriptMessage("Unknown texture '%s' in breakceiling definition", sc.String); sc.ScriptMessage("Unknown texture '%s' in breakceiling definition", sc.String);
@ -439,7 +441,7 @@ void FMapInfoParser::ParseBreakCeiling()
} }
ParseAssign(); ParseAssign();
sc.MustGetString(); sc.MustGetString();
breaktile = TexMan.CheckForTexture(sc.String, ETextureType::Any); breaktile = TexMan.CheckForTexture(sc.String, ETextureType::Any, texlookupflags);
if (*sc.String && !breaktile.isValid()) sc.ScriptMessage("Unknown texture '%s' in breakceiling definition", sc.String); if (*sc.String && !breaktile.isValid()) sc.ScriptMessage("Unknown texture '%s' in breakceiling definition", sc.String);
if (sc.CheckString(",")) if (sc.CheckString(","))
{ {
@ -504,7 +506,7 @@ void FMapInfoParser::ParseTextureFlags()
{ {
sc.MustGetString(); sc.MustGetString();
// this must also get null textures and ones not yet loaded. // this must also get null textures and ones not yet loaded.
auto tex = TexMan.CheckForTexture(sc.String, ETextureType::Any, FTextureManager::TEXMAN_ReturnAll | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ForceLookup); auto tex = TexMan.CheckForTexture(sc.String, ETextureType::Any, texlookupflags);
if (!tex.isValid()) if (!tex.isValid())
{ {
@ -547,7 +549,7 @@ void FMapInfoParser::ParseSurfaceTypes()
{ {
sc.MustGetString(); sc.MustGetString();
// this must also get null textures and ones not yet loaded. // this must also get null textures and ones not yet loaded.
auto tex = TexMan.CheckForTexture(sc.String, ETextureType::Any, FTextureManager::TEXMAN_ReturnAll | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ForceLookup); auto tex = TexMan.CheckForTexture(sc.String, ETextureType::Any, texlookupflags);
if (!tex.isValid()) if (!tex.isValid())
{ {

View file

@ -984,7 +984,6 @@ static void InitTextures(TArray<GrpEntry>& usedgroups)
ConstructTileset(); ConstructTileset();
InitFont(); // InitFonts may only be called once all texture data has been initialized. InitFont(); // InitFonts may only be called once all texture data has been initialized.
//TileFiles.SetAliases();
lookups.postLoadTables(); lookups.postLoadTables();
highTileSetup(); highTileSetup();

View file

@ -319,6 +319,6 @@ void ConstructTileset()
for (auto& a : info.aliases) for (auto& a : info.aliases)
{ {
TexMan.AddAlias(a.first.GetChars(), a.second + firstarttile); TexMan.AddAlias(a.first.GetChars(), min(maxarttile, a.second) + firstarttile);
} }
} }