Ejemplo n.º 1
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var num = io.ReadByte();
                Flags = io.ReadByte();

                Constants = new ushort[num];
                for (var i = 0; i < num; i++)
                {
                    Constants[i] = io.ReadUInt16();
                }
            }
        }
Ejemplo n.º 2
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var num = io.ReadByte();
                Flags = io.ReadByte();

                Constants = new ushort[num];
                for (var i = 0; i < num; i++)
                {
                    Constants[i] = io.ReadUInt16();
                }
            }
        }
Ejemplo n.º 3
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var  version = io.ReadUInt16();
                uint count   = 0;

                if (version == 0x8000)
                {
                    count = io.ReadUInt16();
                    io.Skip(8);
                }
                else if (version == 0x8001)
                {
                    count = io.ReadUInt16();
                    var unknown = io.ReadBytes(8);
                }
                else if (version == 0x8002)
                {
                    count       = io.ReadUInt16();
                    this.Type   = io.ReadByte();
                    this.Args   = io.ReadByte();
                    this.Locals = io.ReadUInt16();
                    this.Flags  = io.ReadUInt16();
                    io.Skip(2);
                }
                else if (version == 0x8003)
                {
                    this.Type   = io.ReadByte();
                    this.Args   = io.ReadByte();
                    this.Locals = io.ReadByte();
                    io.Skip(2);
                    this.Flags = io.ReadUInt16();
                    count      = io.ReadUInt32();
                }

                Instructions = new BHAVInstruction[count];
                for (var i = 0; i < count; i++)
                {
                    var instruction = new BHAVInstruction();
                    instruction.Opcode       = io.ReadUInt16();
                    instruction.TruePointer  = io.ReadByte();
                    instruction.FalsePointer = io.ReadByte();
                    instruction.Operand      = io.ReadBytes(8);
                    Instructions[i]          = instruction;
                }
            }
        }
Ejemplo n.º 4
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var version = io.ReadUInt16();
                uint count = 0;

                if (version == 0x8000)
                {
                    count = io.ReadUInt16();
                    io.Skip(8);
                }
                else if (version == 0x8001)
                {
                    count = io.ReadUInt16();
                    var unknown = io.ReadBytes(8);
                }
                else if (version == 0x8002)
                {
                    count = io.ReadUInt16();
                    this.Type = io.ReadByte();
                    this.Args = io.ReadByte();
                    this.Locals = io.ReadUInt16();
                    this.Flags = io.ReadUInt16();
                    io.Skip(2);
                }
                else if (version == 0x8003)
                {
                    this.Type = io.ReadByte();
                    this.Args = io.ReadByte();
                    this.Locals = io.ReadByte();
                    io.Skip(2);
                    this.Flags = io.ReadUInt16();
                    count = io.ReadUInt32();
                }

                Instructions = new BHAVInstruction[count];
                for (var i = 0; i < count; i++)
                {
                    var instruction = new BHAVInstruction();
                    instruction.Opcode = io.ReadUInt16();
                    instruction.TruePointer = io.ReadByte();
                    instruction.FalsePointer = io.ReadByte();
                    instruction.Operand = io.ReadBytes(8);
                    Instructions[i] = instruction;
                }
            }
        }
Ejemplo n.º 5
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var  version    = io.ReadUInt16();
                uint imageCount = version < 20003 ? io.ReadUInt16() : io.ReadUInt32();
                Images = new DGRPImage[imageCount];

                for (var i = 0; i < imageCount; i++)
                {
                    var image = new DGRPImage(this);
                    image.Read(version, io);
                    Images[i] = image;
                }
            }
        }
Ejemplo n.º 6
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var  version1 = io.ReadUInt16();
                var  version2 = io.ReadUInt16();
                uint version  = 0;

                if (version1 == 0)
                {
                    io.ByteOrder = ByteOrder.BIG_ENDIAN;
                    version      = version2;
                }
                else
                {
                    version = version1;
                }

                var spriteCount = io.ReadUInt32();
                PaletteID = (ushort)io.ReadUInt32();

                Frames = new List <SPRFrame>();
                if (version != 1001)
                {
                    var offsetTable = new List <uint>();
                    for (var i = 0; i < spriteCount; i++)
                    {
                        offsetTable.Add(io.ReadUInt32());
                    }
                    for (var i = 0; i < spriteCount; i++)
                    {
                        var frame = new SPRFrame(this);
                        frame.Read(version, io);
                        Frames.Add(frame);
                    }
                }
                else
                {
                    while (io.HasMore)
                    {
                        var frame = new SPRFrame(this);
                        frame.Read(version, io);
                        Frames.Add(frame);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var version1 = io.ReadUInt16();
                var version2 = io.ReadUInt16();
                uint version = 0;

                if (version1 == 0)
                {
                    io.ByteOrder = ByteOrder.BIG_ENDIAN;
                    version = version2;
                }
                else
                {
                    version = version1;
                }

                var spriteCount = io.ReadUInt32();
                PaletteID = (ushort)io.ReadUInt32();

                Frames = new List<SPRFrame>();
                if (version != 1001)
                {
                    var offsetTable = new List<uint>();
                    for (var i = 0; i < spriteCount; i++)
                    {
                        offsetTable.Add(io.ReadUInt32());
                    }
                    for (var i = 0; i < spriteCount; i++)
                    {
                        var frame = new SPRFrame(this);
                        frame.Read(version, io);
                        Frames.Add(frame);
                    }
                }
                else
                {
                    while (io.HasMore)
                    {
                        var frame = new SPRFrame(this);
                        frame.Read(version, io);
                        Frames.Add(frame);
                    }
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates a new SimulationObject instance.
        /// </summary>
        /// <param name="Obj">The OBJD for this object. Assumed to be the master OBJD if the object is multi-tile.</param>
        /// <param name="Container">The IFF archive where the OBJD resides.</param>
        public SimulationObject(OBJD Obj, Iff Container, string GUID)
        {
            m_GUID = GUID;

            if (!Obj.IsMultiTile)
            {
                m_MasterOBJD = Obj;
                m_ObjectContainer = Container;
            }
            else //Load the OBJDs for the other tiles...
            {
                foreach (OBJD O in m_ObjectContainer.OBJDs)
                {
                    if (O.MasterID == Obj.MasterID)
                        m_Slaves.Add(O);
                }
            }
        }
Ejemplo n.º 9
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var version = io.ReadUInt32();
                var numEntries = io.ReadUInt32();
                var reserved = io.ReadBytes(8);

                Colors = new Color[numEntries];
                for (var i = 0; i < numEntries; i++)
                {
                    var r = io.ReadByte();
                    var g = io.ReadByte();
                    var b = io.ReadByte();
                    Colors[i] = new Color(r, g, b);
                }
            }
        }
Ejemplo n.º 10
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var version    = io.ReadUInt32();
                var numEntries = io.ReadUInt32();
                var reserved   = io.ReadBytes(8);

                Colors = new Color[numEntries];
                for (var i = 0; i < numEntries; i++)
                {
                    var r = io.ReadByte();
                    var g = io.ReadByte();
                    var b = io.ReadByte();
                    Colors[i] = new Color(r, g, b);
                }
            }
        }
