mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-14 12:44:44 +08:00
Improved interior info display and XML conversion
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -3441,7 +3441,7 @@ namespace CodeWalker.GameFiles
|
||||
timecycleName = 2724323497,
|
||||
secondaryTimecycleName = 3255324828,
|
||||
portalCount = 1105339827,
|
||||
//exteriorVisibiltyDepth = 552849982, //not correct = spelling error?
|
||||
exteriorVisibiltyDepth = 552849982, //not correct = spelling error?
|
||||
attachedObjects = 2382704940,
|
||||
roomFrom = 4101034749,
|
||||
roomTo = 2607060513,
|
||||
|
||||
@@ -840,7 +840,7 @@ namespace CodeWalker.GameFiles
|
||||
new MetaStructureEntryInfo_s(MetaName.flags, 76, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0),
|
||||
new MetaStructureEntryInfo_s(MetaName.portalCount, 80, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0),
|
||||
new MetaStructureEntryInfo_s(MetaName.floorId, 84, MetaStructureEntryDataType.SignedInt, 0, 0, 0),
|
||||
new MetaStructureEntryInfo_s((MetaName)552849982, 88, MetaStructureEntryDataType.SignedInt, 0, 0, 0),
|
||||
new MetaStructureEntryInfo_s(MetaName.exteriorVisibiltyDepth, 88, MetaStructureEntryDataType.SignedInt, 0, 0, 0),
|
||||
new MetaStructureEntryInfo_s(MetaName.ARRAYINFO, 0, MetaStructureEntryDataType.UnsignedInt, 0, 0, 0),
|
||||
new MetaStructureEntryInfo_s(MetaName.attachedObjects, 96, MetaStructureEntryDataType.Array, 0, 10, 0)
|
||||
);
|
||||
@@ -2411,7 +2411,7 @@ namespace CodeWalker.GameFiles
|
||||
public uint flags { get; set; } //76 76: UnsignedInt: 0: flags
|
||||
public uint portalCount { get; set; } //80 80: UnsignedInt: 0: portalCount//1105339827
|
||||
public int floorId { get; set; } //84 84: SignedInt: 0: floorId//2187650609
|
||||
public int Unk_552849982 { get; set; } //88 88: SignedInt: 0: exteriorVisibiltyDepth//552849982
|
||||
public int exteriorVisibiltyDepth { get; set; } //88 88: SignedInt: 0: exteriorVisibiltyDepth//552849982
|
||||
public uint Unused6 { get; set; }//92
|
||||
public Array_uint attachedObjects { get; set; } //96 96: Array: 0: attachedObjects//2382704940 {0: UnsignedInt: 0: 256}
|
||||
}
|
||||
@@ -2422,6 +2422,14 @@ namespace CodeWalker.GameFiles
|
||||
public string RoomName { get; set; }
|
||||
public uint[] AttachedObjects { get; set; }
|
||||
|
||||
public Vector3 BBCenter { get { return (_Data.bbMax + _Data.bbMin) * 0.5f; } }
|
||||
public Vector3 BBSize { get { return (_Data.bbMax - _Data.bbMin); } }
|
||||
public Vector3 BBMin { get { return (_Data.bbMin); } }
|
||||
public Vector3 BBMax { get { return (_Data.bbMax); } }
|
||||
public Vector3 BBMin_CW { get; set; }
|
||||
public Vector3 BBMax_CW { get; set; }
|
||||
|
||||
|
||||
public MCMloRoomDef() { }
|
||||
public MCMloRoomDef(Meta meta, CMloRoomDef data)
|
||||
{
|
||||
@@ -2495,6 +2503,21 @@ namespace CodeWalker.GameFiles
|
||||
public Vector4[] Corners { get; set; }
|
||||
public uint[] AttachedObjects { get; set; }
|
||||
|
||||
public Vector3 Center
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((Corners == null)||(Corners.Length==0)) return Vector3.Zero;
|
||||
var v = Vector3.Zero;
|
||||
for (int i = 0; i < Corners.Length; i++)
|
||||
{
|
||||
v += Corners[i].XYZ();
|
||||
}
|
||||
v *= (1.0f / Corners.Length);
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
public MCMloPortalDef() { }
|
||||
public MCMloPortalDef(Meta meta, CMloPortalDef data)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user