diff --git a/TREnvironmentEditor/Model/BaseEMFunction.cs b/TREnvironmentEditor/Model/BaseEMFunction.cs index 0f9cd70d8..12ebd3b68 100644 --- a/TREnvironmentEditor/Model/BaseEMFunction.cs +++ b/TREnvironmentEditor/Model/BaseEMFunction.cs @@ -47,15 +47,15 @@ public static List GetTileVertices(short x, short y, short z, bool asC return vertices; } - public static int CreateRoomVertex(TRRoom room, TRVertex vert, short lighting = 6574) + public static int CreateRoomVertex(TR1Room room, TRVertex vert, short lighting = 6574) { - TRRoomVertex v = new() + TR1RoomVertex v = new() { Lighting = lighting, Vertex = vert }; - List verts = room.RoomData.Vertices.ToList(); + List verts = room.RoomData.Vertices.ToList(); verts.Add(v); room.RoomData.Vertices = verts.ToArray(); room.RoomData.NumVertices++; diff --git a/TREnvironmentEditor/Model/Conditions/Room/EMRoomContainsWaterCondition.cs b/TREnvironmentEditor/Model/Conditions/Room/EMRoomContainsWaterCondition.cs index 808c239c6..21428a281 100644 --- a/TREnvironmentEditor/Model/Conditions/Room/EMRoomContainsWaterCondition.cs +++ b/TREnvironmentEditor/Model/Conditions/Room/EMRoomContainsWaterCondition.cs @@ -1,4 +1,5 @@ -using TRLevelControl.Model; +using TREnvironmentEditor.Helpers; +using TRLevelControl.Model; namespace TREnvironmentEditor.Model.Conditions; @@ -8,19 +9,19 @@ public class EMRoomContainsWaterCondition : BaseEMCondition protected override bool Evaluate(TR1Level level) { - TRRoom room = level.Rooms[RoomIndex]; - return room.ContainsWater; + EMLevelData data = EMLevelData.GetData(level); + return level.Rooms[data.ConvertRoom(RoomIndex)].ContainsWater; } protected override bool Evaluate(TR2Level level) { - TR2Room room = level.Rooms[RoomIndex]; - return room.ContainsWater; + EMLevelData data = EMLevelData.GetData(level); + return level.Rooms[data.ConvertRoom(RoomIndex)].ContainsWater; } protected override bool Evaluate(TR3Level level) { - TR3Room room = level.Rooms[RoomIndex]; - return room.ContainsWater; + EMLevelData data = EMLevelData.GetData(level); + return level.Rooms[data.ConvertRoom(RoomIndex)].ContainsWater; } } diff --git a/TREnvironmentEditor/Model/Conditions/Room/EMSectorIsWallCondition.cs b/TREnvironmentEditor/Model/Conditions/Room/EMSectorIsWallCondition.cs index 94a1e543a..d478cc0bd 100644 --- a/TREnvironmentEditor/Model/Conditions/Room/EMSectorIsWallCondition.cs +++ b/TREnvironmentEditor/Model/Conditions/Room/EMSectorIsWallCondition.cs @@ -11,7 +11,7 @@ public class EMSectorIsWallCondition : BaseEMCondition protected override bool Evaluate(TR1Level level) { EMLevelData data = EMLevelData.GetData(level); - TRRoom room = level.Rooms[data.ConvertRoom(Location.Room)]; + TR1Room room = level.Rooms[data.ConvertRoom(Location.Room)]; return room.Sectors[GetSectorIndex(room.Info, Location, room.NumZSectors)].IsWall; } protected override bool Evaluate(TR2Level level) diff --git a/TREnvironmentEditor/Model/Types/Mirroring/EMMirrorFunction.cs b/TREnvironmentEditor/Model/Types/Mirroring/EMMirrorFunction.cs index ebddbf413..2d71d359a 100644 --- a/TREnvironmentEditor/Model/Types/Mirroring/EMMirrorFunction.cs +++ b/TREnvironmentEditor/Model/Types/Mirroring/EMMirrorFunction.cs @@ -66,7 +66,7 @@ private void CalculateWorldWidth(TR1Level level) { _worldWidth = 0; _xAdjustment = 0; - foreach (TRRoom room in level.Rooms) + foreach (TR1Room room in level.Rooms) { _worldWidth = Math.Max(_worldWidth, room.Info.X + TRConsts.Step4 * room.NumXSectors); } @@ -121,7 +121,7 @@ private static void MirrorFloorData(TR1Level level) FDControl floorData = new(); floorData.ParseFromLevel(level); - foreach (TRRoom room in level.Rooms) + foreach (TR1Room room in level.Rooms) { List sectors = room.Sectors.ToList(); MirrorSectors(sectors, room.NumXSectors, room.NumZSectors, floorData); @@ -298,17 +298,17 @@ private static void MirrorSectors(List sectors, ushort numXSectors private void MirrorRooms(TR1Level level) { - foreach (TRRoom room in level.Rooms) + foreach (TR1Room room in level.Rooms) { int oldRoomX = room.Info.X; room.Info.X = FlipWorldX(oldRoomX); room.Info.X -= room.NumXSectors * TRConsts.Step4; Debug.Assert(room.Info.X >= 0); // Flip room sprites separately as they don't sit on tile edges - List processedVerts = new(); + List processedVerts = new(); foreach (TRRoomSprite sprite in room.RoomData.Sprites) { - TRRoomVertex roomVertex = room.RoomData.Vertices[sprite.Vertex]; + TR1RoomVertex roomVertex = room.RoomData.Vertices[sprite.Vertex]; // Flip the old world coordinate, then subtract the new room position int x = oldRoomX + roomVertex.Vertex.X; @@ -321,7 +321,7 @@ private void MirrorRooms(TR1Level level) } // Flip the face vertices - foreach (TRRoomVertex vert in room.RoomData.Vertices) + foreach (TR1RoomVertex vert in room.RoomData.Vertices) { if (processedVerts.Contains(vert)) { @@ -348,13 +348,13 @@ private void MirrorRooms(TR1Level level) } // Move the lights to their new spots - foreach (TRRoomLight light in room.Lights) + foreach (TR1RoomLight light in room.Lights) { light.X = FlipWorldX(light.X); } // Move the static meshes - foreach (TRRoomStaticMesh mesh in room.StaticMeshes) + foreach (TR1RoomStaticMesh mesh in room.StaticMeshes) { mesh.X = (uint)FlipWorldX((int)mesh.X); @@ -1013,7 +1013,7 @@ private static void MirrorTextures(TR1Level level) List staticMeshes = level.StaticMeshes.ToList(); ISet processedMeshes = new HashSet(); - foreach (TRRoom room in level.Rooms) + foreach (TR1Room room in level.Rooms) { // Invert the faces, otherwise they are inside out foreach (TRFace4 f in room.RoomData.Rectangles) @@ -1029,7 +1029,7 @@ private static void MirrorTextures(TR1Level level) textureReferences.Add(f.Texture); } - foreach (TRRoomStaticMesh roomStaticMesh in room.StaticMeshes) + foreach (TR1RoomStaticMesh roomStaticMesh in room.StaticMeshes) { TRStaticMesh staticMesh = staticMeshes.Find(m => m.ID == roomStaticMesh.MeshID); if (!processedMeshes.Add(staticMesh)) diff --git a/TREnvironmentEditor/Model/Types/Portals/EMRemoveCollisionalPortalFunction.cs b/TREnvironmentEditor/Model/Types/Portals/EMRemoveCollisionalPortalFunction.cs index 05e996029..d4719cbba 100644 --- a/TREnvironmentEditor/Model/Types/Portals/EMRemoveCollisionalPortalFunction.cs +++ b/TREnvironmentEditor/Model/Types/Portals/EMRemoveCollisionalPortalFunction.cs @@ -20,8 +20,8 @@ public override void ApplyToLevel(TR1Level level) FDControl floorData = new(); floorData.ParseFromLevel(level); - TRRoom room1 = level.Rooms[Location1.Room]; - TRRoom room2 = level.Rooms[Location2.Room]; + TR1Room room1 = level.Rooms[Location1.Room]; + TR1Room room2 = level.Rooms[Location2.Room]; TRRoomSector sector1 = room1.Sectors[GetSectorIndex(room1.Info, Location1, room1.NumZSectors)]; TRRoomSector sector2 = room2.Sectors[GetSectorIndex(room2.Info, Location2, room2.NumZSectors)]; diff --git a/TREnvironmentEditor/Model/Types/Portals/EMReplaceCollisionalPortalFunction.cs b/TREnvironmentEditor/Model/Types/Portals/EMReplaceCollisionalPortalFunction.cs index 530de641c..342280180 100644 --- a/TREnvironmentEditor/Model/Types/Portals/EMReplaceCollisionalPortalFunction.cs +++ b/TREnvironmentEditor/Model/Types/Portals/EMReplaceCollisionalPortalFunction.cs @@ -19,7 +19,7 @@ public override void ApplyToLevel(TR1Level level) FDControl floorData = new(); floorData.ParseFromLevel(level); - TRRoom room = level.Rooms[data.ConvertRoom(Room)]; + TR1Room room = level.Rooms[data.ConvertRoom(Room)]; TRRoomSector sector = room.Sectors[X * room.NumZSectors + Z]; ReplacePortal(sector, (ushort)data.ConvertRoom(AdjoiningRoom), floorData); diff --git a/TREnvironmentEditor/Model/Types/Portals/EMVisibilityPortalFunction.cs b/TREnvironmentEditor/Model/Types/Portals/EMVisibilityPortalFunction.cs index 16a9c1cf8..2145addd0 100644 --- a/TREnvironmentEditor/Model/Types/Portals/EMVisibilityPortalFunction.cs +++ b/TREnvironmentEditor/Model/Types/Portals/EMVisibilityPortalFunction.cs @@ -14,7 +14,7 @@ public override void ApplyToLevel(TR1Level level) foreach (EMVisibilityPortal emPortal in Portals) { TRRoomPortal portal = emPortal.ToPortal(data); - TRRoom room = level.Rooms[emPortal.BaseRoom]; + TR1Room room = level.Rooms[emPortal.BaseRoom]; List portals = room.Portals.ToList(); portals.Add(portal); room.Portals = portals.ToArray(); diff --git a/TREnvironmentEditor/Model/Types/Rooms/EMCopyRoomFunction.cs b/TREnvironmentEditor/Model/Types/Rooms/EMCopyRoomFunction.cs index d39a2715b..92b52f5df 100644 --- a/TREnvironmentEditor/Model/Types/Rooms/EMCopyRoomFunction.cs +++ b/TREnvironmentEditor/Model/Types/Rooms/EMCopyRoomFunction.cs @@ -18,13 +18,13 @@ public class EMCopyRoomFunction : BaseEMFunction public override void ApplyToLevel(TR1Level level) { EMLevelData data = GetData(level); - TRRoom baseRoom = level.Rooms[data.ConvertRoom(RoomIndex)]; + TR1Room baseRoom = level.Rooms[data.ConvertRoom(RoomIndex)]; int xdiff = NewLocation.X - baseRoom.Info.X; int ydiff = NewLocation.Y - baseRoom.Info.YBottom; int zdiff = NewLocation.Z - baseRoom.Info.Z; - TRRoom newRoom = new() + TR1Room newRoom = new() { AlternateRoom = -1, AmbientIntensity = baseRoom.AmbientIntensity, @@ -36,7 +36,7 @@ public override void ApplyToLevel(TR1Level level) YTop = NewLocation.Y + (baseRoom.Info.YTop - baseRoom.Info.YBottom), Z = NewLocation.Z }, - Lights = new TRRoomLight[baseRoom.NumLights], + Lights = new TR1RoomLight[baseRoom.NumLights], NumDataWords = baseRoom.NumDataWords, NumLights = baseRoom.NumLights, @@ -45,7 +45,7 @@ public override void ApplyToLevel(TR1Level level) NumXSectors = baseRoom.NumXSectors, NumZSectors = baseRoom.NumZSectors, Portals = Array.Empty(), - RoomData = new TRRoomData + RoomData = new TR1RoomData { NumRectangles = baseRoom.RoomData.NumRectangles, NumSprites = baseRoom.RoomData.NumSprites, @@ -54,16 +54,16 @@ public override void ApplyToLevel(TR1Level level) Rectangles = new TRFace4[baseRoom.RoomData.NumRectangles], Sprites = new TRRoomSprite[baseRoom.RoomData.NumSprites], Triangles = new TRFace3[baseRoom.RoomData.NumTriangles], - Vertices = new TRRoomVertex[baseRoom.RoomData.NumVertices] + Vertices = new TR1RoomVertex[baseRoom.RoomData.NumVertices] }, Sectors = new TRRoomSector[baseRoom.Sectors.Length], - StaticMeshes = new TRRoomStaticMesh[baseRoom.NumStaticMeshes] + StaticMeshes = new TR1RoomStaticMesh[baseRoom.NumStaticMeshes] }; // Lights for (int i = 0; i < newRoom.Lights.Length; i++) { - newRoom.Lights[i] = new TRRoomLight + newRoom.Lights[i] = new TR1RoomLight { Fade = baseRoom.Lights[i].Fade, Intensity = baseRoom.Lights[i].Intensity, @@ -103,7 +103,7 @@ public override void ApplyToLevel(TR1Level level) // Vertices for (int i = 0; i < newRoom.RoomData.Vertices.Length; i++) { - newRoom.RoomData.Vertices[i] = new TRRoomVertex + newRoom.RoomData.Vertices[i] = new TR1RoomVertex { Lighting = baseRoom.RoomData.Vertices[i].Lighting, Vertex = new TRVertex @@ -128,7 +128,7 @@ public override void ApplyToLevel(TR1Level level) // Static Meshes for (int i = 0; i < newRoom.NumStaticMeshes; i++) { - newRoom.StaticMeshes[i] = new TRRoomStaticMesh + newRoom.StaticMeshes[i] = new TR1RoomStaticMesh { Intensity = baseRoom.StaticMeshes[i].Intensity, MeshID = baseRoom.StaticMeshes[i].MeshID, diff --git a/TREnvironmentEditor/Model/Types/Rooms/EMCopyVertexAttributesFunction.cs b/TREnvironmentEditor/Model/Types/Rooms/EMCopyVertexAttributesFunction.cs index 10d7da394..a7da23a14 100644 --- a/TREnvironmentEditor/Model/Types/Rooms/EMCopyVertexAttributesFunction.cs +++ b/TREnvironmentEditor/Model/Types/Rooms/EMCopyVertexAttributesFunction.cs @@ -17,7 +17,7 @@ public override void ApplyToLevel(TR1Level level) { foreach (short roomNumber in FaceMap.Keys) { - TRRoom room = level.Rooms[data.ConvertRoom(roomNumber)]; + TR1Room room = level.Rooms[data.ConvertRoom(roomNumber)]; foreach (EMTextureFaceType faceType in FaceMap[roomNumber].Keys) { foreach (int baseFaceIndex in FaceMap[roomNumber][faceType].Keys) @@ -39,8 +39,8 @@ public override void ApplyToLevel(TR1Level level) for (int i = 0; i < baseVertices.Length; i++) { - TRRoomVertex baseVertex = room.RoomData.Vertices[baseVertices[i]]; - TRRoomVertex copyVertex = room.RoomData.Vertices[copyVertices[i]]; + TR1RoomVertex baseVertex = room.RoomData.Vertices[baseVertices[i]]; + TR1RoomVertex copyVertex = room.RoomData.Vertices[copyVertices[i]]; CopyAttributes(baseVertex, copyVertex); } } @@ -53,8 +53,8 @@ public override void ApplyToLevel(TR1Level level) { foreach (short roomNumber in RoomMap.Keys) { - TRRoom room = level.Rooms[data.ConvertRoom(roomNumber)]; - foreach (TRRoomVertex copyVertex in room.RoomData.Vertices) + TR1Room room = level.Rooms[data.ConvertRoom(roomNumber)]; + foreach (TR1RoomVertex copyVertex in room.RoomData.Vertices) { CopyAttributes(RoomMap[roomNumber], copyVertex); } @@ -171,12 +171,12 @@ public override void ApplyToLevel(TR3Level level) } // TR3RoomVertex is a placeholder in the data to cover all levels - private static void CopyAttributes(TR3RoomVertex baseVertex, TRRoomVertex copyVertex) + private static void CopyAttributes(TR3RoomVertex baseVertex, TR1RoomVertex copyVertex) { copyVertex.Lighting = baseVertex.Lighting; } - private static void CopyAttributes(TRRoomVertex baseVertex, TRRoomVertex copyVertex) + private static void CopyAttributes(TR1RoomVertex baseVertex, TR1RoomVertex copyVertex) { copyVertex.Lighting = baseVertex.Lighting; } diff --git a/TREnvironmentEditor/Model/Types/Rooms/EMCreateRoomFunction.cs b/TREnvironmentEditor/Model/Types/Rooms/EMCreateRoomFunction.cs index 4a88b9fe0..563b290e0 100644 --- a/TREnvironmentEditor/Model/Types/Rooms/EMCreateRoomFunction.cs +++ b/TREnvironmentEditor/Model/Types/Rooms/EMCreateRoomFunction.cs @@ -23,7 +23,7 @@ public class EMCreateRoomFunction : BaseEMFunction public override void ApplyToLevel(TR1Level level) { - TRRoom room = new() + TR1Room room = new() { NumXSectors = Width, NumZSectors = Depth, @@ -33,7 +33,7 @@ public override void ApplyToLevel(TR1Level level) NumPortals = 0, NumStaticMeshes = 0, Portals = Array.Empty(), - StaticMeshes = Array.Empty(), + StaticMeshes = Array.Empty(), Info = new TRRoomInfo { X = Location.X, @@ -41,7 +41,7 @@ public override void ApplyToLevel(TR1Level level) YTop = Location.Y - Height * TRConsts.Step1, Z = Location.Z }, - RoomData = new TRRoomData + RoomData = new TR1RoomData { // Ignored for now NumSprites = 0, @@ -51,11 +51,11 @@ public override void ApplyToLevel(TR1Level level) } }; - room.Lights = new TRRoomLight[room.NumLights]; + room.Lights = new TR1RoomLight[room.NumLights]; for (int i = 0; i < room.NumLights; i++) { EMRoomLight light = Lights[i]; - room.Lights[i] = new TRRoomLight + room.Lights[i] = new TR1RoomLight { X = light.X + Location.X, Y = light.Y + Location.Y, @@ -90,7 +90,7 @@ public override void ApplyToLevel(TR1Level level) room.RoomData.NumRectangles = (short)faces.Count; room.RoomData.NumVertices = (short)vertices.Count; room.RoomData.Rectangles = faces.ToArray(); - room.RoomData.Vertices = vertices.Select(v => new TRRoomVertex + room.RoomData.Vertices = vertices.Select(v => new TR1RoomVertex { Lighting = DefaultVertex.Lighting, Vertex = v diff --git a/TREnvironmentEditor/Model/Types/Rooms/EMGenerateLightFunction.cs b/TREnvironmentEditor/Model/Types/Rooms/EMGenerateLightFunction.cs index d7fec41b5..0829bddcf 100644 --- a/TREnvironmentEditor/Model/Types/Rooms/EMGenerateLightFunction.cs +++ b/TREnvironmentEditor/Model/Types/Rooms/EMGenerateLightFunction.cs @@ -13,20 +13,20 @@ public override void ApplyToLevel(TR1Level level) EMLevelData data = GetData(level); foreach (short roomIndex in RoomIndices) { - TRRoom room = level.Rooms[data.ConvertRoom(roomIndex)]; + TR1Room room = level.Rooms[data.ConvertRoom(roomIndex)]; if (room.NumLights == 0) { continue; } - Dictionary lightPositions = new(); - foreach (TRRoomVertex vertex in room.RoomData.Vertices) + Dictionary lightPositions = new(); + foreach (TR1RoomVertex vertex in room.RoomData.Vertices) { // Several lights per room - for now just use whichever is nearest this point Vector3 vertexPosition = new(vertex.Vertex.X, vertex.Vertex.Y, vertex.Vertex.Z); double smallestDistance = double.MaxValue; - TRRoomLight nearestLight = room.Lights[0]; - foreach (TRRoomLight light in room.Lights) + TR1RoomLight nearestLight = room.Lights[0]; + foreach (TR1RoomLight light in room.Lights) { if (!lightPositions.ContainsKey(light)) { diff --git a/TREnvironmentEditor/Model/Types/Surfaces/BaseWaterFunction.cs b/TREnvironmentEditor/Model/Types/Surfaces/BaseWaterFunction.cs index 3cfdb8af1..7d501d4e2 100644 --- a/TREnvironmentEditor/Model/Types/Surfaces/BaseWaterFunction.cs +++ b/TREnvironmentEditor/Model/Types/Surfaces/BaseWaterFunction.cs @@ -10,7 +10,7 @@ public abstract class BaseWaterFunction : BaseEMFunction, ITextureModifier public int[] RoomNumbers { get; set; } public ushort[] WaterTextures { get; set; } - public void AddWaterSurface(TRRoom room, bool asCeiling, IEnumerable adjacentRooms) + public void AddWaterSurface(TR1Room room, bool asCeiling, IEnumerable adjacentRooms) { if (WaterTextures == null || WaterTextures.Length == 0) { @@ -18,7 +18,7 @@ public void AddWaterSurface(TRRoom room, bool asCeiling, IEnumerable adjace return; } - List vertices = room.RoomData.Vertices.ToList(); + List vertices = room.RoomData.Vertices.ToList(); List rectangles = room.RoomData.Rectangles.ToList(); for (int i = 0; i < room.Sectors.Length; i++) @@ -48,7 +48,7 @@ public void AddWaterSurface(TRRoom room, bool asCeiling, IEnumerable adjace } else { - TRRoomVertex exVert = room.RoomData.Vertices[vi]; + TR1RoomVertex exVert = room.RoomData.Vertices[vi]; } vertIndices.Add((ushort)vi); } @@ -189,7 +189,7 @@ public void AddWaterSurface(TR3Room room, bool asCeiling, IEnumerable adjac room.NumDataWords = (uint)(room.RoomData.Serialize().Length / 2); } - public void RemoveWaterSurface(TRRoom room) + public void RemoveWaterSurface(TR1Room room) { List rs = room.RoomData.Rectangles.ToList(); RemoveWaterSurfaces(rs); diff --git a/TREnvironmentEditor/Model/Types/Surfaces/EMCeilingFunction.cs b/TREnvironmentEditor/Model/Types/Surfaces/EMCeilingFunction.cs index 1b44b69de..b5cb8ec3e 100644 --- a/TREnvironmentEditor/Model/Types/Surfaces/EMCeilingFunction.cs +++ b/TREnvironmentEditor/Model/Types/Surfaces/EMCeilingFunction.cs @@ -14,7 +14,7 @@ public override void ApplyToLevel(TR1Level level) EMLevelData data = GetData(level); foreach (int roomNumber in CeilingHeights.Keys) { - TRRoom room = level.Rooms[data.ConvertRoom(roomNumber)]; + TR1Room room = level.Rooms[data.ConvertRoom(roomNumber)]; int oldYTop = room.Info.YTop; int min = int.MaxValue; foreach (TRRoomSector sector in room.Sectors) @@ -29,7 +29,7 @@ public override void ApplyToLevel(TR1Level level) if (AmendVertices) { - foreach (TRRoomVertex vertex in room.RoomData.Vertices) + foreach (TR1RoomVertex vertex in room.RoomData.Vertices) { if (vertex.Vertex.Y == oldYTop) { diff --git a/TREnvironmentEditor/Model/Types/Surfaces/EMDrainFunction.cs b/TREnvironmentEditor/Model/Types/Surfaces/EMDrainFunction.cs index 617fb76b4..49025ca76 100644 --- a/TREnvironmentEditor/Model/Types/Surfaces/EMDrainFunction.cs +++ b/TREnvironmentEditor/Model/Types/Surfaces/EMDrainFunction.cs @@ -19,12 +19,12 @@ public override void ApplyToLevel(TR1Level level) foreach (int roomNumber in RoomNumbers) { - TRRoom room = level.Rooms[data.ConvertRoom(roomNumber)]; + TR1Room room = level.Rooms[data.ConvertRoom(roomNumber)]; ISet roomsBelow = GetAdjacentRooms(room.Sectors, false); foreach (byte roomBelowNumber in roomsBelow) { - TRRoom roomBelow = level.Rooms[roomBelowNumber]; + TR1Room roomBelow = level.Rooms[roomBelowNumber]; if (roomBelow.ContainsWater) { AddWaterSurface(room, false, RoomNumbers); @@ -35,7 +35,7 @@ public override void ApplyToLevel(TR1Level level) ISet roomsAbove = GetAdjacentRooms(room.Sectors, true); foreach (byte roomAboveNumber in roomsAbove) { - TRRoom roomAbove = level.Rooms[roomAboveNumber]; + TR1Room roomAbove = level.Rooms[roomAboveNumber]; if (!roomAbove.ContainsWater) { RemoveWaterSurface(room); diff --git a/TREnvironmentEditor/Model/Types/Surfaces/EMFloodFunction.cs b/TREnvironmentEditor/Model/Types/Surfaces/EMFloodFunction.cs index 5bd80d528..71607399d 100644 --- a/TREnvironmentEditor/Model/Types/Surfaces/EMFloodFunction.cs +++ b/TREnvironmentEditor/Model/Types/Surfaces/EMFloodFunction.cs @@ -21,12 +21,12 @@ public override void ApplyToLevel(TR1Level level) // and what needs them as floors. foreach (int roomNumber in RoomNumbers) { - TRRoom room = level.Rooms[data.ConvertRoom(roomNumber)]; + TR1Room room = level.Rooms[data.ConvertRoom(roomNumber)]; ISet roomsBelow = GetAdjacentRooms(room.Sectors, false); foreach (byte roomBelowNumber in roomsBelow) { - TRRoom roomBelow = level.Rooms[roomBelowNumber]; + TR1Room roomBelow = level.Rooms[roomBelowNumber]; if (roomBelow.ContainsWater) { RemoveWaterSurface(room); @@ -37,7 +37,7 @@ public override void ApplyToLevel(TR1Level level) ISet roomsAbove = GetAdjacentRooms(room.Sectors, true); foreach (byte roomAboveNumber in roomsAbove) { - TRRoom roomAbove = level.Rooms[roomAboveNumber]; + TR1Room roomAbove = level.Rooms[roomAboveNumber]; if (!roomAbove.ContainsWater) { AddWaterSurface(room, true, new int[] { roomAboveNumber }); diff --git a/TREnvironmentEditor/Model/Types/Surfaces/EMFloorFunction.cs b/TREnvironmentEditor/Model/Types/Surfaces/EMFloorFunction.cs index 9205e1069..e67e0e00d 100644 --- a/TREnvironmentEditor/Model/Types/Surfaces/EMFloorFunction.cs +++ b/TREnvironmentEditor/Model/Types/Surfaces/EMFloorFunction.cs @@ -53,7 +53,7 @@ private void MoveFloor(TR1Level level) fdc.ParseFromLevel(level); short roomNumber = data.ConvertRoom(Location.Room); - TRRoom room = level.Rooms[roomNumber]; + TR1Room room = level.Rooms[roomNumber]; TRRoomSector sector = FDUtilities.GetRoomSector(Location.X, Location.Y, Location.Z, roomNumber, level, fdc); int sectorIndex = room.Sectors.ToList().IndexOf(sector); @@ -62,7 +62,7 @@ private void MoveFloor(TR1Level level) short z = (short)(sectorIndex % room.NumZSectors * TRConsts.Step4); short y = (short)(sector.Floor * TRConsts.Step1); - List vertices = room.RoomData.Vertices.ToList(); + List vertices = room.RoomData.Vertices.ToList(); List oldVertIndices = new(); List defVerts = GetTileVertices(x, y, z, false); @@ -92,7 +92,7 @@ private void MoveFloor(TR1Level level) List newVertIndices = new(); foreach (ushort vert in oldVertIndices) { - TRRoomVertex oldRoomVertex = vertices[vert]; + TR1RoomVertex oldRoomVertex = vertices[vert]; TRVertex oldVert = vertices[vert].Vertex; TRVertex newVertex = new() { @@ -207,7 +207,7 @@ private void MoveFloor(TR1Level level) } } - private static void AlterSectorBox(TR1Level level, TRRoom room, int sectorIndex) + private static void AlterSectorBox(TR1Level level, TR1Room room, int sectorIndex) { TRRoomSector sector = room.Sectors[sectorIndex]; if (sector.BoxIndex == ushort.MaxValue) diff --git a/TREnvironmentEditor/Model/Types/Textures/EMAddFaceFunction.cs b/TREnvironmentEditor/Model/Types/Textures/EMAddFaceFunction.cs index b74129be4..530675b9c 100644 --- a/TREnvironmentEditor/Model/Types/Textures/EMAddFaceFunction.cs +++ b/TREnvironmentEditor/Model/Types/Textures/EMAddFaceFunction.cs @@ -16,7 +16,7 @@ public override void ApplyToLevel(TR1Level level) { foreach (short roomIndex in Quads.Keys) { - TRRoom room = level.Rooms[data.ConvertRoom(roomIndex)]; + TR1Room room = level.Rooms[data.ConvertRoom(roomIndex)]; List faces = room.RoomData.Rectangles.ToList(); faces.AddRange(Quads[roomIndex]); @@ -31,7 +31,7 @@ public override void ApplyToLevel(TR1Level level) { foreach (short roomIndex in Triangles.Keys) { - TRRoom room = level.Rooms[data.ConvertRoom(roomIndex)]; + TR1Room room = level.Rooms[data.ConvertRoom(roomIndex)]; List faces = room.RoomData.Triangles.ToList(); faces.AddRange(Triangles[roomIndex]); diff --git a/TREnvironmentEditor/Model/Types/Textures/EMAddRoomSpriteFunction.cs b/TREnvironmentEditor/Model/Types/Textures/EMAddRoomSpriteFunction.cs index 214781bf4..28cc2ba42 100644 --- a/TREnvironmentEditor/Model/Types/Textures/EMAddRoomSpriteFunction.cs +++ b/TREnvironmentEditor/Model/Types/Textures/EMAddRoomSpriteFunction.cs @@ -14,18 +14,18 @@ public override void ApplyToLevel(TR1Level level) EMLevelData data = GetData(level); foreach (EMLocation location in Locations) { - TRRoom room = level.Rooms[data.ConvertRoom(location.Room)]; - List vertices = room.RoomData.Vertices.ToList(); + TR1Room room = level.Rooms[data.ConvertRoom(location.Room)]; + List vertices = room.RoomData.Vertices.ToList(); List sprites = room.RoomData.Sprites.ToList(); - sprites.Add(new TRRoomSprite + sprites.Add(new() { Texture = Texture, Vertex = (short)vertices.Count }); - vertices.Add(new TRRoomVertex + vertices.Add(new() { Lighting = Vertex.Lighting, - Vertex = new TRVertex + Vertex = new() { X = (short)(location.X - room.Info.X), Y = (short)location.Y, @@ -50,17 +50,17 @@ public override void ApplyToLevel(TR2Level level) TR2Room room = level.Rooms[data.ConvertRoom(location.Room)]; List vertices = room.RoomData.Vertices.ToList(); List sprites = room.RoomData.Sprites.ToList(); - sprites.Add(new TRRoomSprite + sprites.Add(new() { Texture = Texture, Vertex = (short)vertices.Count }); - vertices.Add(new TR2RoomVertex + vertices.Add(new() { Lighting = Vertex.Lighting, Lighting2 = Vertex.Lighting2, Attributes = Vertex.Attributes, - Vertex = new TRVertex + Vertex = new() { X = (short)(location.X - room.Info.X), Y = (short)location.Y, @@ -85,17 +85,17 @@ public override void ApplyToLevel(TR3Level level) TR3Room room = level.Rooms[data.ConvertRoom(location.Room)]; List vertices = room.RoomData.Vertices.ToList(); List sprites = room.RoomData.Sprites.ToList(); - sprites.Add(new TRRoomSprite + sprites.Add(new() { Texture = Texture, Vertex = (short)vertices.Count }); - vertices.Add(new TR3RoomVertex + vertices.Add(new() { Lighting = Vertex.Lighting, Attributes = Vertex.Attributes, Colour = Vertex.Colour, - Vertex = new TRVertex + Vertex = new() { X = (short)(location.X - room.Info.X), Y = (short)location.Y, diff --git a/TREnvironmentEditor/Model/Types/Textures/EMAddStaticMeshFunction.cs b/TREnvironmentEditor/Model/Types/Textures/EMAddStaticMeshFunction.cs index 362515c37..1136d75f8 100644 --- a/TREnvironmentEditor/Model/Types/Textures/EMAddStaticMeshFunction.cs +++ b/TREnvironmentEditor/Model/Types/Textures/EMAddStaticMeshFunction.cs @@ -21,7 +21,7 @@ public override void ApplyToLevel(TR1Level level) foreach (EMLocation location in Locations) { short roomNumber = data.ConvertRoom(location.Room); - TRRoom room = level.Rooms[roomNumber]; + TR1Room room = level.Rooms[roomNumber]; // Only add this mesh if there is nothing else in the same sector. if (!IgnoreSectorEntities) @@ -47,8 +47,8 @@ public override void ApplyToLevel(TR1Level level) } } - List meshes = room.StaticMeshes.ToList(); - meshes.Add(new TRRoomStaticMesh + List meshes = room.StaticMeshes.ToList(); + meshes.Add(new() { X = (uint)location.X, Y = (uint)(location.Y < 0 ? uint.MaxValue + location.Y : location.Y), @@ -100,7 +100,7 @@ public override void ApplyToLevel(TR2Level level) } List meshes = room.StaticMeshes.ToList(); - meshes.Add(new TR2RoomStaticMesh + meshes.Add(new() { X = (uint)location.X, Y = (uint)(location.Y < 0 ? uint.MaxValue + location.Y : location.Y), @@ -153,7 +153,7 @@ public override void ApplyToLevel(TR3Level level) } List meshes = room.StaticMeshes.ToList(); - meshes.Add(new TR3RoomStaticMesh + meshes.Add(new() { X = (uint)location.X, Y = (uint)(location.Y < 0 ? uint.MaxValue + location.Y : location.Y), diff --git a/TREnvironmentEditor/Model/Types/Textures/EMModifyFaceFunction.cs b/TREnvironmentEditor/Model/Types/Textures/EMModifyFaceFunction.cs index 65631c536..614d9cf1d 100644 --- a/TREnvironmentEditor/Model/Types/Textures/EMModifyFaceFunction.cs +++ b/TREnvironmentEditor/Model/Types/Textures/EMModifyFaceFunction.cs @@ -16,7 +16,7 @@ public override void ApplyToLevel(TR1Level level) { foreach (EMFaceModification mod in Modifications) { - TRRoom room = level.Rooms[data.ConvertRoom(mod.RoomNumber)]; + TR1Room room = level.Rooms[data.ConvertRoom(mod.RoomNumber)]; switch (mod.FaceType) { case EMTextureFaceType.Rectangles: @@ -33,7 +33,7 @@ public override void ApplyToLevel(TR1Level level) { foreach (EMFaceRotation rot in Rotations) { - TRRoom room = level.Rooms[data.ConvertRoom(rot.RoomNumber)]; + TR1Room room = level.Rooms[data.ConvertRoom(rot.RoomNumber)]; switch (rot.FaceType) { case EMTextureFaceType.Rectangles: @@ -125,17 +125,17 @@ public override void ApplyToLevel(TR3Level level) } } - private static void ModifyRectangles(TRRoom room, EMFaceModification mod) + private static void ModifyRectangles(TR1Room room, EMFaceModification mod) { - List allVertices = room.RoomData.Vertices.ToList(); + List allVertices = room.RoomData.Vertices.ToList(); foreach (int faceIndex in mod.GetIndices()) { TRFace4 rect = room.RoomData.Rectangles[faceIndex]; foreach (int vertIndex in mod.VertexChanges.Keys) { - TRRoomVertex currentRoomVertex = allVertices[rect.Vertices[vertIndex]]; + TR1RoomVertex currentRoomVertex = allVertices[rect.Vertices[vertIndex]]; TRVertex newVertex = mod.VertexChanges[vertIndex]; - TRRoomVertex newRoomVertex = GenerateRoomVertex(currentRoomVertex, newVertex); + TR1RoomVertex newRoomVertex = GenerateRoomVertex(currentRoomVertex, newVertex); // Remap the face to use this vertex rect.Vertices[vertIndex] = (ushort)allVertices.Count; @@ -194,17 +194,17 @@ private static void ModifyRectangles(TR3Room room, EMFaceModification mod) room.NumDataWords = (uint)(room.RoomData.Serialize().Length / 2); } - private static void ModifyTriangles(TRRoom room, EMFaceModification mod) + private static void ModifyTriangles(TR1Room room, EMFaceModification mod) { - List allVertices = room.RoomData.Vertices.ToList(); + List allVertices = room.RoomData.Vertices.ToList(); foreach (int faceIndex in mod.GetIndices()) { TRFace3 tri = room.RoomData.Triangles[faceIndex]; foreach (int vertIndex in mod.VertexChanges.Keys) { - TRRoomVertex currentRoomVertex = allVertices[tri.Vertices[vertIndex]]; + TR1RoomVertex currentRoomVertex = allVertices[tri.Vertices[vertIndex]]; TRVertex newVertex = mod.VertexChanges[vertIndex]; - TRRoomVertex newRoomVertex = GenerateRoomVertex(currentRoomVertex, newVertex); + TR1RoomVertex newRoomVertex = GenerateRoomVertex(currentRoomVertex, newVertex); // Remap the face to use this vertex tri.Vertices[vertIndex] = (ushort)allVertices.Count; @@ -263,15 +263,15 @@ private static void ModifyTriangles(TR3Room room, EMFaceModification mod) room.NumDataWords = (uint)(room.RoomData.Serialize().Length / 2); } - private static TRRoomVertex GenerateRoomVertex(TRRoomVertex currentRoomVertex, TRVertex newVertex) + private static TR1RoomVertex GenerateRoomVertex(TR1RoomVertex currentRoomVertex, TRVertex newVertex) { // We create a new vertex because we can't guarantee nothing else is using it. // Note the vertex values in the mod are added to the existing values, so we // don't have to define those we aren't changing. - return new TRRoomVertex + return new() { Lighting = currentRoomVertex.Lighting, - Vertex = new TRVertex + Vertex = new() { X = (short)(currentRoomVertex.Vertex.X + newVertex.X), Y = (short)(currentRoomVertex.Vertex.Y + newVertex.Y), @@ -282,15 +282,12 @@ private static TRRoomVertex GenerateRoomVertex(TRRoomVertex currentRoomVertex, T private static TR2RoomVertex GenerateRoomVertex(TR2RoomVertex currentRoomVertex, TRVertex newVertex) { - // We create a new vertex because we can't guarantee nothing else is using it. - // Note the vertex values in the mod are added to the existing values, so we - // don't have to define those we aren't changing. - return new TR2RoomVertex + return new() { Attributes = currentRoomVertex.Attributes, Lighting = currentRoomVertex.Lighting, Lighting2 = currentRoomVertex.Lighting2, - Vertex = new TRVertex + Vertex = new() { X = (short)(currentRoomVertex.Vertex.X + newVertex.X), Y = (short)(currentRoomVertex.Vertex.Y + newVertex.Y), @@ -301,15 +298,12 @@ private static TR2RoomVertex GenerateRoomVertex(TR2RoomVertex currentRoomVertex, private static TR3RoomVertex GenerateRoomVertex(TR3RoomVertex currentRoomVertex, TRVertex newVertex) { - // We create a new vertex because we can't guarantee nothing else is using it. - // Note the vertex values in the mod are added to the existing values, so we - // don't have to define those we aren't changing. - return new TR3RoomVertex + return new() { Attributes = currentRoomVertex.Attributes, Lighting = currentRoomVertex.Lighting, Colour = currentRoomVertex.Colour, - Vertex = new TRVertex + Vertex = new() { X = (short)(currentRoomVertex.Vertex.X + newVertex.X), Y = (short)(currentRoomVertex.Vertex.Y + newVertex.Y), diff --git a/TREnvironmentEditor/Model/Types/Textures/EMMoveStaticMeshFunction.cs b/TREnvironmentEditor/Model/Types/Textures/EMMoveStaticMeshFunction.cs index 9108f91b4..13df80b0b 100644 --- a/TREnvironmentEditor/Model/Types/Textures/EMMoveStaticMeshFunction.cs +++ b/TREnvironmentEditor/Model/Types/Textures/EMMoveStaticMeshFunction.cs @@ -12,10 +12,10 @@ public override void ApplyToLevel(TR1Level level) EMLevelData data = GetData(level); foreach (short roomIndex in Relocations.Keys) { - TRRoom room = level.Rooms[data.ConvertRoom(roomIndex)]; + TR1Room room = level.Rooms[data.ConvertRoom(roomIndex)]; foreach (int meshIndex in Relocations[roomIndex].Keys) { - TRRoomStaticMesh mesh = room.StaticMeshes[meshIndex]; + TR1RoomStaticMesh mesh = room.StaticMeshes[meshIndex]; EMLocation location = new() { X = (int)mesh.X, diff --git a/TREnvironmentEditor/Model/Types/Textures/EMRefaceFunction.cs b/TREnvironmentEditor/Model/Types/Textures/EMRefaceFunction.cs index a5a9c83c2..f3b435ac9 100644 --- a/TREnvironmentEditor/Model/Types/Textures/EMRefaceFunction.cs +++ b/TREnvironmentEditor/Model/Types/Textures/EMRefaceFunction.cs @@ -30,7 +30,7 @@ public void ApplyTextures(TR1Level level) { foreach (int roomIndex in TextureMap[texture].Keys) { - TRRoom room = level.Rooms[data.ConvertRoom(roomIndex)]; + TR1Room room = level.Rooms[data.ConvertRoom(roomIndex)]; ApplyTextures(texture, TextureMap[texture][roomIndex], room.RoomData.Rectangles, room.RoomData.Triangles); } } diff --git a/TREnvironmentEditor/Model/Types/Textures/EMRemoveFaceFunction.cs b/TREnvironmentEditor/Model/Types/Textures/EMRemoveFaceFunction.cs index f2637e9ce..79b0256ca 100644 --- a/TREnvironmentEditor/Model/Types/Textures/EMRemoveFaceFunction.cs +++ b/TREnvironmentEditor/Model/Types/Textures/EMRemoveFaceFunction.cs @@ -13,7 +13,7 @@ public override void ApplyToLevel(TR1Level level) foreach (int roomNumber in GeometryMap.Keys) { - TRRoom room = level.Rooms[data.ConvertRoom(roomNumber)]; + TR1Room room = level.Rooms[data.ConvertRoom(roomNumber)]; List rectangleRemovals = new(); List triangleRemovals = new(); diff --git a/TREnvironmentEditor/Model/Types/Textures/EMRemoveStaticMeshFunction.cs b/TREnvironmentEditor/Model/Types/Textures/EMRemoveStaticMeshFunction.cs index 72a531e83..b2eefc578 100644 --- a/TREnvironmentEditor/Model/Types/Textures/EMRemoveStaticMeshFunction.cs +++ b/TREnvironmentEditor/Model/Types/Textures/EMRemoveStaticMeshFunction.cs @@ -14,14 +14,14 @@ public override void ApplyToLevel(TR1Level level) if (Location != null) { - TRRoom room = level.Rooms[data.ConvertRoom(Location.Room)]; - List meshes = room.StaticMeshes.ToList(); + TR1Room room = level.Rooms[data.ConvertRoom(Location.Room)]; + List meshes = room.StaticMeshes.ToList(); uint x = (uint)Location.X; uint y = (uint)(Location.Y < 0 ? uint.MaxValue + Location.Y : Location.Y); uint z = (uint)Location.Z; - TRRoomStaticMesh match = meshes.Find(m => m.X == x && m.Y == y && m.Z == z); + TR1RoomStaticMesh match = meshes.Find(m => m.X == x && m.Y == y && m.Z == z); if (match != null) { meshes.Remove(match); @@ -36,8 +36,8 @@ public override void ApplyToLevel(TR1Level level) { foreach (int roomNumber in ClearFromRooms[meshID]) { - TRRoom room = level.Rooms[data.ConvertRoom(roomNumber)]; - List meshes = room.StaticMeshes.ToList(); + TR1Room room = level.Rooms[data.ConvertRoom(roomNumber)]; + List meshes = room.StaticMeshes.ToList(); if (meshes.RemoveAll(m => m.MeshID == meshID) > 0) { room.StaticMeshes = meshes.ToArray(); diff --git a/TREnvironmentEditor/Model/Types/Textures/EMSwapFaceFunction.cs b/TREnvironmentEditor/Model/Types/Textures/EMSwapFaceFunction.cs index 637df0cd4..8d2b15075 100644 --- a/TREnvironmentEditor/Model/Types/Textures/EMSwapFaceFunction.cs +++ b/TREnvironmentEditor/Model/Types/Textures/EMSwapFaceFunction.cs @@ -12,7 +12,7 @@ public class EMSwapFaceFunction : BaseEMFunction public override void ApplyToLevel(TR1Level level) { EMLevelData data = GetData(level); - TRRoom room = level.Rooms[data.ConvertRoom(RoomIndex)]; + TR1Room room = level.Rooms[data.ConvertRoom(RoomIndex)]; if (FaceType == EMTextureFaceType.Rectangles) { foreach (int originalIndex in Swaps.Keys) diff --git a/TREnvironmentEditor/Model/Types/Triggers/EMRemoveEntityTriggersFunction.cs b/TREnvironmentEditor/Model/Types/Triggers/EMRemoveEntityTriggersFunction.cs index 8664afc75..e57a60498 100644 --- a/TREnvironmentEditor/Model/Types/Triggers/EMRemoveEntityTriggersFunction.cs +++ b/TREnvironmentEditor/Model/Types/Triggers/EMRemoveEntityTriggersFunction.cs @@ -19,7 +19,7 @@ public override void ApplyToLevel(TR1Level level) FDControl floorData = new(); floorData.ParseFromLevel(level); - foreach (TRRoom room in level.Rooms) + foreach (TR1Room room in level.Rooms) { RemoveSectorTriggers(floorData, room.Sectors, entities, excludedTypes); } diff --git a/TRFDControl/Utilities/FDUtilities.cs b/TRFDControl/Utilities/FDUtilities.cs index 91b5ea758..70b1fcd31 100644 --- a/TRFDControl/Utilities/FDUtilities.cs +++ b/TRFDControl/Utilities/FDUtilities.cs @@ -81,7 +81,7 @@ public static List GetActionListItems(FDControl control, FDTri public static void RemoveEntityTriggers(TR1Level level, int entityIndex, FDControl control) { - foreach (TRRoom room in level.Rooms) + foreach (TR1Room room in level.Rooms) { RemoveEntityTriggers(room.Sectors, entityIndex, control); } @@ -144,7 +144,7 @@ public static TRRoomSector GetRoomSector(int x, int z, TRRoomSector[] sectors, T public static TRRoomSector GetRoomSector(int x, int y, int z, short roomNumber, TR1Level level, FDControl floorData) { int xFloor, yFloor; - TRRoom room = level.Rooms[roomNumber]; + TR1Room room = level.Rooms[roomNumber]; TRRoomSector sector; short data; @@ -515,7 +515,7 @@ private static int CheckCeilingTriangle(FDControl floorData, TRRoomSector sector public static int GetHeight(int x, int z, short roomIndex, TR1Level level, FDControl floorData, bool waterOnly) { - TRRoom room = level.Rooms[roomIndex]; + TR1Room room = level.Rooms[roomIndex]; if (waterOnly && !room.ContainsWater) { return TRConsts.NoHeight; diff --git a/TRLevelControl/Compression/TRZlib.cs b/TRLevelControl/Compression/TRZlib.cs deleted file mode 100644 index f8398e836..000000000 --- a/TRLevelControl/Compression/TRZlib.cs +++ /dev/null @@ -1,40 +0,0 @@ -using ICSharpCode.SharpZipLib.Zip.Compression.Streams; - -//ref: https://benfoster.io/blog/zlib-compression-net-core/ - -//Looking at a .TR4 file in HxD, the zlib header is 78 9C which means default compression. - -//Level | ZLIB | GZIP -// 1 | 78 01 | 1F 8B - No/Low -// 2 | 78 5E | 1F 8B -// 3 | 78 5E | 1F 8B -// 4 | 78 5E | 1F 8B -// 5 | 78 5E | 1F 8B -// 6 | 78 9C | 1F 8B - Default -// 7 | 78 DA | 1F 8B - Best -// 8 | 78 DA | 1F 8B -// 9 | 78 DA | 1F 8B - -namespace TRLevelControl.Compression; - -public static class TRZlib -{ - public static byte[] Decompress(byte[] data) - { - using MemoryStream outputStream = new(); - using MemoryStream compressedStream = new(data); - using InflaterInputStream inputStream = new(compressedStream); - inputStream.CopyTo(outputStream); - return outputStream.ToArray(); - } - - public static byte[] Compress(byte[] data) - { - using MemoryStream outMemoryStream = new(); - using DeflaterOutputStream outZStream = new(outMemoryStream); - using Stream inMemoryStream = new MemoryStream(data); - inMemoryStream.CopyTo(outZStream); - outZStream.Finish(); - return outMemoryStream.ToArray(); - } -} diff --git a/TRLevelControl/Control/TR1LevelControl.cs b/TRLevelControl/Control/TR1LevelControl.cs index 78fa3e181..876446100 100644 --- a/TRLevelControl/Control/TR1LevelControl.cs +++ b/TRLevelControl/Control/TR1LevelControl.cs @@ -42,7 +42,7 @@ protected override void Read(TRLevelReader reader) _level.Rooms = new(); for (int i = 0; i < numRooms; i++) { - TRRoom room = new() + TR1Room room = new() { //Grab info Info = new TRRoomInfo @@ -87,18 +87,18 @@ protected override void Read(TRLevelReader reader) //Lighting room.AmbientIntensity = reader.ReadInt16(); room.NumLights = reader.ReadUInt16(); - room.Lights = new TRRoomLight[room.NumLights]; + room.Lights = new TR1RoomLight[room.NumLights]; for (int j = 0; j < room.NumLights; j++) { - room.Lights[j] = TRFileReadUtilities.ReadRoomLight(reader); + room.Lights[j] = TR1FileReadUtilities.ReadRoomLight(reader); } //Static meshes room.NumStaticMeshes = reader.ReadUInt16(); - room.StaticMeshes = new TRRoomStaticMesh[room.NumStaticMeshes]; + room.StaticMeshes = new TR1RoomStaticMesh[room.NumStaticMeshes]; for (int j = 0; j < room.NumStaticMeshes; j++) { - room.StaticMeshes[j] = TRFileReadUtilities.ReadRoomStaticMesh(reader); + room.StaticMeshes[j] = TR1FileReadUtilities.ReadRoomStaticMesh(reader); } room.AlternateRoom = reader.ReadInt16(); @@ -154,7 +154,7 @@ protected override void Read(TRLevelReader reader) _level.Boxes = new(); for (int i = 0; i < numBoxes; i++) { - _level.Boxes.Add(TRFileReadUtilities.ReadBox(reader)); + _level.Boxes.Add(TR1FileReadUtilities.ReadBox(reader)); } //Overlaps & Zones @@ -201,7 +201,7 @@ protected override void Write(TRLevelWriter writer) writer.Write(_level.Version.LevelNumber); writer.Write((ushort)_level.Rooms.Count); - foreach (TRRoom room in _level.Rooms) { writer.Write(room.Serialize()); } + foreach (TR1Room room in _level.Rooms) { writer.Write(room.Serialize()); } writer.Write((uint)_level.FloorData.Count); writer.Write(_level.FloorData); @@ -284,23 +284,23 @@ private void WriteStaticMeshes(TRLevelWriter writer) _meshBuilder.WriteStaticMeshes(writer, _level.StaticMeshes); } - private static TRRoomData ConvertToRoomData(TRRoom room) + private static TR1RoomData ConvertToRoomData(TR1Room room) { int RoomDataOffset = 0; //Grab detailed room data - TRRoomData RoomData = new() + TR1RoomData RoomData = new() { //Room vertices NumVertices = UnsafeConversions.UShortToShort(room.Data[RoomDataOffset]) }; - RoomData.Vertices = new TRRoomVertex[RoomData.NumVertices]; + RoomData.Vertices = new TR1RoomVertex[RoomData.NumVertices]; RoomDataOffset++; for (int j = 0; j < RoomData.NumVertices; j++) { - TRRoomVertex vertex = new() + TR1RoomVertex vertex = new() { Vertex = new TRVertex() }; diff --git a/TRLevelControl/Helpers/Pathing/BoxGenerator.cs b/TRLevelControl/Helpers/Pathing/BoxGenerator.cs index 7b6bf6edc..f1394e3d0 100644 --- a/TRLevelControl/Helpers/Pathing/BoxGenerator.cs +++ b/TRLevelControl/Helpers/Pathing/BoxGenerator.cs @@ -5,7 +5,7 @@ namespace TRLevelControl.Helpers.Pathing; public class BoxGenerator { - public static void Generate(TRRoom room, TR1Level level, TRRoomSector linkedSector) + public static void Generate(TR1Room room, TR1Level level, TRRoomSector linkedSector) { Room boxRoom = Room.Create(room); Generate(boxRoom, level.Boxes.Count); diff --git a/TRLevelControl/Helpers/Pathing/Room.cs b/TRLevelControl/Helpers/Pathing/Room.cs index 0566d2aa8..e175b086d 100644 --- a/TRLevelControl/Helpers/Pathing/Room.cs +++ b/TRLevelControl/Helpers/Pathing/Room.cs @@ -13,7 +13,7 @@ public class Room public List FloorPlan { get; set; } public List Boxes { get; set; } - public static Room Create(TRRoom room) + public static Room Create(TR1Room room) { return new Room { diff --git a/TRLevelControl/Helpers/TR1BoxUtilities.cs b/TRLevelControl/Helpers/TR1BoxUtilities.cs index 209d42ae4..f55bd762b 100644 --- a/TRLevelControl/Helpers/TR1BoxUtilities.cs +++ b/TRLevelControl/Helpers/TR1BoxUtilities.cs @@ -89,7 +89,7 @@ public static List FlattenZones(List zoneGroups) public static int GetSectorCount(TR1Level level, int boxIndex) { int count = 0; - foreach (TRRoom room in level.Rooms) + foreach (TR1Room room in level.Rooms) { foreach (TRRoomSector sector in room.Sectors) { diff --git a/TRLevelControl/Model/Base/Enums/FlipStatus.cs b/TRLevelControl/Model/Common/Enums/FlipStatus.cs similarity index 100% rename from TRLevelControl/Model/Base/Enums/FlipStatus.cs rename to TRLevelControl/Model/Common/Enums/FlipStatus.cs diff --git a/TRLevelControl/Model/Base/Enums/TRZones.cs b/TRLevelControl/Model/Common/Enums/TRZones.cs similarity index 100% rename from TRLevelControl/Model/Base/Enums/TRZones.cs rename to TRLevelControl/Model/Common/Enums/TRZones.cs diff --git a/TRLevelControl/Model/Base/FixedPointTypes.cs b/TRLevelControl/Model/Common/FixedPointTypes.cs similarity index 100% rename from TRLevelControl/Model/Base/FixedPointTypes.cs rename to TRLevelControl/Model/Common/FixedPointTypes.cs diff --git a/TRLevelControl/Model/Base/TRAnimCommand.cs b/TRLevelControl/Model/Common/TRAnimCommand.cs similarity index 100% rename from TRLevelControl/Model/Base/TRAnimCommand.cs rename to TRLevelControl/Model/Common/TRAnimCommand.cs diff --git a/TRLevelControl/Model/Base/TRAnimDispatch.cs b/TRLevelControl/Model/Common/TRAnimDispatch.cs similarity index 100% rename from TRLevelControl/Model/Base/TRAnimDispatch.cs rename to TRLevelControl/Model/Common/TRAnimDispatch.cs diff --git a/TRLevelControl/Model/Base/TRAnimFrame.cs b/TRLevelControl/Model/Common/TRAnimFrame.cs similarity index 100% rename from TRLevelControl/Model/Base/TRAnimFrame.cs rename to TRLevelControl/Model/Common/TRAnimFrame.cs diff --git a/TRLevelControl/Model/Base/TRAnimatedTexture.cs b/TRLevelControl/Model/Common/TRAnimatedTexture.cs similarity index 100% rename from TRLevelControl/Model/Base/TRAnimatedTexture.cs rename to TRLevelControl/Model/Common/TRAnimatedTexture.cs diff --git a/TRLevelControl/Model/Base/TRAnimation.cs b/TRLevelControl/Model/Common/TRAnimation.cs similarity index 100% rename from TRLevelControl/Model/Base/TRAnimation.cs rename to TRLevelControl/Model/Common/TRAnimation.cs diff --git a/TRLevelControl/Model/Base/TRBoundingBox.cs b/TRLevelControl/Model/Common/TRBoundingBox.cs similarity index 100% rename from TRLevelControl/Model/Base/TRBoundingBox.cs rename to TRLevelControl/Model/Common/TRBoundingBox.cs diff --git a/TRLevelControl/Model/Base/TRBox.cs b/TRLevelControl/Model/Common/TRBox.cs similarity index 100% rename from TRLevelControl/Model/Base/TRBox.cs rename to TRLevelControl/Model/Common/TRBox.cs diff --git a/TRLevelControl/Model/Base/TRCamera.cs b/TRLevelControl/Model/Common/TRCamera.cs similarity index 100% rename from TRLevelControl/Model/Base/TRCamera.cs rename to TRLevelControl/Model/Common/TRCamera.cs diff --git a/TRLevelControl/Model/Base/TRCinematicFrame.cs b/TRLevelControl/Model/Common/TRCinematicFrame.cs similarity index 100% rename from TRLevelControl/Model/Base/TRCinematicFrame.cs rename to TRLevelControl/Model/Common/TRCinematicFrame.cs diff --git a/TRLevelControl/Model/Base/TRFace3.cs b/TRLevelControl/Model/Common/TRFace3.cs similarity index 100% rename from TRLevelControl/Model/Base/TRFace3.cs rename to TRLevelControl/Model/Common/TRFace3.cs diff --git a/TRLevelControl/Model/Base/TRFace4.cs b/TRLevelControl/Model/Common/TRFace4.cs similarity index 100% rename from TRLevelControl/Model/Base/TRFace4.cs rename to TRLevelControl/Model/Common/TRFace4.cs diff --git a/TRLevelControl/Model/Base/TRMeshTreeNode.cs b/TRLevelControl/Model/Common/TRMeshTreeNode.cs similarity index 100% rename from TRLevelControl/Model/Base/TRMeshTreeNode.cs rename to TRLevelControl/Model/Common/TRMeshTreeNode.cs diff --git a/TRLevelControl/Model/Base/TRModel.cs b/TRLevelControl/Model/Common/TRModel.cs similarity index 100% rename from TRLevelControl/Model/Base/TRModel.cs rename to TRLevelControl/Model/Common/TRModel.cs diff --git a/TRLevelControl/Model/Base/TRObjectTexture.cs b/TRLevelControl/Model/Common/TRObjectTexture.cs similarity index 100% rename from TRLevelControl/Model/Base/TRObjectTexture.cs rename to TRLevelControl/Model/Common/TRObjectTexture.cs diff --git a/TRLevelControl/Model/Base/TRObjectTextureVert.cs b/TRLevelControl/Model/Common/TRObjectTextureVert.cs similarity index 100% rename from TRLevelControl/Model/Base/TRObjectTextureVert.cs rename to TRLevelControl/Model/Common/TRObjectTextureVert.cs diff --git a/TRLevelControl/Model/Base/TRRoomInfo.cs b/TRLevelControl/Model/Common/TRRoomInfo.cs similarity index 100% rename from TRLevelControl/Model/Base/TRRoomInfo.cs rename to TRLevelControl/Model/Common/TRRoomInfo.cs diff --git a/TRLevelControl/Model/Base/TRRoomPortal.cs b/TRLevelControl/Model/Common/TRRoomPortal.cs similarity index 100% rename from TRLevelControl/Model/Base/TRRoomPortal.cs rename to TRLevelControl/Model/Common/TRRoomPortal.cs diff --git a/TRLevelControl/Model/Base/TRRoomSector.cs b/TRLevelControl/Model/Common/TRRoomSector.cs similarity index 100% rename from TRLevelControl/Model/Base/TRRoomSector.cs rename to TRLevelControl/Model/Common/TRRoomSector.cs diff --git a/TRLevelControl/Model/Base/TRRoomSprite.cs b/TRLevelControl/Model/Common/TRRoomSprite.cs similarity index 100% rename from TRLevelControl/Model/Base/TRRoomSprite.cs rename to TRLevelControl/Model/Common/TRRoomSprite.cs diff --git a/TRLevelControl/Model/Base/TRSoundSource.cs b/TRLevelControl/Model/Common/TRSoundSource.cs similarity index 100% rename from TRLevelControl/Model/Base/TRSoundSource.cs rename to TRLevelControl/Model/Common/TRSoundSource.cs diff --git a/TRLevelControl/Model/Base/TRSpriteSequence.cs b/TRLevelControl/Model/Common/TRSpriteSequence.cs similarity index 100% rename from TRLevelControl/Model/Base/TRSpriteSequence.cs rename to TRLevelControl/Model/Common/TRSpriteSequence.cs diff --git a/TRLevelControl/Model/Base/TRSpriteTexture.cs b/TRLevelControl/Model/Common/TRSpriteTexture.cs similarity index 100% rename from TRLevelControl/Model/Base/TRSpriteTexture.cs rename to TRLevelControl/Model/Common/TRSpriteTexture.cs diff --git a/TRLevelControl/Model/Base/TRStateChange.cs b/TRLevelControl/Model/Common/TRStateChange.cs similarity index 100% rename from TRLevelControl/Model/Base/TRStateChange.cs rename to TRLevelControl/Model/Common/TRStateChange.cs diff --git a/TRLevelControl/Model/Base/TRStaticMesh.cs b/TRLevelControl/Model/Common/TRStaticMesh.cs similarity index 100% rename from TRLevelControl/Model/Base/TRStaticMesh.cs rename to TRLevelControl/Model/Common/TRStaticMesh.cs diff --git a/TRLevelControl/Model/Base/TRVertex.cs b/TRLevelControl/Model/Common/TRVertex.cs similarity index 100% rename from TRLevelControl/Model/Base/TRVertex.cs rename to TRLevelControl/Model/Common/TRVertex.cs diff --git a/TRLevelControl/Model/Base/TRZone.cs b/TRLevelControl/Model/Common/TRZone.cs similarity index 100% rename from TRLevelControl/Model/Base/TRZone.cs rename to TRLevelControl/Model/Common/TRZone.cs diff --git a/TRLevelControl/Model/Base/TRZoneGroup.cs b/TRLevelControl/Model/Common/TRZoneGroup.cs similarity index 100% rename from TRLevelControl/Model/Base/TRZoneGroup.cs rename to TRLevelControl/Model/Common/TRZoneGroup.cs diff --git a/TRLevelControl/Model/Base/Enums/TR1FX.cs b/TRLevelControl/Model/TR1/Enums/TR1FX.cs similarity index 100% rename from TRLevelControl/Model/Base/Enums/TR1FX.cs rename to TRLevelControl/Model/TR1/Enums/TR1FX.cs diff --git a/TRLevelControl/Model/Base/Enums/TR1SFX.cs b/TRLevelControl/Model/TR1/Enums/TR1SFX.cs similarity index 100% rename from TRLevelControl/Model/Base/Enums/TR1SFX.cs rename to TRLevelControl/Model/TR1/Enums/TR1SFX.cs diff --git a/TRLevelControl/Model/Base/Enums/TR1SFXMode.cs b/TRLevelControl/Model/TR1/Enums/TR1SFXMode.cs similarity index 100% rename from TRLevelControl/Model/Base/Enums/TR1SFXMode.cs rename to TRLevelControl/Model/TR1/Enums/TR1SFXMode.cs diff --git a/TRLevelControl/Model/Base/Enums/TR1Type.cs b/TRLevelControl/Model/TR1/Enums/TR1Type.cs similarity index 100% rename from TRLevelControl/Model/Base/Enums/TR1Type.cs rename to TRLevelControl/Model/TR1/Enums/TR1Type.cs diff --git a/TRLevelControl/Model/Base/TR1Entity.cs b/TRLevelControl/Model/TR1/TR1Entity.cs similarity index 100% rename from TRLevelControl/Model/Base/TR1Entity.cs rename to TRLevelControl/Model/TR1/TR1Entity.cs diff --git a/TRLevelControl/Model/Base/TR1Level.cs b/TRLevelControl/Model/TR1/TR1Level.cs similarity index 96% rename from TRLevelControl/Model/Base/TR1Level.cs rename to TRLevelControl/Model/TR1/TR1Level.cs index 42ac231df..c8c6beb33 100644 --- a/TRLevelControl/Model/Base/TR1Level.cs +++ b/TRLevelControl/Model/TR1/TR1Level.cs @@ -3,7 +3,7 @@ public class TR1Level : TRLevelBase { public List Images8 { get; set; } - public List Rooms { get; set; } + public List Rooms { get; set; } public List FloorData { get; set; } public List Models { get; set; } public List StaticMeshes { get; set; } diff --git a/TRLevelControl/Model/Base/TRRoom.cs b/TRLevelControl/Model/TR1/TR1Room.cs similarity index 84% rename from TRLevelControl/Model/Base/TRRoom.cs rename to TRLevelControl/Model/TR1/TR1Room.cs index bdbdb3d6e..b65a2209a 100644 --- a/TRLevelControl/Model/Base/TRRoom.cs +++ b/TRLevelControl/Model/TR1/TR1Room.cs @@ -2,7 +2,7 @@ namespace TRLevelControl.Model; -public class TRRoom : ISerializableCompact +public class TR1Room : ISerializableCompact { public TRRoomInfo Info { get; set; } @@ -10,7 +10,7 @@ public class TRRoom : ISerializableCompact public ushort[] Data { get; set; } - public TRRoomData RoomData { get; set; } + public TR1RoomData RoomData { get; set; } public ushort NumPortals { get; set; } @@ -26,11 +26,11 @@ public class TRRoom : ISerializableCompact public ushort NumLights { get; set; } - public TRRoomLight[] Lights { get; set; } + public TR1RoomLight[] Lights { get; set; } public ushort NumStaticMeshes { get; set; } - public TRRoomStaticMesh[] StaticMeshes { get; set; } + public TR1RoomStaticMesh[] StaticMeshes { get; set; } public short AlternateRoom { get; set; } @@ -61,7 +61,7 @@ public void Drain() //Light intensity = 0 (dark) - 0x1FFF (bright)!!! public void SetLights(ushort val) { - foreach (TRRoomLight light in Lights) + foreach (TR1RoomLight light in Lights) { light.Intensity = val; } @@ -69,7 +69,7 @@ public void SetLights(ushort val) public void SetStaticMeshLights(ushort val) { - foreach (TRRoomStaticMesh mesh in StaticMeshes) + foreach (TR1RoomStaticMesh mesh in StaticMeshes) { mesh.Intensity = val; } @@ -77,7 +77,7 @@ public void SetStaticMeshLights(ushort val) public void SetVertexLight(short val) { - foreach (TRRoomVertex vert in RoomData.Vertices) + foreach (TR1RoomVertex vert in RoomData.Vertices) { vert.Lighting = val; } @@ -115,14 +115,14 @@ public byte[] Serialize() writer.Write(AmbientIntensity); writer.Write(NumLights); - foreach (TRRoomLight light in Lights) + foreach (TR1RoomLight light in Lights) { writer.Write(light.Serialize()); } writer.Write(NumStaticMeshes); - foreach (TRRoomStaticMesh mesh in StaticMeshes) + foreach (TR1RoomStaticMesh mesh in StaticMeshes) { writer.Write(mesh.Serialize()); } diff --git a/TRLevelControl/Model/Base/TRRoomData.cs b/TRLevelControl/Model/TR1/TR1RoomData.cs similarity index 88% rename from TRLevelControl/Model/Base/TRRoomData.cs rename to TRLevelControl/Model/TR1/TR1RoomData.cs index 62c3cdd94..c4cbb38f7 100644 --- a/TRLevelControl/Model/Base/TRRoomData.cs +++ b/TRLevelControl/Model/TR1/TR1RoomData.cs @@ -2,11 +2,11 @@ namespace TRLevelControl.Model; -public class TRRoomData : ISerializableCompact +public class TR1RoomData : ISerializableCompact { public short NumVertices { get; set; } - public TRRoomVertex[] Vertices { get; set; } + public TR1RoomVertex[] Vertices { get; set; } public short NumRectangles { get; set; } @@ -27,7 +27,7 @@ public byte[] Serialize() { writer.Write(NumVertices); - foreach (TRRoomVertex vert in Vertices) + foreach (TR1RoomVertex vert in Vertices) { writer.Write(vert.Serialize()); } diff --git a/TRLevelControl/Model/Base/TRRoomLight.cs b/TRLevelControl/Model/TR1/TR1RoomLight.cs similarity index 92% rename from TRLevelControl/Model/Base/TRRoomLight.cs rename to TRLevelControl/Model/TR1/TR1RoomLight.cs index 0969de30b..98fef215a 100644 --- a/TRLevelControl/Model/Base/TRRoomLight.cs +++ b/TRLevelControl/Model/TR1/TR1RoomLight.cs @@ -2,7 +2,7 @@ namespace TRLevelControl.Model; -public class TRRoomLight : ISerializableCompact +public class TR1RoomLight : ISerializableCompact { public int X { get; set; } diff --git a/TRLevelControl/Model/Base/TRRoomStaticMesh.cs b/TRLevelControl/Model/TR1/TR1RoomStaticMesh.cs similarity index 92% rename from TRLevelControl/Model/Base/TRRoomStaticMesh.cs rename to TRLevelControl/Model/TR1/TR1RoomStaticMesh.cs index b7630a987..6a2b26fd4 100644 --- a/TRLevelControl/Model/Base/TRRoomStaticMesh.cs +++ b/TRLevelControl/Model/TR1/TR1RoomStaticMesh.cs @@ -2,7 +2,7 @@ namespace TRLevelControl.Model; -public class TRRoomStaticMesh : ISerializableCompact +public class TR1RoomStaticMesh : ISerializableCompact { public uint X { get; set; } diff --git a/TRLevelControl/Model/Base/TRRoomVertex.cs b/TRLevelControl/Model/TR1/TR1RoomVertex.cs similarity index 89% rename from TRLevelControl/Model/Base/TRRoomVertex.cs rename to TRLevelControl/Model/TR1/TR1RoomVertex.cs index 57203b80f..5ac3782d2 100644 --- a/TRLevelControl/Model/Base/TRRoomVertex.cs +++ b/TRLevelControl/Model/TR1/TR1RoomVertex.cs @@ -2,7 +2,7 @@ namespace TRLevelControl.Model; -public class TRRoomVertex : ISerializableCompact +public class TR1RoomVertex : ISerializableCompact { public TRVertex Vertex { get; set; } diff --git a/TRLevelControl/Model/Base/TR1SoundEffect.cs b/TRLevelControl/Model/TR1/TR1SoundEffect.cs similarity index 100% rename from TRLevelControl/Model/Base/TR1SoundEffect.cs rename to TRLevelControl/Model/TR1/TR1SoundEffect.cs diff --git a/TRLevelControl/TRFileReadUtilities.cs b/TRLevelControl/TR1FileReadUtilities.cs similarity index 76% rename from TRLevelControl/TRFileReadUtilities.cs rename to TRLevelControl/TR1FileReadUtilities.cs index f5ff69956..3004f0e34 100644 --- a/TRLevelControl/TRFileReadUtilities.cs +++ b/TRLevelControl/TR1FileReadUtilities.cs @@ -2,11 +2,11 @@ namespace TRLevelControl; -internal static class TRFileReadUtilities +internal static class TR1FileReadUtilities { - public static TRRoomLight ReadRoomLight(BinaryReader reader) + public static TR1RoomLight ReadRoomLight(BinaryReader reader) { - return new TRRoomLight + return new() { X = reader.ReadInt32(), Y = reader.ReadInt32(), @@ -16,9 +16,9 @@ public static TRRoomLight ReadRoomLight(BinaryReader reader) }; } - public static TRRoomStaticMesh ReadRoomStaticMesh(BinaryReader reader) + public static TR1RoomStaticMesh ReadRoomStaticMesh(BinaryReader reader) { - return new TRRoomStaticMesh + return new() { X = reader.ReadUInt32(), Y = reader.ReadUInt32(), @@ -31,7 +31,7 @@ public static TRRoomStaticMesh ReadRoomStaticMesh(BinaryReader reader) public static TRBox ReadBox(BinaryReader reader) { - return new TRBox() + return new() { ZMin = reader.ReadUInt32(), ZMax = reader.ReadUInt32(), diff --git a/TRRandomizerCore/Randomizers/TR1/TR1AudioRandomizer.cs b/TRRandomizerCore/Randomizers/TR1/TR1AudioRandomizer.cs index 27b46f041..34f565a5e 100644 --- a/TRRandomizerCore/Randomizers/TR1/TR1AudioRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR1/TR1AudioRandomizer.cs @@ -123,7 +123,7 @@ private void RandomizeMusicTriggers(TR1CombinedLevel level) floorData.ParseFromLevel(level.Data); _audioRandomizer.ResetFloorMap(); - foreach (TRRoom room in level.Data.Rooms.Where(r => (r.Flags & EMLockMusicFunction.LockedMusicFlag) == 0)) + foreach (TR1Room room in level.Data.Rooms.Where(r => (r.Flags & EMLockMusicFunction.LockedMusicFlag) == 0)) { _audioRandomizer.RandomizeFloorTracks(room.Sectors, floorData, _generator, sectorIndex => { diff --git a/TRRandomizerCore/Randomizers/TR1/TR1EnemyRandomizer.cs b/TRRandomizerCore/Randomizers/TR1/TR1EnemyRandomizer.cs index 620901bb9..65e9f24d4 100644 --- a/TRRandomizerCore/Randomizers/TR1/TR1EnemyRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR1/TR1EnemyRandomizer.cs @@ -656,7 +656,7 @@ private void RandomizeEnemies(TR1CombinedLevel level, EnemyRandomizationCollecti // hybrid, otherwise allow land creatures underwater (which works, but is obviously more difficult). if (difficulty == RandoDifficulty.Default) { - TRRoom currentRoom = level.Data.Rooms[currentEntity.Room]; + TR1Room currentRoom = level.Data.Rooms[currentEntity.Room]; if (currentRoom.AlternateRoom != -1 && level.Data.Rooms[currentRoom.AlternateRoom].ContainsWater && TR1TypeUtilities.IsWaterLandCreatureEquivalent(currentEntityType) && !TR1TypeUtilities.IsWaterLandCreatureEquivalent(newEntityType)) { Dictionary hybrids = TR1TypeUtilities.GetWaterEnemyLandCreatures(); diff --git a/TRRandomizerCore/Randomizers/TR1/TR1NightModeRandomizer.cs b/TRRandomizerCore/Randomizers/TR1/TR1NightModeRandomizer.cs index f77176dfe..3df199475 100644 --- a/TRRandomizerCore/Randomizers/TR1/TR1NightModeRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR1/TR1NightModeRandomizer.cs @@ -86,7 +86,7 @@ private void DarkenRooms(TR1CombinedLevel level) continue; } - TRRoom room = level.Data.Rooms[i]; + TR1Room room = level.Data.Rooms[i]; room.SetAmbient(intensity1); room.SetLights(intensity2); room.SetStaticMeshLights((ushort)intensity1); diff --git a/TRRandomizerCore/Randomizers/TR1/TR1SecretRandomizer.cs b/TRRandomizerCore/Randomizers/TR1/TR1SecretRandomizer.cs index bcac53faa..5226d335d 100644 --- a/TRRandomizerCore/Randomizers/TR1/TR1SecretRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR1/TR1SecretRandomizer.cs @@ -173,7 +173,7 @@ private static void RemoveDefaultSecrets(TR1CombinedLevel level) floorData.ParseFromLevel(level.Data); // Scan all rooms and remove any existing secret triggers. - foreach (TRRoom room in level.Data.Rooms) + foreach (TR1Room room in level.Data.Rooms) { foreach (TRRoomSector sector in room.Sectors) { diff --git a/TRRandomizerCore/Randomizers/TR1R/TR1RAudioRandomizer.cs b/TRRandomizerCore/Randomizers/TR1R/TR1RAudioRandomizer.cs index c96f83822..4bc8e70b2 100644 --- a/TRRandomizerCore/Randomizers/TR1R/TR1RAudioRandomizer.cs +++ b/TRRandomizerCore/Randomizers/TR1R/TR1RAudioRandomizer.cs @@ -63,7 +63,7 @@ private void RandomizeMusicTriggers(TR1RCombinedLevel level) private void RandomizeFloorTracks(TR1Level level, FDControl floorData) { _audioRandomizer.ResetFloorMap(); - foreach (TRRoom room in level.Rooms.Where(r => (r.Flags & EMLockMusicFunction.LockedMusicFlag) == 0)) + foreach (TR1Room room in level.Rooms.Where(r => (r.Flags & EMLockMusicFunction.LockedMusicFlag) == 0)) { _audioRandomizer.RandomizeFloorTracks(room.Sectors, floorData, _generator, sectorIndex => { diff --git a/TRRandomizerCore/Textures/DynamicTextureBuilder.cs b/TRRandomizerCore/Textures/DynamicTextureBuilder.cs index 681ccde04..b440fc60e 100644 --- a/TRRandomizerCore/Textures/DynamicTextureBuilder.cs +++ b/TRRandomizerCore/Textures/DynamicTextureBuilder.cs @@ -71,7 +71,7 @@ public DynamicTextureTarget Build(TR1CombinedLevel level) ISet modelMeshes = new HashSet(); // Collect unique room and room sprite textures - foreach (TRRoom room in level.Data.Rooms) + foreach (TR1Room room in level.Data.Rooms) { foreach (TRFace3 f in room.RoomData.Triangles) defaultObjectTextures.Add(f.Texture); diff --git a/TRRandomizerCore/Textures/Landmarks/TR1LandmarkImporter.cs b/TRRandomizerCore/Textures/Landmarks/TR1LandmarkImporter.cs index 9bfb42e14..fd4e0232e 100644 --- a/TRRandomizerCore/Textures/Landmarks/TR1LandmarkImporter.cs +++ b/TRRandomizerCore/Textures/Landmarks/TR1LandmarkImporter.cs @@ -29,7 +29,7 @@ protected override void SetRoomTexture(TR1Level level, int roomIndex, int rectan FDControl floorData = new(); floorData.ParseFromLevel(level); - TRRoom room = level.Rooms[portalSector.Room]; + TR1Room room = level.Rooms[portalSector.Room]; int x = isLevelMirrored ? (room.NumXSectors - portalSector.X - 1) : portalSector.X; TRRoomSector sector = room.Sectors[x * room.NumZSectors + portalSector.Z]; diff --git a/TRRandomizerCore/Textures/Wireframing/TR1Wireframer.cs b/TRRandomizerCore/Textures/Wireframing/TR1Wireframer.cs index 8c2002999..ac46e269a 100644 --- a/TRRandomizerCore/Textures/Wireframing/TR1Wireframer.cs +++ b/TRRandomizerCore/Textures/Wireframing/TR1Wireframer.cs @@ -104,7 +104,7 @@ protected override List GetObjectTextures(TR1Level level) protected override IEnumerable> GetRoomFace3s(TR1Level level) { List> faces = new(); - foreach (TRRoom room in level.Rooms) + foreach (TR1Room room in level.Rooms) { faces.Add(room.RoomData.Triangles.ToList()); } @@ -114,7 +114,7 @@ protected override IEnumerable> GetRoomFace3s(TR1Level leve protected override IEnumerable> GetRoomFace4s(TR1Level level) { List> faces = new(); - foreach (TRRoom room in level.Rooms) + foreach (TR1Room room in level.Rooms) { faces.Add(room.RoomData.Rectangles.ToList()); } diff --git a/TRRandomizerCore/Utilities/FaceUtilities.cs b/TRRandomizerCore/Utilities/FaceUtilities.cs index 0f0c85b61..c9e828522 100644 --- a/TRRandomizerCore/Utilities/FaceUtilities.cs +++ b/TRRandomizerCore/Utilities/FaceUtilities.cs @@ -14,7 +14,7 @@ public static List GetTriggerFaces(TR1Level level, List tri floorData.ParseFromLevel(level); List faces = new(); - foreach (TRRoom room in level.Rooms) + foreach (TR1Room room in level.Rooms) { faces.AddRange(ScanTriggerFaces(floorData, triggerTypes, includeDeathTiles, room.Sectors, room.NumZSectors, room.RoomData.Rectangles, v => { diff --git a/TRRandomizerCore/Utilities/Locations/TR1LocationGenerator.cs b/TRRandomizerCore/Utilities/Locations/TR1LocationGenerator.cs index 070535d01..5180f0ad5 100644 --- a/TRRandomizerCore/Utilities/Locations/TR1LocationGenerator.cs +++ b/TRRandomizerCore/Utilities/Locations/TR1LocationGenerator.cs @@ -24,7 +24,7 @@ protected override TRRoomSector GetSector(Location location, TR1Level level) protected override TRRoomSector GetSector(int x, int z, int roomIndex, TR1Level level) { - TRRoom room = level.Rooms[roomIndex]; + TR1Room room = level.Rooms[roomIndex]; return FDUtilities.GetRoomSector(x, z, room.Sectors, room.Info, room.NumZSectors); } @@ -63,7 +63,7 @@ protected override bool TriggerSupportsItems(TR1Level level, FDTriggerEntry trig protected override Dictionary> GetRoomStaticMeshLocations(TR1Level level, short room) { Dictionary> locations = new(); - foreach (TRRoomStaticMesh staticMesh in level.Rooms[room].StaticMeshes) + foreach (TR1RoomStaticMesh staticMesh in level.Rooms[room].StaticMeshes) { if (!locations.ContainsKey(staticMesh.MeshID)) {