Ejemplo n.º 11
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var version = io.ReadUInt32();
                uint spriteCount = 0;
                if (version == 1000)
                {
                    spriteCount = io.ReadUInt32();
                    DefaultPaletteID = io.ReadUInt32();
                    var offsetTable = new uint[spriteCount];
                    for (var i = 0; i < spriteCount; i++)
                    {
                        offsetTable[i] = io.ReadUInt32();
                    }

                    Frames = new SPR2Frame[spriteCount];
                    for (var i = 0; i < spriteCount; i++)
                    {
                        var frame = new SPR2Frame(this);
                        io.Seek(SeekOrigin.Begin, offsetTable[i]);

                        frame.Read(version, io);
                        Frames[i] = frame;
                    }
                }
                else if (version == 1001)
                {
                    DefaultPaletteID = io.ReadUInt32();
                    spriteCount = io.ReadUInt32();

                    Frames = new SPR2Frame[spriteCount];
                    for (var i = 0; i < spriteCount; i++)
                    {
                        var frame = new SPR2Frame(this);
                        frame.Read(version, io);
                        Frames[i] = frame;
                    }
                }


            }
        }
Ejemplo n.º 12
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var  version     = io.ReadUInt32();
                uint spriteCount = 0;
                if (version == 1000)
                {
                    spriteCount      = io.ReadUInt32();
                    DefaultPaletteID = io.ReadUInt32();
                    var offsetTable = new uint[spriteCount];
                    for (var i = 0; i < spriteCount; i++)
                    {
                        offsetTable[i] = io.ReadUInt32();
                    }

                    Frames = new SPR2Frame[spriteCount];
                    for (var i = 0; i < spriteCount; i++)
                    {
                        var frame = new SPR2Frame(this);
                        io.Seek(SeekOrigin.Begin, offsetTable[i]);

                        frame.Read(version, io);
                        Frames[i] = frame;
                    }
                }
                else if (version == 1001)
                {
                    DefaultPaletteID = io.ReadUInt32();
                    spriteCount      = io.ReadUInt32();

                    Frames = new SPR2Frame[spriteCount];
                    for (var i = 0; i < spriteCount; i++)
                    {
                        var frame = new SPR2Frame(this);
                        frame.Read(version, io);
                        Frames[i] = frame;
                    }
                }
            }
        }
Ejemplo n.º 13
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var formatCode = io.ReadInt16();
                if (!io.HasMore)
                {
                    return;
                }

                if (formatCode == 0)
                {
                    var numStrings = io.ReadUInt16();
                    Strings = new STRItem[numStrings];
                    for (var i = 0; i < numStrings; i++)
                    {
                        Strings[i] = new STRItem
                        {
                            Value = io.ReadPascalString()
                        };
                    }
                }
                else if (formatCode == -1)
                {
                    var numStrings = io.ReadUInt16();
                    Strings = new STRItem[numStrings];
                    for (var i = 0; i < numStrings; i++)
                    {
                        Strings[i] = new STRItem
                        {
                            Value = io.ReadNullTerminatedString()
                        };
                    }
                }
                else if (formatCode == -2)
                {
                    var numStrings = io.ReadUInt16();
                    Strings = new STRItem[numStrings];
                    for (var i = 0; i < numStrings; i++)
                    {
                        Strings[i] = new STRItem
                        {
                            Value   = io.ReadNullTerminatedString(),
                            Comment = io.ReadNullTerminatedString()
                        };
                    }
                }
                else if (formatCode == -3)
                {
                    var numStrings = io.ReadUInt16();
                    Strings = new STRItem[numStrings];
                    for (var i = 0; i < numStrings; i++)
                    {
                        Strings[i] = new STRItem
                        {
                            LanguageCode = (byte)(io.ReadByte() + 1),
                            Value        = io.ReadNullTerminatedString(),
                            Comment      = io.ReadNullTerminatedString()
                        };
                    }
                }
                else if (formatCode == -4)
                {
                    var numLanguageSets = io.ReadByte();
                    this.LanguageSets = new STRLanguageSet[numLanguageSets];

                    for (var i = 0; i < numLanguageSets; i++)
                    {
                        var item           = new STRLanguageSet();
                        var numStringPairs = io.ReadUInt16();
                        item.Strings = new STRItem[numStringPairs];
                        for (var x = 0; x < numStringPairs; x++)
                        {
                            item.Strings[x] = new STRItem
                            {
                                LanguageCode = (byte)(io.ReadByte() + 1),
                                Value        = io.ReadVariableLengthPascalString(),
                                Comment      = io.ReadVariableLengthPascalString()
                            };
                        }
                        this.LanguageSets[i] = item;
                    }
                }
            }
        }
