public Actor(SaveIO.SaveReader reader, Squad squad, uint datumIndex, long offset) { _dataPosition = offset; _datumIndex = datumIndex; _squad = squad; reader.SeekTo(offset + 0x2C); _team = reader.ReadByte(); reader.SeekTo(offset + 0x343); _blind = (reader.ReadByte() == 1); _deaf = (reader.ReadByte() == 1); }
public Squad(SaveIO.SaveReader reader, uint datumIndex, long offset) { _dataPosition = offset; _datumIndex = datumIndex; reader.SeekTo(offset + 2); _flags = new BitVector32((int)reader.ReadInt16()); reader.SeekTo(offset + 0xA0); _actorIndex = reader.ReadUInt32(); reader.SeekTo(offset + 0xE7); _team = reader.ReadByte(); }
/// <summary> /// Reads the entry list and calls a callback function for each entry. /// </summary> /// <param name="reader">The SaveReader to read from. It must be positioned at the start of the entry list.</param> /// <param name="callback">The ReadEntriesCallback to call for each entry.</param> public void ReadEntries(SaveIO.SaveReader reader, ReadEntriesCallback callback) { long entryListStart = reader.Position; long currentEntryOffset = entryListStart; for (ushort i = 0; i < _nextFree; i++) { reader.SeekTo(currentEntryOffset); ushort salt = reader.ReadUInt16(); DatumIndex index = new DatumIndex(salt, i); if (!callback(this, reader, index, _entrySize, currentEntryOffset)) { break; } currentEntryOffset += _entrySize; } }
public void ReadFrom(SaveIO.SaveReader reader) { long baseOffset = reader.Position; string saveType = reader.ReadAscii(SaveTypeSize); if (saveType != "non compressed save") { throw new ArgumentException("Invalid save header - expected a non-compressed HCEX save"); } if (reader.ReadUInt32() != Magic1) { throw new ArgumentException("Invalid save header - bad magic number 1 (expected 0x92F7E104)"); } _map = reader.ReadAscii(); reader.SeekTo(baseOffset + Magic2Offset); if (reader.ReadUInt32() != Magic2) { throw new ArgumentException("Invalid save header - bad magic number 2 (expected 0xDEADBEEF)"); } }