Esempio n. 1
0
            public int unpack(Reader reader, bool isPacked)
            {
                int pos = (int)reader.BaseStream.Position;

                info = (InfoTypes)reader.ReadByte();
                byte flags = reader.ReadByte();

                if (isPacked)
                {
                    bool flag = info == InfoTypes.StateChange || info == InfoTypes.PassedTimeAttackGate;

                    if ((flags & (byte)FlagTypes.InputChange) != 0 || flag)
                    {
                        inputs = reader.ReadByte();
                    }

                    if ((flags & (byte)FlagTypes.PositionChange) != 0 || flag)
                    {
                        position.x = reader.ReadInt32();
                        position.y = reader.ReadInt32();
                    }
                    if ((flags & (byte)FlagTypes.VelocityChange) != 0 || flag)
                    {
                        velocity.x = reader.ReadInt32();
                        velocity.y = reader.ReadInt32();
                    }

                    if ((flags & (byte)FlagTypes.RotationChange) != 0 || flag)
                    {
                        rotation = reader.ReadByte() << 1;
                    }

                    if ((flags & (byte)FlagTypes.DirectionChange) != 0 || flag)
                    {
                        direction = (Directions)reader.ReadByte();
                    }

                    if ((flags & (byte)FlagTypes.AnimationChange) != 0 || flag)
                    {
                        anim = reader.ReadByte();
                    }

                    if ((flags & (byte)FlagTypes.FrameChange) != 0 || flag)
                    {
                        frame = reader.ReadByte();
                    }
                }
                else
                {
                    inputs     = reader.ReadByte();
                    position.x = reader.ReadInt32();
                    position.y = reader.ReadInt32();
                    velocity.x = reader.ReadInt32();
                    velocity.y = reader.ReadInt32();
                    rotation   = reader.ReadInt32();
                    direction  = (Directions)reader.ReadByte();
                    anim       = reader.ReadByte();
                    frame      = reader.ReadByte();
                }

                this.flags = (FlagTypes)flags;

                return((int)reader.BaseStream.Position - pos);
            }
        public StaticObject(Reader reader, bool PrintDebugInfo = false)
        {
            bool Debug = PrintDebugInfo;

            int[]  TmpData  = new int[reader.BaseStream.Length];
            string filename = System.IO.Path.GetFileName(reader.GetFilename());

            if (!reader.ReadBytes(4).SequenceEqual(MAGIC)) //"OBJ" Header
            {
                throw new Exception("Invalid config file header magic");
            }

            if (Debug)
            {
                Console.WriteLine("Viewing Info for " + filename);
            }


            int MemPos = 0; // I think?

            while (!reader.IsEof)
            {
                int DataType  = reader.ReadByte();
                int ArraySize = reader.ReadInt32();

                if ((DataType & 0x80) != 0)
                {
                    uint DataSize = reader.ReadUInt32();

                    DataType &= 0x7F;

                    ArrayInfo array = new ArrayInfo();
                    array.Type     = (byte)DataType;
                    array.Size     = (int)ArraySize;
                    array.DataSize = (int)DataSize;
                    array.Data     = new int[(int)DataSize];
                    if (Debug)
                    {
                        Console.WriteLine();
                        Console.WriteLine("Array Info:");
                        Console.WriteLine("Struct Offset: " + MemPos + "(0x" + MemPos.ToString("X") + ")");
                        Console.WriteLine("Array Size: " + ArraySize);
                        Console.WriteLine("Array DataSize: " + DataSize);
                    }

                    switch (DataType)
                    {
                    //INT8
                    case (int)AttributeTypes.UINT8:
                        if (Debug)
                        {
                            Console.WriteLine("Array Type: UINT8");
                        }
                        for (int i = 0; i < DataSize; ++i)
                        {
                            array.Data[i] = reader.ReadByte();
                            printValInfo(array.Data[i], (int)(reader.BaseStream.Position - 1), Debug);
                        }
                        MemPos += ArraySize;
                        break;

                    case (int)AttributeTypes.INT8:
                        if (Debug)
                        {
                            Console.WriteLine("Array Type: INT8");
                        }
                        for (int i = 0; i < DataSize; ++i)
                        {
                            array.Data[i] = reader.ReadSByte();
                            printValInfo(array.Data[i], (int)(reader.BaseStream.Position - 1), Debug);
                        }
                        MemPos += ArraySize;
                        break;

                    //IN16
                    case (int)AttributeTypes.UINT16:
                        if (Debug)
                        {
                            Console.WriteLine("Array Type: UINT16");
                        }
                        int TmpDataOffset = (int)((MemPos & 0xFFFFFFFE) + 2);
                        if ((MemPos & 0xFFFFFFFE) >= MemPos)
                        {
                            TmpDataOffset = MemPos;
                        }
                        MemPos = TmpDataOffset;

                        for (int i = 0; i < DataSize; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            array.Data[i] = (ushort)(valA + (valB << 8));
                            printValInfo(array.Data[i], (int)(reader.BaseStream.Position - 2), Debug);
                        }

                        MemPos += 2 * ArraySize;
                        break;

                    case (int)AttributeTypes.INT16:
                        if (Debug)
                        {
                            Console.WriteLine("Array Type: INT16");
                        }
                        TmpDataOffset = (int)((MemPos & 0xFFFFFFFE) + 2);
                        if ((MemPos & 0xFFFFFFFE) >= MemPos)
                        {
                            TmpDataOffset = MemPos;
                        }
                        MemPos = TmpDataOffset;

                        for (int i = 0; i < DataSize; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            array.Data[i] = (short)(valA + (valB << 8));
                            printValInfo(array.Data[i], (int)(reader.BaseStream.Position - 2), Debug);
                        }
                        MemPos += 2 * ArraySize;
                        break;

                    //INT32
                    case (int)AttributeTypes.UINT32:
                        if (Debug)
                        {
                            Console.WriteLine("Array Type: UINT32");
                        }
                        TmpDataOffset = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            TmpDataOffset = MemPos;
                        }
                        MemPos = TmpDataOffset;

                        for (int i = 0; i < DataSize; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            byte valC = reader.ReadByte();
                            byte valD = reader.ReadByte();
                            array.Data[i] = (int)(uint)(valA + (valB << 8) + (valC << 16) + (valD << 24));
                            printValInfo(array.Data[i], (int)(reader.BaseStream.Position - 4), Debug);
                        }
                        MemPos += 4 * ArraySize;
                        break;

                    case (int)AttributeTypes.INT32:
                        if (Debug)
                        {
                            Console.WriteLine("Array Type: INT32");
                        }
                        TmpDataOffset = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            TmpDataOffset = MemPos;
                        }
                        MemPos = TmpDataOffset;

                        for (int i = 0; i < DataSize; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            byte valC = reader.ReadByte();
                            byte valD = reader.ReadByte();
                            array.Data[i] = valA + (valB << 8) + (valC << 16) + (valD << 24);
                            printValInfo(array.Data[i], (int)(reader.BaseStream.Position - 4), Debug);
                        }
                        MemPos += 4 * ArraySize;
                        break;

                    case (int)AttributeTypes.ENUM:
                        if (Debug)
                        {
                            Console.WriteLine("Array Type: VAR/ENUM");
                        }
                        TmpDataOffset = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            TmpDataOffset = MemPos;
                        }
                        MemPos = TmpDataOffset;

                        for (int i = 0; i < DataSize; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            byte valC = reader.ReadByte();
                            byte valD = reader.ReadByte();
                            array.Data[i] = valA + (valB << 8) + (valC << 16) + (valD << 24);
                            printValInfo(array.Data[i], (int)(reader.BaseStream.Position - 4), Debug);
                        }
                        MemPos += 4 * ArraySize;
                        break;
                    }
                }
                else
                {
                    int Buffer = 0;
                    switch (DataType)
                    {
                    //INT8
                    case (int)AttributeTypes.UINT8:
                    case (int)AttributeTypes.INT8:
                        MemPos += ArraySize;
                        break;

                    //IN16
                    case (int)AttributeTypes.UINT16:
                    case (int)AttributeTypes.INT16:
                        Buffer = (int)((MemPos & 0xFFFFFFFE) + 2);
                        if ((MemPos & 0xFFFFFFFE) >= MemPos)
                        {
                            Buffer = MemPos;
                        }
                        MemPos = Buffer + 2 * ArraySize;
                        break;

                    //INT32
                    case (int)AttributeTypes.UINT32:
                    case (int)AttributeTypes.INT32:
                    case (int)AttributeTypes.ENUM:
                    case (int)AttributeTypes.BOOL:
                        Buffer = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            Buffer = MemPos;
                        }
                        MemPos = Buffer + 4 * ArraySize;
                        break;

                    case (int)AttributeTypes.STRING:
                    case (int)AttributeTypes.VECTOR2:
                        Buffer = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            Buffer = MemPos;
                        }
                        MemPos = Buffer + 8 * ArraySize;
                        break;

                    case (int)AttributeTypes.VECTOR3:
                        Buffer = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            Buffer = MemPos;
                        }
                        MemPos = Buffer + 24 * ArraySize;
                        break;

                    case (int)AttributeTypes.COLOR:
                        Buffer = (int)((MemPos & 0xFFFFFFFE) + 2);
                        if ((MemPos & 0xFFFFFFFE) >= MemPos)
                        {
                            Buffer = MemPos;
                        }
                        MemPos = Buffer + 8 * ArraySize;
                        break;

                    default:
                        break;
                    }
                }
            }
            reader.Close();

            if (Debug)
            {
                Console.WriteLine(filename + " Has " + Arrays.Count + " Arrays");
            }
        }
