public static SwitchEvent Serdes(SwitchEvent e, AssetMapping mapping, ISerializer s) { if (s == null) { throw new ArgumentNullException(nameof(s)); } e ??= new SwitchEvent(); e.Operation = s.EnumU8(nameof(Operation), e.Operation); e.Unk3 = s.UInt8(nameof(Unk3), e.Unk3); int zeroed = s.UInt8(null, 0); zeroed += s.UInt8(null, 0); e.SwitchId = SwitchId.SerdesU16(nameof(SwitchId), e.SwitchId, mapping, s); zeroed += s.UInt16(null, 0); s.Assert(zeroed == 0, "SwitchEvent: Expected fields 4,5,8 to be 0"); return(e); }
public static QuerySwitchEvent Serdes(QuerySwitchEvent e, AssetMapping mapping, ISerializer s) { if (s == null) { throw new ArgumentNullException(nameof(s)); } e ??= new QuerySwitchEvent(); e.Operation = s.EnumU8(nameof(Operation), e.Operation); e.Immediate = s.UInt8(nameof(Immediate), e.Immediate); int zeroes = s.UInt8(null, 0); zeroes += s.UInt8(null, 0); e.SwitchId = SwitchId.SerdesU16(nameof(SwitchId), e.SwitchId, mapping, s); // field 8 is the next event id when the condition is false and is deserialised as part of the BranchEventNode that this event should belong to. s.Assert(zeroes == 0, "QuerySwitchEvent: Expected fields 3,4 to be 0"); return(e); }