Exemplo n.º 1
0
        public BCON(IFFChunk BaseChunk)
            : base(BaseChunk)
        {
            FileReader Reader = new FileReader(new MemoryStream(m_Data), false);

            byte NumConstants = Reader.ReadByte();
            Reader.ReadByte(); //Unknown.

            for (int i = 0; i < NumConstants; i++)
                Constants.Add(Reader.ReadInt16());
        }
Exemplo n.º 2
0
        public CST(IFFChunk BaseChunk)
            : base(BaseChunk)
        {
            FileReader Reader = new FileReader(new MemoryStream(m_Data), false);

            Version = Reader.ReadInt16();
            ushort NumStrings = 0;

            if ((Reader.StreamLength - Reader.Position) > 2)
            {
                switch (Version)
                {
                    case 0:
                        NumStrings = Reader.ReadUShort();

                        for (int i = 0; i < NumStrings; i++)
                        {
                            TranslatedString Str = new TranslatedString();
                            Str.LangCode = LanguageCodes.unused;
                            Str.TranslatedStr = Reader.ReadPascalString();

                            if (Strings.ContainsKey(Str.LangCode))
                                Strings[Str.LangCode].Add(Str);
                            else
                            {
                                List<TranslatedString> LanguageSet = new List<TranslatedString>();
                                LanguageSet.Add(Str);
                                Strings.Add(Str.LangCode, LanguageSet);
                            }
                        }

                        break;
                    case -1:
                        NumStrings = Reader.ReadUShort();

                        for (int i = 0; i < NumStrings; i++)
                        {
                            TranslatedString Str = new TranslatedString();
                            Str.LangCode = LanguageCodes.unused;
                            Str.TranslatedStr = Reader.ReadCString();

                            if (Strings.ContainsKey(Str.LangCode))
                                Strings[Str.LangCode].Add(Str);
                            else
                            {
                                List<TranslatedString> LanguageSet = new List<TranslatedString>();
                                LanguageSet.Add(Str);
                                Strings.Add(Str.LangCode, LanguageSet);
                            }
                        }

                        break;
                    case -2:
                        NumStrings = Reader.ReadUShort();

                        for (int i = 0; i < NumStrings; i++)
                        {
                            TranslatedString Str = new TranslatedString();
                            Str.LangCode = LanguageCodes.unused;
                            Str.TranslatedStr = Reader.ReadCString();
                            Reader.ReadCString(); //Comment

                            if (Strings.ContainsKey(Str.LangCode))
                                Strings[Str.LangCode].Add(Str);
                            else
                            {
                                List<TranslatedString> LanguageSet = new List<TranslatedString>();
                                LanguageSet.Add(Str);
                                Strings.Add(Str.LangCode, LanguageSet);
                            }
                        }

                        break;
                    case -3:
                        NumStrings = Reader.ReadUShort();

                        for (int i = 0; i < NumStrings; i++)
                        {
                            TranslatedString Str = new TranslatedString();
                            Str.LangCode = (LanguageCodes)Reader.ReadByte();
                            Str.TranslatedStr = Reader.ReadCString();
                            Reader.ReadCString(); //Comment

                            if (Strings.ContainsKey(Str.LangCode))
                                Strings[Str.LangCode].Add(Str);
                            else
                            {
                                List<TranslatedString> LanguageSet = new List<TranslatedString>();
                                LanguageSet.Add(Str);
                                Strings.Add(Str.LangCode, LanguageSet);
                            }
                        }

                        break;
                    case -4:
                        byte LanguageSets = Reader.ReadByte();
                        for (int i = 0; i < LanguageSets; i++)
                        {
                            NumStrings = Reader.ReadUShort();

                            for (int j = 0; j < NumStrings; j++)
                            {
                                TranslatedString Str = new TranslatedString();
                                Str.LangCode = (LanguageCodes)(Reader.ReadByte() + 1);
                                Str.TranslatedStr = Reader.ReadString();
                                Reader.ReadString(); //Comment

                                if (Strings.ContainsKey(Str.LangCode))
                                    Strings[Str.LangCode].Add(Str);
                                else
                                {
                                    List<TranslatedString> LanguageSet = new List<TranslatedString>();
                                    LanguageSet.Add(Str);
                                    Strings.Add(Str.LangCode, LanguageSet);
                                }
                            }
                        }

                        break;
                }
            }

            Reader.Close();
            m_Data = null;
        }
Exemplo n.º 3
0
        public SpriteInfo(FileReader Reader, uint Version)
        {
            if(Version == 20000 || Version == 20001)
            {
                Type = Reader.ReadInt16();
                SPRChunkID = Reader.ReadInt16();
                SPRFrameNum = Reader.ReadInt16();
                Flags = Reader.ReadInt16();
                SpriteXOffset = Reader.ReadInt16();
                SpriteYOffset = Reader.ReadInt16();
                ObjectZOffset = Reader.ReadFloat();
            }
            else
            {
                SPRChunkID = Reader.ReadInt32();
                SPRFrameNum = Reader.ReadInt32();
                SpriteXOffset = Reader.ReadInt32();
                SpriteYOffset = Reader.ReadInt32();
                ObjectZOffset = Reader.ReadFloat();
                Flags = Reader.ReadInt32();

                if (Version == 20004)
                {
                    ObjectXOffset = Reader.ReadFloat();
                    ObjectYOffset = Reader.ReadFloat();
                }
            }
        }
