diff --git a/project/code/LGS/ResourcePathManager.cs b/project/code/LGS/ResourcePathManager.cs index eb7b248..abf253e 100644 --- a/project/code/LGS/ResourcePathManager.cs +++ b/project/code/LGS/ResourcePathManager.cs @@ -133,28 +133,32 @@ public class ResourcePathManager return null; } - public string GetTexturePath(string textureName) - { - if (!_initialised) return null; - - textureName = textureName.ToLower(); - if (_omResources.texturePathMap.TryGetValue(textureName, out var path)) - { - return path; - } - return null; - } - + // TODO: OMs fail to find a path, but FMs using OM textures do find them + // The OMs still fail even if I put them in a folder with FMs that work=?? public string GetTexturePath(string campaignName, string textureName) { if (!_initialised) return null; textureName = textureName.ToLower(); - if (_fmResources.TryGetValue(campaignName, out var campaign) && - campaign.texturePathMap.TryGetValue(textureName, out var path)) + if (campaignName == null || campaignName == "") { - return path; + if (_omResources.texturePathMap.TryGetValue(textureName, out var path)) + { + return path; + } } + else if (_fmResources.TryGetValue(campaignName, out var campaign)) + { + if (campaign.texturePathMap.TryGetValue(textureName, out var fmPath)) + { + return fmPath; + } + else if (_omResources.texturePathMap.TryGetValue(textureName, out var omPath)) + { + return omPath; + } + } + return null; } diff --git a/project/code/TMV/TextureLoader.cs b/project/code/TMV/TextureLoader.cs index 98d6eaa..8c2339e 100644 --- a/project/code/TMV/TextureLoader.cs +++ b/project/code/TMV/TextureLoader.cs @@ -29,16 +29,7 @@ public partial class TextureLoader public bool Load(ResourcePathManager installManager, int id, string path) { var loaded = false; - string texPath; - if (_fmName != null) - { - texPath = installManager.GetTexturePath(_fmName, path); - texPath ??= installManager.GetTexturePath(path); - } - else - { - texPath = installManager.GetTexturePath(path); - } + string texPath = installManager.GetTexturePath(_fmName, path); if (texPath != null) {