Esempio n. 1
0
        public Scene(PakFile Pak, PakFile.PakTag Item, bool loadMesh)
        {
            var reader = Pak.Reader;
            reader.EndianType = EndianFormat.LittleEndian;
            reader.StreamOrigin = Item.Offset;
            reader.SeekTo(0);

            Name = Item.Name;

            //contains 16bytes, maybe all uint16
            _C003 = new unkBlock_XXXX(reader, 0xC003);

            #region Block 5501
            reader.ReadInt16(); //5501
            reader.ReadInt32(); //address

            int count = reader.ReadInt32();
            Materials = new List<MatRefBlock_5601>();
            for (int i = 0; i < count; i++)
                Materials.Add(new MatRefBlock_5601(Pak.Reader));
            #endregion

            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address

            #region Block 1F02
            reader.ReadInt16(); //1F02
            reader.ReadInt32(); //EOB offset

            _2002 = new Block_2002(reader);

            _2102 = new Block_2102(reader);

            _2202 = new Block_2202(reader, _2102.unk0);
            #endregion

            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address

            #region Block 8204
            reader.ReadInt16(); //8204
            reader.ReadInt32(); //address

            count = reader.ReadInt32();
            Scripts = new List<StringBlock_BA01>();
            for (int i = 0; i < count; i++)
                Scripts.Add(new StringBlock_BA01(Pak.Reader));
            #endregion

            _8404 = new unkBlock_XXXX(reader, 0x8404);

            #region Block F000
            xF000 = reader.ReadInt16();
            reader.ReadInt32();
            x2C01 = reader.ReadInt16();
            reader.ReadInt32(); //address to first object

            count = reader.ReadInt32();
            Objects = new List<Node>();
            for (int i = 0; i < count; i++)
                Objects.Add(new Node(Pak.Reader, loadMesh));
            #endregion

            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address

            //additional geometry, mainly sky objects
            _EA01 = new unkBlock_XXXX(reader, 0xEA01);

            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address

            //additional objects, no geometry, lighting related
            _B801 = new unkBlock_XXXX(reader, 0xB801);

            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address

            //additional objects, no geometry, lighting related
            _8002 = new unkBlock_XXXX(reader, 0x8002);

            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address

            //6x int32
            _2504 = new unkBlock_XXXX(reader, 0x2504);

            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address

            //empty?
            _1D02 = new unkBlock_XXXX(reader, 0x1D02);

            foreach (var obj in Objects)
                if (obj.isInheritor)
                    Objects[obj._2901.InheritID].isInherited = true;

            reader.StreamOrigin = 0;
        }
Esempio n. 2
0
        public BoneBlock_E902(EndianReader reader)
            : base(reader, 0xE902)
        {
            unk00 = reader.ReadSingle();

            _FA02 = new PosBlock_FA02(reader);

            if (reader.PeekUInt16() == 0xEA02)
                _EA02 = new unkBlock_XXXX(reader, 0xEA02);

            _FB02 = new Block_FB02(reader);

            if (reader.PeekUInt16() == 0xEB02)
                _EB02 = new unkBlock_XXXX(reader, 0xEB02);

            _FC02 = new Block_FC02(reader);

            if (reader.PeekUInt16() == 0xEC02)
                _EC02 = new unkBlock_XXXX(reader, 0xEC02);

            _0A03 = new Block_0A03(reader);

            if (reader.PeekUInt16() == 0xED02)
                _ED02 = new unkBlock_XXXX(reader, 0xED02);

            //technically not part of the block
            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address
        }
        public Template(PakFile Pak, PakFile.PakTag Item, bool loadMesh)
        {
            var reader = Pak.Reader;
            reader.EndianType = EndianFormat.LittleEndian;
            reader.StreamOrigin = Item.Offset;
            reader.SeekTo(0);

            reader.ReadInt16(); //E402
            reader.ReadInt32(); //filesize (EOB offset?)

            #region Block E502
            reader.ReadInt16(); //E502
            reader.ReadInt32(); //EOB offset
            reader.ReadInt32(); //LPTA (probs part of the string)
            Name = reader.ReadNullTerminatedString();
            reader.ReadByte(); //00
            #endregion

            #region Block 1603
            reader.ReadInt16(); //1603
            reader.ReadInt32(); //EOB offset
            reader.ReadBytes(3); //02 01 01
            #endregion

            #region Block 5501
            reader.ReadInt16(); //5501
            reader.ReadInt32(); //address

            int count = reader.ReadInt32();
            Materials = new List<MatRefBlock_5601>();
            for (int i = 0; i < count; i++)
                Materials.Add(new MatRefBlock_5601(reader));
            #endregion

            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address

            #region Block F000
            xF000 = reader.ReadInt16();
            reader.ReadInt32(); //EOB offset
            x2C01 = reader.ReadInt16();
            reader.ReadInt32(); //EOB offset

            count = reader.ReadInt32();
            Objects = new List<Node>();
            for (int i = 0; i < count; i++)
                Objects.Add(new Node(reader, loadMesh));

            foreach (var obj in Objects)
                if (obj.isInheritor)
                    Objects[obj._2901.InheritID].isInherited = true;
            #endregion

            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address

            #region Block E802
            reader.ReadInt16(); //E802
            reader.ReadInt32(); //address

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
                Bones.Add(new BoneBlock_E902(reader));
            #endregion

            //havent mapped this block, assumed anim/sound related
            _E602 = new unkBlock_XXXX(reader, 0xE602);

            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address

            if (reader.PeekUInt16() == 0xBA01)
                unkStrBlk = new StringBlock_BA01(reader);

            //contains data count, havent seen used
            _1D02 = new unkBlock_XXXX(reader, 0x1D02);

            //int16 count, [int16, int16] * count
            if (reader.PeekUInt16() == 0x1103)
                _1103 = new unkBlock_XXXX(reader, 0x1103);

            //contains null term string, used on IGA models
            _0403 = new unkBlock_XXXX(reader, 0x0403);

            if (reader.PeekUInt16() == 0x0503)
                _0503 = new Block_0503(reader);

            #region Block 0803
            reader.ReadInt16(); //0803
            reader.ReadInt32(); //address to end of bounds values
            reader.ReadInt32(); //bounds count?
            var min = new Vector(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
            var max = new Vector(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());

            RenderBounds = new BoundingBox();
            RenderBounds.XBounds = new Range<float>(min.X, max.X);
            RenderBounds.YBounds = new Range<float>(min.Y, max.Y);
            RenderBounds.ZBounds = new Range<float>(min.Z, max.Z);
            #endregion

            _0E03 = new Block_0E03(reader);

            //contains length prefixed string
            if (reader.PeekUInt16() == 0x1203)
                _1203 = new unkBlock_XXXX(reader, 0x1203);

            reader.ReadInt16(); //0100
            reader.ReadInt32(); //address to EOF

            reader.StreamOrigin = 0;
        }