Use LodInParentYmap flag for LOD linking instead of index check hack

This commit is contained in:
dexy 2022-01-16 00:00:48 +11:00
parent 64f007d611
commit d622cd33fa

View File

@ -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
{