protected override void ReadObjectData(BinaryReader xReader, CDC.Objects.ExportOptions options) { // Object name xReader.BaseStream.Position = _dataStart + 0x00000024; xReader.BaseStream.Position = _dataStart + xReader.ReadUInt32(); String strModelName = new String(xReader.ReadChars(8)); _name = Utility.CleanName(strModelName); // Texture type xReader.BaseStream.Position = _dataStart + 0x44; if (options.ForcedPlatform == CDC.Platform.None) { if (xReader.ReadUInt64() != 0xFFFFFFFFFFFFFFFF) { _platform = Platform.PSX; } else { _platform = Platform.PC; } } else { _platform = options.ForcedPlatform; } // Model data xReader.BaseStream.Position = _dataStart + 0x00000008; _modelCount = xReader.ReadUInt16(); _animCount = xReader.ReadUInt16(); _modelStart = _dataStart + xReader.ReadUInt32(); _animStart = _dataStart + xReader.ReadUInt32(); _models = new SR1Model[_modelCount]; Platform ePlatform = _platform; for (UInt16 m = 0; m < _modelCount; m++) { Console.WriteLine(string.Format("Debug: reading object model {0} / {1}", m, (_modelCount - 1))); _models[m] = SR1ObjectModel.Load(xReader, _dataStart, _modelStart, _name, _platform, m, _version, options); if ((options.ForcedPlatform == CDC.Platform.None) && (_models[m].Platform == Platform.Dreamcast)) { ePlatform = _models[m].Platform; } } if (options.ForcedPlatform == CDC.Platform.None) { _platform = ePlatform; } }
protected override void ReadObjectData(BinaryReader xReader) { // Object name xReader.BaseStream.Position = _dataStart + 0x00000024; xReader.BaseStream.Position = _dataStart + xReader.ReadUInt32(); String strModelName = new String(xReader.ReadChars(8)); _name = Utility.CleanName(strModelName); // Texture type xReader.BaseStream.Position = _dataStart + 0x44; if (xReader.ReadUInt64() != 0xFFFFFFFFFFFFFFFF) { _platform = Platform.PSX; } else { _platform = Platform.PC; } // Model data xReader.BaseStream.Position = _dataStart + 0x00000008; _modelCount = xReader.ReadUInt16(); _animCount = xReader.ReadUInt16(); _modelStart = _dataStart + xReader.ReadUInt32(); _animStart = _dataStart + xReader.ReadUInt32(); _models = new SR1Model[_modelCount]; Platform ePlatform = _platform; for (UInt16 m = 0; m < _modelCount; m++) { _models[m] = SR1ObjectModel.Load(xReader, _dataStart, _modelStart, _name, _platform, m, _version); if (_models[m].Platform == Platform.Dreamcast) { ePlatform = _models[m].Platform; } } _platform = ePlatform; }
protected override void ReadObjectData(BinaryReader reader, ExportOptions options) { // Object name reader.BaseStream.Position = _dataStart + 0x00000024; reader.BaseStream.Position = _dataStart + reader.ReadUInt32(); String strModelName = new String(reader.ReadChars(8)); _name = Utility.CleanObjectName(strModelName); // Hack to check for lighthouse demo. // The only way the name can be at 0x0000003C is if the Level structure is smaller. Hence it's the demo. reader.BaseStream.Position = _dataStart + 0x00000024; if (reader.ReadUInt32() == 0x0000003C) { _version = PROTO_19981025_VERSION; } else { // Assume retail for now. There might be other checks needed. _version = RETAIL_VERSION; } // Texture type if (options.ForcedPlatform == CDC.Platform.None) { reader.BaseStream.Position = _dataStart + 0x44; if (_version == PROTO_19981025_VERSION || reader.ReadUInt64() != 0xFFFFFFFFFFFFFFFF) { _platform = Platform.PSX; } else { _platform = Platform.PC; } } else { _platform = options.ForcedPlatform; } // Model data reader.BaseStream.Position = _dataStart + 0x00000008; _modelCount = reader.ReadUInt16(); _animCount = reader.ReadUInt16(); _modelStart = _dataStart + reader.ReadUInt32(); _animStart = _dataStart + reader.ReadUInt32(); _models = new SR1Model[_modelCount]; Platform ePlatform = _platform; for (UInt16 m = 0; m < _modelCount; m++) { Console.WriteLine(string.Format("Debug: reading object model {0} / {1}", m, (_modelCount - 1))); _models[m] = SR1ObjectModel.Load(reader, _dataStart, _modelStart, _name, _platform, m, _version, options); if ((options.ForcedPlatform == CDC.Platform.None) && (_models[m].Platform == Platform.Dreamcast)) { ePlatform = _models[m].Platform; } } if (options.ForcedPlatform == CDC.Platform.None) { _platform = ePlatform; } /*reader.BaseStream.Position = _dataStart + 0x1C; * UInt32 objectDataStart = reader.ReadUInt32(); * reader.BaseStream.Position = _dataStart + 0x2C; * Int32 oflags2 = reader.ReadInt32(); * * // MonsterAttributes * if ((oflags2 & 0x00080000) != 0 && objectDataStart != 0) * { * _monsterAttributes = new MonsterAttributes(); * * reader.BaseStream.Position = objectDataStart + 0x24; * if (Version <= BETA_19990512_VERSION) * { * reader.BaseStream.Position += 0x03; * } * if (Version == BETA_19990512_VERSION) * { * reader.BaseStream.Position += 0x01; * } * * _monsterAttributes.numSubAttributes = reader.ReadSByte(); * _monsterAttributes.subAttributes = new MonsterSubAttributes[_monsterAttributes.numSubAttributes]; * reader.BaseStream.Position += 0x07; * * for (int s = 0; s < _monsterAttributes.numSubAttributes; s++) * { * _monsterAttributes.subAttributes[s].dataStart = reader.ReadUInt32(); * } * * for (int s = 0; s < _monsterAttributes.numSubAttributes; s++) * { * reader.BaseStream.Position = _monsterAttributes.subAttributes[s].dataStart + 0x26; * _monsterAttributes.subAttributes[s].modelNum = reader.ReadByte(); * } * }*/ }