Ejemplo n.º 14
0
        private static void InitWalls(GraphicsDevice gd)
        {
            m_Walls = new List<Wall>();

            string walls1dat = GlobalSettings.Default.StartupPath + "housedata\\walls\\walls.far";
            string walls2dat = GlobalSettings.Default.StartupPath + "housedata\\walls2\\walls2.far";
            string walls3dat = GlobalSettings.Default.StartupPath + "housedata\\walls3\\walls3.far";
            string walls4dat = GlobalSettings.Default.StartupPath + "housedata\\walls4\\walls4.far";
            string walls5iff = GlobalSettings.Default.StartupPath + "objectdata\\globals\\walls.iff";
            string walls5Namesiff = GlobalSettings.Default.StartupPath + "objectdata\\globals\\build.iff";

            FARArchive walls1 = new FARArchive(walls1dat);
            FARArchive walls2 = new FARArchive(walls2dat);
            FARArchive walls3 = new FARArchive(walls3dat);
            FARArchive walls4 = new FARArchive(walls4dat);
            Iff walls5 = new Iff(File.OpenRead(walls5iff));
            Iff walls5names = new Iff(File.OpenRead(walls5Namesiff));

            // Load the first wall data
            List<KeyValuePair<string, byte[]>> walls = walls1.GetAllEntries();
            foreach (KeyValuePair<string, byte[]> kvp in walls)
            {
                Iff flr;

                if (kvp.Key.Contains("iff") || kvp.Key.Contains("spf"))
                    flr = new Iff(new MemoryStream(kvp.Value));
                else
                    flr = new Iff(new MemoryStream(kvp.Value));

                List<StringTableString> catalogInfo = (flr.StringTables[0].StringSets.Count > 0) ? flr.StringTables[0].StringSets[0].Strings : flr.StringTables[0].Strings;
                SPR2Parser spr1 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; });
                SPR2Parser spr2 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1793; });
                SPR2Parser spr3 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 2049; });

                lock (m_Walls)
                {
                    m_Walls.Add(new Wall(catalogInfo[0].Str, catalogInfo[1].Str, catalogInfo[2].Str,
                        new Bitmap[,] {{spr1.GetFrame(0).BitmapData.BitMap, spr1.GetFrame(1).BitmapData.BitMap,
                    spr1.GetFrame(2).BitmapData.BitMap, spr1.GetFrame(3).BitmapData.BitMap}, {spr2.GetFrame(0).BitmapData.BitMap,
                    spr2.GetFrame(1).BitmapData.BitMap, spr2.GetFrame(2).BitmapData.BitMap, spr2.GetFrame(3).BitmapData.BitMap},
                    {spr3.GetFrame(0).BitmapData.BitMap, spr3.GetFrame(1).BitmapData.BitMap, spr3.GetFrame(2).BitmapData.BitMap,
                    spr3.GetFrame(3).BitmapData.BitMap} }, gd,
                        flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; }).Name));
                }
            }

            LuaInterfaceManager.CallFunction("UpdateLoadingscreen");

            // Load the second wall data
            walls = walls2.GetAllEntries();
            foreach (KeyValuePair<string, byte[]> kvp in walls)
            {
                Iff flr;

                if (kvp.Key.Contains("iff") || kvp.Key.Contains("spf"))
                    flr = new Iff(new MemoryStream(kvp.Value));
                else
                    flr = new Iff(new MemoryStream(kvp.Value));

                List<StringTableString> catalogInfo = (flr.StringTables[0].StringSets.Count > 0) ? flr.StringTables[0].StringSets[0].Strings : flr.StringTables[0].Strings;
                SPR2Parser spr1 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; });
                SPR2Parser spr2 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1793; });
                SPR2Parser spr3 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 2049; });

                lock (m_Walls)
                {
                    m_Walls.Add(new Wall(catalogInfo[0].Str, catalogInfo[1].Str, catalogInfo[2].Str,
                        new Bitmap[,] {{spr1.GetFrame(0).BitmapData.BitMap, spr1.GetFrame(1).BitmapData.BitMap,
                    spr1.GetFrame(2).BitmapData.BitMap, spr1.GetFrame(3).BitmapData.BitMap}, {spr2.GetFrame(0).BitmapData.BitMap,
                    spr2.GetFrame(1).BitmapData.BitMap, spr2.GetFrame(2).BitmapData.BitMap, spr2.GetFrame(3).BitmapData.BitMap},
                    {spr3.GetFrame(0).BitmapData.BitMap, spr3.GetFrame(1).BitmapData.BitMap, spr3.GetFrame(2).BitmapData.BitMap,
                    spr3.GetFrame(3).BitmapData.BitMap} }, gd,
                        flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; }).Name));
                }
            }

            LuaInterfaceManager.CallFunction("UpdateLoadingscreen");

            // Load the third wall data
            walls = walls3.GetAllEntries();
            foreach (KeyValuePair<string, byte[]> kvp in walls)
            {
                Iff flr;

                if (kvp.Key.Contains("iff") || kvp.Key.Contains("spf"))
                    flr = new Iff(new MemoryStream(kvp.Value));
                else
                    flr = new Iff(new MemoryStream(kvp.Value));

                List<StringTableString> catalogInfo = (flr.StringTables[0].StringSets.Count > 0) ? flr.StringTables[0].StringSets[0].Strings : flr.StringTables[0].Strings;
                SPR2Parser spr1 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; });
                SPR2Parser spr2 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1793; });
                SPR2Parser spr3 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 2049; });

                lock (m_Walls)
                {
                    m_Walls.Add(new Wall(catalogInfo[0].Str, catalogInfo[1].Str, catalogInfo[2].Str,
                        new Bitmap[,] {{spr1.GetFrame(0).BitmapData.BitMap, spr1.GetFrame(1).BitmapData.BitMap,
                    spr1.GetFrame(2).BitmapData.BitMap, spr1.GetFrame(3).BitmapData.BitMap}, {spr2.GetFrame(0).BitmapData.BitMap,
                    spr2.GetFrame(1).BitmapData.BitMap, spr2.GetFrame(2).BitmapData.BitMap, spr2.GetFrame(3).BitmapData.BitMap},
                    {spr3.GetFrame(0).BitmapData.BitMap, spr3.GetFrame(1).BitmapData.BitMap, spr3.GetFrame(2).BitmapData.BitMap,
                    spr3.GetFrame(3).BitmapData.BitMap} }, gd,
                        flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; }).Name));
                }
            }

            LuaInterfaceManager.CallFunction("UpdateLoadingscreen");

            // Load the fourth wall data
            walls = walls4.GetAllEntries();
            foreach (KeyValuePair<string, byte[]> kvp in walls)
            {
                Iff flr;

                if (kvp.Key.Contains("iff") || kvp.Key.Contains("spf"))
                    flr = new Iff(new MemoryStream(kvp.Value));
                else
                    flr = new Iff(new MemoryStream(kvp.Value));

                List<StringTableString> catalogInfo = (flr.StringTables[0].StringSets.Count > 0) ? flr.StringTables[0].StringSets[0].Strings : flr.StringTables[0].Strings;
                SPR2Parser spr1 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; });
                SPR2Parser spr2 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1793; });
                SPR2Parser spr3 = flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 2049; });

                lock (m_Walls)
                {
                    m_Walls.Add(new Wall(catalogInfo[0].Str, catalogInfo[1].Str, catalogInfo[2].Str,
                        new Bitmap[,] {{spr1.GetFrame(0).BitmapData.BitMap, spr1.GetFrame(1).BitmapData.BitMap,
                    spr1.GetFrame(2).BitmapData.BitMap, spr1.GetFrame(3).BitmapData.BitMap}, {spr2.GetFrame(0).BitmapData.BitMap,
                    spr2.GetFrame(1).BitmapData.BitMap, spr2.GetFrame(2).BitmapData.BitMap, spr2.GetFrame(3).BitmapData.BitMap},
                    {spr3.GetFrame(0).BitmapData.BitMap, spr3.GetFrame(1).BitmapData.BitMap, spr3.GetFrame(2).BitmapData.BitMap,
                    spr3.GetFrame(3).BitmapData.BitMap} }, gd,
                        flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; }).Name));
                }
            }

            LuaInterfaceManager.CallFunction("UpdateLoadingscreen");

            int numActualWalls = 0;
            for (int i = 2; i < 31; i++)
            {
                Bitmap[,] frames = new Bitmap[3, 4];

                string spriteName = walls5.SPR2s[i].Name;
                SPR2Parser spr1 = walls5.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == i; });
                SPR2Parser spr2 = walls5.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == i + 1792; });
                SPR2Parser spr3 = walls5.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == i + 2048; });

                if (spr1 != null && spr2 != null && spr3 != null && !(i >= 3 && i <= 9) && !(i >= 18 && i <= 532) &&
                    !(i >= 548 && i <= 1047) && !(i >= 1543 && i <= 1554) && !(i >= 1557 && i <= 2049))
                {
                    numActualWalls++;
                    frames = new Bitmap[,] {
                {spr1.GetFrame(0).BitmapData.BitMap, spr1.GetFrame(1).BitmapData.BitMap, spr1.GetFrame(2).BitmapData.BitMap, spr1.GetFrame(3).BitmapData.BitMap},
                {spr2.GetFrame(0).BitmapData.BitMap, spr2.GetFrame(1).BitmapData.BitMap, spr2.GetFrame(2).BitmapData.BitMap, spr2.GetFrame(3).BitmapData.BitMap},
                {spr3.GetFrame(0).BitmapData.BitMap, spr3.GetFrame(1).BitmapData.BitMap, spr3.GetFrame(2).BitmapData.BitMap, spr3.GetFrame(3).BitmapData.BitMap} };

                    string price = walls5names.StringTables[6].StringSets[0].Strings[(numActualWalls - 1) * 3].Str;
                    string title = walls5names.StringTables[6].StringSets[0].Strings[(numActualWalls - 1) * 3 + 1].Str;
                    string description = walls5names.StringTables[6].StringSets[0].Strings[(numActualWalls - 1) * 3 + 2].Str;

                    m_Walls.Add(new Wall(title, price, description, frames, gd, spriteName));
                }
            }

            LuaInterfaceManager.CallFunction("UpdateLoadingscreen");

            //m_Walls.Sort(delegate(Wall f1, Wall f2) { return f1.FloorName.CompareTo(f2.FloorName); });
        }
