public override byte[] Serialize(Game game, Endianness endianness) { using (var writer = new EndianBinaryWriter(endianness)) { writer.Write(SerializeEntity(game, endianness)); if (game != Game.Scooby) { writer.Write(PressedModel_AssetID); } writer.Write((int)ActMethod); writer.Write(InitialButtonState); writer.Write(ResetAfterDelay ? 1 : 0); writer.Write(ResetDelay); writer.Write(HitMask.FlagValueInt); writer.Write(Motion.Serialize(game, endianness)); int linkStart = game == Game.Scooby ? 0x94 : game == Game.BFBB ? 0x9C : game == Game.Incredibles ? 0xA4 : throw new ArgumentException("Invalid game"); while (writer.BaseStream.Length < linkStart) { writer.Write((byte)0); } writer.Write(SerializeLinks(endianness)); return(writer.ToArray()); } }
public override byte[] Serialize(Game game, Endianness endianness) { using (var writer = new EndianBinaryWriter(endianness)) { writer.Write(SerializeEntity(game, endianness)); writer.Write(Motion.Serialize(game, endianness)); writer.BaseStream.Position = 0x74 + (game == Game.BFBB ? 4 : 0); writer.Write(Lt); writer.Write(Q1t); writer.Write(Q3t); writer.Write(SerializeLinks(endianness)); return(writer.ToArray()); } }