Improved interior info display and XML conversion

This commit is contained in:
dexyfex
2018-03-07 13:12:20 +11:00
Unverified
parent 05ec5e5b76
commit a68523b2ef
7 changed files with 269 additions and 140 deletions
@@ -1828,9 +1828,61 @@ namespace CodeWalker.GameFiles
if (iarch == null)
{ } //can't find archetype - des stuff eg {des_prologue_door}
}
//update archetype room AABB's.. bad to have this here? where else to put it?
var mloa = arch as MloArchetype;
if (mloa != null)
{
Vector3[] c = new Vector3[8];
var rooms = mloa.rooms;
if (rooms != null)
{
for (int j = 0; j < rooms.Length; j++)
{
var room = rooms[j];
if ((room.AttachedObjects == null) || (room.AttachedObjects.Length == 0)) continue;
Vector3 min = new Vector3(float.MaxValue);
Vector3 max = new Vector3(float.MinValue);
for (int k = 0; k < room.AttachedObjects.Length; k++)
{
var objid = room.AttachedObjects[k];
if (objid < entities.Length)
{
var rooment = entities[objid];
if ((rooment != null) && (rooment.Archetype != null))
{
var earch = rooment.Archetype;
var pos = rooment._CEntityDef.position;
var ori = rooment.Orientation;
Vector3 abmin = earch.BBMin * rooment.Scale; //entity box
Vector3 abmax = earch.BBMax * rooment.Scale;
c[0] = abmin;
c[1] = new Vector3(abmin.X, abmin.Y, abmax.Z);
c[2] = new Vector3(abmin.X, abmax.Y, abmin.Z);
c[3] = new Vector3(abmin.X, abmax.Y, abmax.Z);
c[4] = new Vector3(abmax.X, abmin.Y, abmin.Z);
c[5] = new Vector3(abmax.X, abmin.Y, abmax.Z);
c[6] = new Vector3(abmax.X, abmax.Y, abmin.Z);
c[7] = abmax;
for (int n = 0; n < 8; n++)
{
Vector3 corn = ori.Multiply(c[n]) + pos;
min = Vector3.Min(min, corn);
max = Vector3.Max(max, corn);
}
}
}
}
room.BBMin_CW = min;
room.BBMax_CW = max;
}
}
}
}
}
}
}
if (file.GrassInstanceBatches != null)