diff --git a/Deps/TRGE.Coord.dll b/Deps/TRGE.Coord.dll index 962777ef1..2ba8335e3 100644 Binary files a/Deps/TRGE.Coord.dll and b/Deps/TRGE.Coord.dll differ diff --git a/TRDataControl/Environment/EMEditorMapping.cs b/TRDataControl/Environment/EMEditorMapping.cs index 4df951bc1..81541c2c5 100644 --- a/TRDataControl/Environment/EMEditorMapping.cs +++ b/TRDataControl/Environment/EMEditorMapping.cs @@ -13,28 +13,16 @@ public class EMEditorMapping Formatting = Formatting.Indented }; - public EMEditorSet All { get; set; } - public List Any { get; set; } - public List> AllWithin { get; set; } - public List OneOf { get; set; } - public List ConditionalAllWithin { get; set; } - public List ConditionalAll { get; set; } - public List ConditionalOneOf { get; set; } - public EMEditorSet Mirrored { get; set; } + public EMEditorSet All { get; set; } = new(); + public List Any { get; set; } = new(); + public List> AllWithin { get; set; } = new(); + public List OneOf { get; set; } = new(); + public List ConditionalAllWithin { get; set; } = new(); + public List ConditionalAll { get; set; } = new(); + public List ConditionalOneOf { get; set; } = new(); + public EMEditorSet Mirrored { get; set; } = new(); public Dictionary AlternativeTextures { get; set; } - public EMEditorMapping() - { - All = new EMEditorSet(); - ConditionalAll = new List(); - Any = new List(); - AllWithin = new List>(); - ConditionalAllWithin = new List(); - OneOf = new List(); - ConditionalOneOf = new List(); - Mirrored = new EMEditorSet(); - } - public static EMEditorMapping Get(string packPath) { if (File.Exists(packPath)) @@ -83,4 +71,35 @@ public void SetCommunityPatch(bool isCommunityPatch) ConditionalOneOf?.ForEach(s => s.SetCommunityPatch(isCommunityPatch)); Mirrored?.SetCommunityPatch(isCommunityPatch); } + + public List FindAll(Predicate predicate = null) + { + List results = new(); + Scan(e => + { + if (predicate == null || predicate(e)) + { + results.Add(e); + } + }); + return results; + } + + public void Scan(Action callback) + { + All?.ForEach(e => callback(e)); + ConditionalAll?.ForEach(s => s.OnFalse?.ForEach(e => callback(e))); + ConditionalAll?.ForEach(s => s.OnTrue?.ForEach(e => callback(e))); + Any?.ForEach(e => e.ForEach(a => callback(a))); + AllWithin?.ForEach(a => a.ForEach(s => s.ForEach(e => callback(e)))); + ConditionalAllWithin?.ForEach(s => s.OnFalse?.ForEach(a => a.ForEach(e => callback(e)))); + ConditionalAllWithin?.ForEach(s => s.OnTrue?.ForEach(a => a.ForEach(e => callback(e)))); + OneOf?.ForEach(s => s.Leader.ForEach(e => callback(e))); + OneOf?.ForEach(s => s.Followers.ForEach(e => e.ForEach(a => callback(a)))); + ConditionalOneOf?.ForEach(s => s.OnFalse?.Leader.ForEach(e => callback(e))); + ConditionalOneOf?.ForEach(s => s.OnFalse?.Followers.ForEach(e => e.ForEach(a => callback(a)))); + ConditionalOneOf?.ForEach(s => s.OnTrue?.Leader.ForEach(e => callback(e))); + ConditionalOneOf?.ForEach(s => s.OnTrue?.Followers.ForEach(e => e.ForEach(a => callback(a)))); + Mirrored?.ForEach(e => callback(e)); + } } diff --git a/TRDataControl/Transport/TRDataImporter.cs b/TRDataControl/Transport/TRDataImporter.cs index 8ed2758af..9dab1691d 100644 --- a/TRDataControl/Transport/TRDataImporter.cs +++ b/TRDataControl/Transport/TRDataImporter.cs @@ -14,6 +14,7 @@ public abstract class TRDataImporter : TRDataTransport public List TypesToRemove { get; set; } = new(); public bool ClearUnusedSprites { get; set; } public string TextureRemapPath { get; set; } + public ITexturePositionMonitor TextureMonitor { get; set; } public bool IgnoreGraphics { get; set; } public bool ForceCinematicOverwrite { get; set; } @@ -278,14 +279,20 @@ protected void RemoveData() switch (blobType) { case TRBlobType.Model: - staleTextures.AddRange(Models[type].Meshes - .SelectMany(m => m.TexturedFaces.Select(t => (int)t.Texture))); - Models.Remove(id); + if (Models.ContainsKey(id)) + { + staleTextures.AddRange(Models[type].Meshes + .SelectMany(m => m.TexturedFaces.Select(t => (int)t.Texture))); + Models.Remove(id); + } break; case TRBlobType.StaticMesh: - staleTextures.AddRange(StaticMeshes[type].Mesh.TexturedFaces.Select(t => (int)t.Texture)); - StaticMeshes.Remove(id); + if (StaticMeshes.ContainsKey(id)) + { + staleTextures.AddRange(StaticMeshes[type].Mesh.TexturedFaces.Select(t => (int)t.Texture)); + StaticMeshes.Remove(id); + } break; case TRBlobType.Sprite: @@ -301,6 +308,8 @@ protected void RemoveData() CreateRemapper(Level)?.RemoveUnusedTextures(staleTextures, (tile, bounds) => remapGroup?.CanRemoveRectangle(tile, bounds, TypesToRemove) ?? true); } + + TextureMonitor?.OnTexturesRemoved(TypesToRemove); } protected void ImportTextures(List blobs) @@ -373,6 +382,8 @@ protected void ImportTextures(List blobs) } } + Dictionary> texturePositions = new(); + foreach (B blob in blobs) { if (blob.IsDependencyOnly) @@ -412,7 +423,21 @@ protected void ImportTextures(List blobs) { face.Texture = ImportColour(blob, face.Texture); } + + texturePositions[blob.Alias] = new(); + foreach (var (oldIndex, newIndex) in remap) + { + TRObjectTexture texture = Level.ObjectTextures[newIndex]; + texturePositions[blob.Alias].Add(new() + { + OriginalIndex = oldIndex, + TileIndex = texture.Atlas, + Position = texture.Position + }); + } } + + TextureMonitor?.OnTexturesPositioned(texturePositions); } protected void ImportData(List blobs, TRMesh oldDummyMesh) diff --git a/TRImageControl/Packing/Remapping/ITexturePositionMonitor.cs b/TRImageControl/Packing/Remapping/ITexturePositionMonitor.cs index 1a06abdd4..44ec066a6 100644 --- a/TRImageControl/Packing/Remapping/ITexturePositionMonitor.cs +++ b/TRImageControl/Packing/Remapping/ITexturePositionMonitor.cs @@ -1,11 +1,9 @@ namespace TRImageControl.Packing; -// This allows external callers to monitor specific textures for specific entities by providing a list -// of texture indices it wants to observe. When the import completes, a map of entity to a list of -// PositionedTextures will be returned to it for processing as necessary. -public interface ITexturePositionMonitor where E : Enum +public interface ITexturePositionMonitor + where T : Enum { - Dictionary> GetMonitoredTextureIndices(); - void MonitoredTexturesPositioned(Dictionary> texturePositions); - void EntityTexturesRemoved(List entities); + Dictionary> GetMonitoredIndices(); + void OnTexturesPositioned(Dictionary> texturePositions); + void OnTexturesRemoved(List types); } diff --git a/TRImageControl/Packing/Remapping/PositionedTexture.cs b/TRImageControl/Packing/Remapping/PositionedTexture.cs index bab2754a2..a0c8c515e 100644 --- a/TRImageControl/Packing/Remapping/PositionedTexture.cs +++ b/TRImageControl/Packing/Remapping/PositionedTexture.cs @@ -4,15 +4,7 @@ namespace TRImageControl.Packing; public class PositionedTexture { - private readonly TRTextileSegment _segment; - - public int OriginalIndex => _segment.Index; - public int TileIndex => _segment.Atlas; - public Point Position => new(_segment.Bounds.X, _segment.Bounds.Y); - public Rectangle Bounds => _segment.Bounds; - - public PositionedTexture(TRTextileSegment segment) - { - _segment = segment; - } + public int OriginalIndex { get; set; } + public int TileIndex { get; set; } + public Point Position { get; set; } } diff --git a/TRRandomizerCore/Processors/TR3/TR3SequenceProcessor.cs b/TRRandomizerCore/Processors/TR3/TR3SequenceProcessor.cs index bacbd71ec..c52ea1bc8 100644 --- a/TRRandomizerCore/Processors/TR3/TR3SequenceProcessor.cs +++ b/TRRandomizerCore/Processors/TR3/TR3SequenceProcessor.cs @@ -164,7 +164,7 @@ private void ImportUPV(TR3CombinedLevel level) LevelName = level.Name, TypesToImport = upvImport, DataFolder = GetResourcePath(@"TR3\Objects"), - //TexturePositionMonitor = TextureMonitor.CreateMonitor(level.Name, upvImport) + TextureMonitor = TextureMonitor.CreateMonitor(level.Name, upvImport) }; importer.Import(); diff --git a/TRRandomizerCore/Randomizers/TR1/TR1EnemyRandomizer.cs b/TRRandomizerCore/Randomizers/TR1/TR1EnemyRandomizer.cs index 4dff2d22c..54cfb3fdf 100644 --- a/TRRandomizerCore/Randomizers/TR1/TR1EnemyRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR1/TR1EnemyRandomizer.cs @@ -1376,7 +1376,7 @@ protected override void ProcessImpl() Level = level.Data, LevelName = level.Name, DataFolder = _outer.GetResourcePath(@"TR1\Objects"), - //TexturePositionMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, enemies.EntitiesToImport) + TextureMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, enemies.TypesToImport) }; string remapPath = @"TR1\Textures\Deduplication\" + level.Name + "-TextureRemap.json"; diff --git a/TRRandomizerCore/Randomizers/TR1/TR1OutfitRandomizer.cs b/TRRandomizerCore/Randomizers/TR1/TR1OutfitRandomizer.cs index 9cb91b794..ffc23b4f3 100644 --- a/TRRandomizerCore/Randomizers/TR1/TR1OutfitRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR1/TR1OutfitRandomizer.cs @@ -305,7 +305,7 @@ private void ImportBraid(TR1CombinedLevel level) LevelName = level.Name, ClearUnusedSprites = false, TypesToImport = _ponytailEntities, - //TexturePositionMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, _ponytailEntities), + TextureMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, _ponytailEntities), DataFolder = _outer.GetResourcePath(@"TR1\Objects") }; @@ -881,7 +881,7 @@ private void ConvertToMauledOutfit(TR1CombinedLevel level) LevelName = level.CutSceneLevel.Name, ClearUnusedSprites = false, TypesToImport = _mauledEntities, - //TexturePositionMonitor = _outer.TextureMonitor.CreateMonitor(level.CutSceneLevel.Name, _mauledEntities), + TextureMonitor = _outer.TextureMonitor.CreateMonitor(level.CutSceneLevel.Name, _mauledEntities), DataFolder = _outer.GetResourcePath(@"TR1\Objects") }; diff --git a/TRRandomizerCore/Randomizers/TR1/TR1TextureRandomizer.cs b/TRRandomizerCore/Randomizers/TR1/TR1TextureRandomizer.cs index 152ece1e4..241e84e3e 100644 --- a/TRRandomizerCore/Randomizers/TR1/TR1TextureRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR1/TR1TextureRandomizer.cs @@ -217,8 +217,8 @@ private TR1TextureMapping GetMapping(TR1CombinedLevel level) level.JsonID, _textureDatabase, TextureMonitor.GetLevelMapping(level.Name), - TextureMonitor.GetIgnoredEntities(level.Name), - TextureMonitor.GetEntityMap(level.Name) + TextureMonitor.GetIgnoredTypes(level.Name), + TextureMonitor.GetTypeMap(level.Name) ); } } diff --git a/TRRandomizerCore/Randomizers/TR2/TR2EnemyRandomizer.cs b/TRRandomizerCore/Randomizers/TR2/TR2EnemyRandomizer.cs index fcb30cbe7..5a8cd09ea 100644 --- a/TRRandomizerCore/Randomizers/TR2/TR2EnemyRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR2/TR2EnemyRandomizer.cs @@ -1036,7 +1036,7 @@ private bool Import(TR2CombinedLevel level, EnemyTransportCollection enemies) LevelName = level.Name, DataFolder = _outer.GetResourcePath(@"TR2\Objects"), TextureRemapPath = _outer.GetResourcePath(@"TR2\Textures\Deduplication\" + level.JsonID + "-TextureRemap.json"), - //TexturePositionMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, enemies.EntitiesToImport) + TextureMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, enemies.TypesToImport) }; importer.Data.AliasPriority = TR2EnemyUtilities.GetAliasPriority(level.Name, enemies.TypesToImport); diff --git a/TRRandomizerCore/Randomizers/TR2/TR2ItemRandomizer.cs b/TRRandomizerCore/Randomizers/TR2/TR2ItemRandomizer.cs index efcff5465..cfe55031e 100644 --- a/TRRandomizerCore/Randomizers/TR2/TR2ItemRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR2/TR2ItemRandomizer.cs @@ -619,7 +619,7 @@ private void RandomizeVehicles() ClearUnusedSprites = false, TypesToImport = new(vehicles.Keys), DataFolder = GetResourcePath(@"TR2\Objects"), - //TexturePositionMonitor = TextureMonitor.CreateMonitor(_levelInstance.Name, vehicles.Keys.ToList()) + TextureMonitor = TextureMonitor.CreateMonitor(_levelInstance.Name, vehicles.Keys.ToList()) }; diff --git a/TRRandomizerCore/Randomizers/TR2/TR2OutfitRandomizer.cs b/TRRandomizerCore/Randomizers/TR2/TR2OutfitRandomizer.cs index 06e96d98b..f2303be01 100644 --- a/TRRandomizerCore/Randomizers/TR2/TR2OutfitRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR2/TR2OutfitRandomizer.cs @@ -259,7 +259,7 @@ private bool Import(TR2CombinedLevel level, TR2Type lara) ClearUnusedSprites = false, TypesToImport = laraImport, TypesToRemove = laraRemovals, - //TexturePositionMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, laraImport), + TextureMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, laraImport), DataFolder = _outer.GetResourcePath(@"TR2\Objects") }; diff --git a/TRRandomizerCore/Randomizers/TR2/TR2TextureRandomizer.cs b/TRRandomizerCore/Randomizers/TR2/TR2TextureRandomizer.cs index 723886ac2..19cc4c5b5 100644 --- a/TRRandomizerCore/Randomizers/TR2/TR2TextureRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR2/TR2TextureRandomizer.cs @@ -211,7 +211,7 @@ private TR2TextureMapping GetMapping(TR2CombinedLevel level) level.JsonID, _textureDatabase, TextureMonitor.GetLevelMapping(level.Name), - TextureMonitor.GetIgnoredEntities(level.Name) + TextureMonitor.GetIgnoredTypes(level.Name) ); } } diff --git a/TRRandomizerCore/Randomizers/TR3/TR3EnemyRandomizer.cs b/TRRandomizerCore/Randomizers/TR3/TR3EnemyRandomizer.cs index a6cafd5fa..65554dd54 100644 --- a/TRRandomizerCore/Randomizers/TR3/TR3EnemyRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR3/TR3EnemyRandomizer.cs @@ -734,7 +734,7 @@ protected override void ProcessImpl() Level = level.Data, LevelName = level.Name, DataFolder = _outer.GetResourcePath(@"TR3\Objects"), - //TexturePositionMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, enemies.EntitiesToImport) + TextureMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, enemies.TypesToImport) }; string remapPath = @"TR3\Textures\Deduplication\" + level.Name + "-TextureRemap.json"; diff --git a/TRRandomizerCore/Randomizers/TR3/TR3OutfitRandomizer.cs b/TRRandomizerCore/Randomizers/TR3/TR3OutfitRandomizer.cs index f494d414a..eb78478a6 100644 --- a/TRRandomizerCore/Randomizers/TR3/TR3OutfitRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR3/TR3OutfitRandomizer.cs @@ -233,7 +233,7 @@ private bool Import(TR3CombinedLevel level, TR3Type lara) ClearUnusedSprites = false, TypesToImport = laraImport, TypesToRemove = laraRemovals, - //TexturePositionMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, laraImport), + TextureMonitor = _outer.TextureMonitor.CreateMonitor(level.Name, laraImport), DataFolder = _outer.GetResourcePath(@"TR3\Objects") }; diff --git a/TRRandomizerCore/Randomizers/TR3/TR3SecretRandomizer.cs b/TRRandomizerCore/Randomizers/TR3/TR3SecretRandomizer.cs index 84de18d85..5bbc5b80c 100644 --- a/TRRandomizerCore/Randomizers/TR3/TR3SecretRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR3/TR3SecretRandomizer.cs @@ -753,7 +753,7 @@ protected override void ProcessImpl() LevelName = level.Name, TypesToImport = allocation.ImportModels, DataFolder = _outer.GetResourcePath(@"TR3\Objects"), - //TexturePositionMonitor = monitor + TextureMonitor = monitor }; importer.Import(); @@ -782,8 +782,8 @@ protected override void ProcessImpl() SetPuzzleTypeName(level, puzzlePickupType, _pickupNames[artefactPickupType]); // Tell the texture monitor that these artefacts are puzzle items - monitor.EntityMap[artefactPickupType] = puzzlePickupType; - monitor.EntityMap[artefactMenuType] = puzzleMenuType; + monitor.TypeMap[artefactPickupType] = puzzlePickupType; + monitor.TypeMap[artefactMenuType] = puzzleMenuType; } } diff --git a/TRRandomizerCore/Randomizers/TR3/TR3TextureRandomizer.cs b/TRRandomizerCore/Randomizers/TR3/TR3TextureRandomizer.cs index 2783cef9e..21a6fb8bd 100644 --- a/TRRandomizerCore/Randomizers/TR3/TR3TextureRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR3/TR3TextureRandomizer.cs @@ -215,8 +215,8 @@ private TR3TextureMapping GetMapping(TR3CombinedLevel level) level.Name, _textureDatabase, TextureMonitor.GetLevelMapping(level.Name), - TextureMonitor.GetIgnoredEntities(level.Name), - TextureMonitor.GetEntityMap(level.Name) + TextureMonitor.GetIgnoredTypes(level.Name), + TextureMonitor.GetTypeMap(level.Name) ); } } diff --git a/TRRandomizerCore/Resources/TR2/Environment/CATACOMB.TR2-Environment.json b/TRRandomizerCore/Resources/TR2/Environment/CATACOMB.TR2-Environment.json index d826e7954..669dea8bc 100644 --- a/TRRandomizerCore/Resources/TR2/Environment/CATACOMB.TR2-Environment.json +++ b/TRRandomizerCore/Resources/TR2/Environment/CATACOMB.TR2-Environment.json @@ -441,6 +441,7 @@ { "Comments": "Add a bowl where the spikes were.", "EMType": 24, + "MeshID": 302, "Locations": [ { "X": 47616, diff --git a/TRRandomizerCore/Resources/TR2/Environment/EMPRTOMB.TR2-Environment.json b/TRRandomizerCore/Resources/TR2/Environment/EMPRTOMB.TR2-Environment.json index 821efd705..5709b2b7a 100644 --- a/TRRandomizerCore/Resources/TR2/Environment/EMPRTOMB.TR2-Environment.json +++ b/TRRandomizerCore/Resources/TR2/Environment/EMPRTOMB.TR2-Environment.json @@ -1928,7 +1928,6 @@ "Centre": {}, "Vertices": [], "Normals": [], - "Lights": [], "TexturedRectangles": [], "TexturedTriangles": [], "ColouredRectangles": [], diff --git a/TRRandomizerCore/Resources/TR2/Environment/HOUSE.TR2-Environment.json b/TRRandomizerCore/Resources/TR2/Environment/HOUSE.TR2-Environment.json index 60fc0fca7..125692535 100644 --- a/TRRandomizerCore/Resources/TR2/Environment/HOUSE.TR2-Environment.json +++ b/TRRandomizerCore/Resources/TR2/Environment/HOUSE.TR2-Environment.json @@ -134,6 +134,25 @@ } ] } + }, + { + "EMType": 23, + "Rotations": [ + { + "RoomNumber": 8, + "FaceIndices": [ + 15, + 31, + 42 + ], + "VertexRemap": { + "0": 2, + "1": 3, + "2": 0, + "3": 1 + } + } + ] } ], "Any": [ diff --git a/TRRandomizerCore/Resources/TR2/Environment/MONASTRY.TR2-Environment.json b/TRRandomizerCore/Resources/TR2/Environment/MONASTRY.TR2-Environment.json index 98bf788cc..43311f99f 100644 --- a/TRRandomizerCore/Resources/TR2/Environment/MONASTRY.TR2-Environment.json +++ b/TRRandomizerCore/Resources/TR2/Environment/MONASTRY.TR2-Environment.json @@ -3211,7 +3211,7 @@ "Comments": "Add a lever texture for above.", "EMType": 21, "TextureMap": { - "1815": { + "1770": { "63": { "Rectangles": [ 18, @@ -3242,7 +3242,7 @@ "Comments": "Add a lever texture for above.", "EMType": 21, "TextureMap": { - "1815": { + "1770": { "63": { "Rectangles": [ 10, @@ -3273,7 +3273,7 @@ "Comments": "Add a lever texture for above.", "EMType": 21, "TextureMap": { - "1815": { + "1770": { "63": { "Rectangles": [ 13, @@ -3304,7 +3304,7 @@ "Comments": "Add a lever texture for above.", "EMType": 21, "TextureMap": { - "1815": { + "1770": { "63": { "Rectangles": [ 37, @@ -3335,7 +3335,7 @@ "Comments": "Add a lever texture for above.", "EMType": 21, "TextureMap": { - "1815": { + "1770": { "63": { "Rectangles": [ 59, @@ -3366,7 +3366,7 @@ "Comments": "Add a lever texture for above.", "EMType": 21, "TextureMap": { - "1815": { + "1770": { "63": { "Rectangles": [ 65, @@ -3397,7 +3397,7 @@ "Comments": "Add a lever texture for above.", "EMType": 21, "TextureMap": { - "1815": { + "1770": { "63": { "Rectangles": [ 68, @@ -3428,7 +3428,7 @@ "Comments": "Add a lever texture for above.", "EMType": 21, "TextureMap": { - "1815": { + "1770": { "63": { "Rectangles": [ 71, @@ -3459,7 +3459,7 @@ "Comments": "Add a lever texture for above.", "EMType": 21, "TextureMap": { - "1815": { + "1770": { "63": { "Rectangles": [ 74, @@ -3489,7 +3489,7 @@ "Comments": "Add a lever texture for above.", "EMType": 21, "TextureMap": { - "1815": { + "1770": { "63": { "Rectangles": [ 56, @@ -3519,7 +3519,7 @@ "Comments": "Add a lever texture for above.", "EMType": 21, "TextureMap": { - "1815": { + "1770": { "91": { "Rectangles": [ 84, diff --git a/TRRandomizerCore/Resources/TR2/Environment/OPERA.TR2-Environment.json b/TRRandomizerCore/Resources/TR2/Environment/OPERA.TR2-Environment.json index d4fdf9aa5..fa12ca7f3 100644 --- a/TRRandomizerCore/Resources/TR2/Environment/OPERA.TR2-Environment.json +++ b/TRRandomizerCore/Resources/TR2/Environment/OPERA.TR2-Environment.json @@ -1243,7 +1243,6 @@ "Centre": {}, "Vertices": [], "Normals": [], - "Lights": [], "TexturedRectangles": [], "TexturedTriangles": [], "ColouredRectangles": [], diff --git a/TRRandomizerCore/Resources/TR2/Objects/LARAAUTOANIM_H_HOME.TRB b/TRRandomizerCore/Resources/TR2/Objects/LARAAUTOANIM_H_HOME.TRB index 4005d530c..302842e47 100644 Binary files a/TRRandomizerCore/Resources/TR2/Objects/LARAAUTOANIM_H_HOME.TRB and b/TRRandomizerCore/Resources/TR2/Objects/LARAAUTOANIM_H_HOME.TRB differ diff --git a/TRRandomizerCore/Resources/TR2/Objects/LARAHOME.TRB b/TRRandomizerCore/Resources/TR2/Objects/LARAHOME.TRB index 771231c65..f6461a621 100644 Binary files a/TRRandomizerCore/Resources/TR2/Objects/LARAHOME.TRB and b/TRRandomizerCore/Resources/TR2/Objects/LARAHOME.TRB differ diff --git a/TRRandomizerCore/Resources/TR2/Objects/LARAPISTOLANIM_H_HOME.TRB b/TRRandomizerCore/Resources/TR2/Objects/LARAPISTOLANIM_H_HOME.TRB index 3c7a98914..72f665913 100644 Binary files a/TRRandomizerCore/Resources/TR2/Objects/LARAPISTOLANIM_H_HOME.TRB and b/TRRandomizerCore/Resources/TR2/Objects/LARAPISTOLANIM_H_HOME.TRB differ diff --git a/TRRandomizerCore/Resources/TR2/Objects/LARAUZIANIM_H_HOME.TRB b/TRRandomizerCore/Resources/TR2/Objects/LARAUZIANIM_H_HOME.TRB index 8bc5b43c0..bbe569d53 100644 Binary files a/TRRandomizerCore/Resources/TR2/Objects/LARAUZIANIM_H_HOME.TRB and b/TRRandomizerCore/Resources/TR2/Objects/LARAUZIANIM_H_HOME.TRB differ diff --git a/TRRandomizerCore/Resources/TR2/Textures/Deduplication/HOUSE.TR2-TextureRemap.json b/TRRandomizerCore/Resources/TR2/Textures/Deduplication/HOUSE.TR2-TextureRemap.json index 9e26dfeeb..e9988cfa9 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Deduplication/HOUSE.TR2-TextureRemap.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Deduplication/HOUSE.TR2-TextureRemap.json @@ -1 +1,116 @@ -{} \ No newline at end of file +{ + "Dependencies": [ + { + "Types": [ + 243 + ], + "TileIndex": 12, + "Bounds": "112, 160, 24, 32" + }, + { + "Types": [ + 243 + ], + "TileIndex": 12, + "Bounds": "48, 184, 24, 32" + }, + { + "Types": [ + 243 + ], + "TileIndex": 12, + "Bounds": "208, 191, 24, 32" + }, + { + "Types": [ + 243 + ], + "TileIndex": 12, + "Bounds": "232, 207, 24, 32" + }, + { + "Types": [ + 243 + ], + "TileIndex": 13, + "Bounds": "176, 0, 24, 32" + }, + { + "Types": [ + 243 + ], + "TileIndex": 13, + "Bounds": "0, 32, 24, 16" + }, + { + "Types": [ + 243 + ], + "TileIndex": 7, + "Bounds": "64, 152, 16, 16" + }, + { + "Types": [ + 243 + ], + "TileIndex": 7, + "Bounds": "48, 136, 16, 16" + }, + { + "Types": [ + 243 + ], + "TileIndex": 7, + "Bounds": "240, 144, 16, 16" + }, + { + "Types": [ + 243 + ], + "TileIndex": 7, + "Bounds": "80, 152, 16, 16" + }, + { + "Types": [ + 243 + ], + "TileIndex": 7, + "Bounds": "208, 160, 16, 16" + }, + { + "Types": [ + 243 + ], + "TileIndex": 7, + "Bounds": "160, 120, 16, 16" + }, + { + "Types": [ + 243 + ], + "TileIndex": 7, + "Bounds": "104, 248, 8, 8" + }, + { + "Types": [ + 243 + ], + "TileIndex": 14, + "Bounds": "40, 208, 8, 16" + }, + { + "Types": [ + 243 + ], + "TileIndex": 8, + "Bounds": "128, 32, 8, 8" + }, + { + "Types": [ + 170 + ], + "TileIndex": 8, + "Bounds": "224, 32, 8, 8" + } + ] +} \ No newline at end of file diff --git a/TRRandomizerCore/Resources/TR2/Textures/Mapping/ASSAULT.TR2-Textures.json b/TRRandomizerCore/Resources/TR2/Textures/Mapping/ASSAULT.TR2-Textures.json index 35f6bd09a..137faf920 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Mapping/ASSAULT.TR2-Textures.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Mapping/ASSAULT.TR2-Textures.json @@ -380,22 +380,15 @@ "HSH.Tiles": [ { - "Segment": 0, - "Tile": 0, - "X": 192, - "Y": 0 + "X": 192 }, { - "Segment": 1, - "Tile": 0, - "X": 128, - "Y": 0 + "X": 128 }, { - "Segment": 2, + "Segment": 1, "Tile": 2, - "X": 0, - "Y": 70 + "Y": 69 } ], diff --git a/TRRandomizerCore/Resources/TR2/Textures/Mapping/EMPRTOMB.TR2-Textures.json b/TRRandomizerCore/Resources/TR2/Textures/Mapping/EMPRTOMB.TR2-Textures.json index 6b4c82f0e..6d5b5ab7f 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Mapping/EMPRTOMB.TR2-Textures.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Mapping/EMPRTOMB.TR2-Textures.json @@ -330,13 +330,13 @@ "Y": 248 }, { - "Segment": 8, + "Segment": 9, "Tile": 12, "X": 16, "Y": 208 }, { - "Segment": 9, + "Segment": 8, "Tile": 12, "X": 192, "Y": 104 diff --git a/TRRandomizerCore/Resources/TR2/Textures/Mapping/HOUSE.TR2-Textures.json b/TRRandomizerCore/Resources/TR2/Textures/Mapping/HOUSE.TR2-Textures.json index ec62b86ca..611d9f392 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Mapping/HOUSE.TR2-Textures.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Mapping/HOUSE.TR2-Textures.json @@ -2,240 +2,193 @@ "Static": { "Enemies.ShotgunGoon": [ { - "Segment": 0, - "Tile": 13, - "X": 96, - "Y": 200 + "Tile": 14, + "X": 72, + "Y": 64 }, { "Segment": 1, "Tile": 12, - "X": 64, - "Y": 72 + "X": 80, + "Y": 168 }, { "Segment": 2, - "Tile": 12, - "X": 160, - "Y": 72 + "Tile": 13, + "X": 200 } ], - "Enemies.StickGoon.BlackJacket": [ + "Fire.Explosion": [ { - "Segment": 0, - "Tile": 9, - "X": 224, - "Y": 88 + "Tile": 8, + "X": 76, + "Y": 98 }, { "Segment": 1, - "Tile": 9, - "X": 176, - "Y": 128 + "Tile": 8, + "X": 164, + "Y": 98 }, { "Segment": 2, "Tile": 9, - "X": 200, - "Y": 168 - }, - { - "Segment": 3, - "Tile": 11, - "X": 160, - "Y": 0 - }, - { - "Segment": 4, - "Tile": 15, - "X": 96, + "X": 88, "Y": 104 - } - ], - - "Fire.Explosion": [ - { - "Segment": 0, - "Tile": 0, - "X": 13, - "Y": 178 - }, - { - "Segment": 1, - "Tile": 0, - "X": 101, - "Y": 178 - }, - { - "Segment": 2, - "Tile": 8, - "X": 0, - "Y": 156 }, { "Segment": 3, - "Tile": 8, + "Tile": 9, "X": 2, - "Y": 205 + "Y": 137 }, { "Segment": 4, - "Tile": 0, - "X": 162, - "Y": 4 + "Tile": 8, + "X": 129, + "Y": 164 }, { "Segment": 5, - "Tile": 7, - "X": 25, - "Y": 192 + "Tile": 9, + "X": 1 }, { "Segment": 6, - "Tile": 8, - "X": 2, + "Tile": 9, + "X": 170, "Y": 2 }, { "Segment": 7, - "Tile": 7, - "X": 112, - "Y": 192 + "Tile": 9, + "X": 88 }, { "Segment": 8, - "Tile": 8, - "X": 128, - "Y": 108 + "Tile": 9, + "X": 96, + "Y": 96 }, { "Segment": 9, - "Tile": 8, - "X": 80, - "Y": 161 + "Tile": 9, + "X": 168, + "Y": 109 }, { "Segment": 10, "Tile": 9, - "X": 2, - "Y": 3 + "X": 126, + "Y": 203 }, { "Segment": 11, - "Tile": 8, - "X": 140, - "Y": 211 + "Tile": 10, + "X": 68, + "Y": 7 }, { "Segment": 12, - "Tile": 9, - "X": 128, - "Y": 92 + "Tile": 10, + "X": 144, + "Y": 52 }, { "Segment": 13, - "Tile": 10, - "X": 122, - "Y": 174 + "Tile": 6, + "X": 218, + "Y": 110 } ], "Fire.Flame": [ { - "Segment": 0, - "Tile": 9, - "X": 80, - "Y": 168 + "Tile": 12, + "X": 144, + "Y": 40 }, { "Segment": 1, "Tile": 9, - "X": 152, - "Y": 168 + "X": 232, + "Y": 104 }, { "Segment": 2, - "Tile": 9, - "X": 128, - "Y": 168 + "Tile": 12, + "X": 224 }, { "Segment": 3, - "Tile": 9, - "X": 0, - "Y": 208 + "Tile": 12, + "Y": 40 }, { "Segment": 4, - "Tile": 9, - "X": 224, - "Y": 168 + "Tile": 12, + "X": 160 }, { "Segment": 5, - "Tile": 9, - "X": 104, - "Y": 168 + "Tile": 12, + "X": 88 } ], "Fire.Flare": [ { - "Segment": 0, - "Tile": 13, - "X": 8, - "Y": 48 + "Tile": 14, + "X": 208, + "Y": 144 }, { - "Segment": 0, - "Tile": 8, - "X": 187, - "Y": 104, - "Clip": "0, 0, 3, 3" + "Tile": 6, + "X": 240, + "Y": 248, + "Clip": "0, 16, 8, 8" }, { "Segment": 1, - "Tile": 15, - "X": 112, - "Y": 16 + "Tile": 14, + "X": 176, + "Y": 184 }, { "Segment": 2, - "Tile": 14, - "X": 0, - "Y": 192 + "Tile": 7, + "X": 32, + "Y": 136 }, { "Segment": 3, - "Tile": 14, - "X": 48, - "Y": 176 + "Tile": 7, + "Y": 136 }, { "Segment": 4, "Tile": 11, - "X": 135, - "Y": 195 + "X": 211, + "Y": 187 }, { "Segment": 5, "Tile": 14, - "X": 72, - "Y": 32 + "X": 232, + "Y": 40 } ], "HSH.Carpet": [ { - "Segment": 0, "Tile": 2, - "X": 0, - "Y": 192 + "X": 64, + "Y": 64 }, { "Segment": 1, - "Tile": 3, + "Tile": 2, "X": 192, "Y": 192 } @@ -243,644 +196,616 @@ "HSH.Cushions": [ { - "Segment": 0, - "Tile": 10, - "X": 184, - "Y": 168 + "Tile": 6, + "Y": 160 } ], "HSH.Duvet": [ { - "Segment": 0, - "Tile": 7, - "X": 128, - "Y": 0 + "Tile": 5, + "Y": 64 }, { "Segment": 1, "Tile": 10, - "X": 64, - "Y": 72 + "X": 128, + "Y": 208 }, { "Segment": 2, "Tile": 10, - "X": 80, - "Y": 40 + "X": 64, + "Y": 192 } ], "HSH.Marble": [ { - "Segment": 0, - "Tile": 6, - "X": 192, - "Y": 128 + "Tile": 4, + "X": 128, + "Y": 192 }, { "Segment": 1, - "Tile": 10, - "X": 128, - "Y": 72 + "Tile": 8, + "Y": 224 }, { "Segment": 2, - "Tile": 6, - "X": 0, - "Y": 128 + "Tile": 2, + "X": 192, + "Y": 64 }, { "Segment": 3, - "Tile": 6, - "X": 0, - "Y": 192 + "Tile": 3, + "Y": 64 }, { "Segment": 4, - "Tile": 6, - "X": 0, - "Y": 247 + "Tile": 3, + "Y": 119 }, { "Segment": 5, - "Tile": 6, - "X": 192, - "Y": 209 + "Tile": 1, + "X": 128, + "Y": 81 }, { "Segment": 6, - "Tile": 6, - "X": 145, + "Tile": 1, + "X": 81, "Y": 145 }, { "Segment": 7, - "Tile": 6, - "X": 0, - "Y": 202 + "Tile": 3, + "Y": 74 }, { "Segment": 8, - "Tile": 6, - "X": 145, + "Tile": 1, + "X": 81, "Y": 155 }, { "Segment": 9, - "Tile": 6, + "Tile": 2, "X": 115, - "Y": 64 + "Y": 128 }, { "Segment": 10, - "Tile": 9, - "X": 0, - "Y": 168 + "Tile": 11, + "X": 208, + "Y": 112 } ], "HSH.Paintings": [ { - "Segment": 0, - "Tile": 6, - "X": 146, - "Y": 0, + "Tile": 5, + "X": 82, + "Y": 128, "Clip": "0, 0, 46, 64" }, { - "Segment": 0, - "Tile": 6, - "X": 64, - "Y": 0, + "Tile": 5, + "X": 192, + "Y": 128, "Clip": "46, 0, 55, 64" }, { "Segment": 1, - "Tile": 1, - "X": 128, - "Y": 128, + "Tile": 4, + "X": 192, "Clip": "46, 0, 47, 64" }, { "Segment": 1, - "Tile": 2, + "Tile": 4, "X": 18, - "Y": 0, + "Y": 192, "Clip": "0, 0, 46, 64" }, { "Segment": 2, - "Tile": 2, + "Tile": 3, "X": 192, - "Y": 64, + "Y": 192, "Clip": "0, 0, 64, 64" }, { "Segment": 2, - "Tile": 2, - "X": 0, + "Tile": 4, + "X": 192, "Y": 128, "Clip": "64, 0, 64, 64" }, { "Segment": 3, "Tile": 10, - "X": 64, - "Y": 104, + "X": 136, + "Y": 176, "Clip": "0, 0, 64, 32" }, { "Segment": 3, "Tile": 10, - "X": 144, - "Y": 40, + "Y": 153, "Clip": "0, 32, 64, 32" }, { "Segment": 4, - "Tile": 1, - "X": 205, - "Y": 70 + "Tile": 2, + "X": 141, + "Y": 134 }, { "Segment": 5, - "Tile": 3, - "X": 7, - "Y": 198 + "Tile": 6, + "X": 135, + "Y": 6 }, { "Segment": 6, - "Tile": 3, + "Tile": 6, "X": 68, - "Y": 134 + "Y": 6 }, { "Segment": 7, - "Tile": 3, + "Tile": 6, "X": 95, - "Y": 134 + "Y": 6 }, { "Segment": 8, - "Tile": 2, "X": 157, - "Y": 134 + "Y": 6 }, { "Segment": 9, - "Tile": 2, - "X": 139, - "Y": 205 + "Tile": 1, + "X": 11, + "Y": 141 }, { "Segment": 10, - "Tile": 2, - "X": 170, - "Y": 215 + "Tile": 1, + "X": 42, + "Y": 150 } ], "HSH.Tiles": [ { - "Segment": 0, - "Tile": 4, - "X": 64, - "Y": 192 + "Y": 64 }, { - "Segment": 2, - "Tile": 5, - "X": 192, - "Y": 6 + "Segment": 1, + "Tile": 3, + "X": 128, + "Y": 69 } ], "Inventory.Background": [ { - "Segment": 0, "Tile": 5, "X": 128, - "Y": 64 + "Y": 128 } ], "Inventory.Health": [ { - "Segment": 0, - "Tile": 12, + "Tile": 13, "X": 90, - "Y": 53 + "Y": 5 }, { "Segment": 1, "Tile": 13, - "X": 152, - "Y": 232 + "X": 96, + "Y": 200 }, { "Segment": 1, "Tile": 13, - "X": 152, - "Y": 216, + "X": 72, + "Y": 200, "Clip": "0, 3, 8, 7" }, { - "Segment": 2, - "Tile": 9, - "X": 26, - "Y": 105 + "Segment": 1, + "Tile": 12, + "X": 88, + "Y": 248, + "Clip": "0, 3, 8, 7" + }, + { + "Segment": 2, + "Tile": 10, + "X": 98, + "Y": 65 }, { "Segment": 3, - "Tile": 9, - "X": 89, - "Y": 99 + "Tile": 10, + "X": 97, + "Y": 163 } ], "Inventory.Passport": [ { - "Segment": 0, - "Tile": 0, - "X": 88, - "Y": 0 + "Tile": 8, + "Y": 48 } ], "Lara.Bobble": [ { - "Segment": 0, - "Tile": 14, - "X": 160, - "Y": 176 + "Tile": 6, + "X": 112, + "Y": 232 }, { - "Segment": 0, - "Tile": 14, - "X": 128, - "Y": 192 + "Tile": 7, + "X": 176, + "Y": 152 } ], "Lara.Braid": [ { - "Segment": 0, - "Tile": 13, - "X": 208, - "Y": 35 + "Tile": 14, + "X": 152, + "Y": 11 } ], "Lara.DressingGown": [ { - "Segment": 0, - "Tile": 9, - "X": 24, - "Y": 208 + "Tile": 12 }, { "Segment": 1, - "Tile": 14, - "X": 144, - "Y": 16 + "Tile": 13, + "X": 224, + "Y": 232 }, { "Segment": 2, "Tile": 14, - "X": 168, - "Y": 16 + "X": 208, + "Y": 48 }, { "Segment": 3, - "Tile": 12, - "X": 48, - "Y": 0 + "Tile": 11, + "X": 64, + "Y": 208 }, { "Segment": 4, - "Tile": 12, - "X": 96, - "Y": 0 + "Tile": 11, + "X": 120, + "Y": 200 }, { "Segment": 5, "Tile": 14, - "X": 144, - "Y": 32 + "Y": 24 }, { "Segment": 6, - "Tile": 15, - "X": 120, - "Y": 128 + "Tile": 14, + "X": 184, + "Y": 168 }, { "Segment": 7, "Tile": 14, - "X": 168, + "X": 184, "Y": 32 }, { "Segment": 8, - "Tile": 15, - "X": 144, - "Y": 128 + "Tile": 14, + "X": 80, + "Y": 168 }, { "Segment": 9, "Tile": 14, - "X": 48, - "Y": 32 + "X": 184, + "Y": 16 }, { "Segment": 10, "Tile": 14, - "X": 216, - "Y": 0 + "X": 128 }, { "Segment": 11, - "Tile": 14, - "X": 64, - "Y": 176 + "Tile": 7, + "X": 16, + "Y": 152 }, { "Segment": 12, - "Tile": 14, - "X": 48, - "Y": 192 + "Tile": 7, + "X": 32, + "Y": 152 }, { "Segment": 13, - "Tile": 14, - "X": 224, - "Y": 192 + "Tile": 7, + "X": 160, + "Y": 136 }, { "Segment": 14, - "Tile": 11, - "X": 240, - "Y": 96 + "Tile": 13, + "X": 16, + "Y": 120 }, { "Segment": 15, - "Tile": 11, - "X": 152, - "Y": 128 + "Tile": 13, + "Y": 176 }, { "Segment": 16, - "Tile": 10, - "X": 241, - "Y": 0 + "Tile": 14, + "X": 32, + "Y": 136 }, { "Segment": 17, - "Tile": 10, - "X": 248, - "Y": 168 + "Tile": 14, + "X": 112, + "Y": 136 }, { "Segment": 18, - "Tile": 11, - "X": 8, - "Y": 160 + "Tile": 14, + "X": 248, + "Y": 128 }, { "Segment": 19, - "Tile": 11, - "X": 16, - "Y": 160 + "Tile": 14, + "X": 128, + "Y": 136 }, { "Segment": 20, - "Tile": 11, - "X": 24, - "Y": 160 + "Tile": 14, + "X": 136, + "Y": 136 }, { "Segment": 21, - "Tile": 11, - "X": 32, - "Y": 160 + "Tile": 14, + "X": 144, + "Y": 136 }, { "Segment": 22, - "Tile": 11, - "X": 48, - "Y": 160 + "Tile": 13, + "X": 240, + "Y": 184 }, { "Segment": 23, - "Tile": 11, - "X": 64, - "Y": 160 + "Tile": 14, + "X": 248, + "Y": 96 }, { "Segment": 24, - "Tile": 11, - "X": 208, - "Y": 128 + "Tile": 14, + "X": 40, + "Y": 136 }, { "Segment": 25, - "Tile": 11, - "X": 216, - "Y": 128 + "Tile": 14, + "X": 224, + "Y": 136 }, { "Segment": 26, "Tile": 12, - "X": 176, - "Y": 48 + "X": 200, + "Y": 223 }, { "Segment": 27, - "Tile": 12, + "Tile": 7, "X": 192, - "Y": 144 + "Y": 48 }, { "Segment": 28, - "Tile": 15, - "X": 120, - "Y": 136 + "Tile": 14, + "X": 184, + "Y": 152 }, { "Segment": 29, - "Tile": 15, - "X": 32, - "Y": 104 + "Tile": 14, + "X": 64, + "Y": 120 }, { "Segment": 30, - "Tile": 11, - "X": 224, - "Y": 218 + "Tile": 12, + "Y": 192 }, { "Segment": 31, - "Tile": 12, - "X": 144, - "Y": 144 + "Tile": 7, + "X": 96, + "Y": 48 }, { "Segment": 32, - "Tile": 12, - "X": 168, - "Y": 144 + "Tile": 6, + "X": 88, + "Y": 232 }, { "Segment": 33, - "Tile": 12, - "X": 216, - "Y": 168 + "Tile": 7, + "X": 192 }, { "Segment": 34, - "Tile": 12, - "X": 192, - "Y": 192 + "Tile": 6, + "X": 24, + "Y": 224 }, { "Segment": 35, - "Tile": 12, - "X": 240, - "Y": 216 + "Tile": 14, + "X": 72 }, { "Segment": 36, - "Tile": 11, - "X": 234, - "Y": 192 + "Tile": 14, + "X": 32 }, { "Segment": 37, - "Tile": 15, - "X": 0, - "Y": 176 + "Tile": 8, + "X": 152, + "Y": 40 }, { "Segment": 38, - "Tile": 15, - "X": 40, - "Y": 176 + "Tile": 6, + "X": 240, + "Y": 96 + }, + { + "Segment": 39, + "Tile": 8, + "X": 192, + "Y": 32 }, { "Segment": 40, - "Tile": 14, - "X": 16, - "Y": 176 + "Tile": 7, + "X": 112, + "Y": 200 }, { "Segment": 41, - "Tile": 14, - "X": 32, - "Y": 176 + "Tile": 7, + "X": 208, + "Y": 192 }, { "Segment": 42, - "Tile": 14, - "X": 128, - "Y": 144 + "Tile": 7, + "X": 48, + "Y": 136 }, { "Segment": 43, - "Tile": 14, - "X": 144, + "Tile": 7, + "X": 240, "Y": 144 }, { "Segment": 44, - "Tile": 14, - "X": 128, - "Y": 176 + "Tile": 8, + "X": 160 }, { "Segment": 45, - "Tile": 14, - "X": 144, - "Y": 176 + "Tile": 7, + "X": 208, + "Y": 144 }, { "Segment": 46, - "Tile": 14, - "X": 240, - "Y": 176 + "Tile": 8, + "X": 144 }, { "Segment": 47, - "Tile": 15, - "X": 168, - "Y": 128 + "Tile": 14, + "Y": 152 }, { "Segment": 48, - "Tile": 15, - "X": 144, - "Y": 136 + "Tile": 14, + "X": 88, + "Y": 152 }, { "Segment": 49, - "Tile": 15, - "X": 160, - "Y": 168 + "Tile": 14, + "X": 80, + "Y": 200 + }, + { + "Segment": 50, + "Tile": 8, + "X": 152, + "Y": 32 } ], "Secrets": [ { - "Segment": 1, "Clear": true, - "Tile": 8, - "X": 44, - "Y": 56 + "Tile": 10, + "X": 208, + "Y": 80 }, { - "Segment": 0, + "Segment": 1, "Clear": true, "Tile": 8, - "X": 89, - "Y": 56, - "Clip": "0, 0, 44, 51" + "X": 200, + "Y": 40 }, { "Segment": 2, "Clear": true, "Tile": 8, - "X": 0, - "Y": 56 + "X": 208, + "Y": 160 } ], "Water": [ { - "Segment": 0, - "Tile": 2, "X": 64, - "Y": 192, "Clip": "0, 0, 64, 64" }, { - "Segment": 0, - "Tile": 3, - "X": 0, - "Y": 0, + "Tile": 1, "Clip": "64, 0, 64, 64" }, { "Segment": 1, - "Tile": 2, - "X": 192, + "X": 128, "Y": 192, "Clip": "0, 0, 64, 64" }, { "Segment": 1, - "Tile": 3, - "X": 0, - "Y": 128, + "X": 64, + "Y": 192, "Clip": "64, 0, 64, 64" } ] diff --git a/TRRandomizerCore/Resources/TR2/Textures/Mapping/OPERA.TR2-Textures.json b/TRRandomizerCore/Resources/TR2/Textures/Mapping/OPERA.TR2-Textures.json index 8aa20a27e..55baa1e53 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Mapping/OPERA.TR2-Textures.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Mapping/OPERA.TR2-Textures.json @@ -302,13 +302,13 @@ "Y": 88 }, { - "Segment": 8, + "Segment": 9, "Tile": 11, "X": 80, "Y": 120 }, { - "Segment": 9, + "Segment": 8, "Tile": 11, "X": 200, "Y": 112 diff --git a/TRRandomizerCore/Resources/TR2/Textures/Mapping/PLATFORM.TR2-Textures.json b/TRRandomizerCore/Resources/TR2/Textures/Mapping/PLATFORM.TR2-Textures.json index aec4d68ed..5e6610c41 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Mapping/PLATFORM.TR2-Textures.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Mapping/PLATFORM.TR2-Textures.json @@ -573,13 +573,13 @@ "Y": 16 }, { - "Segment": 8, + "Segment": 9, "Tile": 10, "X": 232, "Y": 64 }, { - "Segment": 9, + "Segment": 8, "Tile": 8, "X": 80, "Y": 200 diff --git a/TRRandomizerCore/Resources/TR2/Textures/Mapping/RIG.TR2-Textures.json b/TRRandomizerCore/Resources/TR2/Textures/Mapping/RIG.TR2-Textures.json index 140648a9a..420233a2e 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Mapping/RIG.TR2-Textures.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Mapping/RIG.TR2-Textures.json @@ -479,13 +479,13 @@ "Y": 56 }, { - "Segment": 8, + "Segment": 9, "Tile": 10, "X": 128, "Y": 112 }, { - "Segment": 9, + "Segment": 8, "Tile": 9, "X": 64, "Y": 56 diff --git a/TRRandomizerCore/Resources/TR2/Textures/Mapping/VENICE.TR2-Textures.json b/TRRandomizerCore/Resources/TR2/Textures/Mapping/VENICE.TR2-Textures.json index 0d6f47e44..37bb9817b 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Mapping/VENICE.TR2-Textures.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Mapping/VENICE.TR2-Textures.json @@ -317,13 +317,13 @@ "Y": 192 }, { - "Segment": 8, + "Segment": 9, "Tile": 10, "X": 32, "Y": 224 }, { - "Segment": 9, + "Segment": 8, "Tile": 8, "X": 232, "Y": 240 diff --git a/TRRandomizerCore/Resources/TR2/Textures/Mapping/WALL.TR2-Textures.json b/TRRandomizerCore/Resources/TR2/Textures/Mapping/WALL.TR2-Textures.json index 3b2d4acdd..414708a29 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Mapping/WALL.TR2-Textures.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Mapping/WALL.TR2-Textures.json @@ -517,13 +517,13 @@ "Y": 104 }, { - "Segment": 8, + "Segment": 9, "Tile": 7, "X": 192, "Y": 80 }, { - "Segment": 9, + "Segment": 8, "Tile": 6, "X": 56, "Y": 216 diff --git a/TRRandomizerCore/Resources/TR2/Textures/Mapping/XIAN.TR2-Textures.json b/TRRandomizerCore/Resources/TR2/Textures/Mapping/XIAN.TR2-Textures.json index 04644b0de..40dd7a00a 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Mapping/XIAN.TR2-Textures.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Mapping/XIAN.TR2-Textures.json @@ -636,13 +636,13 @@ "Y": 120 }, { - "Segment": 8, + "Segment": 9, "Tile": 7, "X": 168, "Y": 56 }, { - "Segment": 9, + "Segment": 8, "Tile": 6, "X": 144, "Y": 200 diff --git a/TRRandomizerCore/Resources/TR2/Textures/Source/Static/HSH/Tiles/Data.json b/TRRandomizerCore/Resources/TR2/Textures/Source/Static/HSH/Tiles/Data.json index 6897a221b..4b77cb214 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Source/Static/HSH/Tiles/Data.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Source/Static/HSH/Tiles/Data.json @@ -2,43 +2,35 @@ "VariantMap": { "Black": [ "0, 0, 64, 64", - "0, 64, 64, 64", - "0, 128, 64, 58" + "0, 64, 64, 59" ], "Blue": [ "64, 0, 64, 64", - "64, 64, 64, 64", - "64, 128, 64, 58" + "64, 64, 64, 59" ], "Green": [ "128, 0, 64, 64", - "128, 64, 64, 64", - "128, 128, 64, 58" + "128, 64, 64, 59" ], "Grey": [ "192, 0, 64, 64", - "192, 64, 64, 64", - "192, 128, 64, 58" + "192, 64, 64, 59" ], "Orange": [ "256, 0, 64, 64", - "256, 64, 64, 64", - "256, 128, 64, 58" + "256, 64, 64, 59" ], "Purple": [ "320, 0, 64, 64", - "320, 64, 64, 64", - "320, 128, 64, 58" + "320, 64, 64, 59" ], "Red": [ "384, 0, 64, 64", - "384, 64, 64, 64", - "384, 128, 64, 58" + "384, 64, 64, 59" ], "VegasLeopard": [ "448, 0, 64, 64", - "448, 64, 64, 64", - "448, 128, 64, 58" + "448, 64, 64, 59" ] } } \ No newline at end of file diff --git a/TRRandomizerCore/Resources/TR2/Textures/Source/Static/HSH/Tiles/Segments.png b/TRRandomizerCore/Resources/TR2/Textures/Source/Static/HSH/Tiles/Segments.png index 77a920719..14a5f5324 100644 Binary files a/TRRandomizerCore/Resources/TR2/Textures/Source/Static/HSH/Tiles/Segments.png and b/TRRandomizerCore/Resources/TR2/Textures/Source/Static/HSH/Tiles/Segments.png differ diff --git a/TRRandomizerCore/Resources/TR2/Textures/Source/Static/Lara/DressingGown/Data.json b/TRRandomizerCore/Resources/TR2/Textures/Source/Static/Lara/DressingGown/Data.json index 3fc78a00d..254a09658 100644 --- a/TRRandomizerCore/Resources/TR2/Textures/Source/Static/Lara/DressingGown/Data.json +++ b/TRRandomizerCore/Resources/TR2/Textures/Source/Static/Lara/DressingGown/Data.json @@ -5,53 +5,53 @@ "EntityTextureMap": { "3300": { - "326": 0, - "538": 14, - "553": 15, - "557": 17, - "559": 16, - "567": 24, - "568": 25, - "577": 18, - "581": 19, - "583": 20, - "585": 21, - "590": 22, - "595": 23, - "607": 3, - "608": 4, - "611": 30, - "617": 26, - "688": 31, - "694": 32, - "695": 27, - "721": 33, - "738": 34, - "768": 36, - "775": 35, - "1010": 10, - "1024": 1, - "1025": 2, - "1035": 9, - "1041": 5, - "1042": 7, - "1232": 40, - "1233": 41, - "1235": 11, - "1240": 44, - "1244": 45, - "1263": 46, - "1268": 12, - "1298": 13, - "1471": 29, - "1519": 6, - "1520": 8, - "1521": 47, - "1530": 28, - "1531": 48, - "1626": 49, - "1654": 37, - "1666": 38 + "89": 0, + "74": 1, + "73": 2, + "1": 3, + "3": 4, + "75": 5, + "78": 6, + "95": 7, + "77": 8, + "88": 9, + "70": 10, + "79": 11, + "71": 12, + "98": 13, + "110": 14, + "111": 15, + "113": 16, + "114": 17, + "127": 18, + "121": 19, + "120": 20, + "123": 21, + "125": 22, + "112": 23, + "115": 24, + "116": 25, + "2": 26, + "5": 27, + "85": 28, + "97": 29, + "4": 30, + "16": 31, + "20": 32, + "17": 33, + "83": 34, + "24": 35, + "19": 36, + "118": 37, + "117": 38, + "81": 40, + "80": 41, + "82": 44, + "96": 45, + "86": 46, + "76": 47, + "84": 48, + "93": 49 } }, @@ -585,6 +585,59 @@ "784, 216, 24, 8", "808, 208, 16, 8", "824, 208, 8, 8" + ], + "Blue": [ + "0, 224, 24, 40", + "24, 224, 24, 16", + "48, 224, 24, 16", + "72, 224, 48, 24", + "120, 224, 48, 24", + "24, 240, 24, 16", + "24, 256, 24, 8", + "48, 240, 24, 16", + "48, 256, 24, 8", + "72, 248, 24, 16", + "96, 248, 24, 16", + "120, 248, 16, 16", + "136, 248, 16, 16", + "152, 248, 16, 16", + "0, 264, 16, 32", + "16, 264, 16, 32", + "32, 264, 8, 32", + "40, 264, 8, 32", + "48, 264, 8, 32", + "56, 264, 8, 32", + "64, 264, 8, 32", + "72, 264, 8, 32", + "80, 264, 8, 32", + "88, 264, 8, 32", + "96, 264, 8, 32", + "104, 264, 8, 32", + "112, 264, 32, 24", + "144, 264, 24, 24", + "112, 288, 24, 8", + "136, 288, 32, 8", + "0, 296, 32, 24", + "32, 296, 24, 24", + "56, 296, 24, 24", + "80, 296, 24, 24", + "104, 296, 24, 24", + "128, 296, 16, 24", + "144, 296, 16, 24", + "160, 296, 8, 8", + "160, 304, 8, 8", + "160, 312, 8, 8", + "0, 320, 16, 16", + "16, 320, 16, 16", + "32, 320, 16, 16", + "48, 320, 16, 16", + "64, 320, 16, 16", + "80, 320, 16, 16", + "96, 320, 16, 16", + "112, 320, 24, 8", + "112, 328, 24, 8", + "136, 320, 16, 8", + "152, 320, 8, 8" ] } } \ No newline at end of file diff --git a/TRRandomizerCore/Resources/TR2/Textures/Source/Static/Lara/DressingGown/Segments.png b/TRRandomizerCore/Resources/TR2/Textures/Source/Static/Lara/DressingGown/Segments.png index 6ed7bf75b..de2ad9e57 100644 Binary files a/TRRandomizerCore/Resources/TR2/Textures/Source/Static/Lara/DressingGown/Segments.png and b/TRRandomizerCore/Resources/TR2/Textures/Source/Static/Lara/DressingGown/Segments.png differ diff --git a/TRRandomizerCore/Textures/Monitoring/AbstractTextureMonitorBroker.cs b/TRRandomizerCore/Textures/Monitoring/AbstractTextureMonitorBroker.cs index d80a1b718..48f3b9744 100644 --- a/TRRandomizerCore/Textures/Monitoring/AbstractTextureMonitorBroker.cs +++ b/TRRandomizerCore/Textures/Monitoring/AbstractTextureMonitorBroker.cs @@ -2,35 +2,35 @@ namespace TRRandomizerCore.Textures; -public abstract class AbstractTextureMonitorBroker - where E : Enum +public abstract class AbstractTextureMonitorBroker + where T : Enum { - private readonly Dictionary> _monitors; - private readonly TextureDatabase _textureDatabase; + private readonly Dictionary> _monitors; + private readonly TextureDatabase _textureDatabase; private readonly object _lock; - protected abstract Dictionary ExpandedMonitorMap { get; } + protected abstract Dictionary ExpandedMonitorMap { get; } public AbstractTextureMonitorBroker() { - _monitors = new Dictionary>(); + _monitors = new(); _textureDatabase = CreateDatabase(); - _lock = new object(); + _lock = new(); } - protected abstract TextureDatabase CreateDatabase(); - protected abstract E TranslateAlias(string lvlName, E entity); + protected abstract TextureDatabase CreateDatabase(); + protected abstract T TranslateAlias(string lvlName, T type); - public TextureMonitor CreateMonitor(string lvlName, List entities = null) + public TextureMonitor CreateMonitor(string lvlName, List types = null) { lock (_lock) { - entities ??= new(); - List> sources = GetSourcesToMonitor(entities); - TextureMonitor monitor = GetMonitor(lvlName); + types ??= new(); + List> sources = GetSourcesToMonitor(types); + TextureMonitor monitor = GetMonitor(lvlName); if (monitor == null) { - monitor = new TextureMonitor(sources); + monitor = new TextureMonitor(sources); _monitors[lvlName] = monitor; } else @@ -42,42 +42,42 @@ public TextureMonitor CreateMonitor(string lvlName, List entities = null) } } - public void ClearMonitor(string lvlName, List entities) + public void ClearMonitor(string lvlName, List types) { lock (_lock) { - TextureMonitor monitor = GetMonitor(lvlName); + TextureMonitor monitor = GetMonitor(lvlName); if (monitor == null) { return; } - List> sources = GetSourcesToMonitor(entities); + List> sources = GetSourcesToMonitor(types); monitor.RemoveSources(sources); } } - private List> GetSourcesToMonitor(List entities) + private List> GetSourcesToMonitor(List types) { - List expandedEntities = new(entities); + List expandedTypes = new(types); // We need to capture things like flames being imported into Boat, Opera, Skidoo and the fact that // the red Skidoo is available when importing MercSnomobDriver. if (ExpandedMonitorMap != null) { - foreach (E entity in ExpandedMonitorMap.Keys) + foreach (T type in ExpandedMonitorMap.Keys) { - if (expandedEntities.Contains(entity) && !expandedEntities.Contains(ExpandedMonitorMap[entity])) + if (expandedTypes.Contains(type) && !expandedTypes.Contains(ExpandedMonitorMap[type])) { - expandedEntities.Add(ExpandedMonitorMap[entity]); + expandedTypes.Add(ExpandedMonitorMap[type]); } } } - List> sources = new(); - foreach (E entity in expandedEntities) + List> sources = new(); + foreach (T type in expandedTypes) { - foreach (StaticTextureSource source in _textureDatabase.GetStaticSource(entity)) + foreach (StaticTextureSource source in _textureDatabase.GetStaticSource(type)) { // Does the source have any defined object texture indices we are interested in monitoring? if (source.EntityTextureMap != null && !sources.Contains(source)) @@ -90,7 +90,7 @@ private List> GetSourcesToMonitor(List entities) return sources; } - public TextureMonitor GetMonitor(string lvlName) + public TextureMonitor GetMonitor(string lvlName) { return _monitors.ContainsKey(lvlName) ? _monitors[lvlName] : null; } @@ -103,30 +103,30 @@ public bool RemoveMonitor(string lvlName) } } - public Dictionary, List> GetLevelMapping(string lvlName) + public Dictionary, List> GetLevelMapping(string lvlName) { - TextureMonitor monitor = GetMonitor(lvlName); + TextureMonitor monitor = GetMonitor(lvlName); return monitor?.PreparedLevelMapping; } - public List GetIgnoredEntities(string lvlName) + public List GetIgnoredTypes(string lvlName) { - TextureMonitor monitor = GetMonitor(lvlName); + TextureMonitor monitor = GetMonitor(lvlName); if (monitor != null && monitor.RemovedTextures != null) { - List entities = new(); - foreach (E entity in monitor.RemovedTextures) + List types = new(); + foreach (T type in monitor.RemovedTextures) { - entities.Add(TranslateAlias(lvlName, entity)); + types.Add(TranslateAlias(lvlName, type)); } - return entities; + return types; } return null; } - public Dictionary GetEntityMap(string lvlName) + public Dictionary GetTypeMap(string lvlName) { - TextureMonitor monitor = GetMonitor(lvlName); - return monitor?.EntityMap; + TextureMonitor monitor = GetMonitor(lvlName); + return monitor?.TypeMap; } } diff --git a/TRRandomizerCore/Textures/Monitoring/TR1TextureMonitorBroker.cs b/TRRandomizerCore/Textures/Monitoring/TR1TextureMonitorBroker.cs index 2d889b4fb..e69eb0479 100644 --- a/TRRandomizerCore/Textures/Monitoring/TR1TextureMonitorBroker.cs +++ b/TRRandomizerCore/Textures/Monitoring/TR1TextureMonitorBroker.cs @@ -18,8 +18,8 @@ protected override TextureDatabase CreateDatabase() return new TR1TextureDatabase(); } - protected override TR1Type TranslateAlias(string lvlName, TR1Type entity) + protected override TR1Type TranslateAlias(string lvlName, TR1Type type) { - return TR1TypeUtilities.GetAliasForLevel(lvlName, entity); + return TR1TypeUtilities.GetAliasForLevel(lvlName, type); } } diff --git a/TRRandomizerCore/Textures/Monitoring/TR2TextureMonitorBroker.cs b/TRRandomizerCore/Textures/Monitoring/TR2TextureMonitorBroker.cs index 2f195998e..bb001d835 100644 --- a/TRRandomizerCore/Textures/Monitoring/TR2TextureMonitorBroker.cs +++ b/TRRandomizerCore/Textures/Monitoring/TR2TextureMonitorBroker.cs @@ -21,8 +21,8 @@ protected override TextureDatabase CreateDatabase() return new TR2TextureDatabase(); } - protected override TR2Type TranslateAlias(string lvlName, TR2Type entity) + protected override TR2Type TranslateAlias(string lvlName, TR2Type type) { - return TR2TypeUtilities.GetAliasForLevel(lvlName, entity); + return TR2TypeUtilities.GetAliasForLevel(lvlName, type); } } diff --git a/TRRandomizerCore/Textures/Monitoring/TR3TextureMonitorBroker.cs b/TRRandomizerCore/Textures/Monitoring/TR3TextureMonitorBroker.cs index 036d5c033..c9ae2ba67 100644 --- a/TRRandomizerCore/Textures/Monitoring/TR3TextureMonitorBroker.cs +++ b/TRRandomizerCore/Textures/Monitoring/TR3TextureMonitorBroker.cs @@ -13,8 +13,8 @@ protected override TextureDatabase CreateDatabase() return new TR3TextureDatabase(); } - protected override TR3Type TranslateAlias(string lvlName, TR3Type entity) + protected override TR3Type TranslateAlias(string lvlName, TR3Type type) { - return TR3TypeUtilities.GetAliasForLevel(lvlName, entity); + return TR3TypeUtilities.GetAliasForLevel(lvlName, type); } } diff --git a/TRRandomizerCore/Textures/Monitoring/TextureMonitor.cs b/TRRandomizerCore/Textures/Monitoring/TextureMonitor.cs index c55d4beaa..f2731f8f7 100644 --- a/TRRandomizerCore/Textures/Monitoring/TextureMonitor.cs +++ b/TRRandomizerCore/Textures/Monitoring/TextureMonitor.cs @@ -3,44 +3,44 @@ namespace TRRandomizerCore.Textures; -public class TextureMonitor : ITexturePositionMonitor - where E : Enum +public class TextureMonitor : ITexturePositionMonitor + where T : Enum { - private readonly List> _entitySources; + private readonly List> _typeSources; - public Dictionary, List> PreparedLevelMapping { get; private set; } - public List RemovedTextures { get; private set; } + public Dictionary, List> PreparedLevelMapping { get; private set; } + public List RemovedTextures { get; private set; } public bool UseMirroring { get; set; } public bool UseNightTextures { get; set; } public bool UseLaraOutfitTextures { get; set; } // Allow entities such as Artefacts to be defined in texture sources, but mapped to different types here - public Dictionary EntityMap { get; set; } + public Dictionary TypeMap { get; set; } - public TextureMonitor(List> sources) + public TextureMonitor(List> sources) { - _entitySources = sources; - EntityMap = new Dictionary(); + _typeSources = sources; + TypeMap = new(); UseLaraOutfitTextures = true; } - public void AppendSources(IEnumerable> sources) + public void AppendSources(IEnumerable> sources) { - foreach (StaticTextureSource source in sources) + foreach (StaticTextureSource source in sources) { - if (!_entitySources.Contains(source)) + if (!_typeSources.Contains(source)) { - _entitySources.Add(source); + _typeSources.Add(source); } } } - public void RemoveSources(IEnumerable> sources) + public void RemoveSources(IEnumerable> sources) { - foreach (StaticTextureSource source in sources) + foreach (StaticTextureSource source in sources) { - _entitySources.Remove(source); + _typeSources.Remove(source); if (PreparedLevelMapping != null && PreparedLevelMapping.ContainsKey(source)) { PreparedLevelMapping.Remove(source); @@ -48,77 +48,75 @@ public void RemoveSources(IEnumerable> sources) } } - public Dictionary> GetMonitoredTextureIndices() + public Dictionary> GetMonitoredIndices() { // The keys defined in the source ObjectTextureMap are TRObjectTexture index references // from the original level they were extracted from. We want to track what happens to // these textures. - Dictionary> entityIndices = new(); - foreach (StaticTextureSource source in _entitySources) + Dictionary> indices = new(); + foreach (StaticTextureSource source in _typeSources) { - foreach (E entity in source.EntityTextureMap.Keys) + foreach (T type in source.EntityTextureMap.Keys) { - if (!entityIndices.ContainsKey(entity)) + if (!indices.ContainsKey(type)) { - entityIndices[entity] = new List(); + indices[type] = new List(); } - entityIndices[entity].AddRange(source.EntityTextureMap[entity].Keys); // The keys hold the texture indices, the values are the segment positions + indices[type].AddRange(source.EntityTextureMap[type].Keys); // The keys hold the texture indices, the values are the segment positions } } - return entityIndices; + return indices; } - public void MonitoredTexturesPositioned(Dictionary> texturePositions) + public void OnTexturesPositioned(Dictionary> texturePositions) { PreparedLevelMapping ??= new(); - foreach (E entity in texturePositions.Keys) + foreach (var (type, positions) in texturePositions) { - StaticTextureSource[] sources = GetSources(entity); - List targets = new(); - foreach (PositionedTexture texture in texturePositions[entity]) + List> sources = GetSources(type); + foreach (PositionedTexture texture in positions) { - foreach (StaticTextureSource source in sources) + foreach (StaticTextureSource source in sources) { - if (source.EntityTextureMap[entity].ContainsKey(texture.OriginalIndex)) + if (!source.EntityTextureMap[type].ContainsKey(texture.OriginalIndex)) { - // We'll make a new texture target for the level this monitor is associated with - targets.Add(new StaticTextureTarget - { - Segment = source.EntityTextureMap[entity][texture.OriginalIndex], // this points to the associated rectangle in the source's Bitmap - Tile = texture.TileIndex, - X = texture.Position.X, - Y = texture.Position.Y - }); + continue; + } - if (!PreparedLevelMapping.ContainsKey(source)) - { - PreparedLevelMapping[source] = new List(); - } - PreparedLevelMapping[source].Add(targets[^1]); + if (!PreparedLevelMapping.ContainsKey(source)) + { + PreparedLevelMapping[source] = new(); } + PreparedLevelMapping[source].Add(new() + { + Segment = source.EntityTextureMap[type][texture.OriginalIndex], // this points to the associated rectangle in the source's Bitmap + Tile = texture.TileIndex, + X = texture.Position.X, + Y = texture.Position.Y + }); } } } } - private StaticTextureSource[] GetSources(E entity) + private List> GetSources(T type) { - List> sources = new(); - foreach (StaticTextureSource source in _entitySources) + List> sources = new(); + foreach (StaticTextureSource source in _typeSources) { - if (source.EntityTextureMap.ContainsKey(entity)) + if (source.EntityTextureMap.ContainsKey(type)) { sources.Add(source); } } - return sources.ToArray(); + return sources; } // Keep a note of removed textures so that anything defined statically in the texture source // files does not get imported (e.g. if Barney is removed from GW, we don't want the randomized // textures to be imported). - public void EntityTexturesRemoved(List entities) + public void OnTexturesRemoved(List entities) { if (RemovedTextures == null) {