From 1f024454bdce2b7c8fcf2a136d55c6a672829814 Mon Sep 17 00:00:00 2001 From: Rampastring Date: Fri, 18 Oct 2024 01:21:17 +0300 Subject: [PATCH] Add support for FA2 NEWURBAN hack --- src/TSMapEditor/CCEngine/Theater.cs | 16 +--------------- src/TSMapEditor/Rendering/TheaterGraphics.cs | 11 ++++++++++- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/TSMapEditor/CCEngine/Theater.cs b/src/TSMapEditor/CCEngine/Theater.cs index 83e37f83..a853b3d0 100644 --- a/src/TSMapEditor/CCEngine/Theater.cs +++ b/src/TSMapEditor/CCEngine/Theater.cs @@ -56,21 +56,6 @@ public Theater(string name) UIName = name; } - public Theater(string uiName, string configIniName, List contentMixName, - List optionalContentMixName, string paletteName, string unitPaletteName, - string tiberiumPaletteName, string fileExtension, char newTheaterBuildingLetter) - { - UIName = uiName; - ConfigINIPath = configIniName; - ContentMIXName = contentMixName; - OptionalContentMIXName = optionalContentMixName; - TerrainPaletteName = paletteName; - UnitPaletteName = unitPaletteName; - TiberiumPaletteName = tiberiumPaletteName; - FileExtension = fileExtension; - NewTheaterBuildingLetter = newTheaterBuildingLetter; - } - public string UIName { get; } public string ConfigINIPath { get; set; } public List ContentMIXName { get; set; } @@ -79,6 +64,7 @@ public Theater(string uiName, string configIniName, List contentMixName, public string UnitPaletteName { get; set; } public string TiberiumPaletteName { get; set; } public string FileExtension { get; set; } + public string FallbackTileFileExtension { get; set; } public char NewTheaterBuildingLetter { get; set; } public List RoughConnectToTileSets { get; set; } diff --git a/src/TSMapEditor/Rendering/TheaterGraphics.cs b/src/TSMapEditor/Rendering/TheaterGraphics.cs index 8bef22ce..e2ee997a 100644 --- a/src/TSMapEditor/Rendering/TheaterGraphics.cs +++ b/src/TSMapEditor/Rendering/TheaterGraphics.cs @@ -517,7 +517,16 @@ private void ReadTileTextures() } string fileName = baseName + Theater.FileExtension; - byte[] data = fileManager.LoadFile(baseName + Theater.FileExtension); + byte[] data = fileManager.LoadFile(fileName); + + if (data == null && !string.IsNullOrWhiteSpace(Theater.FallbackTileFileExtension)) + { + // Support for FA2 NEWURBAN hack. FA2 Marble.mix does not contain Marble Madness graphics for NEWURBAN, only URBAN. + // To allow Marble Madness to work in NEWURBAN, FA2 also loads .urb files for NEWURBAN. + // We must do the same at least for now. + fileName = baseName + Theater.FallbackTileFileExtension; + data = fileManager.LoadFile(fileName); + } if (data == null) {