public T8BTVABlock(System.IO.Stream stream, uint refStringStart) { uint size = stream.PeekUInt32().SwapEndian(); if (size % 4 != 0) { throw new Exception("T8BTVABlock size must be divisible by 4!"); } if (size / 4 < 14) { throw new Exception("T8BTVABlock must contain at least 14 ints!"); } Size = stream.ReadUInt32().SwapEndian(); IndexInArray = stream.ReadUInt32().SwapEndian(); IndexInGame = stream.ReadUInt32().SwapEndian(); IdentifierLocation = stream.ReadUInt32().SwapEndian(); CharacterSpecificData = new uint[9]; for (int i = 0; i < 9; ++i) { CharacterSpecificData[i] = stream.ReadUInt32().SwapEndian(); } EntryCount = stream.ReadUInt32().SwapEndian(); Identifier = stream.ReadAsciiNulltermFromLocationAndReset(IdentifierLocation + refStringStart); Entries = new List <T8BTVAEntry>((int)EntryCount); for (uint i = 0; i < EntryCount; ++i) { Entries.Add(new T8BTVAEntry(stream, refStringStart)); } }
public T8BTVAEntry(System.IO.Stream stream, uint refStringStart) { Data = new uint[33]; for (int i = 0; i < 33; ++i) { Data[i] = stream.ReadUInt32().SwapEndian(); } RefString = stream.ReadAsciiNulltermFromLocationAndReset(refStringStart + Data[22]); ScenarioStart = Data[2]; ScenarioEnd = Data[3]; CharacterBitmask = Data[5]; KillCharacterBitmask = Data[6]; }
public T8BTVAEntry(System.IO.Stream stream, uint refStringStart, Util.Endianness endian, uint byteCount) { if ((byteCount % 4) != 0) { throw new Exception("T8BTVAEntry byte count must be divisible by 4"); } Data = new uint[byteCount / 4]; for (int i = 0; i < Data.Length; ++i) { Data[i] = stream.ReadUInt32().FromEndian(endian); } RefString = stream.ReadAsciiNulltermFromLocationAndReset(refStringStart + Data[22]); ScenarioStart = Data[2]; ScenarioEnd = Data[3]; CharacterBitmask = Data[5]; KillCharacterBitmask = Data[6]; }