module Rattletrap.Decode.PickupAttribute
  ( decodePickupAttributeBits
  )
where

import Rattletrap.Decode.Common
import Rattletrap.Decode.Word32le
import Rattletrap.Type.PickupAttribute

decodePickupAttributeBits :: DecodeBits PickupAttribute
decodePickupAttributeBits :: DecodeBits PickupAttribute
decodePickupAttributeBits = do
  Bool
instigator <- BitGet Bool
getBool
  Maybe Word32le -> Bool -> PickupAttribute
PickupAttribute (Maybe Word32le -> Bool -> PickupAttribute)
-> BitGet (Maybe Word32le) -> BitGet (Bool -> PickupAttribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Bool -> BitGet Word32le -> BitGet (Maybe Word32le)
forall (m :: * -> *) (f :: * -> *) a.
(Applicative m, Alternative f) =>
Bool -> m a -> m (f a)
decodeWhen Bool
instigator BitGet Word32le
decodeWord32leBits BitGet (Bool -> PickupAttribute)
-> BitGet Bool -> DecodeBits PickupAttribute
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BitGet Bool
getBool