Example #1
0
        public void Unserialize(Core.BinaryFileReader reader)
        {
            m_Location = reader.ReadByte();
            reader.ReadByte(); // length

            m_Conditions.Clear();
            int conditioncount = reader.ReadByte();

            for (int i = 0; i < conditioncount; i++)
            {
                Condition condition = new Condition();
                condition.Unserialize(reader);
                m_Conditions.Add(condition);
            }

            m_Effects.Clear();
            int effectcount = reader.ReadByte();

            for (int i = 0; i < effectcount; i++)
            {
                Effect effect = new Effect();
                effect.Unserialize(reader);
                m_Effects.Add(effect);
            }
        }
Example #2
0
        public bool Unserialize(Core.BinaryFileReader reader)
        {
            string id = reader.ReadString();

            if (id != c_SerializeIdentifier)
            {
                return(false);
            }
            int version = reader.ReadInt();

            if (version >= 0)
            {
                // version 0
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    byte[] data = new byte[4];
                    data[0] = reader.ReadByte();
                    data[1] = reader.ReadByte();
                    data[2] = reader.ReadByte();
                    data[3] = reader.ReadByte();
                    m_Palettes.Add(data);
                }
            }
            return(true);
        }
Example #3
0
        public SpriteMetaTileFrame(Core.BinaryFileReader reader, int version)
        {
            m_Tile       = reader.ReadByte();
            m_Attributes = reader.ReadByte();

            if (version >= 2)
            {
                m_TilePage = reader.ReadByte();
            }
            else
            {
                m_TilePage = 1; // debug.
            }
        }
Example #4
0
        public bool Unserialize(Core.BinaryFileReader reader)
        {
            string id = reader.ReadString();

            if (id != c_SerializeIdentifier)
            {
                return(false);
            }
            int version = reader.ReadInt();

            if (version >= 0)
            {
                // version 0
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    string name    = reader.ReadString();
                    int    tileset = reader.ReadInt();
                    byte[] data    = new byte[64];
                    for (int j = 0; j < 64; j++)
                    {
                        data[j] = reader.ReadByte();
                    }
                    m_Chunks.Add(new Chunk(data, tileset));
                    m_Chunks[m_Chunks.Count - 1].Name = name;
                }
            }
            return(true);
        }
Example #5
0
        public bool Unserialize(Core.BinaryFileReader reader)
        {
            string id = reader.ReadString();

            if (id != c_SerializeIdentifier)
            {
                return(false);
            }
            int version = reader.ReadInt();

            if (version >= 0)
            {
                // version 0
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    byte[] data = new byte[4096];
                    for (int j = 0; j < 4096; j++)
                    {
                        data[j] = reader.ReadByte();
                    }
                    m_TileGfxPages.Add(data);
                }
            }
            return(true);
        }
Example #6
0
 public void Unserialize(Core.BinaryFileReader reader)
 {
     m_Location  = reader.ReadByte();
     m_SaveIndex = reader.ReadUShort();
     m_TypeLo    = reader.ReadByte();
     m_TypeHi    = reader.ReadByte();
     if (IsContainer)
     {
         reader.ReadByte();
         int count = reader.ReadByte();
         for (int i = 0; i < count; i++)
         {
             Actor actor = new Actor();
             actor.Unserialize(reader);
             m_Contents.Add(actor);
         }
     }
 }
Example #7
0
        // ================================================================================
        // Import/Export data
        // ================================================================================

        public void Unserialize(Core.BinaryFileReader reader, int version)
        {
            Name   = reader.ReadString();
            m_Data = reader.ReadByte();
            m_Tile = reader.ReadByte();
            if (HasStandardSprites)
            {
                m_StandardFrames = new SpriteMetaTileFrame[8][];
                for (int i = 0; i < 8; i++)
                {
                    m_StandardFrames[i] = new SpriteMetaTileFrame[TilesPerFrame];
                    for (int j = 0; j < m_StandardFrames[i].Length; j++)
                    {
                        m_StandardFrames[i][j] = new SpriteMetaTileFrame(reader, version);
                    }
                }
            }
            if (HasExtendedSprites)
            {
                m_ExtendedFrames = new SpriteMetaTileFrame[4][];
                for (int i = 0; i < 4; i++)
                {
                    m_ExtendedFrames[i] = new SpriteMetaTileFrame[TilesPerFrame];
                    for (int j = 0; j < m_ExtendedFrames[i].Length; j++)
                    {
                        m_ExtendedFrames[i][j] = new SpriteMetaTileFrame(reader, version);
                    }
                }
            }
            if (ExtraFrames != ExtraFramesEnum.Extra0)
            {
                m_ExtraFrames = new SpriteMetaTileFrame[ExtraFramesInt][];
                for (int i = 0; i < ExtraFramesInt; i++)
                {
                    m_ExtraFrames[i] = new SpriteMetaTileFrame[TilesPerFrame];
                    for (int j = 0; j < m_ExtraFrames[i].Length; j++)
                    {
                        m_ExtraFrames[i][j] = new SpriteMetaTileFrame(reader, version);
                    }
                }
            }
        }
Example #8
0
        public bool Unserialize(Core.BinaryFileReader reader)
        {
            string id = reader.ReadString();

            if (id != c_SerializeIdentifier)
            {
                return(false);
            }
            int version = reader.ReadInt();

            if (version >= 0)
            {
                // version 0
                for (int i = 0; i < 4; i++)
                {
                    m_Chunks[i] = reader.ReadInt();
                }
                m_Tileset = reader.ReadByte();

                int count;

                count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Actor actor = new Actor();
                    actor.Unserialize(reader);
                    m_Actors.Add(actor);
                }

                byte length = reader.ReadByte();

                count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Egg egg = new Egg();
                    egg.Unserialize(reader);
                    m_Eggs.Add(egg);
                }
            }
            return(true);
        }
Example #9
0
 public void Unserialize(Core.BinaryFileReader reader)
 {
     reader.ReadByte();
 }