Exemplo n.º 4
0
        public OBJD(IFFChunk BaseChunk)
            : base(BaseChunk)
        {
            FileReader Reader = new FileReader(new MemoryStream(m_Data), false);

            Version = Reader.ReadUInt32();

            switch(Version)
            {
                case 136:
                    m_NumFields = 80;
                    break;
                case 138:
                    m_NumFields = 95;
                    break;
                case 139:
                    m_NumFields = 96;
                    break;
                case 140:
                    m_NumFields = 97;
                    break;
                case 141:
                    m_NumFields = 97;
                    break;
                case 142:
                    m_NumFields = 105;
                    break;
            }

            InitialStackSize = Reader.ReadUShort();
            BaseGraphicID = Reader.ReadUShort();
            NumGraphics = Reader.ReadUShort();
            MainID = Reader.ReadUShort();
            GardeningID = Reader.ReadUShort();
            TTABID = Reader.ReadUShort();
            InteractionGroup = Reader.ReadUShort();
            ObjectType = (OBJDType)Reader.ReadUShort();
            MasterID = Reader.ReadUShort();
            SubIndex = Reader.ReadInt16();
            WashHandsID = Reader.ReadUShort();
            AnimTableID = Reader.ReadUShort();
            GUID = Reader.ReadUInt32();
            Disabled = Reader.ReadUShort();
            Portal = Reader.ReadUShort();
            Price = Reader.ReadUShort();
            BodyStringsID = Reader.ReadUShort();
            SLOTID = Reader.ReadUShort();
            AllowIntersection = Reader.ReadUShort();
            UsesFnTable = Reader.ReadUShort();
            Bitfield1 = Reader.ReadUShort();
            PrepareFoodID = Reader.ReadUShort();
            CookFoodID = Reader.ReadUShort();
            PlaceOnSurfaceID = Reader.ReadUShort();
            DisposeID = Reader.ReadUShort();
            EatFoodID = Reader.ReadUShort();
            PickupFromSLOTID = Reader.ReadUShort();
            WashDishID = Reader.ReadUShort();
            EatingSurfaceID = Reader.ReadUShort();
            Sit = Reader.ReadUShort();
            Stand = Reader.ReadUShort();
            SalePrice = Reader.ReadUShort();
            InitialDepreciation = Reader.ReadUShort();
            DailyDepreciation = Reader.ReadUShort();
            SelfDepreciating = Reader.ReadUShort();
            DepreciationLimit = Reader.ReadUShort();
            RoomFlags = Reader.ReadUShort();
            FunctionFlags = Reader.ReadUShort();
            CatalogStringsID = Reader.ReadUShort();

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

            BHAV_Clean = Reader.ReadUShort();
            BHAV_QueueSkipped = Reader.ReadUShort();
            FrontDirection = Reader.ReadUShort();
            BHAV_WallAdjacencyChanged = Reader.ReadUShort();
            MyLeadObject = Reader.ReadUShort();
            DynamicSpriteBaseId = Reader.ReadUShort();
            NumDynamicSprites = Reader.ReadUShort();

            ChairEntryFlags = Reader.ReadUShort();
            TileWidth = Reader.ReadUShort();
            InhibitSuitCopying = Reader.ReadUShort();
            BuildModeType = Reader.ReadUShort();
            OriginalGUID1 = Reader.ReadUShort();
            OriginalGUID2 = Reader.ReadUShort();
            SuitGUID1 = Reader.ReadUShort();
            SuitGUID2 = Reader.ReadUShort();
            BHAV_Pickup = Reader.ReadUShort();
            ThumbnailGraphic = Reader.ReadUShort();
            ShadowFlags = Reader.ReadUShort();
            FootprintMask = Reader.ReadUShort();
            BHAV_DynamicMultiTileUpdate = Reader.ReadUShort();
            ShadowBrightness = Reader.ReadUShort();
            BHAV_Repair = Reader.ReadUShort();

            if (m_NumFields > 80)
            {
                WallStyleSpriteID = Reader.ReadUShort();
                RatingHunger = Reader.ReadUShort();
                RatingComfort = Reader.ReadUShort();
                RatingHygiene = Reader.ReadUShort();
                RatingBladder = Reader.ReadUShort();
                RatingEnergy = Reader.ReadUShort();
                RatingFun = Reader.ReadUShort();
                RatingRoom = Reader.ReadUShort();
                RatingSkillFlags = Reader.ReadUShort();
            }

            m_Data = null;
        }