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 Shape.Point();
                    break;

                case ShapeType.Circle:
                    Shape = new Shape.Circle(br);
                    break;

                case ShapeType.Sphere:
                    Shape = new Shape.Sphere(br);
                    break;

                case ShapeType.Cylinder:
                    Shape = new Shape.Cylinder(br);
                    break;

                case ShapeType.Rect:
                    Shape = new Shape.Rect(br);
                    break;

                case ShapeType.Box:
                    Shape = new Shape.Box(br);
                    break;

                default:
                    throw new NotImplementedException($"Unimplemented shape type: {shapeType}");
                }

                br.Position = start + entityDataOffset;
                EntityID    = br.ReadInt32();
            }
Beispiel #2
0
            internal Region(BinaryReaderEx br)
            {
                long start      = br.Position;
                long nameOffset = br.ReadInt64();

                br.AssertUInt32((uint)Type);
                br.ReadInt32(); // ID
                ShapeType shapeType = br.ReadEnum32 <ShapeType>();

                Position = br.ReadVector3();
                Rotation = br.ReadVector3();
                Unk2C    = br.ReadInt32();
                long baseDataOffset1 = br.ReadInt64();
                long baseDataOffset2 = br.ReadInt64();

                br.AssertInt32(-1);
                MapStudioLayer = br.ReadInt32();
                long shapeDataOffset = br.ReadInt64();
                long baseDataOffset3 = br.ReadInt64();
                long typeDataOffset  = 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 Shape.Point();
                    break;

                case ShapeType.Circle:
                    Shape = new Shape.Circle(br);
                    break;

                case ShapeType.Sphere:
                    Shape = new Shape.Sphere(br);
                    break;

                case ShapeType.Cylinder:
                    Shape = new Shape.Cylinder(br);
                    break;

                case ShapeType.Rect:
                    Shape = new Shape.Rect(br);
                    break;

                case ShapeType.Box:
                    Shape = new Shape.Box(br);
                    break;

                case ShapeType.Composite:
                    Shape = new Shape.Composite(br);
                    break;

                default:
                    throw new NotImplementedException($"Unimplemented shape type: {shapeType}");
                }

                br.Position = start + baseDataOffset3;
                UnkC00      = br.ReadInt32();
                UnkC04      = br.ReadInt32();
                br.Position = start + typeDataOffset;
            }
Beispiel #3
0
            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 Shape.Point();
                    break;

                case ShapeType.Circle:
                    Shape = new Shape.Circle(br);
                    break;

                case ShapeType.Sphere:
                    Shape = new Shape.Sphere(br);
                    break;

                case ShapeType.Cylinder:
                    Shape = new Shape.Cylinder(br);
                    break;

                case ShapeType.Rect:
                    Shape = new Shape.Rect(br);
                    break;

                case ShapeType.Box:
                    Shape = new Shape.Box(br);
                    break;

                default:
                    throw new NotImplementedException($"Unimplemented shape type: {shapeType}");
                }

                if (HasTypeData)
                {
                    br.Position = start + typeDataOffset;
                    ReadTypeData(br);
                }
            }