public static LabyrinthObject Serdes(int _, LabyrinthObject o, AssetMapping mapping, ISerializer s) { if (s == null) { throw new ArgumentNullException(nameof(s)); } o ??= new LabyrinthObject(); o.Properties = s.EnumU8(nameof(o.Properties), o.Properties); o.CollisionData = s.ByteArray(nameof(o.CollisionData), o.CollisionData, 3); o.SpriteId = SpriteId.SerdesU16(nameof(SpriteId), o.SpriteId, AssetType.Object3D, mapping, s); o.AnimationFrames = s.UInt8(nameof(o.AnimationFrames), o.AnimationFrames); o.Unk7 = s.UInt8(nameof(o.Unk7), o.Unk7); o.Width = s.UInt16(nameof(o.Width), o.Width); o.Height = s.UInt16(nameof(o.Height), o.Height); o.MapWidth = s.UInt16(nameof(o.MapWidth), o.MapWidth); o.MapHeight = s.UInt16(nameof(o.MapHeight), o.MapHeight); return(o); }
public static LabyrinthObject Serdes(int _, LabyrinthObject o, AssetMapping mapping, ISerializer s) { if (s == null) { throw new ArgumentNullException(nameof(s)); } o ??= new LabyrinthObject(); o.Properties = s.EnumU8(nameof(o.Properties), o.Properties); // Either a 24 bit int or a 3 byte array, annoying to serialize either way. o.Collision = (o.Collision & 0xffff00) | s.UInt8(nameof(o.Collision), (byte)(o.Collision & 0xff)); o.Collision = (o.Collision & 0xff00ff) | (uint)s.UInt8(nameof(o.Collision), (byte)((o.Collision >> 8) & 0xff)) << 8; o.Collision = (o.Collision & 0x00ffff) | (uint)s.UInt8(nameof(o.Collision), (byte)((o.Collision >> 16) & 0xff)) << 16; o.SpriteId = SpriteId.SerdesU16(nameof(SpriteId), o.SpriteId, AssetType.Object3D, mapping, s); o.AnimationFrames = s.UInt8(nameof(o.AnimationFrames), o.AnimationFrames); o.Unk7 = s.UInt8(nameof(o.Unk7), o.Unk7); o.Width = s.UInt16(nameof(o.Width), o.Width); o.Height = s.UInt16(nameof(o.Height), o.Height); o.MapWidth = s.UInt16(nameof(o.MapWidth), o.MapWidth); o.MapHeight = s.UInt16(nameof(o.MapHeight), o.MapHeight); return(o); }