public OBJTEntry(IoBuffer io, int version) { //16 bytes of data GUID = io.ReadUInt32(); if (GUID == 0) { return; } Unknown1a = io.ReadUInt16(); Unknown1b = io.ReadUInt16(); Unknown2a = io.ReadUInt16(); Unknown2b = io.ReadUInt16(); //increases by one each time, one based, essentially an ID for this loaded type. Mostly matches index in array, but I guess it can possibly be different. TypeID = io.ReadUInt16(); OBJDType = (OBJDType)io.ReadUInt16(); //then the name, null terminated Name = io.ReadNullTerminatedString(); if (Name.Length % 2 == 0) { io.ReadByte(); //pad to short width } if (version > 2) { io.ReadInt32(); //not sure what this is } }
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")); } } }
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")); } } }
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; }
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; }