Render all interior entitySets.

This commit is contained in:
dexyfex 2018-01-02 17:43:47 +11:00
parent 48fe9cee9b
commit 56f9378506
3 changed files with 41 additions and 17 deletions

View File

@ -1115,6 +1115,7 @@ namespace CodeWalker.GameFiles
public bool IsMlo { get; set; }
public MloInstanceData MloInstance { get; set; }
public YmapEntityDef MloParent { get; set; }
public MCMloEntitySet MloEntitySet { get; set; }
public Vector3 MloRefPosition { get; set; }
public Quaternion MloRefOrientation { get; set; }
public MetaWrapper[] Extensions { get; set; }

View File

@ -1962,7 +1962,7 @@ namespace CodeWalker.GameFiles
public override string ToString()
{
return Name;
return Name + ": " + (Entities?.Length ?? 0).ToString() + " entities";
}
}

View File

@ -212,31 +212,54 @@ namespace CodeWalker.GameFiles
if (owner == null) return;
if (mloa.entities == null) return;
var ec = mloa.entities.Length;
Entities = new YmapEntityDef[ec];
var entlist = new List<YmapEntityDef>();
for (int i = 0; i < ec; i++)
{
MCEntityDef ment = mloa.entities[i];
YmapEntityDef e = new YmapEntityDef(null, i, ref ment._Data);
e.Extensions = ment.Extensions;
e.MloRefPosition = e.Position;
e.MloRefOrientation = e.Orientation;
e.MloParent = owner;
e.Position = owner.Position + owner.Orientation.Multiply(e.MloRefPosition);
e.Orientation = Quaternion.Multiply(owner.Orientation, e.MloRefOrientation);
e.UpdateWidgetPosition();
e.UpdateWidgetOrientation();
Entities[i] = e;
YmapEntityDef e = CreateYmapEntity(owner, mloa.entities[i], i);
entlist.Add(e);
}
int lasti = ec;
var entitySets = mloa.entitySets;
if (entitySets != null)
{
//for (int i = 0; i < entitySets.Length; i++)
//{
// var entitySet = entitySets[i];
//}
for (int i = 0; i < entitySets.Length; i++)
{
var entitySet = entitySets[i];
if (entitySet.Entities != null)
{
for (int j = 0; j < entitySet.Entities.Length; j++)
{
YmapEntityDef e = CreateYmapEntity(owner, entitySet.Entities[j], lasti);
e.MloEntitySet = entitySet;
entlist.Add(e);
lasti++;
}
}
}
}
if (defaultEntitySets != null)
{
}
Entities = entlist.ToArray();
}
private YmapEntityDef CreateYmapEntity(YmapEntityDef owner, MCEntityDef ment, int i)
{
YmapEntityDef e = new YmapEntityDef(null, i, ref ment._Data);
e.Extensions = ment.Extensions;
e.MloRefPosition = e.Position;
e.MloRefOrientation = e.Orientation;
e.MloParent = owner;
e.Position = owner.Position + owner.Orientation.Multiply(e.MloRefPosition);
e.Orientation = Quaternion.Multiply(owner.Orientation, e.MloRefOrientation);
e.UpdateWidgetPosition();
e.UpdateWidgetOrientation();
return e;
}