Esempio n. 3
0
        public void read(Reader reader)
        {
            if (!reader.readBytes(4).SequenceEqual(signature))
            {
                reader.Close();
                throw new Exception("Invalid Static Object v5 signature");
            }

            int memPos = 0;

            while (!reader.isEof)
            {
                int type      = reader.ReadByte();
                int arraySize = reader.ReadInt32();

                if ((type & 0x80) != 0)
                {
                    uint count = reader.ReadUInt32();

                    type &= 0x7F;

                    ArrayInfo array = new ArrayInfo();
                    array.type       = (byte)type;
                    array.size       = arraySize;
                    array.valueCount = (int)count;
                    array.values     = new int[(int)count];

                    switch (type)
                    {
                    default:
                        Console.WriteLine($"ERROR: Encountered unexpected array type ({type})!");
                        break;

                    //INT8
                    case (int)VariableTypes.UINT8:
                        for (int i = 0; i < count; ++i)
                        {
                            array.values[i] = reader.ReadByte();
                        }
                        memPos += arraySize;
                        break;

                    case (int)VariableTypes.INT8:
                        for (int i = 0; i < count; ++i)
                        {
                            array.values[i] = reader.ReadSByte();
                        }
                        memPos += arraySize;
                        break;

                    //IN16
                    case (int)VariableTypes.UINT16:
                        int tmpMemPos = (int)((memPos & 0xFFFFFFFE) + 2);
                        if ((memPos & 0xFFFFFFFE) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos;

                        for (int i = 0; i < count; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            array.values[i] = (ushort)(valA + (valB << 8));
                        }

                        memPos += 2 * arraySize;
                        break;

                    case (int)VariableTypes.INT16:
                        tmpMemPos = (int)((memPos & 0xFFFFFFFE) + 2);
                        if ((memPos & 0xFFFFFFFE) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos;

                        for (int i = 0; i < count; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            array.values[i] = (short)(valA + (valB << 8));
                        }
                        memPos += 2 * arraySize;
                        break;

                    //INT32
                    case (int)VariableTypes.UINT32:
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos;

                        for (int i = 0; i < count; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            byte valC = reader.ReadByte();
                            byte valD = reader.ReadByte();
                            array.values[i] = (int)(uint)(valA + (valB << 8) + (valC << 16) + (valD << 24));
                        }
                        memPos += 4 * arraySize;
                        break;

                    case (int)VariableTypes.INT32:
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos;

                        for (int i = 0; i < count; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            byte valC = reader.ReadByte();
                            byte valD = reader.ReadByte();
                            array.values[i] = valA + (valB << 8) + (valC << 16) + (valD << 24);
                        }
                        memPos += 4 * arraySize;
                        break;

                    case (int)VariableTypes.ENUM:     // bool
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos;

                        for (int i = 0; i < count; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            byte valC = reader.ReadByte();
                            byte valD = reader.ReadByte();
                            array.values[i] = valA + (valB << 8) + (valC << 16) + (valD << 24);
                        }
                        memPos += 4 * arraySize;
                        break;
                    }
                    arrays.Add(array);
                }
                else
                {
                    ArrayInfo array = new ArrayInfo();
                    array.type       = (byte)type;
                    array.size       = arraySize;
                    array.valueCount = 0;
                    array.values     = new int[0];
                    arrays.Add(array);

                    int tmpMemPos = 0;
                    switch (type)
                    {
                    //INT8
                    case (int)VariableTypes.UINT8:
                    case (int)VariableTypes.INT8:
                        memPos += arraySize;
                        break;

                    //IN16
                    case (int)VariableTypes.UINT16:
                    case (int)VariableTypes.INT16:
                        tmpMemPos = (int)((memPos & 0xFFFFFFFE) + 2);
                        if ((memPos & 0xFFFFFFFE) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 2 * arraySize;
                        break;

                    //INT32
                    case (int)VariableTypes.UINT32:
                    case (int)VariableTypes.INT32:
                    case 6:     //bool
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 4 * arraySize;
                        break;

                    case 7:     // Pointer
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 4 * arraySize;
                        break;

                    case 8:     // Vector2
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 8 * arraySize;
                        break;

                    case 9:     // Text
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 8 * arraySize;
                        break;

                    case 10:     // Animator
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 24 * arraySize;
                        break;

                    case 11:     // Hitbox
                        tmpMemPos = (int)((memPos & 0xFFFFFFFE) + 2);
                        if ((memPos & 0xFFFFFFFE) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 8 * arraySize;
                        break;

                    case 12:     // Unknown
                        tmpMemPos = (int)((memPos & 0xFFFFFFFE) + 2);
                        if ((memPos & 0xFFFFFFFE) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 18 * arraySize;
                        break;

                    default:
                        break;
                    }
                }
            }
            reader.Close();
        }
Esempio n. 4
0
 internal WAVConfiguration(Reader reader)
 {
     Name = reader.ReadRSDKString();
     MaxConcurrentPlay = reader.ReadByte();
 }
Esempio n. 5
0
        public void read(Reader reader, bool skipHeader = false, int clrCnt = 0x80)
        {
            #region Header
            if (!skipHeader)
            {
                reader.seek(6, System.IO.SeekOrigin.Begin); // GIF89a

                width  = reader.ReadByte();
                width |= (ushort)(reader.ReadByte() << 8);

                height  = reader.ReadByte();
                height |= (ushort)(reader.ReadByte() << 8);

                byte info = reader.ReadByte(); // Palette Size
                clrCnt = (info & 0x7) + 1;
                if (clrCnt > 0)
                {
                    clrCnt = 1 << clrCnt;
                }
                reader.ReadByte(); // background colour index
                reader.ReadByte(); // unused

                if (clrCnt != 0x100)
                {
                    throw new Exception("RSDK-Formatted Gif files must use 256 colours!");
                }
            }

            for (int c = 0; c < clrCnt; ++c)
            {
                palette[c].R = reader.ReadByte();
                palette[c].G = reader.ReadByte();
                palette[c].B = reader.ReadByte();
            }
            #endregion

            #region Blocks
            byte blockType = reader.ReadByte();
            while (blockType != 0 && blockType != ';')
            {
                switch (blockType)
                {
                default:     // Unknown
                    Console.WriteLine($"Unknown Block Type ({blockType})");
                    break;

                case (byte)'!':     // Extension
                {
                    byte extensionType = reader.ReadByte();
                    switch (extensionType)
                    {
                    case 0xF9:             // Graphics Control Extension
                    {
                        int    blockSize        = reader.ReadByte();
                        byte   disposalFlag     = reader.ReadByte();
                        ushort frameDelay       = reader.ReadUInt16();
                        byte   transparentIndex = reader.ReadByte();
                        reader.ReadByte();                 // terminator
                    }
                    break;

                    case 0x01:             // Plain Text Extension
                    case 0xFE:             // Comment Extension
                    case 0xFF:             // Application Extension
                    {
                        int blockSize = reader.ReadByte();
                        while (blockSize != 0)
                        {
                            // Read block
                            reader.BaseStream.Position += blockSize;
                            blockSize = reader.ReadByte();                 // next block Size, if its 0 we know its the end of block
                        }
                    }
                    break;

                    default:             // Unknown
                        Console.WriteLine($"Unknown Extension Type ({extensionType})");
                        return;
                    }
                }
                break;

                case (byte)',':     // Image descriptor
                {
                    int left   = reader.ReadUInt16();
                    int top    = reader.ReadUInt16();
                    int right  = reader.ReadUInt16();
                    int bottom = reader.ReadUInt16();

                    byte info2      = reader.ReadByte();
                    bool interlaced = (info2 & 0x40) != 0;
                    if (info2 >> 7 == 1)
                    {
                        for (int c = 0x80; c < 0x100; ++c)
                        {
                            palette[c].R = reader.ReadByte();
                            palette[c].G = reader.ReadByte();
                            palette[c].B = reader.ReadByte();
                        }
                    }

                    readPictureData(width, height, interlaced, reader);
                }
                break;
                }

                blockType = reader.ReadByte();
            }
            #endregion

            if (!skipHeader)
            {
                reader.Close();
            }
        }
Esempio n. 6
0
        public StaticObject(Reader reader)
        {
            uint[] TmpData = new uint[reader.BaseStream.Length];
            DataPos = 0;

            if (!reader.ReadBytes(4).SequenceEqual(MAGIC)) //"OBJ" Header
            {
                throw new Exception("Invalid config file header magic");
            }

            while (!reader.IsEof)
            {
                int Unknown1 = reader.ReadByte();
                reader.ReadUInt32(); //Unknown

                if ((Unknown1 & 0x80) != 0)
                {
                    uint Unknown3 = reader.ReadUInt32();

                    int Variable1 = Unknown1 & 0x7F;

                    switch (Variable1)
                    {
                    //INT8
                    case 0:
                    case 3:
                        for (int i = 0; i < Unknown3; i++)
                        {
                            TmpData[DataPos++] = reader.ReadByte();
                        }
                        break;

                    //IN16
                    case 1:
                    case 4:
                        for (int i = 0; i < Unknown3; i++)
                        {
                            byte valA  = reader.ReadByte();
                            byte valB  = reader.ReadByte();
                            int  Value = valA + (valB << 8);
                            TmpData[DataPos++] = (uint)Value;
                        }
                        break;

                    //INT32
                    case 2:
                    case 5:
                    case 6:
                        for (int i = 0; i < Unknown3; i++)
                        {
                            byte valA  = reader.ReadByte();
                            byte valB  = reader.ReadByte();
                            byte valC  = reader.ReadByte();
                            byte valD  = reader.ReadByte();
                            int  Value = valA + (valB << 8) + (valC << 16) + (valD << 24);
                            TmpData[DataPos++] = (uint)Value;
                        }
                        break;
                    }
                }
            }
            reader.Close();

            Data = new uint[DataPos];

            for (int i = 0; i < DataPos; i++)
            {
                Data[i] = TmpData[i];
            }
        }
Esempio n. 7
0
        public Model(Reader reader)
        {
            if (!reader.ReadBytes(4).SequenceEqual(MAGIC))
            {
                throw new Exception("Invalid config file header magic");
            }

            for (int a = 0; a < 256; a++)
            {
                MySin[a] = -Math.Sin(a * Math.PI / 128);
                MyCos[a] = Math.Cos(a * Math.PI / 128);
            }

            byte flags = reader.ReadByte();

            HasNormals  = GetBit(flags, 0);
            HasTextures = GetBit(flags, 1);
            HasColours  = GetBit(flags, 2);

            Console.WriteLine("MDL READ: FLAGS:" + Pad(flags));

            string Pad(byte b)
            {
                return(Convert.ToString(b, 2).PadLeft(8, '0'));
            }

            FaceVerticiesCount = reader.ReadByte();
            if (FaceVerticiesCount != 3 && FaceVerticiesCount != 4)
            {
                throw new Exception("Detected Vertex Type wasn't Tris or Quads! RSDKv5 doesn't support other N-gons!");
            }

            ushort VertexCount = 0;
            ushort FramesCount = 0;
            ushort FaceCount   = 0;

            VertexCount = reader.ReadUInt16();
            FramesCount = reader.ReadUInt16();

            Console.WriteLine("Frame Count: " + FramesCount + Environment.NewLine + "Vertex Count: " + VertexCount);

            if (HasTextures)
            {
                for (int i = 0; i < VertexCount; ++i)
                {
                    TexturePositions.Add(new TexturePosition(reader));
                }
            }

            if (HasColours)
            {
                for (int i = 0; i < VertexCount; ++i)
                {
                    Colours.Add(new Colour(reader));
                }
            }

            FaceCount = reader.ReadUInt16();
            for (int i = 0; i < FaceCount; ++i)
            {
                Faces.Add(reader.ReadUInt16());
            }

            for (int i = 0; i < FramesCount; ++i)
            {
                Frames.Add(new Frame(reader, VertexCount, HasNormals));
            }

            Console.WriteLine("MDL READ: FileSize: {0}, Position: 0x{1:X8}, DataLeft: {2}", reader.BaseStream.Length, reader.BaseStream.Position, reader.BaseStream.Length - reader.BaseStream.Position);
        }