From d622cd33fa9fcd2ab2582a5fd99116d9c0143d23 Mon Sep 17 00:00:00 2001 From: dexy Date: Sun, 16 Jan 2022 00:00:48 +1100 Subject: [PATCH] Use LodInParentYmap flag for LOD linking instead of index check hack --- CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs b/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs index 58d7095..8265371 100644 --- a/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs +++ b/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs @@ -315,7 +315,7 @@ namespace CodeWalker.GameFiles YmapEntityDef d = alldefs[i]; int pind = d._CEntityDef.parentIndex; bool isroot = false; - if ((pind < 0) || (pind >= alldefs.Count) || (pind >= i)) //index check? might be a problem + if ((pind < 0) || d.LodInParentYmap) { isroot = true; } @@ -912,7 +912,7 @@ namespace CodeWalker.GameFiles } //pind = 0; } - if ((pind >= 0) && (pind < AllEntities.Length)) + if ((pind >= 0) && (pind < AllEntities.Length) && rcent.LodInParentYmap) { var pentity = AllEntities[pind]; pentity.AddChild(rcent); @@ -1718,6 +1718,8 @@ namespace CodeWalker.GameFiles public LightInstance[] Lights { get; set; } //public uint[] LightHashTest { get; set; } + public bool LodInParentYmap { get { return ((_CEntityDef.flags >> 3) & 1) > 0; } } + public string Name {