Ejemplo n.º 15
0
        private static void InitFloors(GraphicsDevice gd)
        {
            m_Floors = new List<Floor>();

            string floors1dat = GlobalSettings.Default.StartupPath + "housedata\\floors\\floors.far";
            string floors2dat = GlobalSettings.Default.StartupPath + "housedata\\floors2\\floors2.far";
            string floors3dat = GlobalSettings.Default.StartupPath + "housedata\\floors3\\floors3.far";
            string floors4dat = GlobalSettings.Default.StartupPath + "housedata\\floors4\\floors4.far";
            string floors5iff = GlobalSettings.Default.StartupPath + "objectdata\\globals\\floors.iff";
            string floors5Namesiff = GlobalSettings.Default.StartupPath + "objectdata\\globals\\build.iff";

            FARArchive floors1 = new FARArchive(floors1dat);
            FARArchive floors2 = new FARArchive(floors2dat);
            FARArchive floors3 = new FARArchive(floors3dat);
            FARArchive floors4 = new FARArchive(floors4dat);
            Iff floors5        = new Iff       (File.OpenRead(floors5iff));
            Iff floors5names   = new Iff       (File.OpenRead(floors5Namesiff));

            // Load the first floor data
            List<KeyValuePair<string, byte[]>> floors = floors1.GetAllEntries();
            foreach (KeyValuePair<string, byte[]> kvp in floors)
            {
                Iff flr;

                if (kvp.Key.Contains("iff") || kvp.Key.Contains("spf"))
                    flr = new Iff(new MemoryStream(kvp.Value));
                else
                    flr = new Iff(new MemoryStream(kvp.Value));

                List<StringTableString> catalogInfo = (flr.StringTables[0].StringSets.Count > 0) ? flr.StringTables[0].StringSets[0].Strings : flr.StringTables[0].Strings;

                lock (m_Floors)
                {
                    m_Floors.Add(new Floor(catalogInfo[0].Str, catalogInfo[1].Str, catalogInfo[2].Str,
                        new Bitmap[] {flr.SPR2s.Find(delegate (SPR2Parser sp) {
                            return sp.ID == 1; }).GetFrame(0).BitmapData.BitMap,
                    flr.SPR2s.Find(delegate (SPR2Parser sp) { return sp.ID == 257; }).GetFrame(0).BitmapData.BitMap,
                    flr.SPR2s.Find(delegate (SPR2Parser sp) { return sp.ID == 513; }).GetFrame(0).BitmapData.BitMap},
                        gd, flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; }).Name));
                }
            }

            LuaInterfaceManager.CallFunction("UpdateLoadingscreen");

            // Load the second floor data
            floors = floors2.GetAllEntries();
            foreach (KeyValuePair<string, byte[]> kvp in floors)
            {
                Iff flr;

                if (kvp.Key.Contains("iff") || kvp.Key.Contains("spf"))
                    flr = new Iff(new MemoryStream(kvp.Value));
                else
                    flr = new Iff(new MemoryStream(kvp.Value));

                List<StringTableString> catalogInfo = (flr.StringTables[0].StringSets.Count > 0) ? flr.StringTables[0].StringSets[0].Strings : flr.StringTables[0].Strings;

                lock (m_Floors)
                {
                    m_Floors.Add(new Floor(catalogInfo[0].Str, catalogInfo[1].Str, catalogInfo[2].Str,
                        new Bitmap[] {flr.SPR2s.Find(delegate (SPR2Parser sp)
                        { return sp.ID == 1; }).GetFrame(0).BitmapData.BitMap,
                    flr.SPR2s.Find(delegate (SPR2Parser sp) { return sp.ID == 257; }).GetFrame(0).BitmapData.BitMap,
                    flr.SPR2s.Find(delegate (SPR2Parser sp) { return sp.ID == 513; }).GetFrame(0).BitmapData.BitMap},
                        gd, flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; }).Name));
                }
            }

            LuaInterfaceManager.CallFunction("UpdateLoadingscreen");

            // Load the third floor data
            floors = floors3.GetAllEntries();
            foreach (KeyValuePair<string, byte[]> kvp in floors)
            {
                Iff flr;

                if (kvp.Key.Contains("iff") || kvp.Key.Contains("spf"))
                    flr = new Iff(new MemoryStream(kvp.Value));
                else
                    flr = new Iff(new MemoryStream(kvp.Value));

                List<StringTableString> catalogInfo = (flr.StringTables[0].StringSets.Count > 0) ? flr.StringTables[0].StringSets[0].Strings : flr.StringTables[0].Strings;

                lock (m_Floors)
                {
                    m_Floors.Add(new Floor(catalogInfo[0].Str, catalogInfo[1].Str, catalogInfo[2].Str,
                        new Bitmap[] { flr.SPR2s.Find(delegate (SPR2Parser sp)
                        { return sp.ID == 1; }).GetFrame(0).BitmapData.BitMap,
                    flr.SPR2s.Find(delegate (SPR2Parser sp) { return sp.ID == 257; }).GetFrame(0).BitmapData.BitMap,
                    flr.SPR2s.Find(delegate (SPR2Parser sp) { return sp.ID == 513; }).GetFrame(0).BitmapData.BitMap},
                        gd, flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; }).Name));
                }
            }

            LuaInterfaceManager.CallFunction("UpdateLoadingscreen");

            // Load the fourth floor data
            floors = floors4.GetAllEntries();
            foreach (KeyValuePair<string, byte[]> kvp in floors)
            {
                Iff flr;

                if (kvp.Key.Contains("iff") || kvp.Key.Contains("spf"))
                    flr = new Iff(new MemoryStream(kvp.Value));
                else
                    flr = new Iff(new MemoryStream(kvp.Value));

                List<StringTableString> catalogInfo = (flr.StringTables[0].StringSets.Count > 0) ? flr.StringTables[0].StringSets[0].Strings : flr.StringTables[0].Strings;

                lock (m_Floors)
                {
                    m_Floors.Add(new Floor(catalogInfo[0].Str, catalogInfo[1].Str, catalogInfo[2].Str,
                        new Bitmap[] {
                    flr.SPR2s.Find(delegate (SPR2Parser sp) { return sp.ID == 1; }).GetFrame(0).BitmapData.BitMap,
                    flr.SPR2s.Find(delegate (SPR2Parser sp) { return sp.ID == 257; }).GetFrame(0).BitmapData.BitMap,
                    flr.SPR2s.Find(delegate (SPR2Parser sp) { return sp.ID == 513; }).GetFrame(0).BitmapData.BitMap},
                        gd, flr.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == 1; }).Name));
                }
            }

            LuaInterfaceManager.CallFunction("UpdateLoadingscreen");

            for (int i = 1; i < 30; i++)
            {
                Bitmap[] frames = new Bitmap[3];

                string spriteName = floors5.SPR2s[i].Name;
                frames[0] = floors5.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == i; }).GetFrame(0).BitmapData.BitMap;
                frames[1] = floors5.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == i + 256; }).GetFrame(0).BitmapData.BitMap;
                frames[2] = floors5.SPR2s.Find(delegate(SPR2Parser sp) { return sp.ID == i + 512; }).GetFrame(0).BitmapData.BitMap;

                string price = floors5names.StringTables[2].StringSets[0].Strings[(i - 1) * 3].Str;
                string title = floors5names.StringTables[2].StringSets[0].Strings[(i - 1) * 3 + 1].Str;
                string description = floors5names.StringTables[2].StringSets[0].Strings[(i - 1) * 3 + 2].Str;

                m_Floors.Add(new Floor(title, price, description, frames, gd, spriteName));
            }

            myLoadingScreenEWH.Set();
        }
