97 lines
2.4 KiB
Haskell
97 lines
2.4 KiB
Haskell
{-# LANGUAGE DeriveGeneric #-}
|
|
{-# LANGUAGE DeriveAnyClass #-}
|
|
{-# LANGUAGE StrictData #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
module Dodge.Data.Prop where
|
|
|
|
import Color
|
|
import Control.Lens
|
|
import Data.Aeson
|
|
import Data.Aeson.TH
|
|
import Dodge.Data.WorldEffect
|
|
import Geometry.Data
|
|
import qualified Quaternion as Q
|
|
import Shape.Data
|
|
import ShapePicture.Data
|
|
|
|
data Prop
|
|
= PropZ
|
|
{ _prPos :: Point2
|
|
, _prDraw :: PropDraw
|
|
, _prUpdate :: PropUpdate
|
|
, _prStartPos :: Point2
|
|
, _prVel :: Point2
|
|
, _prID :: Int
|
|
, _prPosZ :: Float
|
|
, _prVelZ :: Float
|
|
, _prQuat :: Q.Quaternion Float
|
|
, _prQuatSpin :: Q.Quaternion Float
|
|
, _prColor :: Color
|
|
}
|
|
| ShapeProp
|
|
{ _prPos :: Point2
|
|
, _prDraw :: PropDraw
|
|
, _prUpdate :: PropUpdate
|
|
, _prID :: Int
|
|
, _prRot :: Float
|
|
, _prToggle :: Bool
|
|
}
|
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
data DebrisType =
|
|
Gib {_gibSize :: Float
|
|
,_gibColor :: Color
|
|
}
|
|
| BlockDebris {_bdColor :: Color}
|
|
|
|
data Debris = DebrisChunk
|
|
{ _dbPos :: Point3
|
|
, _dbType :: DebrisType
|
|
, _dbVel :: Point3
|
|
, _dbRot :: Q.Quaternion Float
|
|
, _dbSpin :: Q.Quaternion Float
|
|
}
|
|
|
|
--data PropType = FallingBlock Material
|
|
|
|
data PropDraw
|
|
= PropDrawSPic SPic
|
|
| PropDrawMovingShapeCol Shape
|
|
| PropDrawMovingShape PropDraw
|
|
| PropDrawFlatTranslate PropDraw
|
|
| PropDoubleLampCover Float
|
|
| PropVerticalLampCover Float
|
|
| PropLampCover Float
|
|
| PropDrawToggle PropDraw
|
|
-- | PropDrawGib Float
|
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
data PropUpdate
|
|
= PropUpdateId
|
|
| PropUpdateAnd PropUpdate PropUpdate
|
|
| PropRotate Float
|
|
| PropSetToggleAnd WdBl PropUpdate
|
|
| PropUpdates [PropUpdate]
|
|
| PropUpdateLS Int PrWdLsLs
|
|
| PropUpdatePosition WdP2f
|
|
| PropUpdateWhen WdBl PropUpdate
|
|
| PropUpdateIf WdBl PropUpdate PropUpdate
|
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
data PrWdLsLs
|
|
= PrWdLsId
|
|
| PrWdLsSetPosition WdP2f Point3
|
|
| PrWdLsSetColor Point3
|
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
makeLenses ''Prop
|
|
makeLenses ''Debris
|
|
makeLenses ''DebrisType
|
|
deriveJSON defaultOptions ''DebrisType
|
|
deriveJSON defaultOptions ''Debris
|
|
deriveJSON defaultOptions ''PropDraw
|
|
deriveJSON defaultOptions ''PrWdLsLs
|
|
deriveJSON defaultOptions ''PropUpdate
|
|
deriveJSON defaultOptions ''Prop
|