diff --git a/project/code/TMV/Mission.cs b/project/code/TMV/Mission.cs index 2d3fae9..b448556 100644 --- a/project/code/TMV/Mission.cs +++ b/project/code/TMV/Mission.cs @@ -104,7 +104,16 @@ public partial class Mission : Node3D Timing.TimeStage("Load FAM", () => UseChunk("TXLIST", LoadTextures)); Timing.TimeStage("Build WR", () => UseChunk("WREXT", BuildWrMeshes)); - // TODO: Sort this out so I can time it lol + if (_file.Chunks.TryGetValue("BRLIST", out var brList)) + { + var objHierarchy = Timing.TimeStage("Hierarchy", () => BuildHierarchy(_file)); + Timing.TimeStage("Object Placement", () => PlaceObjects((BrList)brList, objHierarchy)); + } + } + + // TODO: Make this less of a mess + private ObjectHierarchy BuildHierarchy(DbFile db) + { ObjectHierarchy objHierarchy; if (_file.Chunks.TryGetValue("GAM_FILE", out var gamFileChunk)) { @@ -125,11 +134,7 @@ public partial class Mission : Node3D { objHierarchy = new ObjectHierarchy(_file); } - - if (_file.Chunks.TryGetValue("BRLIST", out var brList)) - { - Timing.TimeStage("Object Placement", () => PlaceObjects((BrList)brList, objHierarchy)); - } + return objHierarchy; } private void UseChunk(string name, Action action)