Ejemplo n.º 16
0
        private Iff m_SemiGlobal;           //Related semi-global IFF file.

        public BHAVAnalyzer(Iff IffFile)
        {
            m_MyFile = IffFile;
        }
 /// <summary>
 /// Adds an object that will be run by this virtual machine.
 /// </summary>
 /// <param name="Obj">The object to run.</param>
 /// <param name="ObjectContainer">The object's container.</param>
 public void AddObject(OBJD Obj, Iff ObjectContainer, string GUID)
 {
     VirtualThread VThread = new VirtualThread(new SimulationObject(Obj, ObjectContainer, GUID));
     m_Threads.Add(VThread);
 }
Ejemplo n.º 18
0
        private Iff m_SemiGlobal; //Related semi-global IFF file.

        #endregion Fields

        #region Constructors

        public BHAVAnalyzer(Iff IffFile)
        {
            m_MyFile = IffFile;
        }
Ejemplo n.º 19
0
        public override void Read(Iff iff,System.IO.Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream,ByteOrder.LITTLE_ENDIAN))
            {
                var zero      = io.ReadUInt32();
                var version   = io.ReadUInt32();
                var slotMagic = io.ReadBytes(4);
                var numSlots  = io.ReadUInt32();

                Slots = new SLOTItem[numSlots];

                /** The span for version 4 is 34.  The span for version 6 is 54.  The span for version 7 is 58.  The span for version 8 is 62.  The span for version 9 is 66.  The span for version 10 is 70.  **/
                for (var i = 0; i < numSlots; i++)
                {
                    io.Mark();

                    var item = new SLOTItem();
                    item.Type   = io.ReadUInt16();
                    item.Offset = new Vector3(
                        io.ReadFloat(),
                        io.ReadFloat(),
                        io.ReadFloat()
                        );

                    var standing       = io.ReadInt32();
                    var sitting        = io.ReadInt32();
                    var ground         = io.ReadInt32();
                    var rsflags        = io.ReadInt32();
                    var snaptargetslot = io.ReadInt32();
                    var minproximity   = io.ReadInt32();

                    item.Standing       = standing;
                    item.Sitting        = sitting;
                    item.Ground         = ground;
                    item.Rsflags        = (SLOTFlags)rsflags;
                    item.SnapTargetSlot = snaptargetslot;
                    item.MinProximity   = minproximity;

                    if (version >= 6)
                    {
                        var maxproximity     = io.ReadInt32();
                        var optimalproximity = io.ReadInt32();
                        var i9       = io.ReadInt32();
                        var i10      = io.ReadInt32();
                        var gradient = io.ReadFloat();

                        item.MaxProximity     = maxproximity;
                        item.OptimalProximity = optimalproximity;
                        item.Gradient         = gradient;
                    }

                    if (version >= 7)
                    {
                        var i11 = io.ReadInt32();
                    }

                    if (version >= 8)
                    {
                        var facing     = io.ReadInt32();
                        var resolution = io.ReadInt32();
                    }

                    Slots[i] = item;
                }
            }
        }
