mirror of
https://github.com/ACEmulator/ACE
synced 2026-08-17 12:26:06 -04:00
* ACE.DatLoader.Tests fix for Animation. Also includes some ACE.Entity.Position replacements with ACE.DatLoader.Entity.Frame * ACE.DatLoader Scene converted Also made all the ReadFromDat code more generic/copyable * ACE.DatLoader Palette converted * ACE.DatLoader: PaletteSet converted * ACE.DatLoader: CombatManeuverTable converted * ACE.DatLoader PhysicsScriptTable converted * ACE.DatLoader SpellComponentTable converted * ACE.DatLoader misc cleanups * ACE.DatLoader Surface converted * ACE.DatLoader much more progress
49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
using ACE.Entity.Enum;
|
|
|
|
namespace ACE.DatLoader.Entity
|
|
{
|
|
public class CellStruct : IUnpackable
|
|
{
|
|
public CVertexArray VertexArray { get; } = new CVertexArray();
|
|
public Dictionary<ushort, Polygon> Polygons { get; } = new Dictionary<ushort, Polygon>();
|
|
public List<ushort> Portals { get; } = new List<ushort>();
|
|
public BSPTree CellBSP { get; } = new BSPTree();
|
|
public Dictionary<ushort, Polygon> PhysicsPolygons { get; } = new Dictionary<ushort, Polygon>();
|
|
public BSPTree PhysicsBSP { get; } = new BSPTree();
|
|
public BSPTree DrawingBSP { get; set; }
|
|
|
|
public void Unpack(BinaryReader reader)
|
|
{
|
|
var numPolygons = reader.ReadUInt32();
|
|
var numPhysicsPolygons = reader.ReadUInt32();
|
|
var numPortals = reader.ReadUInt32();
|
|
|
|
VertexArray.Unpack(reader);
|
|
|
|
Polygons.Unpack(reader, numPolygons);
|
|
|
|
for (uint i = 0; i < numPortals; i++)
|
|
Portals.Add(reader.ReadUInt16());
|
|
|
|
reader.AlignBoundary();
|
|
|
|
CellBSP.Unpack(reader, BSPType.Cell);
|
|
|
|
PhysicsPolygons.Unpack(reader, numPhysicsPolygons);
|
|
|
|
PhysicsBSP.Unpack(reader, BSPType.Physics);
|
|
|
|
uint hasDrawingBSP = reader.ReadUInt32();
|
|
if (hasDrawingBSP != 0)
|
|
{
|
|
DrawingBSP = new BSPTree();
|
|
DrawingBSP.Unpack(reader, BSPType.Drawing);
|
|
}
|
|
|
|
reader.AlignBoundary();
|
|
}
|
|
}
|
|
}
|