Exemple #1
0
        public TXPEntry(DhBinaryReader br, ushort frameCount)
        {
            //Ensure that Uknown 1 is 1
            if (br.ReadU16() != 1)
            {
                throw new Exception("Unknown1 wasn't 1!");
            }

            //Read material index
            MaterialIndex = br.ReadS16();

            if (br.ReadU32() != 0)
            {
                throw new Exception("Unknown2 wasn't 0!");
            }

            //Read the frame data offset for this
            uint frameDataOffset = br.ReadU32();

            TexObjIndicies = new short[frameCount];

            //Save reader's current position and seek to the frame data
            br.SaveOffset(0);
            br.Goto(frameDataOffset);

            //Fill TexObjIndicies for each frame
            for (int frame = 0; frame < frameCount; frame++)
            {
                TexObjIndicies[frame] = br.ReadS16();
            }

            br.LoadOffset(0);
        }