Ejemplo n.º 20
0
        public override void Read(Iff iff, System.IO.Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var zero = io.ReadUInt32();
                var version = io.ReadUInt32();
                var slotMagic = io.ReadBytes(4);
                var numSlots = io.ReadUInt32();

                Slots = new SLOTItem[numSlots];

                /** The span for version 4 is 34.  The span for version 6 is 54.  The span for version 7 is 58.  The span for version 8 is 62.  The span for version 9 is 66.  The span for version 10 is 70.  **/
                for (var i = 0; i < numSlots; i++)
                {
                    io.Mark();

                    var item = new SLOTItem();
                    item.Type = io.ReadUInt16();
                    item.Offset = new Vector3(
                        io.ReadFloat(),
                        io.ReadFloat(),
                        io.ReadFloat()
                    );

                    var standing = io.ReadInt32();
                    var sitting = io.ReadInt32();
                    var ground = io.ReadInt32();
                    var rsflags = io.ReadInt32();
                    var snaptargetslot = io.ReadInt32();
                    var minproximity = io.ReadInt32();

                    item.Standing = standing;
                    item.Sitting = sitting;
                    item.Ground = ground;
                    item.Rsflags = (SLOTFlags)rsflags;
                    item.SnapTargetSlot = snaptargetslot;
                    item.MinProximity = minproximity;

                    if (version >= 6)
                    {
                        var maxproximity = io.ReadInt32();
                        var optimalproximity = io.ReadInt32();
                        var i9 = io.ReadInt32();
                        var i10 = io.ReadInt32();
                        var gradient = io.ReadFloat();

                        item.MaxProximity = maxproximity;
                        item.OptimalProximity = optimalproximity;
                        item.Gradient = gradient;
                    }

                    if (version >= 7)
                    {
                        var i11 = io.ReadInt32();
                    }

                    if (version >= 8)
                    {
                        var facing = io.ReadInt32();
                        var resolution = io.ReadInt32();
                    }

                    Slots[i] = item;
                }
            }
        }
Ejemplo n.º 21
0
 public abstract void Read(Iff iff, Stream stream);
