79 lines
1.8 KiB
Haskell
79 lines
1.8 KiB
Haskell
{-# 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 ShapePicture.Data
|
|
|
|
data Prop = ShapeProp
|
|
{ _prPos :: Point2
|
|
, _prDraw :: PropDraw
|
|
, _prUpdate :: PropUpdate
|
|
, _prID :: Int
|
|
, _prRot :: Float
|
|
, _prToggle :: Bool
|
|
}
|
|
|
|
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
|
|
= PropDrawFlatTranslate SPic
|
|
| PropDoubleLampCover Float
|
|
| PropVerticalLampCover Float
|
|
| PropLampCover Float
|
|
|
|
-- | 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
|