module Rattletrap.Decode.Rotation
  ( decodeRotationBits
  )
where

import Rattletrap.Decode.Common
import Rattletrap.Decode.CompressedWordVector
import Rattletrap.Decode.Quaternion
import Rattletrap.Type.Rotation

decodeRotationBits :: (Int, Int, Int) -> DecodeBits Rotation
decodeRotationBits :: (Int, Int, Int) -> DecodeBits Rotation
decodeRotationBits (Int, Int, Int)
version = if (Int, Int, Int)
version (Int, Int, Int) -> (Int, Int, Int) -> Bool
forall a. Ord a => a -> a -> Bool
>= (Int
868, Int
22, Int
7)
  then Quaternion -> Rotation
RotationQuaternion (Quaternion -> Rotation)
-> BitGet Quaternion -> DecodeBits Rotation
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BitGet Quaternion
decodeQuaternionBits
  else CompressedWordVector -> Rotation
RotationCompressedWordVector (CompressedWordVector -> Rotation)
-> BitGet CompressedWordVector -> DecodeBits Rotation
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BitGet CompressedWordVector
decodeCompressedWordVectorBits