Ejemplo n.º 22
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                this.Version = io.ReadUInt32();

                /**136 (80 fields)
                 *  138a (95 fields) - Used for The Sims 1 base game objects?
                 *  138b (108 fields) - Used for The Sims 1 expansion objects?
                 *  139 (96 fields)
                 *  140 (97 fields)
                 *  141 (97 fields)
                 *  142 (105 fields)**/
                var numFields = 80;
                if (Version == 138)
                {
                    numFields = 95;
                }
                else if (Version == 139)
                {
                    numFields = 96;
                }
                else if (Version == 140)
                {
                    numFields = 97;
                }
                else if (Version == 141)
                {
                    numFields = 97;
                }
                else if (Version == 142)
                {
                    numFields = 105;
                }

                numFields -= 2;
                RawData    = new ushort[numFields];
                io.Mark();

                for (var i = 0; i < numFields; i++)
                {
                    RawData[i] = io.ReadUInt16();
                }

                io.SeekFromMark(0);

                this.StackSize          = io.ReadUInt16();
                this.BaseGraphicID      = io.ReadUInt16();
                this.NumGraphics        = io.ReadUInt16();
                this.BHAV_MainID        = io.ReadUInt16();
                this.BHAV_GardeningID   = io.ReadUInt16();
                this.TreeTableID        = io.ReadUInt16();
                this.InteractionGroupID = io.ReadUInt16();
                this.ObjectType         = (OBJDType)io.ReadUInt16();
                this.MasterID           = io.ReadUInt16();
                this.SubIndex           = io.ReadUInt16();
                this.BHAV_WashHandsID   = io.ReadUInt16();
                this.AnimationTableID   = io.ReadUInt16();
                this.GUID                     = io.ReadUInt32();
                this.Disabled                 = io.ReadUInt16();
                this.OldTreeID                = io.ReadUInt16();
                this.Price                    = io.ReadUInt16();
                this.BodyStringID             = io.ReadUInt16();
                this.SlotID                   = io.ReadUInt16();
                this.BHAV_AllowIntersectionID = io.ReadUInt16();
                this.UsesInTable              = io.ReadUInt16();
                this.BitField1                = io.ReadUInt16();
                this.BHAV_PrepareFoodID       = io.ReadUInt16();
                this.BHAV_CookFoodID          = io.ReadUInt16();
                this.BHAV_PlaceSurfaceID      = io.ReadUInt16();
                this.BHAV_DisposeID           = io.ReadUInt16();
                this.BHAV_EatID               = io.ReadUInt16();
                this.BHAV_PickupID            = io.ReadUInt16();
                this.BHAV_WashDishID          = io.ReadUInt16();
                this.BHAV_EatSurfaceID        = io.ReadUInt16();
                this.BHAV_SitID               = io.ReadUInt16();
                this.BHAV_StandID             = io.ReadUInt16();

                this.SalePrice           = io.ReadUInt16();
                this.InitialDepreciation = io.ReadUInt16();
                this.DailyDepreciation   = io.ReadUInt16();
                this.SelfDepreciating    = io.ReadUInt16();
                this.DepreciationLimit   = io.ReadUInt16();
                this.RoomFlags           = io.ReadUInt16();
                this.FunctionFlags       = io.ReadUInt16();
                this.CatalogStringsID    = io.ReadUInt16();

                this.Global              = io.ReadUInt16();
                this.BHAV_Init           = io.ReadUInt16();
                this.BHAV_Place          = io.ReadUInt16();
                this.BHAV_UserPickup     = io.ReadUInt16();
                this.WallStyle           = io.ReadUInt16();
                this.BHAV_Load           = io.ReadUInt16();
                this.BHAV_UserPlace      = io.ReadUInt16();
                this.ObjectVersion       = io.ReadUInt16();
                this.BHAV_RoomChange     = io.ReadUInt16();
                this.MotiveEffectsID     = io.ReadUInt16();
                this.BHAV_Cleanup        = io.ReadUInt16();
                this.BHAV_LevelInfo      = io.ReadUInt16();
                this.CatalogID           = io.ReadUInt16();
                this.BHAV_ServingSurface = io.ReadUInt16();
                this.LevelOffset         = io.ReadUInt16();
                this.Shadow              = io.ReadUInt16();
                this.NumAttributes       = io.ReadUInt16();

                this.BHAV_Clean                = io.ReadUInt16();
                this.BHAV_QueueSkipped         = io.ReadUInt16();
                this.FrontDirection            = io.ReadUInt16();
                this.BHAV_WallAdjacencyChanged = io.ReadUInt16();
                this.MyLeadObject              = io.ReadUInt16();
                this.DynamicSpriteBaseId       = io.ReadUInt16();
                this.NumDynamicSprites         = io.ReadUInt16();

                if (this.NumAttributes == 0 && ObjectType != OBJDType.Portal)
                {
                    System.Diagnostics.Debug.WriteLine(GUID.ToString("x"));
                }
            }
        }
