예제 #1
0
파일: Scene.cs 프로젝트: Neverknew/mooege
            public NavZoneDef(MpqFileStream stream)
            {
                this.NavCellCount = stream.ReadValueS32();

                stream.Position += (3 * 4);
                this.NavCells    = stream.ReadSerializedData <NavCell>(this.NavCellCount);

                this.NeightbourCount   = stream.ReadValueS32();
                stream.Position       += (3 * 4);
                this.NavCellNeighbours = stream.ReadSerializedData <NavCellLookup>(this.NeightbourCount);

                this.Float0 = stream.ReadValueF32();
                this.Float1 = stream.ReadValueF32();
                this.Int2   = stream.ReadValueS32();
                this.V0     = new Vector2D(stream);

                stream.Position += (3 * 4);
                var pointerGridSquares = stream.GetSerializedDataPointer();

                this.GridSquares = stream.ReadSerializedData <NavGridSquare>(pointerGridSquares, pointerGridSquares.Size / 6);

                this.Int3        = stream.ReadValueS32();
                stream.Position += (3 * 4);
                var pointerCellLookups = stream.GetSerializedDataPointer();

                this.CellLookups = stream.ReadSerializedData <NavCellLookup>(pointerCellLookups, pointerCellLookups.Size / 4);

                this.Int4        = stream.ReadValueS32();
                stream.Position += (3 * 4);
                var pointerBorderData = stream.GetSerializedDataPointer();

                this.BorderData = stream.ReadSerializedData <NavCellBorderData>(pointerBorderData, pointerBorderData.Size / 4);
            }
예제 #2
0
파일: World.cs 프로젝트: Neverknew/mooege
        public void Read(MpqFileStream stream)
        {
            var pointer = stream.GetSerializedDataPointer();

            this.ChunkCount  = stream.ReadValueS32();
            stream.Position += (3 * 4);
            this.SceneChunks = stream.ReadSerializedData <SceneChunk>(pointer, this.ChunkCount);
        }
예제 #3
0
파일: World.cs 프로젝트: Neverknew/mooege
        public void Read(MpqFileStream stream)
        {
            var pointer = stream.GetSerializedDataPointer();

            this.DRLGTiles = stream.ReadSerializedData <TileInfo>(pointer, pointer.Size / 72);

            stream.Position  += (14 * 4);
            this.CommandCount = stream.ReadValueS32();
            this.DRLGCommands = stream.ReadSerializedData <DRLGCommand>(this.CommandCount);

            stream.Position   += (3 * 4);
            this.ParentIndices = stream.ReadSerializedInts();

            stream.Position += (2 * 4);
            this.DRLGTagMap  = stream.ReadSerializedItem <TagMap>();
        }
예제 #4
0
        public Conversation(MpqFile file)
        {
            MpqFileStream stream = file.Open();

            this.Header           = new Header(stream);
            this.ConversationType = (ConversationTypes)stream.ReadValueS32();
            this.I0               = stream.ReadValueS32();
            this.I1               = stream.ReadValueS32();
            this.SNOQuest         = stream.ReadValueS32();
            this.I2               = stream.ReadValueS32();
            this.I3               = stream.ReadValueS32();
            this.SNOConvPiggyback = stream.ReadValueS32();
            this.SNOConvUnlock    = stream.ReadValueS32();
            this.I4               = stream.ReadValueS32();
            this.Unknown          = stream.ReadString(128, true);
            this.SNOPrimaryNpc    = stream.ReadValueS32();
            this.SNOAltNpc1       = stream.ReadValueS32();
            this.SNOAltNpc2       = stream.ReadValueS32();
            this.SNOAltNpc3       = stream.ReadValueS32();
            this.SNOAltNpc4       = stream.ReadValueS32();
            this.I5               = stream.ReadValueS32();

            stream.Position += (2 * 4);
            RootTreeNodes    = stream.ReadSerializedData <ConversationTreeNode>();

            this.Unknown2 = stream.ReadString(256, true);
            this.I6       = stream.ReadValueS32();

            stream.Position += (2 * 4);
            SerializableDataPointer compiledScriptPointer = stream.GetSerializedDataPointer();

            stream.Position      += 44; // these bytes are unaccounted for in the xml
            this.SNOBossEncounter = stream.ReadValueS32();

            // reading compiled script, placed it here so i dont have to move the offset around
            CompiledScript  = new byte[compiledScriptPointer.Size];
            stream.Position = compiledScriptPointer.Offset + 16;
            stream.Read(CompiledScript, 0, compiledScriptPointer.Size);

            stream.Close();
        }
예제 #5
0
        /// <summary>
        /// Reads a total of n serialized items.
        /// </summary>
        /// <typeparam name="T">Item type to read.</typeparam>
        /// <param name="stream">The MPQFileStream to read from.</param>
        /// <param name="count">Number of items to read from.</param>
        /// <returns>List of items.</returns>
        public static List <T> ReadSerializedData <T>(this MpqFileStream stream, int count) where T : ISerializableData, new()
        {
            var pointer = stream.GetSerializedDataPointer();

            return(stream.ReadSerializedData <T>(pointer, count));
        }