internal Region(BinaryReaderEx br) { long start = br.Position; int nameOffset = br.ReadInt32(); br.AssertInt32(0); br.ReadInt32(); // ID ShapeType shapeType = br.ReadEnum32 <ShapeType>(); Position = br.ReadVector3(); Rotation = br.ReadVector3(); int unkOffsetA = br.ReadInt32(); int unkOffsetB = br.ReadInt32(); int shapeDataOffset = br.ReadInt32(); int entityDataOffset = br.ReadInt32(); br.AssertInt32(0); Name = br.GetShiftJIS(start + nameOffset); br.Position = start + unkOffsetA; br.AssertInt32(0); br.Position = start + unkOffsetB; br.AssertInt32(0); br.Position = start + shapeDataOffset; switch (shapeType) { case ShapeType.Point: Shape = new MSB.Shape.Point(); break; case ShapeType.Circle: Shape = new MSB.Shape.Circle(br); break; case ShapeType.Sphere: Shape = new MSB.Shape.Sphere(br); break; case ShapeType.Cylinder: Shape = new MSB.Shape.Cylinder(br); break; case ShapeType.Rect: Shape = new MSB.Shape.Rect(br); break; case ShapeType.Box: Shape = new MSB.Shape.Box(br); break; default: throw new NotImplementedException($"Unimplemented shape type: {shapeType}"); } br.Position = start + entityDataOffset; EntityID = br.ReadInt32(); }
internal Region() { Name = ""; Shape = new MSB.Shape.Point(); MapStudioLayer = 0xFFFFFFFF; UnkA = new List <short>(); UnkB = new List <short>(); EntityID = -1; }
internal Region(BinaryReaderEx br) { long start = br.Position; long nameOffset = br.ReadInt64(); br.AssertInt32(0); br.ReadInt32(); // ID ShapeType shapeType = br.ReadEnum32 <ShapeType>(); Position = br.ReadVector3(); Rotation = br.ReadVector3(); Unk2 = br.ReadInt32(); long baseDataOffset1 = br.ReadInt64(); long baseDataOffset2 = br.AssertInt64(baseDataOffset1 + 4); long shapeDataOffset = br.ReadInt64(); long baseDataOffset3 = br.ReadInt64(); Name = br.GetUTF16(start + nameOffset); br.Position = start + baseDataOffset1; short countA = br.ReadInt16(); UnkA = new List <short>(br.ReadInt16s(countA)); br.Position = start + baseDataOffset2; short countB = br.ReadInt16(); UnkB = new List <short>(br.ReadInt16s(countB)); br.Position = start + shapeDataOffset; switch (shapeType) { case ShapeType.Point: Shape = new MSB.Shape.Point(); break; case ShapeType.Circle: Shape = new MSB.Shape.Circle(br); break; case ShapeType.Sphere: Shape = new MSB.Shape.Sphere(br); break; case ShapeType.Cylinder: Shape = new MSB.Shape.Cylinder(br); break; case ShapeType.Box: Shape = new MSB.Shape.Box(br); break; default: throw new NotImplementedException($"Unsupported shape type: {shapeType}"); } br.Position = start + baseDataOffset3; EntityID = br.ReadInt32(); }
/// <summary> /// Creates a Region with default values. /// </summary> public Region() { Name = ""; Shape = new MSB.Shape.Point(); EntityID = -1; }
internal Region(BinaryReaderEx br) { long start = br.Position; long nameOffset = br.ReadInt64(); Unk08 = br.ReadInt16(); br.AssertByte((byte)Type); ShapeType shapeType = br.ReadEnum8 <ShapeType>(); br.ReadInt16(); // Index Unk0E = br.ReadInt16(); Position = br.ReadVector3(); Rotation = br.ReadVector3(); long unkOffsetA = br.ReadInt64(); long unkOffsetB = br.ReadInt64(); br.AssertInt32(-1); br.AssertPattern(0x24, 0x00); long shapeDataOffset = br.ReadInt64(); long typeDataOffset = br.ReadInt64(); br.AssertInt64(0); br.AssertInt64(0); Name = br.GetUTF16(start + nameOffset); br.Position = start + unkOffsetA; br.AssertInt32(0); br.Position = start + unkOffsetB; br.AssertInt32(0); br.Position = start + shapeDataOffset; switch (shapeType) { case ShapeType.Point: Shape = new MSB.Shape.Point(); break; case ShapeType.Circle: Shape = new MSB.Shape.Circle(br); break; case ShapeType.Sphere: Shape = new MSB.Shape.Sphere(br); break; case ShapeType.Cylinder: Shape = new MSB.Shape.Cylinder(br); break; case ShapeType.Rect: Shape = new MSB.Shape.Rect(br); break; case ShapeType.Box: Shape = new MSB.Shape.Box(br); break; default: throw new NotImplementedException($"Unimplemented shape type: {shapeType}"); } if (HasTypeData) { br.Position = start + typeDataOffset; ReadTypeData(br); } }
internal Region(string name = "") { Name = name; Shape = new MSB.Shape.Point(); }