Ejemplo n.º 23
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                this.Version = io.ReadUInt32();

                /**136 (80 fields)
                    138a (95 fields) - Used for The Sims 1 base game objects?
                    138b (108 fields) - Used for The Sims 1 expansion objects?
                    139 (96 fields)
                    140 (97 fields)
                    141 (97 fields)
                    142 (105 fields)**/
                var numFields = 80;
                if (Version == 138)
                {
                    numFields = 95;
                }
                else if (Version == 139)
                {
                    numFields = 96;
                }
                else if (Version == 140)
                {
                    numFields = 97;
                }
                else if (Version == 141)
                {
                    numFields = 97;
                }
                else if (Version == 142)
                {
                    numFields = 105;
                }

                numFields -= 2;
                RawData = new ushort[numFields];
                io.Mark();

                for (var i = 0; i < numFields; i++)
                {
                    RawData[i] = io.ReadUInt16();
                }

                io.SeekFromMark(0);

                this.StackSize = io.ReadUInt16();
                this.BaseGraphicID = io.ReadUInt16();
                this.NumGraphics = io.ReadUInt16();
                this.BHAV_MainID = io.ReadUInt16();
                this.BHAV_GardeningID = io.ReadUInt16();
                this.TreeTableID = io.ReadUInt16();
                this.InteractionGroupID = io.ReadUInt16();
                this.ObjectType = (OBJDType)io.ReadUInt16();
                this.MasterID = io.ReadUInt16();
                this.SubIndex = io.ReadUInt16();
                this.BHAV_WashHandsID = io.ReadUInt16();
                this.AnimationTableID = io.ReadUInt16();
                this.GUID = io.ReadUInt32();
                this.Disabled = io.ReadUInt16();
                this.OldTreeID = io.ReadUInt16();
                this.Price = io.ReadUInt16();
                this.BodyStringID = io.ReadUInt16();
                this.SlotID = io.ReadUInt16();
                this.BHAV_AllowIntersectionID = io.ReadUInt16();
                this.UsesInTable = io.ReadUInt16();
                this.BitField1 = io.ReadUInt16();
                this.BHAV_PrepareFoodID = io.ReadUInt16();
                this.BHAV_CookFoodID = io.ReadUInt16();
                this.BHAV_PlaceSurfaceID = io.ReadUInt16();
                this.BHAV_DisposeID = io.ReadUInt16();
                this.BHAV_EatID = io.ReadUInt16();
                this.BHAV_PickupID = io.ReadUInt16();
                this.BHAV_WashDishID = io.ReadUInt16();
                this.BHAV_EatSurfaceID = io.ReadUInt16();
                this.BHAV_SitID = io.ReadUInt16();
                this.BHAV_StandID = io.ReadUInt16();

                this.SalePrice = io.ReadUInt16();
                this.InitialDepreciation = io.ReadUInt16();
                this.DailyDepreciation = io.ReadUInt16();
                this.SelfDepreciating = io.ReadUInt16();
                this.DepreciationLimit = io.ReadUInt16();
                this.RoomFlags = io.ReadUInt16();
                this.FunctionFlags = io.ReadUInt16();
                this.CatalogStringsID = io.ReadUInt16();

                this.Global = io.ReadUInt16();
                this.BHAV_Init = io.ReadUInt16();
                this.BHAV_Place = io.ReadUInt16();
                this.BHAV_UserPickup = io.ReadUInt16();
                this.WallStyle = io.ReadUInt16();
                this.BHAV_Load = io.ReadUInt16();
                this.BHAV_UserPlace = io.ReadUInt16();
                this.ObjectVersion = io.ReadUInt16();
                this.BHAV_RoomChange = io.ReadUInt16();
                this.MotiveEffectsID = io.ReadUInt16();
                this.BHAV_Cleanup = io.ReadUInt16();
                this.BHAV_LevelInfo = io.ReadUInt16();
                this.CatalogID = io.ReadUInt16();
                this.BHAV_ServingSurface = io.ReadUInt16();
                this.LevelOffset = io.ReadUInt16();
                this.Shadow = io.ReadUInt16();
                this.NumAttributes = io.ReadUInt16();

                this.BHAV_Clean = io.ReadUInt16();
                this.BHAV_QueueSkipped = io.ReadUInt16();
                this.FrontDirection = io.ReadUInt16();
                this.BHAV_WallAdjacencyChanged = io.ReadUInt16();
                this.MyLeadObject = io.ReadUInt16();
                this.DynamicSpriteBaseId = io.ReadUInt16();
                this.NumDynamicSprites = io.ReadUInt16();

                if (this.NumAttributes == 0 && ObjectType != OBJDType.Portal)
                {
                    System.Diagnostics.Debug.WriteLine(GUID.ToString("x"));
                }
            }
        }
Ejemplo n.º 24
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var formatCode = io.ReadInt16();
                if (!io.HasMore) { return; }

                if (formatCode == 0)
                {
                    var numStrings = io.ReadUInt16();
                    Strings = new STRItem[numStrings];
                    for (var i = 0; i < numStrings; i++)
                    {
                        Strings[i] = new STRItem
                        {
                            Value = io.ReadPascalString()
                        };
                    }
                }
                else if (formatCode == -1)
                {
                    var numStrings = io.ReadUInt16();
                    Strings = new STRItem[numStrings];
                    for (var i = 0; i < numStrings; i++)
                    {
                        Strings[i] = new STRItem
                        {
                            Value = io.ReadNullTerminatedString()
                        };
                    }
                }
                else if (formatCode == -2)
                {
                    var numStrings = io.ReadUInt16();
                    Strings = new STRItem[numStrings];
                    for (var i = 0; i < numStrings; i++)
                    {
                        Strings[i] = new STRItem
                        {
                            Value = io.ReadNullTerminatedString(),
                            Comment = io.ReadNullTerminatedString()
                        };
                    }
                }
                else if (formatCode == -3)
                {
                    var numStrings = io.ReadUInt16();
                    Strings = new STRItem[numStrings];
                    for (var i = 0; i < numStrings; i++)
                    {
                        Strings[i] = new STRItem
                        {
                            LanguageCode = (byte)(io.ReadByte() + 1),
                            Value = io.ReadNullTerminatedString(),
                            Comment = io.ReadNullTerminatedString()
                        };
                    }
                }
                else if (formatCode == -4)
                {
                    var numLanguageSets = io.ReadByte();
                    this.LanguageSets = new STRLanguageSet[numLanguageSets];

                    for (var i = 0; i < numLanguageSets; i++)
                    {
                        var item = new STRLanguageSet();
                        var numStringPairs = io.ReadUInt16();
                        item.Strings = new STRItem[numStringPairs];
                        for (var x = 0; x < numStringPairs; x++)
                        {
                            item.Strings[x] = new STRItem
                            {
                                LanguageCode = (byte)(io.ReadByte() + 1),
                                Value = io.ReadVariableLengthPascalString(),
                                Comment = io.ReadVariableLengthPascalString()
                            };
                        }
                        this.LanguageSets[i] = item;
                    }
                }
            }
        }
Ejemplo n.º 25
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var version = io.ReadUInt16();
                uint imageCount = version < 20003 ? io.ReadUInt16() : io.ReadUInt32();
                Images = new DGRPImage[imageCount];

                for (var i = 0; i < imageCount; i++)
                {
                    var image = new DGRPImage(this);
                    image.Read(version, io);
                    Images[i] = image;
                }
            }
        }
Ejemplo n.º 26
0
 public abstract void Read(Iff iff, Stream stream);