Move from store to flat

This commit is contained in:
2022-08-20 17:54:35 +01:00
parent 8571ab9254
commit ff9dbdf068
95 changed files with 793 additions and 748 deletions
+1
View File
@@ -52,6 +52,7 @@ dependencies:
- aeson - aeson
- aeson-pretty - aeson-pretty
- store - store
- flat
- th-utilities - th-utilities
- directory - directory
- extra - extra
+67 -36
View File
@@ -1,30 +1,64 @@
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Color where module Color where
import GHC.Generics
import Flat
import Data.Aeson import Data.Aeson
import Data.Store
import GHC.Generics
import Geometry import Geometry
import LinearHelp import LinearHelp
import TH.Derive import TH.Derive
import Data.Store
data PaletteColor = RED | GREEN | BLUE | YELLOW | CYAN data PaletteColor
| MAGENTA | ROSE | VIOLET | AZURE | AQUAMARINE | CHARTREUSE | ORANGE | WHITE | BLACK = RED
deriving (Eq,Ord,Enum,Show,Read,Generic) | GREEN
| BLUE
| YELLOW
| CYAN
| MAGENTA
| ROSE
| VIOLET
| AZURE
| AQUAMARINE
| CHARTREUSE
| ORANGE
| WHITE
| BLACK
deriving (Eq, Ord, Enum, Show, Read, Generic, Flat)
instance ToJSON PaletteColor where instance ToJSON PaletteColor where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
instance FromJSON PaletteColor instance FromJSON PaletteColor
type RGBA = Point4 type RGBA = Point4
type Color = Point4 type Color = Point4
withAlpha :: Float -> RGBA -> RGBA withAlpha :: Float -> RGBA -> RGBA
{-# INLINE withAlpha #-} {-# INLINE withAlpha #-}
withAlpha a (V4 x y z a') = V4 x y z (a*a') withAlpha a (V4 x y z a') = V4 x y z (a * a')
red,green,blue,yellow,cyan,magenta,rose red
,violet,azure,aquamarine,chartreuse,orange,white,black::Color , green
, blue
, yellow
, cyan
, magenta
, rose
, violet
, azure
, aquamarine
, chartreuse
, orange
, white
, black ::
Color
red = V4 1 0 0 1 red = V4 1 0 0 1
green = V4 0 1 0 1 green = V4 0 1 0 1
blue = V4 0 0 1 1 blue = V4 0 0 1 1
@@ -34,8 +68,8 @@ magenta = V4 1 0 1 1
rose = V4 1 0 0.5 1 rose = V4 1 0 0.5 1
violet = V4 0.5 0 1 1 violet = V4 0.5 0 1 1
azure = V4 0 0.5 1 1 azure = V4 0 0.5 1 1
aquamarine= V4 0 1 0.5 1 aquamarine = V4 0 1 0.5 1
chartreuse= V4 0.5 1 0 1 chartreuse = V4 0.5 1 0 1
orange = V4 1 0.5 0 1 orange = V4 1 0.5 0 1
white = V4 1 1 1 1 white = V4 1 1 1 1
black = V4 0 0 0 1 black = V4 0 0 0 1
@@ -84,8 +118,8 @@ mixColors rata ratb (V4 r0 g0 b0 a0) (V4 r2 g2 b2 a2) =
let fullrat = rata + ratb let fullrat = rata + ratb
normrata = rata / fullrat normrata = rata / fullrat
normratb = ratb / fullrat normratb = ratb / fullrat
f x y = sqrt $ normrata * x^(2::Int) + normratb * y^(2::Int) f x y = sqrt $ normrata * x ^ (2 :: Int) + normratb * y ^ (2 :: Int)
in V4 (f r0 r2 ) ( f g0 g2 ) ( f b0 b2 ) ( normrata * a0 + normratb * a2) in V4 (f r0 r2) (f g0 g2) (f b0 b2) (normrata * a0 + normratb * a2)
mixColorsLinear :: Float -> Float -> Color -> Color -> Color mixColorsLinear :: Float -> Float -> Color -> Color -> Color
{-# INLINE mixColorsLinear #-} {-# INLINE mixColorsLinear #-}
@@ -94,51 +128,48 @@ mixColorsLinear rata ratb (V4 r0 g0 b0 a0) (V4 r2 g2 b2 a2) =
normrata = rata / fullrat normrata = rata / fullrat
normratb = ratb / fullrat normratb = ratb / fullrat
f x y = normrata * x + normratb * y f x y = normrata * x + normratb * y
in V4 (f r0 r2 ) ( f g0 g2 ) ( f b0 b2 ) ( normrata * a0 + normratb * a2) in V4 (f r0 r2) (f g0 g2) (f b0 b2) (normrata * a0 + normratb * a2)
light :: Color -> Color light :: Color -> Color
{-# INLINE light #-} {-# INLINE light #-}
light (V4 r g b a) = V4 (r+0.2) (g+0.2) (b+0.2) a light (V4 r g b a) = V4 (r + 0.2) (g + 0.2) (b + 0.2) a
dark :: Color -> Color dark :: Color -> Color
{-# INLINE dark #-} {-# INLINE dark #-}
dark (V4 r g b a) = V4 (r-0.2) (g-0.2) (b-0.2) a dark (V4 r g b a) = V4 (r -0.2) (g -0.2) (b -0.2) a
dim :: Color -> Color dim :: Color -> Color
{-# INLINE dim #-} {-# INLINE dim #-}
dim (V4 r g b a) = V4 (r/1.2) (g/1.2) (b/1.2) a dim (V4 r g b a) = V4 (r / 1.2) (g / 1.2) (b / 1.2) a
brightX :: Float -> Float -> Color -> Color brightX :: Float -> Float -> Color -> Color
{-# INLINE brightX #-} {-# INLINE brightX #-}
brightX cm am (V4 r g b a) = V4 (r*cm) (g*cm) (b*cm) (a*am) brightX cm am (V4 r g b a) = V4 (r * cm) (g * cm) (b * cm) (a * am)
bright :: Color -> Color bright :: Color -> Color
{-# INLINE bright #-} {-# INLINE bright #-}
bright (V4 r g b a) = V4 (r*1.2) (g*1.2) (b*1.2) a bright (V4 r g b a) = V4 (r * 1.2) (g * 1.2) (b * 1.2) a
greyN :: Float -> Color greyN :: Float -> Color
{-# INLINE greyN #-} {-# INLINE greyN #-}
greyN x = toV4 (x,x,x,1) greyN x = toV4 (x, x, x, 1)
numColor :: Int -> Color numColor :: Int -> Color
{-# INLINE numColor #-} {-# INLINE numColor #-}
numColor 0 = toV4 (1,0,0,1) numColor 0 = toV4 (1, 0, 0, 1)
numColor 1 = toV4 (0,1,0,1) numColor 1 = toV4 (0, 1, 0, 1)
numColor 2 = toV4 (0,0,1,1) numColor 2 = toV4 (0, 0, 1, 1)
numColor 3 = toV4 (1,1,0,1) numColor 3 = toV4 (1, 1, 0, 1)
numColor 4 = toV4 (0,1,1,1) numColor 4 = toV4 (0, 1, 1, 1)
numColor 5 = toV4 (1,0,1,1) numColor 5 = toV4 (1, 0, 1, 1)
numColor 6 = toV4 (1,0,0.5,1) numColor 6 = toV4 (1, 0, 0.5, 1)
numColor 7 = toV4 (0.5,0,1,1) numColor 7 = toV4 (0.5, 0, 1, 1)
numColor 8 = toV4 (0,0.5,1,1) numColor 8 = toV4 (0, 0.5, 1, 1)
numColor 9 = toV4 (0,1,0.5,1) numColor 9 = toV4 (0, 1, 0.5, 1)
numColor 10 = toV4 (0.5,1,0,1) numColor 10 = toV4 (0.5, 1, 0, 1)
numColor 11 = toV4 (1,0.5,0,1) numColor 11 = toV4 (1, 0.5, 0, 1)
numColor 12 = toV4 (1,1,1,1) numColor 12 = toV4 (1, 1, 1, 1)
numColor _ = toV4 (1,1,1,1) numColor _ = toV4 (1, 1, 1, 1)
light4 :: Color -> Color light4 :: Color -> Color
light4 = light . light . light . light light4 = light . light . light . light
$($(derive [d| instance Deriving (Store PaletteColor) |]))
-- $($(derive [d| instance Deriving (Store ProximityRequirement) |]))
+9 -12
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.ActionPlan where module Dodge.Data.ActionPlan where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -21,12 +24,12 @@ data ActionPlan
, _apStrategy :: Strategy , _apStrategy :: Strategy
, _apGoal :: [Goal] , _apGoal :: [Goal]
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data RandImpulse data RandImpulse
= RandImpulseList [Impulse] = RandImpulseList [Impulse]
| RandImpulseCircMove Float | RandImpulseCircMove Float
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Impulse data Impulse
= Move Point2 = Move Point2
@@ -60,7 +63,7 @@ data Impulse
{ _impulseUseAheadPos :: P2Imp { _impulseUseAheadPos :: P2Imp
} }
| ImpulseNothing | ImpulseNothing
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
infixr 9 `WaitThen` infixr 9 `WaitThen`
@@ -167,7 +170,7 @@ data Action
{ _sideImpulses :: [Impulse] { _sideImpulses :: [Impulse]
, _mainAction :: Action , _mainAction :: Action
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Strategy data Strategy
= Flank Int = Flank Int
@@ -185,13 +188,13 @@ data Strategy
| Reload | Reload
| Flee | Flee
| MeleeStrike | MeleeStrike
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Goal data Goal
= LiveLongAndProsper = LiveLongAndProsper
| Kill Int | Kill Int
| SentinelAt Point2 Float | SentinelAt Point2 Float
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
deriveJSON defaultOptions ''ActionPlan deriveJSON defaultOptions ''ActionPlan
deriveJSON defaultOptions ''RandImpulse deriveJSON defaultOptions ''RandImpulse
@@ -202,9 +205,3 @@ deriveJSON defaultOptions ''Goal
makeLenses ''ActionPlan makeLenses ''ActionPlan
makeLenses ''Impulse makeLenses ''Impulse
makeLenses ''Action makeLenses ''Action
$($(derive [d| instance Deriving (Store ActionPlan) |]))
$($(derive [d| instance Deriving (Store RandImpulse) |]))
$($(derive [d| instance Deriving (Store Impulse) |]))
$($(derive [d| instance Deriving (Store Action) |]))
$($(derive [d| instance Deriving (Store Strategy) |]))
$($(derive [d| instance Deriving (Store Goal) |]))
+5 -4
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.ArcStep where module Dodge.Data.ArcStep where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -17,15 +20,13 @@ data ArcStep = ArcStep
, _asDir :: Float , _asDir :: Float
, _asObject :: CrWlID --Maybe (Either Creature Wall) , _asObject :: CrWlID --Maybe (Either Creature Wall)
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data NextArcStep data NextArcStep
= EndArc = EndArc
| DefaultArcStep | DefaultArcStep
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''ArcStep makeLenses ''ArcStep
deriveJSON defaultOptions ''ArcStep deriveJSON defaultOptions ''ArcStep
deriveJSON defaultOptions ''NextArcStep deriveJSON defaultOptions ''NextArcStep
$($(derive [d| instance Deriving (Store ArcStep) |]))
$($(derive [d| instance Deriving (Store NextArcStep) |]))
+7 -8
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Beam where module Dodge.Data.Beam where
import Flat
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -28,12 +31,12 @@ data Beam = Beam
, _bmOrigin :: Maybe Int , _bmOrigin :: Maybe Int
, _bmType :: BeamType , _bmType :: BeamType
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data BeamDraw data BeamDraw
= BasicBeamDraw = BasicBeamDraw
| BeamDrawColor Color | BeamDrawColor Color
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data BeamCombineType data BeamCombineType
= FlameBeamCombine = FlameBeamCombine
@@ -41,14 +44,14 @@ data BeamCombineType
| TeslaBeamCombine | TeslaBeamCombine
| SplitBeamCombine | SplitBeamCombine
| NoBeamCombine | NoBeamCombine
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data BeamType data BeamType
= BeamCombine = BeamCombine
{ _beamCombine :: BeamCombineType -- (Point2 , (Point2,Point2,Beam) , (Point2,Point2,Beam)) -> World -> World { _beamCombine :: BeamCombineType -- (Point2 , (Point2,Point2,Beam) , (Point2,Point2,Beam)) -> World -> World
} }
| BeamSimple | BeamSimple
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''BeamType makeLenses ''BeamType
makeLenses ''Beam makeLenses ''Beam
@@ -56,7 +59,3 @@ deriveJSON defaultOptions ''BeamType
deriveJSON defaultOptions ''Beam deriveJSON defaultOptions ''Beam
deriveJSON defaultOptions ''BeamDraw deriveJSON defaultOptions ''BeamDraw
deriveJSON defaultOptions ''BeamCombineType deriveJSON defaultOptions ''BeamCombineType
$($(derive [d| instance Deriving (Store BeamType) |]))
$($(derive [d| instance Deriving (Store Beam) |]))
$($(derive [d| instance Deriving (Store BeamDraw) |]))
$($(derive [d| instance Deriving (Store BeamCombineType) |]))
+7 -7
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -7,12 +9,13 @@ module Dodge.Data.Block (
module Dodge.Data.PathGraph, module Dodge.Data.PathGraph,
) where ) where
import Flat
import LinearHelp import LinearHelp
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import qualified Data.IntSet as IS import qualified IntSetHelp as IS
import Dodge.Data.Material import Dodge.Data.Material
import Dodge.Data.PathGraph import Dodge.Data.PathGraph
import Geometry import Geometry
@@ -33,24 +36,21 @@ data Block = Block
, _blDraw :: BlockDraw --Block -> SPic , _blDraw :: BlockDraw --Block -> SPic
, _blObstructs :: [(Int, Int, PathEdge)] , _blObstructs :: [(Int, Int, PathEdge)]
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data BlockDraw data BlockDraw
= BlockDrawMempty = BlockDrawMempty
| BlockDrawBlSh BlSh | BlockDrawBlSh BlSh
| BlockDraws [BlockDraw] | BlockDraws [BlockDraw]
| BlockDrawColHeightPoss Color Float [Point2] | BlockDrawColHeightPoss Color Float [Point2]
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data BlSh data BlSh
= BlShMempty = BlShMempty
| BlShConst Shape | BlShConst Shape
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Block makeLenses ''Block
deriveJSON defaultOptions ''Block deriveJSON defaultOptions ''Block
deriveJSON defaultOptions ''BlockDraw deriveJSON defaultOptions ''BlockDraw
deriveJSON defaultOptions ''BlSh deriveJSON defaultOptions ''BlSh
$($(derive [d| instance Deriving (Store Block) |]))
$($(derive [d| instance Deriving (Store BlockDraw) |]))
$($(derive [d| instance Deriving (Store BlSh) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Bounds where module Dodge.Data.Bounds where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -15,11 +18,10 @@ data Bounds = Bounds
, _bdMinY :: Float , _bdMinY :: Float
, _bdMaxY :: Float , _bdMaxY :: Float
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
defaultBounds :: Bounds defaultBounds :: Bounds
defaultBounds = Bounds 0 0 0 0 defaultBounds = Bounds 0 0 0 0
makeLenses ''Bounds makeLenses ''Bounds
deriveJSON defaultOptions ''Bounds deriveJSON defaultOptions ''Bounds
$($(derive [d| instance Deriving (Store Bounds) |]))
+9 -12
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -6,6 +8,7 @@ module Dodge.Data.Bullet
, module Dodge.Data.Damage , module Dodge.Data.Damage
)where )where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -29,30 +32,30 @@ data Bullet = Bullet
, _buTimer :: Int , _buTimer :: Int
, _buDamages :: [Damage] , _buDamages :: [Damage]
} }
deriving (Show, Read, Eq, Ord) deriving (Show, Read, Eq, Ord, Generic, Flat)
data EnergyBallType = IncBall | TeslaBall | ConcBall data EnergyBallType = IncBall | TeslaBall | ConcBall
deriving (Show, Read, Eq, Ord, Enum, Bounded) deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
data BulletUpdateMod = NoBulletUpdateMod data BulletUpdateMod = NoBulletUpdateMod
| ABulletUpdateMod -- hack for template splicing | ABulletUpdateMod -- hack for template splicing
deriving (Show, Read, Eq, Ord, Enum, Bounded) deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
data BulletEffect data BulletEffect
= DestroyBullet = DestroyBullet
| BounceBullet | BounceBullet
| PenetrateBullet | PenetrateBullet
deriving (Eq, Ord, Show, Read, Enum, Bounded) deriving (Eq, Ord, Show, Read, Enum, Bounded, Generic, Flat)
data BulletSpawn = BulBall EnergyBallType | BulSpark data BulletSpawn = BulBall EnergyBallType | BulSpark
deriving (Show, Read, Eq, Ord) deriving (Show, Read, Eq, Ord, Generic, Flat)
data BulletTrajectory data BulletTrajectory
= BasicBulletTrajectory = BasicBulletTrajectory
| BezierTrajectory Point2 Point2 Point2 | BezierTrajectory Point2 Point2 Point2
| FlechetteTrajectory Point2 | FlechetteTrajectory Point2
| MagnetTrajectory Point2 | MagnetTrajectory Point2
deriving (Show, Read, Eq, Ord) deriving (Show, Read, Eq, Ord, Generic, Flat)
makeLenses ''Bullet makeLenses ''Bullet
deriveJSON defaultOptions ''Bullet deriveJSON defaultOptions ''Bullet
@@ -61,9 +64,3 @@ deriveJSON defaultOptions ''BulletUpdateMod
deriveJSON defaultOptions ''BulletEffect deriveJSON defaultOptions ''BulletEffect
deriveJSON defaultOptions ''BulletSpawn deriveJSON defaultOptions ''BulletSpawn
deriveJSON defaultOptions ''BulletTrajectory deriveJSON defaultOptions ''BulletTrajectory
$($(derive [d| instance Deriving (Store Bullet) |]))
$($(derive [d| instance Deriving (Store EnergyBallType) |]))
$($(derive [d| instance Deriving (Store BulletUpdateMod) |]))
$($(derive [d| instance Deriving (Store BulletEffect) |]))
$($(derive [d| instance Deriving (Store BulletSpawn) |]))
$($(derive [d| instance Deriving (Store BulletTrajectory) |]))
+7 -8
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Button where module Dodge.Data.Button where
import Flat
import LinearHelp import LinearHelp
import Color import Color
import Control.Lens import Control.Lens
@@ -18,7 +21,7 @@ data ButtonDraw
= DefaultDrawButton Color = DefaultDrawButton Color
| DefaultDrawSwitch Color Color | DefaultDrawSwitch Color Color
| DrawNoButton | DrawNoButton
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ButtonEvent data ButtonEvent
= ButtonDoNothing = ButtonDoNothing
@@ -43,7 +46,7 @@ data ButtonEvent
, _boffEff :: WdWd , _boffEff :: WdWd
} }
| ButtonAccessTerminal | ButtonAccessTerminal
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data Button = Button data Button = Button
{ _btPict :: ButtonDraw --Button -> SPic { _btPict :: ButtonDraw --Button -> SPic
@@ -57,10 +60,10 @@ data Button = Button
, _btName :: String , _btName :: String
, _btColor :: Color , _btColor :: Color
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data ButtonState = BtOn | BtOff | BtNoLabel data ButtonState = BtOn | BtOff | BtNoLabel
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Button makeLenses ''Button
makeLenses ''ButtonEvent makeLenses ''ButtonEvent
@@ -68,7 +71,3 @@ deriveJSON defaultOptions ''ButtonDraw
deriveJSON defaultOptions ''ButtonEvent deriveJSON defaultOptions ''ButtonEvent
deriveJSON defaultOptions ''Button deriveJSON defaultOptions ''Button
deriveJSON defaultOptions ''ButtonState deriveJSON defaultOptions ''ButtonState
$($(derive [d| instance Deriving (Store ButtonDraw) |]))
$($(derive [d| instance Deriving (Store ButtonEvent) |]))
$($(derive [d| instance Deriving (Store Button) |]))
$($(derive [d| instance Deriving (Store ButtonState) |]))
+8 -10
View File
@@ -1,6 +1,7 @@
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
module Dodge.Data.CWorld ( module Dodge.Data.CWorld (
module Dodge.Data.CWorld, module Dodge.Data.CWorld,
@@ -47,8 +48,7 @@ module Dodge.Data.CWorld (
module Dodge.Data.WorldEffect, module Dodge.Data.WorldEffect,
) where ) where
import TH.Derive import Flat
import Data.Store
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -113,6 +113,7 @@ data CWCam = CWCam
, _cwcBoundBox :: [Point2] , _cwcBoundBox :: [Point2]
, _cwcBoundDist :: (Float, Float, Float, Float) -- NSEW, S and W negative , _cwcBoundDist :: (Float, Float, Float, Float) -- NSEW, S and W negative
} }
deriving (Eq, Ord, Show, Read, Generic, Flat)
data CWorld = CWorld data CWorld = CWorld
--{ _cameraCenter :: Point2 --{ _cameraCenter :: Point2
@@ -186,6 +187,7 @@ data CWorld = CWorld
, _cwTime :: CWTime , _cwTime :: CWTime
, _cwGen :: CWGen , _cwGen :: CWGen
} }
deriving (Eq, Show, Read, Generic, Flat)
data CWTime = CWTime data CWTime = CWTime
{ _maybeWorld :: Maybe' CWorld { _maybeWorld :: Maybe' CWorld
@@ -193,6 +195,7 @@ data CWTime = CWTime
, _worldClock :: Int , _worldClock :: Int
, _deathDelay :: Maybe Int , _deathDelay :: Maybe Int
} }
deriving (Eq, Show, Read, Generic, Flat)
data CWGen = CWGen data CWGen = CWGen
@@ -202,6 +205,7 @@ data CWGen = CWGen
, _cwgRoomClipping :: [ConvexPoly] , _cwgRoomClipping :: [ConvexPoly]
, _cwgSeed :: Int , _cwgSeed :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat)
data WorldBeams = WorldBeams data WorldBeams = WorldBeams
{ _blockingBeams :: [Beam] { _blockingBeams :: [Beam]
@@ -209,7 +213,7 @@ data WorldBeams = WorldBeams
, _positronBeams :: [Beam] , _positronBeams :: [Beam]
, _electronBeams :: [Beam] , _electronBeams :: [Beam]
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
deriveJSON defaultOptions ''CWorld deriveJSON defaultOptions ''CWorld
deriveJSON defaultOptions ''WorldBeams deriveJSON defaultOptions ''WorldBeams
@@ -221,9 +225,3 @@ makeLenses ''WorldBeams
makeLenses ''CWCam makeLenses ''CWCam
makeLenses ''CWGen makeLenses ''CWGen
makeLenses ''CWTime makeLenses ''CWTime
$($(derive [d| instance Deriving (Store CWorld) |]))
$($(derive [d| instance Deriving (Store WorldBeams) |]))
$($(derive [d| instance Deriving (Store CWCam) |]))
$($(derive [d| instance Deriving (Store CWGen) |]))
$($(derive [d| instance Deriving (Store CWTime) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.CamouflageStatus where module Dodge.Data.CamouflageStatus where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import TH.Derive import TH.Derive
@@ -11,7 +14,6 @@ import Data.Store
data CamouflageStatus data CamouflageStatus
= FullyVisible = FullyVisible
| Invisible | Invisible
deriving (Eq, Ord, Enum, Read, Show, Bounded) deriving (Eq, Ord, Enum, Read, Show, Bounded, Generic, Flat)
deriveJSON defaultOptions ''CamouflageStatus deriveJSON defaultOptions ''CamouflageStatus
$($(derive [d| instance Deriving (Store CamouflageStatus) |]))
+6 -6
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Cloud where module Dodge.Data.Cloud where
import Flat
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -14,7 +17,7 @@ import Data.Store
data CloudDraw data CloudDraw
= CloudColor Float Float Color -- radius-multiply fade-time color = CloudColor Float Float Color -- radius-multiply fade-time color
| DrawGasCloud Color | DrawGasCloud Color
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Cloud = Cloud data Cloud = Cloud
{ _clPos :: Point3 { _clPos :: Point3
@@ -25,17 +28,14 @@ data Cloud = Cloud
, _clTimer :: Int , _clTimer :: Int
, _clType :: CloudType , _clType :: CloudType
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data CloudType data CloudType
= SmokeCloud = SmokeCloud
| GasCloud | GasCloud
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Cloud makeLenses ''Cloud
deriveJSON defaultOptions ''CloudDraw deriveJSON defaultOptions ''CloudDraw
deriveJSON defaultOptions ''Cloud deriveJSON defaultOptions ''Cloud
deriveJSON defaultOptions ''CloudType deriveJSON defaultOptions ''CloudType
$($(derive [d| instance Deriving (Store CloudDraw) |]))
$($(derive [d| instance Deriving (Store Cloud) |]))
$($(derive [d| instance Deriving (Store CloudType) |]))
+6 -8
View File
@@ -1,20 +1,20 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Corpse where module Dodge.Data.Corpse where
import LinearHelp import Flat
import LinearHelp ()
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import Geometry.Data import Geometry.Data
import ShapePicture.Data import ShapePicture.Data
import TH.Derive
import Data.Store
data CorpseResurrection = NoResurrection data CorpseResurrection = NoResurrection
| HackCorpseRez deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data Corpse = Corpse data Corpse = Corpse
{ _cpID :: Int { _cpID :: Int
@@ -23,10 +23,8 @@ data Corpse = Corpse
, _cpSPic :: SPic , _cpSPic :: SPic
, _cpRes :: CorpseResurrection , _cpRes :: CorpseResurrection
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Corpse makeLenses ''Corpse
deriveJSON defaultOptions ''CorpseResurrection deriveJSON defaultOptions ''CorpseResurrection
deriveJSON defaultOptions ''Corpse deriveJSON defaultOptions ''Corpse
$($(derive [d| instance Deriving (Store CorpseResurrection) |]))
$($(derive [d| instance Deriving (Store Corpse) |]))
+7 -7
View File
@@ -1,13 +1,16 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.CrGroupParams where module Dodge.Data.CrGroupParams where
import LinearHelp import Flat
import LinearHelp ()
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import qualified Data.IntSet as IS import qualified IntSetHelp as IS
import Geometry.Data import Geometry.Data
import TH.Derive import TH.Derive
import Data.Store import Data.Store
@@ -18,14 +21,11 @@ data CrGroupParams = CrGroupParams
, _crGroupCenter :: Point2 , _crGroupCenter :: Point2
, _crGroupUpdate :: CrGroupUpdate --World -> CrGroupParams -> Maybe CrGroupParams , _crGroupUpdate :: CrGroupUpdate --World -> CrGroupParams -> Maybe CrGroupParams
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data CrGroupUpdate = DefaultCrGroupUpdate data CrGroupUpdate = DefaultCrGroupUpdate
| HackCrGroupUpdate deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
makeLenses ''CrGroupParams makeLenses ''CrGroupParams
deriveJSON defaultOptions ''CrGroupParams deriveJSON defaultOptions ''CrGroupParams
deriveJSON defaultOptions ''CrGroupUpdate deriveJSON defaultOptions ''CrGroupUpdate
$($(derive [d| instance Deriving (Store CrGroupParams) |]))
$($(derive [d| instance Deriving (Store CrGroupUpdate) |]))
+4 -1
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.CrWlID where module Dodge.Data.CrWlID where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -10,7 +13,7 @@ import TH.Derive
import Data.Store import Data.Store
data CrWlID = CrID Int | WlID Int | NothingID -- TODO rewrite/remove this data CrWlID = CrID Int | WlID Int | NothingID -- TODO rewrite/remove this
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''CrWlID makeLenses ''CrWlID
deriveJSON defaultOptions ''CrWlID deriveJSON defaultOptions ''CrWlID
+6 -16
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
@@ -15,6 +17,7 @@ module Dodge.Data.Creature (
module Dodge.Data.Hammer, module Dodge.Data.Hammer,
) where ) where
import Flat
import LinearHelp import LinearHelp
import TH.Derive import TH.Derive
import Data.Store import Data.Store
@@ -74,18 +77,17 @@ data Creature = Creature
, _crStatistics :: CreatureStatistics , _crStatistics :: CreatureStatistics
, _crCamouflage :: CamouflageStatus , _crCamouflage :: CamouflageStatus
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data CreatureCorpse = MakeDefaultCorpse data CreatureCorpse = MakeDefaultCorpse
| HackDefaultCorpse deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data Intention = Intention data Intention = Intention
{ _targetCr :: Maybe Creature { _targetCr :: Maybe Creature
, _mvToPoint :: Maybe Point2 , _mvToPoint :: Maybe Point2
, _viewPoint :: Maybe Point2 , _viewPoint :: Maybe Point2
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
crSel :: Creature -> Int crSel :: Creature -> Int
crSel = _iselPos . _crInvSel crSel = _iselPos . _crInvSel
@@ -95,15 +97,3 @@ makeLenses ''Intention
deriveJSON defaultOptions ''Creature deriveJSON defaultOptions ''Creature
deriveJSON defaultOptions ''CreatureCorpse deriveJSON defaultOptions ''CreatureCorpse
deriveJSON defaultOptions ''Intention deriveJSON defaultOptions ''Intention
{- FOURMOLU_DISABLE -}
$($(derive [d|
instance Deriving (Store Intention)
|]))
$($(derive [d|
instance Deriving (Store CreatureCorpse)
|]))
$($(derive [d|
instance Deriving (Store Creature)
|]))
{- FOURMOLU_ENABLE -}
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Creature.Memory where module Dodge.Data.Creature.Memory where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -15,8 +18,7 @@ data Memory = Memory
{ _soundsToInvestigate :: [Point2] { _soundsToInvestigate :: [Point2]
, _nodesSearched :: [Int] , _nodesSearched :: [Int]
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Memory makeLenses ''Memory
deriveJSON defaultOptions ''Memory deriveJSON defaultOptions ''Memory
$($(derive [d| instance Deriving (Store Memory) |]))
+9 -15
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -6,6 +8,7 @@ module Dodge.Data.Creature.Misc (
module Dodge.Data.CamouflageStatus, module Dodge.Data.CamouflageStatus,
) where ) where
import Flat
import TH.Derive import TH.Derive
import Data.Store import Data.Store
import Color import Color
@@ -22,7 +25,7 @@ data CreatureStatistics = CreatureStatistics
, _dexterity :: Int , _dexterity :: Int
, _intelligence :: Int , _intelligence :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Vocalization data Vocalization
= Mute = Mute
@@ -32,7 +35,7 @@ data Vocalization
, _vcMaxCoolDown :: Int , _vcMaxCoolDown :: Int
, _vcCoolDown :: Int , _vcCoolDown :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data CrMvType data CrMvType
= NoMvType = NoMvType
@@ -43,7 +46,7 @@ data CrMvType
, _mvTurnJit :: Float , _mvTurnJit :: Float
, _mvAimSpeed :: FloatFloat , _mvAimSpeed :: FloatFloat
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data HumanoidAI data HumanoidAI
= YourAI = YourAI
@@ -59,7 +62,7 @@ data HumanoidAI
| MiniGunAI | MiniGunAI
| LongAI | LongAI
| MultGunAI | MultGunAI
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data CreatureType data CreatureType
= Humanoid = Humanoid
@@ -71,10 +74,10 @@ data CreatureType
| Barreloid {_barrelType :: BarrelType} | Barreloid {_barrelType :: BarrelType}
| Lampoid {_lampHeight :: Float, _lampColor :: Point3, _lampLSID :: Maybe Int} | Lampoid {_lampHeight :: Float, _lampColor :: Point3, _lampLSID :: Maybe Int}
| NonDrawnCreature | NonDrawnCreature
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data BarrelType = PlainBarrel | ExplosiveBarrel data BarrelType = PlainBarrel | ExplosiveBarrel
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''CreatureStatistics makeLenses ''CreatureStatistics
makeLenses ''Vocalization makeLenses ''Vocalization
@@ -86,12 +89,3 @@ deriveJSON defaultOptions ''CrMvType
deriveJSON defaultOptions ''HumanoidAI deriveJSON defaultOptions ''HumanoidAI
deriveJSON defaultOptions ''CreatureType deriveJSON defaultOptions ''CreatureType
deriveJSON defaultOptions ''BarrelType deriveJSON defaultOptions ''BarrelType
{- FOURMOLU_DISABLE -}
$($(derive [d| instance Deriving (Store CreatureStatistics) |]))
$($(derive [d| instance Deriving (Store Vocalization) |]))
$($(derive [d| instance Deriving (Store CrMvType) |]))
$($(derive [d| instance Deriving (Store HumanoidAI) |]))
$($(derive [d| instance Deriving (Store CreatureType) |]))
$($(derive [d| instance Deriving (Store BarrelType) |]))
{- FOURMOLU_ENABLE -}
+9 -12
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -21,6 +23,7 @@ module Dodge.Data.Creature.Perception (
auDist, auDist,
) where ) where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -36,18 +39,18 @@ data Perception = Perception
, _cpVision :: Vision , _cpVision :: Vision
, _cpAudition :: Audition , _cpAudition :: Audition
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Vision = Eyes data Vision = Eyes
{ _viFOV :: FloatFloat { _viFOV :: FloatFloat
, _viDist :: FloatFloat , _viDist :: FloatFloat
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
newtype Audition = Ears newtype Audition = Ears
{ _auDist :: FloatFloat { _auDist :: FloatFloat
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Vigilance data Vigilance
= Comatose = Comatose
@@ -55,17 +58,17 @@ data Vigilance
| Lethargic | Lethargic
| Vigilant | Vigilant
| Overstrung | Overstrung
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Attention data Attention
= AttentiveTo {_getAttentiveTo :: IM.IntMap Awareness} = AttentiveTo {_getAttentiveTo :: IM.IntMap Awareness}
| Fixated {_getFixated :: Int} | Fixated {_getFixated :: Int}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Awareness data Awareness
= Suspicious Float = Suspicious Float
| Cognizant Float | Cognizant Float
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Perception makeLenses ''Perception
makeLenses ''Vision makeLenses ''Vision
@@ -77,9 +80,3 @@ deriveJSON defaultOptions ''Audition
deriveJSON defaultOptions ''Vigilance deriveJSON defaultOptions ''Vigilance
deriveJSON defaultOptions ''Attention deriveJSON defaultOptions ''Attention
deriveJSON defaultOptions ''Awareness deriveJSON defaultOptions ''Awareness
$($(derive [d| instance Deriving (Store Perception) |]))
$($(derive [d| instance Deriving (Store Vision) |]))
$($(derive [d| instance Deriving (Store Audition) |]))
$($(derive [d| instance Deriving (Store Vigilance) |]))
$($(derive [d| instance Deriving (Store Attention) |]))
$($(derive [d| instance Deriving (Store Awareness) |]))
+7 -8
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Creature.Stance where module Dodge.Data.Creature.Stance where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -16,7 +19,7 @@ data Stance = Stance
, _posture :: Posture , _posture :: Posture
, _strideLength :: Int , _strideLength :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Carriage data Carriage
= Walking = Walking
@@ -27,19 +30,19 @@ data Carriage
| Floating | Floating
| Flying | Flying
| Boosting Point2 | Boosting Point2
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data FootForward data FootForward
= LeftForward = LeftForward
| RightForward | RightForward
| WasLeftForward | WasLeftForward
| WasRightForward | WasRightForward
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Posture data Posture
= Aiming = Aiming
| AtEase | AtEase
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Stance makeLenses ''Stance
makeLenses ''Carriage makeLenses ''Carriage
@@ -48,7 +51,3 @@ deriveJSON defaultOptions ''Stance
deriveJSON defaultOptions ''Carriage deriveJSON defaultOptions ''Carriage
deriveJSON defaultOptions ''FootForward deriveJSON defaultOptions ''FootForward
deriveJSON defaultOptions ''Posture deriveJSON defaultOptions ''Posture
$($(derive [d| instance Deriving (Store Stance) |]))
$($(derive [d| instance Deriving (Store Carriage) |]))
$($(derive [d| instance Deriving (Store FootForward) |]))
$($(derive [d| instance Deriving (Store Posture) |]))
+9 -11
View File
@@ -1,13 +1,16 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Creature.State where module Dodge.Data.Creature.State where
import Flat
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import qualified Data.IntSet as IS import qualified IntSetHelp as IS
import Dodge.Data.Damage import Dodge.Data.Damage
import Geometry.Data import Geometry.Data
import TH.Derive import TH.Derive
@@ -18,18 +21,18 @@ data CreatureState = CrSt
, _csSpState :: CrSpState , _csSpState :: CrSpState
, _csDropsOnDeath :: CreatureDropType , _csDropsOnDeath :: CreatureDropType
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data CreatureDropType data CreatureDropType
= DropAll = DropAll
| DropAmount Int | DropAmount Int
| DropSpecific [Int] | DropSpecific [Int]
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data CrSpState data CrSpState
= Barrel {_piercedPoints :: [Point2]} = Barrel {_piercedPoints :: [Point2]}
| GenCr | GenCr
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Faction data Faction
= GenericFaction Int = GenericFaction Int
@@ -40,7 +43,7 @@ data Faction
| NoFaction | NoFaction
| ColorFaction Color | ColorFaction Color
| PlayerFaction | PlayerFaction
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data CrGroup data CrGroup
= LoneWolf = LoneWolf
@@ -50,7 +53,7 @@ data CrGroup
} }
| CrGroupID {_crGroupID :: Int} | CrGroupID {_crGroupID :: Int}
| ShieldGroup | ShieldGroup
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''CreatureState makeLenses ''CreatureState
makeLenses ''CrSpState makeLenses ''CrSpState
@@ -60,8 +63,3 @@ deriveJSON defaultOptions ''CreatureDropType
deriveJSON defaultOptions ''CrSpState deriveJSON defaultOptions ''CrSpState
deriveJSON defaultOptions ''Faction deriveJSON defaultOptions ''Faction
deriveJSON defaultOptions ''CrGroup deriveJSON defaultOptions ''CrGroup
$($(derive [d| instance Deriving (Store CreatureState) |]))
$($(derive [d| instance Deriving (Store CreatureDropType) |]))
$($(derive [d| instance Deriving (Store CrSpState) |]))
$($(derive [d| instance Deriving (Store Faction) |]))
$($(derive [d| instance Deriving (Store CrGroup) |]))
+16 -36
View File
@@ -1,37 +1,33 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.CreatureEffect where module Dodge.Data.CreatureEffect where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import TH.Derive
import Data.Store
data WdCrCr = NoCreatureEffect data WdCrCr = NoCreatureEffect
| HackWdCrCr deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data CrWdImp = NoCrWdImp data CrWdImp = NoCrWdImp
| HackCrWdImp deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data CrWdWd = CrWdWdId data CrWdWd = CrWdWdId
| HackCrWdWd deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data IntImp = NoIntImp data IntImp = NoIntImp
| HackIntImp deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data CrImp data CrImp
= NoCrImp = NoCrImp
| TurnTowardCr Float -- turn amount | TurnTowardCr Float -- turn amount
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data P2Imp = P2ImpNo data P2Imp = P2ImpNo
| HackP2Imp deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data WdCrBl data WdCrBl
= WdCrTrue = WdCrTrue
@@ -39,37 +35,34 @@ data WdCrBl
| WdCrNegate WdCrBl | WdCrNegate WdCrBl
| WdCrLOSTarget | WdCrLOSTarget
| WdCrSafeDistFromTarget Float | WdCrSafeDistFromTarget Float
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data CrBl data CrBl
= CrCanShoot = CrCanShoot
| CrIsReloading | CrIsReloading
| CrIsAiming | CrIsAiming
| CrIsAnimate | CrIsAnimate
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data MCrAc = MCrNoAction data MCrAc = MCrNoAction
| HackMCrAc deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data CrAc data CrAc
= CrTurnAround = CrTurnAround
| CrFleeFromTarget | CrFleeFromTarget
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data P2Ac = P2NoAction data P2Ac = P2NoAction
| HackP2Ac deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data MP2Ac = MP2NoAction data MP2Ac = MP2NoAction
| HackMP2Ac deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data CrWdAc data CrWdAc
= CrWdBFSThenReturn Int = CrWdBFSThenReturn Int
| ChooseMovementSpreadGun | ChooseMovementSpreadGun
| ChooseMovementLtAuto | ChooseMovementLtAuto
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
deriveJSON defaultOptions ''WdCrCr deriveJSON defaultOptions ''WdCrCr
deriveJSON defaultOptions ''CrWdImp deriveJSON defaultOptions ''CrWdImp
@@ -84,16 +77,3 @@ deriveJSON defaultOptions ''CrAc
deriveJSON defaultOptions ''P2Ac deriveJSON defaultOptions ''P2Ac
deriveJSON defaultOptions ''MP2Ac deriveJSON defaultOptions ''MP2Ac
deriveJSON defaultOptions ''CrWdAc deriveJSON defaultOptions ''CrWdAc
$($(derive [d| instance Deriving (Store WdCrCr) |]))
$($(derive [d| instance Deriving (Store CrWdImp) |]))
$($(derive [d| instance Deriving (Store CrWdWd) |]))
$($(derive [d| instance Deriving (Store IntImp) |]))
$($(derive [d| instance Deriving (Store CrImp) |]))
$($(derive [d| instance Deriving (Store P2Imp) |]))
$($(derive [d| instance Deriving (Store WdCrBl) |]))
$($(derive [d| instance Deriving (Store CrBl) |]))
$($(derive [d| instance Deriving (Store MCrAc) |]))
$($(derive [d| instance Deriving (Store CrAc) |]))
$($(derive [d| instance Deriving (Store P2Ac) |]))
$($(derive [d| instance Deriving (Store MP2Ac) |]))
$($(derive [d| instance Deriving (Store CrWdAc) |]))
+5 -4
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -10,6 +12,7 @@ module Dodge.Data.Damage (
module Dodge.Data.Damage.Type, module Dodge.Data.Damage.Type,
) where ) where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import TH.Derive import TH.Derive
@@ -28,7 +31,7 @@ data DamageEffect
| TorqueDamage {_deTorque :: Float} | TorqueDamage {_deTorque :: Float}
| PushBackDamage {_dePushBack :: Float} | PushBackDamage {_dePushBack :: Float}
| NoDamageEffect | NoDamageEffect
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Damage = Damage data Damage = Damage
{ _dmType :: DamageType { _dmType :: DamageType
@@ -38,7 +41,7 @@ data Damage = Damage
, _dmTo :: Point2 , _dmTo :: Point2
, _dmEffect :: DamageEffect , _dmEffect :: DamageEffect
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
isElectrical :: Damage -> Bool isElectrical :: Damage -> Bool
isElectrical dm = case _dmType dm of isElectrical dm = case _dmType dm of
@@ -55,5 +58,3 @@ makeLenses ''Damage
makeLenses ''DamageEffect makeLenses ''DamageEffect
deriveJSON defaultOptions ''DamageEffect deriveJSON defaultOptions ''DamageEffect
deriveJSON defaultOptions ''Damage deriveJSON defaultOptions ''Damage
$($(derive [d| instance Deriving (Store DamageEffect) |]))
$($(derive [d| instance Deriving (Store Damage) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Damage.Type where module Dodge.Data.Damage.Type where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import TH.Derive import TH.Derive
@@ -24,11 +27,10 @@ data DamageType
| PUSHDAM | PUSHDAM
| POISONDAM | POISONDAM
| ENTERREMENT | ENTERREMENT
deriving (Eq, Ord, Show, Read, Enum, Bounded) deriving (Eq, Ord, Show, Read, Enum, Bounded, Generic, Flat)
instance ToJSONKey DamageType instance ToJSONKey DamageType
instance FromJSONKey DamageType instance FromJSONKey DamageType
deriveJSON defaultOptions ''DamageType deriveJSON defaultOptions ''DamageType
$($(derive [d| instance Deriving (Store DamageType) |]))
+9 -6
View File
@@ -1,17 +1,20 @@
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Distortion where module Dodge.Data.Distortion where
import LinearHelp
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import Geometry
import TH.Derive
import Data.Store import Data.Store
import Flat
import Geometry
import LinearHelp
import TH.Derive
data Distortion data Distortion
= RadialDistortion Point2 Point2 Point2 Float = RadialDistortion Point2 Point2 Point2 Float
deriving (Eq,Ord,Show,Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
deriveJSON defaultOptions ''Distortion deriveJSON defaultOptions ''Distortion
$($(derive [d| instance Deriving (Store Distortion) |]))
+7 -7
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -8,11 +10,12 @@ module Dodge.Data.Door (
module Dodge.Data.WorldEffect, module Dodge.Data.WorldEffect,
) where ) where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import qualified Data.IntSet as IS import qualified IntSetHelp as IS
import Dodge.Data.MountedObject import Dodge.Data.MountedObject
import Dodge.Data.PathGraph import Dodge.Data.PathGraph
import Dodge.Data.WorldEffect import Dodge.Data.WorldEffect
@@ -21,13 +24,13 @@ import TH.Derive
import Data.Store import Data.Store
data DoorStatus = DoorOpen | DoorClosed | DoorHalfway | DoorInt Int data DoorStatus = DoorOpen | DoorClosed | DoorHalfway | DoorInt Int
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data PushSource data PushSource
= PushesItself = PushesItself
| PushedBy Int | PushedBy Int
| NotPushed | NotPushed
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Door = Door data Door = Door
{ _drID :: Int { _drID :: Int
@@ -47,12 +50,9 @@ data Door = Door
, _drObstructs :: [(Int, Int, PathEdge)] , _drObstructs :: [(Int, Int, PathEdge)]
, _drObstacleType :: EdgeObstacle , _drObstacleType :: EdgeObstacle
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Door makeLenses ''Door
deriveJSON defaultOptions ''DoorStatus deriveJSON defaultOptions ''DoorStatus
deriveJSON defaultOptions ''PushSource deriveJSON defaultOptions ''PushSource
deriveJSON defaultOptions ''Door deriveJSON defaultOptions ''Door
$($(derive [d| instance Deriving (Store DoorStatus) |]))
$($(derive [d| instance Deriving (Store PushSource) |]))
$($(derive [d| instance Deriving (Store Door) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.EnergyBall where module Dodge.Data.EnergyBall where
import Flat
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -22,8 +25,7 @@ data EnergyBall = EnergyBall
, _ebZ :: Float , _ebZ :: Float
, _ebRot :: Float , _ebRot :: Float
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''EnergyBall makeLenses ''EnergyBall
deriveJSON defaultOptions ''EnergyBall deriveJSON defaultOptions ''EnergyBall
$($(derive [d| instance Deriving (Store EnergyBall) |]))
+5 -4
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Equipment.Misc where module Dodge.Data.Equipment.Misc where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import TH.Derive import TH.Derive
@@ -15,7 +18,7 @@ data EquipSite
| GoesOnWrist | GoesOnWrist
| GoesOnLegs | GoesOnLegs
| GoesOnSpecial | GoesOnSpecial
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data EquipPosition data EquipPosition
= OnHead = OnHead
@@ -25,7 +28,7 @@ data EquipPosition
| OnRightWrist | OnRightWrist
| OnLegs | OnLegs
| OnSpecial | OnSpecial
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSONKey EquipPosition instance ToJSONKey EquipPosition
@@ -33,5 +36,3 @@ instance FromJSONKey EquipPosition
deriveJSON defaultOptions ''EquipSite deriveJSON defaultOptions ''EquipSite
deriveJSON defaultOptions ''EquipPosition deriveJSON defaultOptions ''EquipPosition
$($(derive [d| instance Deriving (Store EquipSite) |]))
$($(derive [d| instance Deriving (Store EquipPosition) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Flame where module Dodge.Data.Flame where
import Flat
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -20,8 +23,7 @@ data Flame = Flame
, _flZ :: Float , _flZ :: Float
, _flOriginalVel :: Point2 , _flOriginalVel :: Point2
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Flame makeLenses ''Flame
deriveJSON defaultOptions ''Flame deriveJSON defaultOptions ''Flame
$($(derive [d| instance Deriving (Store Flame) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Flare where module Dodge.Data.Flare where
import Flat
import LinearHelp import LinearHelp
import Color import Color
import Control.Lens import Control.Lens
@@ -25,8 +28,7 @@ data Flare
, _flareTran3 :: Point3 , _flareTran3 :: Point3
, _flareTime :: Int , _flareTime :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Flare makeLenses ''Flare
deriveJSON defaultOptions ''Flare deriveJSON defaultOptions ''Flare
$($(derive [d| instance Deriving (Store Flare) |]))
+4 -3
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.FloatFunction where module Dodge.Data.FloatFunction where
import Flat
import TH.Derive import TH.Derive
import Data.Store import Data.Store
import Data.Aeson import Data.Aeson
@@ -14,8 +17,6 @@ data FloatFloat
| FloatLessCheck Float | FloatLessCheck Float
| FloatAbsCheckGreaterLess Float Float Float | FloatAbsCheckGreaterLess Float Float Float
| FloatConst Float | FloatConst Float
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
deriveJSON defaultOptions ''FloatFloat deriveJSON defaultOptions ''FloatFloat
$($(derive [d|instance Deriving (Store FloatFloat)|]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.FloorItem where module Dodge.Data.FloorItem where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -13,8 +16,7 @@ import TH.Derive
import Data.Store import Data.Store
data FloorItem = FlIt {_flIt :: Item, _flItPos :: Point2, _flItRot :: Float, _flItID :: Int} data FloorItem = FlIt {_flIt :: Item, _flItPos :: Point2, _flItRot :: Float, _flItID :: Int}
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
makeLenses ''FloorItem makeLenses ''FloorItem
deriveJSON defaultOptions ''FloorItem deriveJSON defaultOptions ''FloorItem
$($(derive [d| instance Deriving (Store FloorItem) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.ForegroundShape where module Dodge.Data.ForegroundShape where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -19,8 +22,7 @@ data ForegroundShape = ForegroundShape
, _fsRad :: Float -- This should probably be a bounding box , _fsRad :: Float -- This should probably be a bounding box
, _fsSPic :: SPic , _fsSPic :: SPic
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''ForegroundShape makeLenses ''ForegroundShape
deriveJSON defaultOptions ''ForegroundShape deriveJSON defaultOptions ''ForegroundShape
$($(derive [d| instance Deriving (Store ForegroundShape) |]))
+5 -4
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.GenParams where module Dodge.Data.GenParams where
import Flat
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -15,13 +18,11 @@ import Data.Store
newtype GenParams = GenParams newtype GenParams = GenParams
{ _sensorCoding :: M.Map DamageType (PaletteColor, DecorationShape) { _sensorCoding :: M.Map DamageType (PaletteColor, DecorationShape)
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data DecorationShape = PLUS | SQUARE | CIRCLE | THREELINES data DecorationShape = PLUS | SQUARE | CIRCLE | THREELINES
deriving (Eq, Ord, Enum, Show, Read) deriving (Eq, Ord, Enum, Show, Read, Generic, Flat)
makeLenses ''GenParams makeLenses ''GenParams
deriveJSON defaultOptions ''GenParams deriveJSON defaultOptions ''GenParams
deriveJSON defaultOptions ''DecorationShape deriveJSON defaultOptions ''DecorationShape
$($(derive [d| instance Deriving (Store GenParams) |]))
$($(derive [d| instance Deriving (Store DecorationShape) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Gust where module Dodge.Data.Gust where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -17,8 +20,7 @@ data Gust = Gust
, _guVel :: Point2 , _guVel :: Point2
, _guTime :: Int , _guTime :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Gust makeLenses ''Gust
deriveJSON defaultOptions ''Gust deriveJSON defaultOptions ''Gust
$($(derive [d| instance Deriving (Store Gust) |]))
+6 -6
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.HUD where module Dodge.Data.HUD where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -14,7 +17,7 @@ import Data.Store
data HUDElement data HUDElement
= DisplayInventory {_subInventory :: SubInventory} = DisplayInventory {_subInventory :: SubInventory}
| DisplayCarte | DisplayCarte
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data SubInventory data SubInventory
= NoSubInventory = NoSubInventory
@@ -23,7 +26,7 @@ data SubInventory
| InspectInventory | InspectInventory
| LockedInventory | LockedInventory
| DisplayTerminal {_termID :: Int} | DisplayTerminal {_termID :: Int}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data HUD = HUD data HUD = HUD
{ _hudElement :: HUDElement { _hudElement :: HUDElement
@@ -31,7 +34,7 @@ data HUD = HUD
, _carteZoom :: Float , _carteZoom :: Float
, _carteRot :: Float , _carteRot :: Float
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''HUD makeLenses ''HUD
makeLenses ''HUDElement makeLenses ''HUDElement
@@ -39,6 +42,3 @@ makeLenses ''SubInventory
deriveJSON defaultOptions ''HUDElement deriveJSON defaultOptions ''HUDElement
deriveJSON defaultOptions ''SubInventory deriveJSON defaultOptions ''SubInventory
deriveJSON defaultOptions ''HUD deriveJSON defaultOptions ''HUD
$($(derive [d| instance Deriving (Store HUDElement) |]))
$($(derive [d| instance Deriving (Store SubInventory) |]))
$($(derive [d| instance Deriving (Store HUD) |]))
+5 -4
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Hammer where module Dodge.Data.Hammer where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -12,16 +15,14 @@ import Data.Store
data HammerType data HammerType
= NoHammer = NoHammer
| HasHammer {_hammerPosition :: HammerPosition} | HasHammer {_hammerPosition :: HammerPosition}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data HammerPosition data HammerPosition
= HammerDown = HammerDown
| HammerReleased | HammerReleased
| HammerUp | HammerUp
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''HammerType makeLenses ''HammerType
deriveJSON defaultOptions ''HammerType deriveJSON defaultOptions ''HammerType
deriveJSON defaultOptions ''HammerPosition deriveJSON defaultOptions ''HammerPosition
$($(derive [d| instance Deriving (Store HammerType) |]))
$($(derive [d| instance Deriving (Store HammerPosition) |]))
+4 -3
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -15,6 +17,7 @@ module Dodge.Data.Item (
module Dodge.Data.Item.Location, module Dodge.Data.Item.Location,
) where ) where
import Flat
import Data.Store import Data.Store
import TH.Derive import TH.Derive
import Color import Color
@@ -49,12 +52,10 @@ data Item = Item
, _itValue :: ItemValue , _itValue :: ItemValue
, _itParams :: ItemParams , _itParams :: ItemParams
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
_itUseAimStance :: Item -> AimStance _itUseAimStance :: Item -> AimStance
_itUseAimStance = _aimStance . _heldAim . _itUse _itUseAimStance = _aimStance . _heldAim . _itUse
makeLenses ''Item makeLenses ''Item
deriveJSON defaultOptions ''Item deriveJSON defaultOptions ''Item
$($(derive [d| instance Deriving (Store Item) |]))
+14 -22
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Combine where module Dodge.Data.Item.Combine where
import Flat
import Control.Lens import Control.Lens
import TH.Derive import TH.Derive
import Data.Store import Data.Store
@@ -17,10 +20,10 @@ data ItemType = ItemType
, _iyModules :: M.Map ModuleSlot ItemModuleType , _iyModules :: M.Map ModuleSlot ItemModuleType
, _iyStack :: Stack , _iyStack :: Stack
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Stack = NoStack | Stack ItAmount data Stack = NoStack | Stack ItAmount
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data CraftType data CraftType
= PIPE = PIPE
@@ -69,7 +72,7 @@ data CraftType
| TIMEMODULE | TIMEMODULE
| SIZEMODULE | SIZEMODULE
| GRAVITYMODULE | GRAVITYMODULE
deriving (Eq, Ord, Show, Enum, Read) deriving (Eq, Ord, Show, Enum, Read, Generic, Flat)
data ItemBaseType data ItemBaseType
= NoItemType = NoItemType
@@ -78,12 +81,12 @@ data ItemBaseType
| EQUIP {_ibtEquip :: EquipItemType} | EQUIP {_ibtEquip :: EquipItemType}
| Consumable {_ibtConsumable :: ConsumableItemType} | Consumable {_ibtConsumable :: ConsumableItemType}
| CRAFT CraftType | CRAFT CraftType
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ConsumableItemType data ConsumableItemType
= MEDKIT Int = MEDKIT Int
| EXPLOSIVES | EXPLOSIVES
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data EquipItemType data EquipItemType
= MAGSHIELD = MAGSHIELD
@@ -99,7 +102,7 @@ data EquipItemType
| JUMPLEGS | JUMPLEGS
| JETPACK | JETPACK
| AUTODETECTOR Detector | AUTODETECTOR Detector
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data LeftItemType data LeftItemType
= BOOSTER = BOOSTER
@@ -108,7 +111,7 @@ data LeftItemType
| BLINKERUNSAFE | BLINKERUNSAFE
| SHRINKER | SHRINKER
| SPAWNER | SPAWNER
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data HeldItemType data HeldItemType
= BANGSTICK {_xNum :: Int} = BANGSTICK {_xNum :: Int}
@@ -156,7 +159,7 @@ data HeldItemType
| TORCH | TORCH
| FLATSHIELD | FLATSHIELD
| KEYCARD Int | KEYCARD Int
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ItemModuleType data ItemModuleType
= EMPTYMODULE = EMPTYMODULE
@@ -181,13 +184,13 @@ data ItemModuleType
| LAUNCHHOME | LAUNCHHOME
| EXTRABATTERY | EXTRABATTERY
| ATTACHTORCH | ATTACHTORCH
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Detector data Detector
= ITEMDETECTOR = ITEMDETECTOR
| CREATUREDETECTOR | CREATUREDETECTOR
| WALLDETECTOR | WALLDETECTOR
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ModuleSlot data ModuleSlot
= ModBullet = ModBullet
@@ -201,7 +204,7 @@ data ModuleSlot
| ModTeleport | ModTeleport
| ModDualBeam | ModDualBeam
| ModHeldAttach | ModHeldAttach
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSONKey ModuleSlot instance ToJSONKey ModuleSlot
@@ -221,14 +224,3 @@ deriveJSON defaultOptions ''ModuleSlot
makeLenses ''ItemType makeLenses ''ItemType
makeLenses ''ItemBaseType makeLenses ''ItemBaseType
makeLenses ''HeldItemType makeLenses ''HeldItemType
$($(derive [d| instance Deriving (Store ItemType) |]))
$($(derive [d| instance Deriving (Store Stack) |]))
$($(derive [d| instance Deriving (Store CraftType) |]))
$($(derive [d| instance Deriving (Store ItemBaseType) |]))
$($(derive [d| instance Deriving (Store ConsumableItemType) |]))
$($(derive [d| instance Deriving (Store EquipItemType) |]))
$($(derive [d| instance Deriving (Store LeftItemType) |]))
$($(derive [d| instance Deriving (Store HeldItemType) |]))
$($(derive [d| instance Deriving (Store ItemModuleType) |]))
$($(derive [d| instance Deriving (Store Detector) |]))
$($(derive [d| instance Deriving (Store ModuleSlot) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.CurseStatus where module Dodge.Data.Item.CurseStatus where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import TH.Derive import TH.Derive
@@ -12,7 +15,6 @@ data CurseStatus
= Uncursed = Uncursed
| UndroppableIdentified | UndroppableIdentified
| UndroppableUnidentified | UndroppableUnidentified
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
deriveJSON defaultOptions ''CurseStatus deriveJSON defaultOptions ''CurseStatus
$($(derive [d| instance Deriving (Store CurseStatus) |]))
+7 -8
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Effect where module Dodge.Data.Item.Effect where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -16,7 +19,7 @@ data ItEffect = ItEffect
, _ieOnHeld :: ItInvEffect , _ieOnHeld :: ItInvEffect
, _ieOnStash :: ItInvEffect , _ieOnStash :: ItInvEffect
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ItInvEffect data ItInvEffect
= NoInvEffect = NoInvEffect
@@ -26,22 +29,18 @@ data ItInvEffect
| CreateShieldWall | CreateShieldWall
| RemoveShieldWall | RemoveShieldWall
| EffectWhileHeld ItInvEffect | EffectWhileHeld ItInvEffect
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ItFloorEffect = NoFloorEffect data ItFloorEffect = NoFloorEffect
| DefaultFloorEffect | DefaultFloorEffect
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ItDropEffect = NoDropEffect data ItDropEffect = NoDropEffect
| DefaultDropEffect | DefaultDropEffect
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''ItEffect makeLenses ''ItEffect
deriveJSON defaultOptions ''ItEffect deriveJSON defaultOptions ''ItEffect
deriveJSON defaultOptions ''ItInvEffect deriveJSON defaultOptions ''ItInvEffect
deriveJSON defaultOptions ''ItFloorEffect deriveJSON defaultOptions ''ItFloorEffect
deriveJSON defaultOptions ''ItDropEffect deriveJSON defaultOptions ''ItDropEffect
$($(derive [d| instance Deriving (Store ItEffect) |]))
$($(derive [d| instance Deriving (Store ItInvEffect) |]))
$($(derive [d| instance Deriving (Store ItFloorEffect) |]))
$($(derive [d| instance Deriving (Store ItDropEffect) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.HeldDelay where module Dodge.Data.Item.HeldDelay where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -25,8 +28,7 @@ data UseDelay -- should just be Delay
{ _warmTime :: Int { _warmTime :: Int
, _warmMax :: Int , _warmMax :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''UseDelay makeLenses ''UseDelay
deriveJSON defaultOptions ''UseDelay deriveJSON defaultOptions ''UseDelay
$($(derive [d| instance Deriving (Store UseDelay) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.HeldScroll where module Dodge.Data.Item.HeldScroll where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -19,8 +22,7 @@ data HeldScroll
{ _hsInt :: Int { _hsInt :: Int
, _hsMaxInt :: Int , _hsMaxInt :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''HeldScroll makeLenses ''HeldScroll
deriveJSON defaultOptions ''HeldScroll deriveJSON defaultOptions ''HeldScroll
$($(derive [d| instance Deriving (Store HeldScroll) |]))
+8 -10
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.HeldUse where module Dodge.Data.Item.HeldUse where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import Dodge.Data.CamouflageStatus import Dodge.Data.CamouflageStatus
@@ -26,12 +29,12 @@ data HeldUse
| HeldTractor | HeldTractor
| HeldForceField | HeldForceField
| HeldShatter | HeldShatter
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Cuse data Cuse
= CDoNothing = CDoNothing
| CHeal Int | CHeal Int
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Euse data Euse
= EDoNothing = EDoNothing
@@ -42,7 +45,7 @@ data Euse
| ECamouflage CamouflageStatus | ECamouflage CamouflageStatus
| EonWristShield | EonWristShield
| EoffWristShield | EoffWristShield
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Luse data Luse
= LDoNothing = LDoNothing
@@ -51,7 +54,7 @@ data Luse
| LBlink | LBlink
| LUnsafeBlink | LUnsafeBlink
| LBoost | LBoost
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data HeldMod data HeldMod
= HeldModNothing = HeldModNothing
@@ -89,15 +92,10 @@ data HeldMod
| RevolverXMod | RevolverXMod
| RevolverXRepeatMod | RevolverXRepeatMod
| BangConeMod | BangConeMod
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
deriveJSON defaultOptions ''Cuse deriveJSON defaultOptions ''Cuse
deriveJSON defaultOptions ''HeldMod deriveJSON defaultOptions ''HeldMod
deriveJSON defaultOptions ''Euse deriveJSON defaultOptions ''Euse
deriveJSON defaultOptions ''HeldUse deriveJSON defaultOptions ''HeldUse
deriveJSON defaultOptions ''Luse deriveJSON defaultOptions ''Luse
$($(derive [d| instance Deriving (Store Cuse) |]))
$($(derive [d| instance Deriving (Store HeldMod) |]))
$($(derive [d| instance Deriving (Store Euse) |]))
$($(derive [d| instance Deriving (Store HeldUse) |]))
$($(derive [d| instance Deriving (Store Luse) |]))
+4 -2
View File
@@ -1,7 +1,10 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Location where module Dodge.Data.Item.Location where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -13,8 +16,7 @@ data ItemLocation
| OnTurret {_ipTuID :: Int} | OnTurret {_ipTuID :: Int}
| OnFloor {_ipFlID :: Int} | OnFloor {_ipFlID :: Int}
| InVoid | InVoid
deriving (Eq, Show, Read, Ord) deriving (Eq, Show, Read, Ord, Generic, Flat)
makeLenses ''ItemLocation makeLenses ''ItemLocation
deriveJSON defaultOptions ''ItemLocation deriveJSON defaultOptions ''ItemLocation
$($(derive [d| instance Deriving (Store ItemLocation) |]))
+7 -8
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Misc where module Dodge.Data.Item.Misc where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -16,7 +19,7 @@ data ItemDimension = ItemDimension
, _dimCenter :: Point3 , _dimCenter :: Point3
, _dimAttachPos :: Point3 , _dimAttachPos :: Point3
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data ItemPortage data ItemPortage
= HeldItem = HeldItem
@@ -25,16 +28,16 @@ data ItemPortage
} }
| WornItem | WornItem
| NoPortage | NoPortage
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data ItemValue = ItemValue data ItemValue = ItemValue
{ _ivInt :: Int { _ivInt :: Int
, _ivType :: ItemValueType , _ivType :: ItemValueType
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data ItemValueType = MundaneItem | ArtefactItem data ItemValueType = MundaneItem | ArtefactItem
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
makeLenses ''ItemDimension makeLenses ''ItemDimension
makeLenses ''ItemPortage makeLenses ''ItemPortage
@@ -43,7 +46,3 @@ deriveJSON defaultOptions ''ItemDimension
deriveJSON defaultOptions ''ItemPortage deriveJSON defaultOptions ''ItemPortage
deriveJSON defaultOptions ''ItemValue deriveJSON defaultOptions ''ItemValue
deriveJSON defaultOptions ''ItemValueType deriveJSON defaultOptions ''ItemValueType
$($(derive [d| instance Deriving (Store ItemDimension) |]))
$($(derive [d| instance Deriving (Store ItemPortage) |]))
$($(derive [d| instance Deriving (Store ItemValue) |]))
$($(derive [d| instance Deriving (Store ItemValueType) |]))
+9 -12
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Params where module Dodge.Data.Item.Params where
import Flat
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -68,13 +71,13 @@ data ItemParams
} }
| ParamMID {_paramMID :: Maybe Int} | ParamMID {_paramMID :: Maybe Int}
| BoostPropIX {_boostPropIX :: Maybe Int} | BoostPropIX {_boostPropIX :: Maybe Int}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ShrinkGunStatus = FullSize | Shrunk data ShrinkGunStatus = FullSize | Shrunk
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data GunBarrels data GunBarrels
= MultiBarrel = MultiBarrel
@@ -87,7 +90,7 @@ data GunBarrels
, _brlInaccuracy :: Float , _brlInaccuracy :: Float
} }
| SingleBarrel {_brlInaccuracy :: Float} | SingleBarrel {_brlInaccuracy :: Float}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Nozzle = Nozzle data Nozzle = Nozzle
{ _nzPressure :: Float { _nzPressure :: Float
@@ -97,13 +100,13 @@ data Nozzle = Nozzle
, _nzWalkSpeed :: Float , _nzWalkSpeed :: Float
, _nzLength :: Float , _nzLength :: Float
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data BarrelSpread data BarrelSpread
= AlignedBarrels = AlignedBarrels
| SpreadBarrels {_spreadAngle :: Float} | SpreadBarrels {_spreadAngle :: Float}
| RotatingBarrels {_rotatingBarrelInaccuracy :: Float} | RotatingBarrels {_rotatingBarrelInaccuracy :: Float}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''BarrelSpread makeLenses ''BarrelSpread
makeLenses ''ItemParams makeLenses ''ItemParams
@@ -115,9 +118,3 @@ deriveJSON defaultOptions ''PreviousArcEffect
deriveJSON defaultOptions ''GunBarrels deriveJSON defaultOptions ''GunBarrels
deriveJSON defaultOptions ''Nozzle deriveJSON defaultOptions ''Nozzle
deriveJSON defaultOptions ''BarrelSpread deriveJSON defaultOptions ''BarrelSpread
$($(derive [d| instance Deriving (Store ItemParams) |]))
$($(derive [d| instance Deriving (Store ShrinkGunStatus) |]))
$($(derive [d| instance Deriving (Store PreviousArcEffect) |]))
$($(derive [d| instance Deriving (Store GunBarrels) |]))
$($(derive [d| instance Deriving (Store Nozzle) |]))
$($(derive [d| instance Deriving (Store BarrelSpread) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Scope where module Dodge.Data.Item.Scope where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -29,8 +32,7 @@ data Scope
, -- | if the camera offset is also the center of vision , -- | if the camera offset is also the center of vision
_scopeIsCamera :: Bool _scopeIsCamera :: Bool
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
makeLenses ''Scope makeLenses ''Scope
deriveJSON defaultOptions ''Scope deriveJSON defaultOptions ''Scope
$($(derive [d| instance Deriving (Store Scope) |]))
+6 -6
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Targeting where module Dodge.Data.Item.Targeting where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -20,7 +23,7 @@ data Targeting
, _tgID :: Maybe Int , _tgID :: Maybe Int
, _tgActive :: Bool , _tgActive :: Bool
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data TargetUpdate data TargetUpdate
= NoTargetUpdate = NoTargetUpdate
@@ -28,19 +31,16 @@ data TargetUpdate
| TargetRBPressUpdate | TargetRBPressUpdate
| TargetRBCreatureUpdate | TargetRBCreatureUpdate
| TargetCursorUpdate | TargetCursorUpdate
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data TargetDraw data TargetDraw
= NoTargetDraw = NoTargetDraw
| TargetDistanceDraw | TargetDistanceDraw
| SimpleDrawTarget | SimpleDrawTarget
| TargetRBCreatureDraw | TargetRBCreatureDraw
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Targeting makeLenses ''Targeting
deriveJSON defaultOptions ''Targeting deriveJSON defaultOptions ''Targeting
deriveJSON defaultOptions ''TargetUpdate deriveJSON defaultOptions ''TargetUpdate
deriveJSON defaultOptions ''TargetDraw deriveJSON defaultOptions ''TargetDraw
$($(derive [d| instance Deriving (Store Targeting) |]))
$($(derive [d| instance Deriving (Store TargetUpdate) |]))
$($(derive [d| instance Deriving (Store TargetDraw) |]))
+6 -6
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Tweak where module Dodge.Data.Item.Tweak where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -15,7 +18,7 @@ data ItemTweaks
| Tweakable | Tweakable
{ _tweakParams :: IM.IntMap TweakParam { _tweakParams :: IM.IntMap TweakParam
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data TweakType data TweakType
= TweakPhaseV = TweakPhaseV
@@ -23,20 +26,17 @@ data TweakType
| TweakSpinDrag | TweakSpinDrag
| TweakSpinAmount | TweakSpinAmount
| TweakThrustDelay | TweakThrustDelay
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data TweakParam = TweakParam data TweakParam = TweakParam
{ _tweakType :: TweakType -- Int -> Item -> Item { _tweakType :: TweakType -- Int -> Item -> Item
, _tweakVal :: Int , _tweakVal :: Int
, _tweakMax :: Int , _tweakMax :: Int
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
makeLenses ''TweakParam makeLenses ''TweakParam
makeLenses ''ItemTweaks makeLenses ''ItemTweaks
deriveJSON defaultOptions ''ItemTweaks deriveJSON defaultOptions ''ItemTweaks
deriveJSON defaultOptions ''TweakType deriveJSON defaultOptions ''TweakType
deriveJSON defaultOptions ''TweakParam deriveJSON defaultOptions ''TweakParam
$($(derive [d| instance Deriving (Store ItemTweaks) |]))
$($(derive [d| instance Deriving (Store TweakType) |]))
$($(derive [d| instance Deriving (Store TweakParam) |]))
+7 -9
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -11,6 +13,7 @@ module Dodge.Data.Item.Use (
module Dodge.Data.Hammer, module Dodge.Data.Hammer,
) where ) where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -49,7 +52,7 @@ data ItemUse
} }
| CraftUse | CraftUse
{_useAmount :: ItAmount} {_useAmount :: ItAmount}
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data AimParams = AimParams data AimParams = AimParams
{ _aimWeight :: Int { _aimWeight :: Int
@@ -59,21 +62,21 @@ data AimParams = AimParams
, _aimHandlePos :: Float , _aimHandlePos :: Float
, _aimMuzPos :: Float , _aimMuzPos :: Float
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data AimStance data AimStance
= TwoHandTwist = TwoHandTwist
| TwoHandFlat | TwoHandFlat
| OneHand | OneHand
| LeaveHolstered | LeaveHolstered
deriving (Eq, Show, Ord, Enum, Read) deriving (Eq, Show, Ord, Enum, Read, Generic, Flat)
data ItZoom = ItZoom data ItZoom = ItZoom
{ _itZoomMax :: Float { _itZoomMax :: Float
, _itZoomMin :: Float , _itZoomMin :: Float
, _itZoomFac :: Float , _itZoomFac :: Float
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''ItemUse makeLenses ''ItemUse
makeLenses ''AimParams makeLenses ''AimParams
@@ -82,8 +85,3 @@ deriveJSON defaultOptions ''ItemUse
deriveJSON defaultOptions ''AimParams deriveJSON defaultOptions ''AimParams
deriveJSON defaultOptions ''AimStance deriveJSON defaultOptions ''AimStance
deriveJSON defaultOptions ''ItZoom deriveJSON defaultOptions ''ItZoom
$($(derive [d| instance Deriving (Store ItemUse) |]))
$($(derive [d| instance Deriving (Store AimParams) |]))
$($(derive [d| instance Deriving (Store AimStance) |]))
$($(derive [d| instance Deriving (Store ItZoom) |]))
+6 -6
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -8,6 +10,7 @@ module Dodge.Data.Item.Use.Consumption (
module Dodge.Data.Item.Use.Consumption.LoadAction, module Dodge.Data.Item.Use.Consumption.LoadAction,
) where ) where
import Flat
import TH.Derive import TH.Derive
import Data.Store import Data.Store
import Control.Lens import Control.Lens
@@ -26,7 +29,7 @@ data HeldConsumption
, _laProgress :: Maybe [LoadAction] , _laProgress :: Maybe [LoadAction]
} }
| NoConsumption | NoConsumption
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data LeftConsumption data LeftConsumption
= AutoRecharging = AutoRecharging
@@ -39,10 +42,10 @@ data LeftConsumption
{ _wpMaxCharge :: Int { _wpMaxCharge :: Int
, _wpCharge :: Int , _wpCharge :: Int
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
newtype ItAmount = ItAmount {_getItAmount :: Int} newtype ItAmount = ItAmount {_getItAmount :: Int}
deriving (Eq, Ord, Read, Show, Num, Real, Enum, Integral) deriving (Eq, Ord, Read, Show, Num, Real, Enum, Integral, Generic, Flat)
makeLenses ''HeldConsumption makeLenses ''HeldConsumption
makeLenses ''LeftConsumption makeLenses ''LeftConsumption
@@ -50,6 +53,3 @@ makeLenses ''ItAmount
deriveJSON defaultOptions ''HeldConsumption deriveJSON defaultOptions ''HeldConsumption
deriveJSON defaultOptions ''LeftConsumption deriveJSON defaultOptions ''LeftConsumption
deriveJSON defaultOptions ''ItAmount deriveJSON defaultOptions ''ItAmount
$($(derive [d| instance Deriving (Store HeldConsumption) |]))
$($(derive [d| instance Deriving (Store LeftConsumption) |]))
$($(derive [d| instance Deriving (Store ItAmount) |]))
+9 -13
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -7,6 +9,7 @@ module Dodge.Data.Item.Use.Consumption.Ammo (
module Dodge.Data.Payload, module Dodge.Data.Payload,
) where ) where
import Flat
import TH.Derive import TH.Derive
import Data.Store import Data.Store
import Control.Lens import Control.Lens
@@ -16,10 +19,10 @@ import Dodge.Data.Bullet
import Dodge.Data.Payload import Dodge.Data.Payload
data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile
deriving (Show, Read, Eq, Ord, Enum, Bounded) deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
data ProjectileCreate = CreateShell | CreateTrackingShell data ProjectileCreate = CreateShell | CreateTrackingShell
deriving (Show, Read, Eq, Ord, Enum, Bounded) deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
data ProjectileUpdate data ProjectileUpdate
= PJThrust {_pjuStart :: Int, _pjuEnd :: Int} = PJThrust {_pjuStart :: Int, _pjuEnd :: Int}
@@ -32,7 +35,7 @@ data ProjectileUpdate
| PJDecTimMvVel | PJDecTimMvVel
| PJShellCollisionCheck | PJShellCollisionCheck
| PJRemoteShellCollisionCheck | PJRemoteShellCollisionCheck
deriving (Show, Read, Eq, Ord) deriving (Show, Read, Eq, Ord, Generic, Flat)
data AmmoType data AmmoType
= ProjectileAmmo = ProjectileAmmo
@@ -55,14 +58,13 @@ data AmmoType
{ _amForceFieldType :: ForceFieldType { _amForceFieldType :: ForceFieldType
} }
| GenericAmmo | GenericAmmo
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ForceFieldType = DefaultForceField data ForceFieldType = DefaultForceField
| HackForTemplateForceField deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data GasCreate = CreatePoisonGas | CreateFlame data GasCreate = CreatePoisonGas | CreateFlame
deriving (Eq, Ord, Show, Enum, Bounded, Read) deriving (Eq, Ord, Show, Enum, Bounded, Read, Generic, Flat)
makeLenses ''ProjectileUpdate makeLenses ''ProjectileUpdate
makeLenses ''AmmoType makeLenses ''AmmoType
@@ -72,9 +74,3 @@ deriveJSON defaultOptions ''ProjectileUpdate
deriveJSON defaultOptions ''AmmoType deriveJSON defaultOptions ''AmmoType
deriveJSON defaultOptions ''GasCreate deriveJSON defaultOptions ''GasCreate
deriveJSON defaultOptions ''ForceFieldType deriveJSON defaultOptions ''ForceFieldType
$($(derive [d| instance Deriving (Store ProjectileDraw) |]))
$($(derive [d| instance Deriving (Store ProjectileCreate) |]))
$($(derive [d| instance Deriving (Store ProjectileUpdate) |]))
$($(derive [d| instance Deriving (Store AmmoType) |]))
$($(derive [d| instance Deriving (Store GasCreate) |]))
$($(derive [d| instance Deriving (Store ForceFieldType) |]))
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Use.Consumption.LoadAction where module Dodge.Data.Item.Use.Consumption.LoadAction where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -16,15 +19,15 @@ data LoadAction
| LoadInsert {_actionTime :: Int, _actionSound :: SoundID} | LoadInsert {_actionTime :: Int, _actionSound :: SoundID}
| LoadAdd {_actionTime :: Int, _actionSound :: SoundID, _insertMax :: Int} | LoadAdd {_actionTime :: Int, _actionSound :: SoundID, _insertMax :: Int}
| LoadPrime {_actionTime :: Int, _actionSound :: SoundID} | LoadPrime {_actionTime :: Int, _actionSound :: SoundID}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data InvSel = InvSel {_iselPos :: Int, _iselAction :: InvSelAction} data InvSel = InvSel {_iselPos :: Int, _iselAction :: InvSelAction}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data InvSelAction data InvSelAction
= NoInvSelAction = NoInvSelAction
| ReloadAction {_actionProgress :: Int, _reloadAction :: LoadAction, _actionHammer :: HammerType} | ReloadAction {_actionProgress :: Int, _reloadAction :: LoadAction, _actionHammer :: HammerType}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''LoadAction makeLenses ''LoadAction
makeLenses ''InvSel makeLenses ''InvSel
@@ -32,6 +35,3 @@ makeLenses ''InvSelAction
deriveJSON defaultOptions ''LoadAction deriveJSON defaultOptions ''LoadAction
deriveJSON defaultOptions ''InvSel deriveJSON defaultOptions ''InvSel
deriveJSON defaultOptions ''InvSelAction deriveJSON defaultOptions ''InvSelAction
$($(derive [d| instance Deriving (Store LoadAction) |]))
$($(derive [d| instance Deriving (Store InvSel) |]))
$($(derive [d| instance Deriving (Store InvSelAction) |]))
+5 -4
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -6,6 +8,7 @@ module Dodge.Data.Item.Use.Equipment (
module Dodge.Data.Item.Use.Equipment, module Dodge.Data.Item.Use.Equipment,
) where ) where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -22,17 +25,15 @@ data EquipEffect = EquipEffect
, _eeParams :: EquipParams , _eeParams :: EquipParams
, _eeViewDist :: Maybe Float , _eeViewDist :: Maybe Float
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data EquipParams data EquipParams
= NoEquipParams = NoEquipParams
| EquipID {_eparamID :: Int} | EquipID {_eparamID :: Int}
| EquipCounter {_eparamInt :: Int} | EquipCounter {_eparamInt :: Int}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''EquipEffect makeLenses ''EquipEffect
makeLenses ''EquipParams makeLenses ''EquipParams
deriveJSON defaultOptions ''EquipEffect deriveJSON defaultOptions ''EquipEffect
deriveJSON defaultOptions ''EquipParams deriveJSON defaultOptions ''EquipParams
$($(derive [d| instance Deriving (Store EquipEffect) |]))
$($(derive [d| instance Deriving (Store EquipParams) |]))
+6 -6
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Laser where module Dodge.Data.Laser where
import Flat
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -14,7 +17,7 @@ import Data.Store
data LaserType data LaserType
= DamageLaser {_laserTypeDamage :: Int} = DamageLaser {_laserTypeDamage :: Int}
| TargetLaser | TargetLaser
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data LaserStart = LaserStart data LaserStart = LaserStart
{ _lpPhaseV :: Float { _lpPhaseV :: Float
@@ -23,14 +26,14 @@ data LaserStart = LaserStart
, _lpColor :: Color , _lpColor :: Color
, _lpType :: LaserType , _lpType :: LaserType
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Laser = Laser data Laser = Laser
{ _laColor :: Color { _laColor :: Color
, _laPoints :: [Point2] , _laPoints :: [Point2]
, _laType :: LaserType , _laType :: LaserType
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Laser makeLenses ''Laser
makeLenses ''LaserStart makeLenses ''LaserStart
@@ -38,6 +41,3 @@ makeLenses ''LaserType
deriveJSON defaultOptions ''LaserType deriveJSON defaultOptions ''LaserType
deriveJSON defaultOptions ''LaserStart deriveJSON defaultOptions ''LaserStart
deriveJSON defaultOptions ''Laser deriveJSON defaultOptions ''Laser
$($(derive [d| instance Deriving (Store LaserType) |]))
$($(derive [d| instance Deriving (Store LaserStart) |]))
$($(derive [d| instance Deriving (Store Laser) |]))
+9 -13
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.LightSource where module Dodge.Data.LightSource where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -12,26 +15,25 @@ import TH.Derive
import Data.Store import Data.Store
data LightSourceDraw = DefaultLightSourceDraw data LightSourceDraw = DefaultLightSourceDraw
| HackLightSourceDraw deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data TLSIntensity data TLSIntensity
= ConstantIntensity = ConstantIntensity
| TLSFade Point3 Int | TLSFade Point3 Int
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data TLSUpdate data TLSUpdate
= DestroyTLS = DestroyTLS
| TimerTLS | TimerTLS
| IntensityTLS TLSIntensity | IntensityTLS TLSIntensity
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data LSParam = LSParam data LSParam = LSParam
{ _lsPos :: !Point3 { _lsPos :: !Point3
, _lsRad :: !Float , _lsRad :: !Float
, _lsCol :: !Point3 , _lsCol :: !Point3
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data LightSource = LS data LightSource = LS
{ _lsID :: Int { _lsID :: Int
@@ -39,14 +41,14 @@ data LightSource = LS
, _lsDir :: Float , _lsDir :: Float
, _lsPict :: LightSourceDraw --LightSource -> Picture , _lsPict :: LightSourceDraw --LightSource -> Picture
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data TempLightSource = TLS data TempLightSource = TLS
{ _tlsParam :: LSParam { _tlsParam :: LSParam
, _tlsUpdate :: TLSUpdate --TempLightSource -> Maybe TempLightSource , _tlsUpdate :: TLSUpdate --TempLightSource -> Maybe TempLightSource
, _tlsTime :: Int , _tlsTime :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''LSParam makeLenses ''LSParam
makeLenses ''LightSource makeLenses ''LightSource
@@ -57,9 +59,3 @@ deriveJSON defaultOptions ''TLSUpdate
deriveJSON defaultOptions ''LSParam deriveJSON defaultOptions ''LSParam
deriveJSON defaultOptions ''LightSource deriveJSON defaultOptions ''LightSource
deriveJSON defaultOptions ''TempLightSource deriveJSON defaultOptions ''TempLightSource
$($(derive [d| instance Deriving (Store LightSourceDraw) |]))
$($(derive [d| instance Deriving (Store TLSIntensity) |]))
$($(derive [d| instance Deriving (Store TLSUpdate) |]))
$($(derive [d| instance Deriving (Store LSParam) |]))
$($(derive [d| instance Deriving (Store LightSource) |]))
$($(derive [d| instance Deriving (Store TempLightSource) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.LinearShockwave where module Dodge.Data.LinearShockwave where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -17,8 +20,7 @@ data LinearShockwave = LinearShockwave
, _lwPoints :: [(Point2, Point2)] , _lwPoints :: [(Point2, Point2)]
, _lwTimer :: Int , _lwTimer :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''LinearShockwave makeLenses ''LinearShockwave
deriveJSON defaultOptions ''LinearShockwave deriveJSON defaultOptions ''LinearShockwave
$($(derive [d| instance Deriving (Store LinearShockwave) |]))
+7 -7
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -11,12 +13,13 @@ module Dodge.Data.Machine (
module Dodge.Data.GenParams, module Dodge.Data.GenParams,
) where ) where
import Flat
import LinearHelp import LinearHelp
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import qualified Data.IntSet as IS import qualified IntSetHelp as IS
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import Dodge.Data.Damage import Dodge.Data.Damage
import Dodge.Data.GenParams import Dodge.Data.GenParams
@@ -44,14 +47,14 @@ data Machine = Machine
, _mcCloseSound :: Maybe SoundID , _mcCloseSound :: Maybe SoundID
, _mcWidth :: Float , _mcWidth :: Float
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data MachineType data MachineType
= McStatic = McStatic
| McTerminal | McTerminal
| McSensor Sensor | McSensor Sensor
| McTurret Turret | McTurret Turret
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data Turret = Turret data Turret = Turret
{ _tuWeapon :: Item { _tuWeapon :: Item
@@ -59,7 +62,7 @@ data Turret = Turret
, _tuFireTime :: Int , _tuFireTime :: Int
, _tuDir :: Float , _tuDir :: Float
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
makeLenses ''Machine makeLenses ''Machine
makeLenses ''Turret makeLenses ''Turret
@@ -67,6 +70,3 @@ makePrisms ''MachineType
deriveJSON defaultOptions ''Machine deriveJSON defaultOptions ''Machine
deriveJSON defaultOptions ''MachineType deriveJSON defaultOptions ''MachineType
deriveJSON defaultOptions ''Turret deriveJSON defaultOptions ''Turret
$($(derive [d| instance Deriving (Store Machine) |]))
$($(derive [d| instance Deriving (Store MachineType) |]))
$($(derive [d| instance Deriving (Store Turret) |]))
+6 -6
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Machine.Sensor where module Dodge.Data.Machine.Sensor where
import Flat
import LinearHelp import LinearHelp
import Dodge.Data.GenParams import Dodge.Data.GenParams
import Color import Color
@@ -28,22 +31,19 @@ data Sensor
, _proxRequirement :: ProximityRequirement , _proxRequirement :: ProximityRequirement
, _sensToggle :: Bool , _sensToggle :: Bool
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ProximityRequirement data ProximityRequirement
= RequireHealth {_proxReqMinHealth :: Int} = RequireHealth {_proxReqMinHealth :: Int}
| RequireEquipment {_proxReqEquipment :: ItemBaseType} | RequireEquipment {_proxReqEquipment :: ItemBaseType}
| RequireImpossible | RequireImpossible
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data CloseToggle = NotClose | IsClose data CloseToggle = NotClose | IsClose
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Sensor makeLenses ''Sensor
makeLenses ''ProximityRequirement makeLenses ''ProximityRequirement
deriveJSON defaultOptions ''Sensor deriveJSON defaultOptions ''Sensor
deriveJSON defaultOptions ''ProximityRequirement deriveJSON defaultOptions ''ProximityRequirement
deriveJSON defaultOptions ''CloseToggle deriveJSON defaultOptions ''CloseToggle
$($(derive [d| instance Deriving (Store Sensor) |]))
$($(derive [d| instance Deriving (Store ProximityRequirement) |]))
$($(derive [d| instance Deriving (Store CloseToggle) |]))
+6 -6
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Magnet where module Dodge.Data.Magnet where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -12,12 +15,12 @@ import TH.Derive
import Data.Store import Data.Store
newtype MagnetUpdate = MagnetUpdateTimer Int newtype MagnetUpdate = MagnetUpdateTimer Int
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data MagnetBuBu data MagnetBuBu
= MagnetBuId = MagnetBuId
| MagnetBuBuCurveAroundField Float Float | MagnetBuBuCurveAroundField Float Float
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Magnet = Magnet data Magnet = Magnet
{ _mgID :: Int { _mgID :: Int
@@ -25,12 +28,9 @@ data Magnet = Magnet
, _mgPos :: Point2 , _mgPos :: Point2
, _mgField :: MagnetBuBu , _mgField :: MagnetBuBu
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Magnet makeLenses ''Magnet
deriveJSON defaultOptions ''MagnetUpdate deriveJSON defaultOptions ''MagnetUpdate
deriveJSON defaultOptions ''MagnetBuBu deriveJSON defaultOptions ''MagnetBuBu
deriveJSON defaultOptions ''Magnet deriveJSON defaultOptions ''Magnet
$($(derive [d| instance Deriving (Store MagnetUpdate) |]))
$($(derive [d| instance Deriving (Store MagnetBuBu) |]))
$($(derive [d| instance Deriving (Store Magnet) |]))
+4 -4
View File
@@ -1,17 +1,17 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
--{-# LANGUAGE FlexibleInstances #-}
--{-# LANGUAGE DeriveGeneric #-}
module Dodge.Data.Material where module Dodge.Data.Material where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import TH.Derive import TH.Derive
import Data.Store import Data.Store
data Material = Wood | Dirt | Stone | Glass | Metal | Crystal | Flesh | Electronics data Material = Wood | Dirt | Stone | Glass | Metal | Crystal | Flesh | Electronics
deriving (Eq, Ord, Show, Bounded, Enum, Read) deriving (Eq, Ord, Show, Bounded, Enum, Read, Generic, Flat)
deriveJSON defaultOptions ''Material deriveJSON defaultOptions ''Material
$($(derive [d| instance Deriving (Store Material) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Modification where module Dodge.Data.Modification where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -27,8 +30,7 @@ data Modification
, _mdExternalID2 :: Int , _mdExternalID2 :: Int
, _mdUpdate :: MdWdWd , _mdUpdate :: MdWdWd
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Modification makeLenses ''Modification
deriveJSON defaultOptions ''Modification deriveJSON defaultOptions ''Modification
$($(derive [d| instance Deriving (Store Modification) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.MountedObject where module Dodge.Data.MountedObject where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import TH.Derive import TH.Derive
@@ -11,7 +14,6 @@ import Data.Store
data MountedObject data MountedObject
= MountedLS Int = MountedLS Int
| MountedProp Int | MountedProp Int
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
deriveJSON defaultOptions ''MountedObject deriveJSON defaultOptions ''MountedObject
$($(derive [d| instance Deriving (Store MountedObject) |]))
+4 -1
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.ObjectType where module Dodge.Data.ObjectType where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import TH.Derive import TH.Derive
@@ -20,7 +23,7 @@ data ObjectType
| ObProp | ObProp
| ObTrigger | ObTrigger
| ObItem | ObItem
deriving (Eq, Show, Ord, Read, Enum, Bounded) deriving (Eq, Show, Ord, Read, Enum, Bounded, Generic, Flat)
instance ToJSONKey ObjectType instance ToJSONKey ObjectType
+8 -14
View File
@@ -1,5 +1,8 @@
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleInstances #-}
@@ -11,6 +14,7 @@ The warnings have been disabled.
-} -}
module Dodge.Data.PathGraph where module Dodge.Data.PathGraph where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -42,7 +46,7 @@ data PathEdge = PathEdge
, _peDist :: Float , _peDist :: Float
, _peObstacles :: Set.Set EdgeObstacle , _peObstacles :: Set.Set EdgeObstacle
} }
deriving (Eq, Ord, Show, Read, Generic) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSON PathEdge where instance ToJSON PathEdge where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
@@ -54,7 +58,7 @@ data EdgeObstacle
| DoorObstacle | DoorObstacle
| AutoDoorObstacle | AutoDoorObstacle
| WallObstacle | WallObstacle
deriving (Eq, Ord, Show, Read, Bounded, Enum, Generic) deriving (Eq, Ord, Show, Read, Bounded, Enum, Generic, Flat)
instance ToJSON EdgeObstacle where instance ToJSON EdgeObstacle where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
@@ -66,17 +70,7 @@ instance (ToJSON a, ToJSON b) => ToJSON (Gr a b) where
instance (FromJSON a, FromJSON b) => FromJSON (Gr a b) instance (FromJSON a, FromJSON b) => FromJSON (Gr a b)
deriving instance (Flat (Gr Point2 PathEdge))
makeLenses ''PathGraph makeLenses ''PathGraph
makeLenses ''PathEdge makeLenses ''PathEdge
{- FOURMOLU_DISABLE -}
$($(derive [d|
instance Deriving (Store EdgeObstacle)
|]))
$($(derive [d|
instance Deriving (Store PathEdge)
|]))
$($(derive [d|
instance Deriving (Store (Gr Point2 PathEdge))
|]))
{- FOURMOLU_ENABLE -}
+4 -2
View File
@@ -1,15 +1,17 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Payload where module Dodge.Data.Payload where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import TH.Derive import TH.Derive
import Data.Store import Data.Store
data Payload = ExplosionPayload | DudPayload data Payload = ExplosionPayload | DudPayload
deriving (Show, Read, Eq, Ord, Enum, Bounded) deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
deriveJSON defaultOptions ''Payload deriveJSON defaultOptions ''Payload
$($(derive [d| instance Deriving (Store Payload) |]))
+6 -6
View File
@@ -1,9 +1,12 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.PosEvent where module Dodge.Data.PosEvent where
import LinearHelp import Flat
import LinearHelp ()
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -12,18 +15,15 @@ import TH.Derive
import Data.Store import Data.Store
data PosEventType = SparkSpawner data PosEventType = SparkSpawner
| HackPosEventType deriving (Eq, Ord, Show, Read, Generic, Flat)
deriving (Eq, Ord, Show, Read)
data PosEvent = PosEvent data PosEvent = PosEvent
{ _pvType :: PosEventType { _pvType :: PosEventType
, _pvTimer :: Int , _pvTimer :: Int
, _pvPos :: Point2 , _pvPos :: Point2
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''PosEvent makeLenses ''PosEvent
deriveJSON defaultOptions ''PosEventType deriveJSON defaultOptions ''PosEventType
deriveJSON defaultOptions ''PosEvent deriveJSON defaultOptions ''PosEvent
$($(derive [d| instance Deriving (Store PosEventType) |]))
$($(derive [d| instance Deriving (Store PosEvent) |]))
+5 -4
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.PressPlate where module Dodge.Data.PressPlate where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -15,7 +18,7 @@ import Data.Store
data PressPlateEvent data PressPlateEvent
= PressPlateId = PressPlateId
| PPLevelReset | PPLevelReset
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data PressPlate = PressPlate data PressPlate = PressPlate
{ _ppPict :: Picture { _ppPict :: Picture
@@ -25,10 +28,8 @@ data PressPlate = PressPlate
, _ppID :: Int , _ppID :: Int
, _ppText :: String , _ppText :: String
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''PressPlate makeLenses ''PressPlate
deriveJSON defaultOptions ''PressPlateEvent deriveJSON defaultOptions ''PressPlateEvent
deriveJSON defaultOptions ''PressPlate deriveJSON defaultOptions ''PressPlate
$($(derive [d| instance Deriving (Store PressPlateEvent) |]))
$($(derive [d| instance Deriving (Store PressPlate) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Projectile where module Dodge.Data.Projectile where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -27,8 +30,7 @@ data Proj
, _prjUpdates :: [ProjectileUpdate] , _prjUpdates :: [ProjectileUpdate]
, _prjMITID :: Maybe Int , _prjMITID :: Maybe Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Proj makeLenses ''Proj
deriveJSON defaultOptions ''Proj deriveJSON defaultOptions ''Proj
$($(derive [d| instance Deriving (Store Proj) |]))
+7 -8
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Prop where module Dodge.Data.Prop where
import Flat
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -38,7 +41,7 @@ data Prop
, _prRot :: Float , _prRot :: Float
, _prToggle :: Bool , _prToggle :: Bool
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data PropDraw data PropDraw
= PropDrawSPic SPic = PropDrawSPic SPic
@@ -50,7 +53,7 @@ data PropDraw
| PropLampCover Float | PropLampCover Float
| PropDrawToggle PropDraw | PropDrawToggle PropDraw
| PropDrawGib Float | PropDrawGib Float
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data PropUpdate data PropUpdate
= PropUpdateAnd PropUpdate PropUpdate = PropUpdateAnd PropUpdate PropUpdate
@@ -64,20 +67,16 @@ data PropUpdate
| PropUpdatePosition WdP2f | PropUpdatePosition WdP2f
| PropUpdateWhen WdBl PropUpdate | PropUpdateWhen WdBl PropUpdate
| PropUpdateIf WdBl PropUpdate PropUpdate | PropUpdateIf WdBl PropUpdate PropUpdate
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data PrWdLsLs data PrWdLsLs
= PrWdLsId = PrWdLsId
| PrWdLsSetPosition WdP2f Point3 | PrWdLsSetPosition WdP2f Point3
| PrWdLsSetColor Point3 | PrWdLsSetColor Point3
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Prop makeLenses ''Prop
deriveJSON defaultOptions ''PropDraw deriveJSON defaultOptions ''PropDraw
deriveJSON defaultOptions ''PropUpdate deriveJSON defaultOptions ''PropUpdate
deriveJSON defaultOptions ''PrWdLsLs deriveJSON defaultOptions ''PrWdLsLs
deriveJSON defaultOptions ''Prop deriveJSON defaultOptions ''Prop
$($(derive [d| instance Deriving (Store PropDraw) |]))
$($(derive [d| instance Deriving (Store PropUpdate) |]))
$($(derive [d| instance Deriving (Store PrWdLsLs) |]))
$($(derive [d| instance Deriving (Store Prop) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.RadarBlip where module Dodge.Data.RadarBlip where
import Flat
import LinearHelp import LinearHelp
import Color import Color
import Control.Lens import Control.Lens
@@ -19,8 +22,7 @@ data RadarBlip = RadarBlip
, _rbRad :: Float , _rbRad :: Float
, _rbPos :: Point2 , _rbPos :: Point2
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''RadarBlip makeLenses ''RadarBlip
deriveJSON defaultOptions ''RadarBlip deriveJSON defaultOptions ''RadarBlip
$($(derive [d| instance Deriving (Store RadarBlip) |]))
+4 -2
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -6,6 +8,7 @@ module Dodge.Data.RadarSweep (
module Dodge.Data.ObjectType, module Dodge.Data.ObjectType,
) where ) where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -21,8 +24,7 @@ data RadarSweep = RadarSweep
, _rsObject :: ObjectType , _rsObject :: ObjectType
, _rsTimer :: Int , _rsTimer :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''RadarSweep makeLenses ''RadarSweep
deriveJSON defaultOptions ''RadarSweep deriveJSON defaultOptions ''RadarSweep
$($(derive [d| instance Deriving (Store RadarSweep) |]))
+6 -3
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.RightButtonOptions where module Dodge.Data.RightButtonOptions where
import Flat
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -17,14 +20,14 @@ data RightButtonOptions
, _opAllocateEquipment :: AllocateEquipment , _opAllocateEquipment :: AllocateEquipment
, _opActivateEquipment :: ActivateEquipment , _opActivateEquipment :: ActivateEquipment
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ActivateEquipment data ActivateEquipment
= ActivateEquipment {_activateEquipment :: Int} = ActivateEquipment {_activateEquipment :: Int}
| DeactivateEquipment {_deactivateEquipment :: Int} | DeactivateEquipment {_deactivateEquipment :: Int}
| ActivateDeactivateEquipment {_activateEquipment :: Int, _deactivateEquipment :: Int} | ActivateDeactivateEquipment {_activateEquipment :: Int, _deactivateEquipment :: Int}
| NoChangeActivateEquipment | NoChangeActivateEquipment
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data AllocateEquipment data AllocateEquipment
= DoNotMoveEquipment = DoNotMoveEquipment
@@ -47,7 +50,7 @@ data AllocateEquipment
| RemoveEquipment | RemoveEquipment
{ _allocOldPos :: EquipPosition { _allocOldPos :: EquipPosition
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''RightButtonOptions makeLenses ''RightButtonOptions
makeLenses ''AllocateEquipment makeLenses ''AllocateEquipment
+4 -1
View File
@@ -1,13 +1,16 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.SaveSlot where module Dodge.Data.SaveSlot where
import Flat
import Control.Lens import Control.Lens
data SaveSlot data SaveSlot
= QuicksaveSlot = QuicksaveSlot
| LevelStartSlot Int | LevelStartSlot Int
| SaveSlotNum Int | SaveSlotNum Int
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''SaveSlot makeLenses ''SaveSlot
+5 -4
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Shockwave where module Dodge.Data.Shockwave where
import Flat
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -12,7 +15,7 @@ import TH.Derive
import Data.Store import Data.Store
data ShockwaveDirection = OutwardShockwave | InwardShockwave data ShockwaveDirection = OutwardShockwave | InwardShockwave
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Shockwave = Shockwave data Shockwave = Shockwave
{ _swColor :: Color { _swColor :: Color
@@ -25,10 +28,8 @@ data Shockwave = Shockwave
, _swMaxTime :: Int , _swMaxTime :: Int
, _swTimer :: Int , _swTimer :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Shockwave makeLenses ''Shockwave
deriveJSON defaultOptions ''ShockwaveDirection deriveJSON defaultOptions ''ShockwaveDirection
deriveJSON defaultOptions ''Shockwave deriveJSON defaultOptions ''Shockwave
$($(derive [d| instance Deriving (Store ShockwaveDirection) |]))
$($(derive [d| instance Deriving (Store Shockwave) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.SoundOrigin where module Dodge.Data.SoundOrigin where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import Dodge.Data.Material import Dodge.Data.Material
@@ -35,11 +38,10 @@ data SoundOrigin
| LeverSound Int | LeverSound Int
| Explosion Int | Explosion Int
| Tap Int | Tap Int
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSONKey SoundOrigin instance ToJSONKey SoundOrigin
instance FromJSONKey SoundOrigin instance FromJSONKey SoundOrigin
deriveJSON defaultOptions ''SoundOrigin deriveJSON defaultOptions ''SoundOrigin
$($(derive [d| instance Deriving (Store SoundOrigin) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Spark where module Dodge.Data.Spark where
import Flat
import LinearHelp import LinearHelp
import Color import Color
import Control.Lens import Control.Lens
@@ -21,8 +24,7 @@ data Spark = Spark
, _skWidth :: Float , _skWidth :: Float
, _skDamageType :: DamageType , _skDamageType :: DamageType
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Spark makeLenses ''Spark
deriveJSON defaultOptions ''Spark deriveJSON defaultOptions ''Spark
$($(derive [d| instance Deriving (Store Spark) |]))
+15 -24
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Terminal where module Dodge.Data.Terminal where
import Flat
import LinearHelp import LinearHelp
import Color import Color
import Control.Lens import Control.Lens
@@ -15,19 +18,19 @@ import TH.Derive
import Data.Store import Data.Store
data TerminalStatus = TerminalOff | TerminalBusy | TerminalReady data TerminalStatus = TerminalOff | TerminalBusy | TerminalReady
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data TerminalInput = TerminalInput data TerminalInput = TerminalInput
{ _tiText :: T.Text { _tiText :: T.Text
, _tiFocus :: Bool , _tiFocus :: Bool
, _tiSel :: (Int, Int) , _tiSel :: (Int, Int)
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data TerminalBootProgram data TerminalBootProgram
= TerminalBootMempty = TerminalBootMempty
| TerminalBootLines [TerminalLine] | TerminalBootLines [TerminalLine]
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data Terminal = Terminal data Terminal = Terminal
{ _tmID :: Int { _tmID :: Int
@@ -47,16 +50,16 @@ data Terminal = Terminal
, _tmCommandHistory :: [String] , _tmCommandHistory :: [String]
, _tmToggles :: M.Map String TerminalToggle , _tmToggles :: M.Map String TerminalToggle
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data TerminalLineString = TerminalLineConst String Color data TerminalLineString = TerminalLineConst String Color
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data TmTm data TmTm
= TmId = TmId
| TmTmClearDisplayedLines | TmTmClearDisplayedLines
| TmTmSetStatus TerminalStatus | TmTmSetStatus TerminalStatus
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data TerminalLine data TerminalLine
= TerminalLineDisplay = TerminalLineDisplay
@@ -71,19 +74,19 @@ data TerminalLine
{ _tlPause :: Int { _tlPause :: Int
, _tlEffect :: TmWdWd --Terminal -> World -> World , _tlEffect :: TmWdWd --Terminal -> World -> World
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data TerminalToggle = TerminalToggle data TerminalToggle = TerminalToggle
{ _ttTriggerID :: Int { _ttTriggerID :: Int
, _ttDeathEffect :: BlBl , _ttDeathEffect :: BlBl
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data BlBl data BlBl
= BlNegate = BlNegate
| BlConst Bool | BlConst Bool
| BlId | BlId
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data EffectArguments data EffectArguments
= NoArguments {_cmdEffect :: [TerminalLine]} = NoArguments {_cmdEffect :: [TerminalLine]}
@@ -91,7 +94,7 @@ data EffectArguments
{ _argType :: String { _argType :: String
, _argList :: M.Map String [TerminalLine] , _argList :: M.Map String [TerminalLine]
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data TerminalCommandEffect data TerminalCommandEffect
= TerminalCommandArguments EffectArguments = TerminalCommandArguments EffectArguments
@@ -103,7 +106,7 @@ data TerminalCommandEffect
| TerminalCommandEffectCommands | TerminalCommandEffectCommands
| TerminalCommandEffectSingleCommand WdWd [String] | TerminalCommandEffectSingleCommand WdWd [String]
| TerminalCommandEffectNone | TerminalCommandEffectNone
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data TerminalCommand = TerminalCommand data TerminalCommand = TerminalCommand
{ _tcString :: String { _tcString :: String
@@ -111,7 +114,7 @@ data TerminalCommand = TerminalCommand
, _tcHelp :: String , _tcHelp :: String
, _tcEffect :: TerminalCommandEffect -- Terminal -> World -> EffectArguments , _tcEffect :: TerminalCommandEffect -- Terminal -> World -> EffectArguments
} }
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
makeLenses ''TerminalInput makeLenses ''TerminalInput
makeLenses ''Terminal makeLenses ''Terminal
@@ -131,15 +134,3 @@ deriveJSON defaultOptions ''BlBl
deriveJSON defaultOptions ''EffectArguments deriveJSON defaultOptions ''EffectArguments
deriveJSON defaultOptions ''TerminalCommandEffect deriveJSON defaultOptions ''TerminalCommandEffect
deriveJSON defaultOptions ''TerminalCommand deriveJSON defaultOptions ''TerminalCommand
$($(derive [d| instance Deriving (Store TerminalStatus) |]))
$($(derive [d| instance Deriving (Store TerminalInput) |]))
$($(derive [d| instance Deriving (Store TerminalBootProgram) |]))
$($(derive [d| instance Deriving (Store Terminal) |]))
$($(derive [d| instance Deriving (Store TerminalLineString) |]))
$($(derive [d| instance Deriving (Store TmTm) |]))
$($(derive [d| instance Deriving (Store TerminalLine) |]))
$($(derive [d| instance Deriving (Store TerminalToggle) |]))
$($(derive [d| instance Deriving (Store BlBl) |]))
$($(derive [d| instance Deriving (Store EffectArguments) |]))
$($(derive [d| instance Deriving (Store TerminalCommandEffect) |]))
$($(derive [d| instance Deriving (Store TerminalCommand) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.TeslaArc where module Dodge.Data.TeslaArc where
import Flat
import LinearHelp import LinearHelp
import Color import Color
import Control.Lens import Control.Lens
@@ -19,8 +22,7 @@ data TeslaArc = TeslaArc
, _taArcSteps :: [ArcStep] , _taArcSteps :: [ArcStep]
, _taColor :: Color , _taColor :: Color
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''TeslaArc makeLenses ''TeslaArc
deriveJSON defaultOptions ''TeslaArc deriveJSON defaultOptions ''TeslaArc
$($(derive [d| instance Deriving (Store TeslaArc) |]))
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.TractorBeam where module Dodge.Data.TractorBeam where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -17,8 +20,7 @@ data TractorBeam = TractorBeam
, _tbVel :: Point2 , _tbVel :: Point2
, _tbTime :: Int , _tbTime :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''TractorBeam makeLenses ''TractorBeam
deriveJSON defaultOptions ''TractorBeam deriveJSON defaultOptions ''TractorBeam
$($(derive [d| instance Deriving (Store TractorBeam) |]))
+4 -1
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -9,6 +11,7 @@ module Dodge.Data.Universe (
module Picture.Data, module Picture.Data,
) where ) where
import Flat
import Control.Lens import Control.Lens
--import qualified Data.Map.Strict as M --import qualified Data.Map.Strict as M
import Data.Preload import Data.Preload
@@ -38,7 +41,7 @@ data ConcEffect = NoConcEffect
| BackgroundConcEffect {_ceString :: String} | BackgroundConcEffect {_ceString :: String}
data OptionScreenFlag = NormalOptions | GameOverOptions | SplashOptions data OptionScreenFlag = NormalOptions | GameOverOptions | SplashOptions
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data ScreenLayer data ScreenLayer
= OptionScreen = OptionScreen
+8 -12
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -6,15 +8,14 @@ module Dodge.Data.Wall (
module Dodge.Data.Material, module Dodge.Data.Material,
) where ) where
import LinearHelp import Flat
import LinearHelp ()
import Color import Color
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import Dodge.Data.Material import Dodge.Data.Material
import Geometry import Geometry
import TH.Derive
import Data.Store
data Wall = Wall data Wall = Wall
{ _wlLine :: (Point2, Point2) { _wlLine :: (Point2, Point2)
@@ -35,18 +36,17 @@ data Wall = Wall
, _wlHeight :: Float , _wlHeight :: Float
, _wlMaterial :: Material , _wlMaterial :: Material
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Opacity data Opacity
= SeeThrough = SeeThrough
| SeeAbove | SeeAbove
| DrawnWall {_opDraw :: WallDraw} -- Wall -> SPic | DrawnWall {_opDraw :: WallDraw} -- Wall -> SPic
| Opaque | Opaque
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data WallDraw = DrawForceField data WallDraw = DrawForceField
| HackWallDraw deriving (Eq, Ord, Show, Read, Enum, Bounded, Generic, Flat)
deriving (Eq, Ord, Show, Read, Enum, Bounded)
data WallStructure data WallStructure
= StandaloneWall = StandaloneWall
@@ -56,7 +56,7 @@ data WallStructure
| CreaturePart | CreaturePart
{ _wlStCreature :: Int { _wlStCreature :: Int
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Wall makeLenses ''Wall
makeLenses ''Opacity makeLenses ''Opacity
@@ -65,7 +65,3 @@ deriveJSON defaultOptions ''Wall
deriveJSON defaultOptions ''Opacity deriveJSON defaultOptions ''Opacity
deriveJSON defaultOptions ''WallDraw deriveJSON defaultOptions ''WallDraw
deriveJSON defaultOptions ''WallStructure deriveJSON defaultOptions ''WallStructure
$($(derive [d| instance Deriving (Store Wall) |]))
$($(derive [d| instance Deriving (Store Opacity) |]))
$($(derive [d| instance Deriving (Store WallDraw) |]))
$($(derive [d| instance Deriving (Store WallStructure) |]))
+4 -1
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
@@ -10,6 +12,7 @@ module Dodge.Data.World (
module Dodge.Data.Hammer, module Dodge.Data.Hammer,
) where ) where
import Flat
import Dodge.Data.SaveSlot import Dodge.Data.SaveSlot
import Control.Lens import Control.Lens
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
@@ -49,7 +52,7 @@ data TimeFlowStatus
= RewindingNow = RewindingNow
| RewindingLastFrame | RewindingLastFrame
| NormalTimeFlow | NormalTimeFlow
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data WorldHammer data WorldHammer
= SubInvHam = SubInvHam
+11 -16
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.WorldEffect where module Dodge.Data.WorldEffect where
import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import Dodge.Data.CreatureEffect import Dodge.Data.CreatureEffect
@@ -16,7 +19,7 @@ import Data.Store
data ItCrWdWd data ItCrWdWd
= ItCrWdId = ItCrWdId
| ItCrWdItemEffect | ItCrWdItemEffect
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data WdWd data WdWd
= NoWorldEffect = NoWorldEffect
@@ -31,19 +34,19 @@ data WdWd
| WdWdNegateTrig Int | WdWdNegateTrig Int
| WdWdFromItixCrixWdWd Int Int ItCrWdWd | WdWdFromItixCrixWdWd Int Int ItCrWdWd
| WdWdFromItCrixWdWd Item Int ItCrWdWd | WdWdFromItCrixWdWd Item Int ItCrWdWd
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
data WdP2 data WdP2
= WdP2Const Point2 = WdP2Const Point2
| WdYouPos | WdYouPos
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data MdWdWd data MdWdWd
= MdWdId = MdWdId
| MdTrigIf MdWdWd MdWdWd | MdTrigIf MdWdWd MdWdWd
| MdSetLSCol Point3 | MdSetLSCol Point3
| MdFlickerUpdate | MdFlickerUpdate
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data WdBl data WdBl
= WdTrig Int = WdTrig Int
@@ -53,19 +56,19 @@ data WdBl
| WdBlCrFilterNearPoint Float Point2 CrBl | WdBlCrFilterNearPoint Float Point2 CrBl
| WdBlBtOn Int | WdBlBtOn Int
| WdBlBtNotOff Int | WdBlBtNotOff Int
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data WdP2f data WdP2f
= WdP2f0 = WdP2f0
| WdP2fDoorPosition Int | WdP2fDoorPosition Int
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data DrWdWd data DrWdWd
= DrWdId = DrWdId
| DrWdMakeDoorDebris | DrWdMakeDoorDebris
| DrWdMechanismStepwise Int [Int] [(Point2, Point2)] | DrWdMechanismStepwise Int [Int] [(Point2, Point2)]
| DoorMechanism | DoorMechanism
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data TmWdWd data TmWdWd
= TmWdId = TmWdId
@@ -73,7 +76,7 @@ data TmWdWd
| TmWdWdfromWdWd WdWd | TmWdWdfromWdWd WdWd
| TmWdWdTermSound SoundID | TmWdWdTermSound SoundID
| TmWdWdDoDeathTriggers | TmWdWdDoDeathTriggers
deriving (Eq, Show, Read) deriving (Eq, Show, Read, Generic, Flat)
deriveJSON defaultOptions ''ItCrWdWd deriveJSON defaultOptions ''ItCrWdWd
deriveJSON defaultOptions ''WdWd deriveJSON defaultOptions ''WdWd
@@ -83,11 +86,3 @@ deriveJSON defaultOptions ''WdBl
deriveJSON defaultOptions ''WdP2f deriveJSON defaultOptions ''WdP2f
deriveJSON defaultOptions ''DrWdWd deriveJSON defaultOptions ''DrWdWd
deriveJSON defaultOptions ''TmWdWd deriveJSON defaultOptions ''TmWdWd
$($(derive [d| instance Deriving (Store ItCrWdWd) |]))
$($(derive [d| instance Deriving (Store WdWd) |]))
$($(derive [d| instance Deriving (Store WdP2) |]))
$($(derive [d| instance Deriving (Store MdWdWd) |]))
$($(derive [d| instance Deriving (Store WdBl) |]))
$($(derive [d| instance Deriving (Store WdP2f) |]))
$($(derive [d| instance Deriving (Store DrWdWd) |]))
$($(derive [d| instance Deriving (Store TmWdWd) |]))
+18 -12
View File
@@ -1,29 +1,35 @@
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{- | GameRooms contain information about given positions in the world {-# LANGUAGE TemplateHaskell #-}
-}
module Dodge.GameRoom -- | GameRooms contain information about given positions in the world
where module Dodge.GameRoom where
import LinearHelp
import Geometry import Flat
import Control.Lens import Control.Lens
import GHC.Generics
import Data.Aeson import Data.Aeson
import TH.Derive
import Data.Store import Data.Store
import GHC.Generics
import Geometry
import LinearHelp
import TH.Derive
data GameRoom = GameRoom data GameRoom = GameRoom
{ _grViewpoints :: [Point2] { _grViewpoints :: [Point2]
, _grViewpointsEx :: [Point2] , _grViewpointsEx :: [Point2]
, _grBound :: [Point2] , _grBound :: [Point2]
, _grDir :: Float -- ^ gives direction of room , -- | gives direction of room
_grDir :: Float
, _grLinkDirs :: [Float] , _grLinkDirs :: [Float]
, _grName :: String , _grName :: String
} }
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSON GameRoom where instance ToJSON GameRoom where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
instance FromJSON GameRoom instance FromJSON GameRoom
makeLenses ''GameRoom makeLenses ''GameRoom
$($(derive [d| instance Deriving (Store GameRoom) |]))
+5 -5
View File
@@ -10,7 +10,7 @@ module Dodge.Save (
fromJSONSaveSlot, fromJSONSaveSlot,
) where ) where
import qualified Data.Store as Store import Flat
import Dodge.Concurrent import Dodge.Concurrent
import Control.Lens import Control.Lens
import Dodge.Data.SaveSlot import Dodge.Data.SaveSlot
@@ -27,7 +27,7 @@ writeSaveSlot ss u = do
putStrLn $ "Saving " ++ saveSlotPath ss putStrLn $ "Saving " ++ saveSlotPath ss
createDirectoryIfMissing True "saveSlot" createDirectoryIfMissing True "saveSlot"
BSS.writeFile (saveSlotPath ss) $ BSS.writeFile (saveSlotPath ss) $
Store.encode flat
(u ^. uvWorld . cWorld) (u ^. uvWorld . cWorld)
return Just return Just
@@ -37,10 +37,10 @@ readSaveSlot ss = do
if fExists if fExists
then do then do
bsstr <- BSS.readFile $ saveSlotPath ss bsstr <- BSS.readFile $ saveSlotPath ss
cwstr <- Store.decodeIO $ bsstr let cwstr = unflat bsstr
case cwstr of case cwstr of
Nothing -> putStrLn "loadSaveSlot failed to read saved file" >> return removescreenlayers Left _ -> putStrLn "loadSaveSlot failed to read saved file" >> return removescreenlayers
Just cw -> return $ \uv -> Just $ uv & uvWorld . cWorld .~ cw Right cw -> return $ \uv -> Just $ uv & uvWorld . cWorld .~ cw
& uvScreenLayers .~ [] & uvScreenLayers .~ []
else putStrLn "loadSaveSlot failed to find saved file" >> return removescreenlayers else putStrLn "loadSaveSlot failed to find saved file" >> return removescreenlayers
where where
+43 -36
View File
@@ -1,49 +1,56 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE BangPatterns #-}
module Geometry.ConvexPoly module Geometry.ConvexPoly (
( ConvexPoly (..) ConvexPoly (..),
, cpPoints cpPoints,
, cpCen cpCen,
, cpRad cpRad,
-- , centroid -- , centroid
, pointsToPoly pointsToPoly,
, convexPolysOverlap convexPolysOverlap,
, pointInPolyPoints pointInPolyPoints,
) where ) where
import LinearHelp
import GHC.Generics
import Data.Aeson
import Geometry.Data
import Geometry.Vector
import Geometry.LHS
import Geometry.Intersect
import Geometry.Polygon
import Control.Lens import Control.Lens
import TH.Derive import Data.Aeson
import Data.Store import Flat
import Geometry.Data
import Geometry.Intersect
import Geometry.LHS
import Geometry.Polygon
import Geometry.Vector
import LinearHelp ()
--import qualified Control.Foldl as L --import qualified Control.Foldl as L
data ConvexPoly = ConvexPoly data ConvexPoly = ConvexPoly
{ _cpPoints :: [Point2] { _cpPoints :: [Point2]
, _cpCen :: Point2 , _cpCen :: Point2
, _cpRad :: Float , _cpRad :: Float
} }
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSON ConvexPoly where instance ToJSON ConvexPoly where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
instance FromJSON ConvexPoly instance FromJSON ConvexPoly
pointsToPoly :: [Point2] -> ConvexPoly pointsToPoly :: [Point2] -> ConvexPoly
pointsToPoly xs = ConvexPoly pointsToPoly xs =
ConvexPoly
{ _cpPoints = xs { _cpPoints = xs
, _cpCen = cen , _cpCen = cen
, _cpRad = maximum $ map (dist cen) xs , _cpRad = maximum $ map (dist cen) xs
} }
where where
cen = centroid xs cen = centroid xs
-- | Test whether two polygons intersect or if one is contained in the other. -- | Test whether two polygons intersect or if one is contained in the other.
convexPolysOverlap :: ConvexPoly -> ConvexPoly -> Bool convexPolysOverlap :: ConvexPoly -> ConvexPoly -> Bool
convexPolysOverlap cp1 cp2 = dist (_cpCen cp1) (_cpCen cp2) < _cpRad cp1 + _cpRad cp2 convexPolysOverlap cp1 cp2 =
dist (_cpCen cp1) (_cpCen cp2) < _cpRad cp1 + _cpRad cp2
&& polyPointsOverlap (_cpPoints cp1) (_cpPoints cp2) && polyPointsOverlap (_cpPoints cp1) (_cpPoints cp2)
--pointInConvexPoly :: Point2 -> ConvexPoly -> Bool --pointInConvexPoly :: Point2 -> ConvexPoly -> Bool
@@ -52,33 +59,33 @@ convexPolysOverlap cp1 cp2 = dist (_cpCen cp1) (_cpCen cp2) < _cpRad cp1 + _cpRa
-- | Test whether two polygons intersect or if one is contained in the other. -- | Test whether two polygons intersect or if one is contained in the other.
polyPointsOverlap :: [Point2] -> [Point2] -> Bool polyPointsOverlap :: [Point2] -> [Point2] -> Bool
polyPointsOverlap (p:ps) (q:qs) = pointInPolyPoints p (q:qs) polyPointsOverlap (p : ps) (q : qs) =
|| pointInPolyPoints q (p:ps) pointInPolyPoints p (q : qs)
|| polyPointsIntersect (p:ps) (q:qs) || pointInPolyPoints q (p : ps)
|| polyPointsIntersect (p : ps) (q : qs)
polyPointsOverlap _ _ = False polyPointsOverlap _ _ = False
-- | Test whether a point is strictly inside a polygon. {- | Test whether a point is strictly inside a polygon.
-- Supposes the points in the polygon are listed in anticlockwise order. Supposes the points in the polygon are listed in anticlockwise order.
-}
pointInPolyPoints :: Point2 -> [Point2] -> Bool pointInPolyPoints :: Point2 -> [Point2] -> Bool
pointInPolyPoints !p (x:xs) = all (\l -> uncurry isLHS l p) $ zip (x:xs) (xs ++ [x]) pointInPolyPoints !p (x : xs) = all (\l -> uncurry isLHS l p) $ zip (x : xs) (xs ++ [x])
pointInPolyPoints _ [] = False pointInPolyPoints _ [] = False
polyPointsIntersect :: [Point2] -> [Point2] -> Bool polyPointsIntersect :: [Point2] -> [Point2] -> Bool
polyPointsIntersect (a:b:xs) ps = go a (a:b:xs) ps polyPointsIntersect (a : b : xs) ps = go a (a : b : xs) ps
where where
go x' (a':b':xs') ps' = pairPolyPointsIntersect a' b' ps' || go x' (b':xs') ps' go x' (a' : b' : xs') ps' = pairPolyPointsIntersect a' b' ps' || go x' (b' : xs') ps'
go b' [a'] ps' = pairPolyPointsIntersect a' b' ps' go b' [a'] ps' = pairPolyPointsIntersect a' b' ps'
go _ _ _ = False go _ _ _ = False
polyPointsIntersect _ _ = False polyPointsIntersect _ _ = False
pairPolyPointsIntersect :: Point2 -> Point2 -> [Point2] -> Bool pairPolyPointsIntersect :: Point2 -> Point2 -> [Point2] -> Bool
pairPolyPointsIntersect a' b' (c':d':xs') = go c' a' b' (c':d':xs') pairPolyPointsIntersect a' b' (c' : d' : xs') = go c' a' b' (c' : d' : xs')
where where
go x a b (c:d:xs) = intersectSegSegTest a b c d || go x a b (d:xs) go x a b (c : d : xs) = intersectSegSegTest a b c d || go x a b (d : xs)
go d a b [c] = intersectSegSegTest a b c d go d a b [c] = intersectSegSegTest a b c d
go _ _ _ _ = False go _ _ _ _ = False
pairPolyPointsIntersect _ _ _ = False pairPolyPointsIntersect _ _ _ = False
makeLenses ''ConvexPoly makeLenses ''ConvexPoly
$($(derive [d| instance Deriving (Store ConvexPoly) |]))
+16
View File
@@ -0,0 +1,16 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StandaloneDeriving #-}
module IntSetHelp (
module IntSetHelp,
module Data.IntSet,
) where
import Data.IntSet.Internal
import Data.IntSet
import Flat
-- IntSet is not an instance of Generic?!
deriving instance Generic IntSet
deriving instance Flat IntSet
+8 -16
View File
@@ -1,21 +1,13 @@
{-# LANGUAGE StrictData #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-}
module LinearHelp where module LinearHelp where
import Data.Store
import Data.Store.TH import Flat
import TH.Derive
import Linear.V2 import Linear.V2
import Linear.V3 import Linear.V3
import Linear.V4 import Linear.V4
deriving instance (Flat a => Flat (V2 a))
$($(derive [d| deriving instance (Flat a => Flat (V3 a))
instance (Store a => Deriving (Store (V2 a))) deriving instance (Flat a => Flat (V4 a))
|]))
$($(derive [d|
instance (Store a => Deriving (Store (V3 a)))
|]))
$($(derive [d|
instance (Store a => Deriving (Store (V4 a)))
|]))
+12 -7
View File
@@ -1,18 +1,24 @@
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module MaybeHelp where module MaybeHelp where
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Store
import Flat
import GHC.Generics import GHC.Generics
import TH.Derive import TH.Derive
import Data.Store
data Maybe' a = Just' {__Just' :: a} | Nothing' data Maybe' a = Just' {__Just' :: a} | Nothing'
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSON a => ToJSON (Maybe' a) where instance ToJSON a => ToJSON (Maybe' a) where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
instance FromJSON a => FromJSON (Maybe' a) instance FromJSON a => FromJSON (Maybe' a)
fromJust' :: Maybe' a -> a fromJust' :: Maybe' a -> a
@@ -21,11 +27,11 @@ fromJust' mx = case mx of
Nothing' -> error "no fromJust'" Nothing' -> error "no fromJust'"
isJust' :: Maybe' a -> Bool isJust' :: Maybe' a -> Bool
isJust' Just' {} = True isJust' Just'{} = True
isJust' Nothing' = False isJust' Nothing' = False
isNothing' :: Maybe' a -> Bool isNothing' :: Maybe' a -> Bool
isNothing' Just' {} = False isNothing' Just'{} = False
isNothing' Nothing' = True isNothing' Nothing' = True
strictify :: Maybe a -> Maybe' a strictify :: Maybe a -> Maybe' a
@@ -37,4 +43,3 @@ toggleJust Nothing = Just ()
toggleJust _ = Nothing toggleJust _ = Nothing
makeLenses ''Maybe' makeLenses ''Maybe'
$($(derive [d| instance (Store a => Deriving (Store (Maybe' a))) |]))
+6 -6
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Picture.Data where module Picture.Data where
import Flat
import LinearHelp import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -19,7 +22,7 @@ data Verx = Verx
, _vxLayer :: !Layer , _vxLayer :: !Layer
, _vxShadNum :: !ShadNum , _vxShadNum :: !ShadNum
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
data Layer data Layer
= BottomLayer = BottomLayer
@@ -28,7 +31,7 @@ data Layer
| BloomNoZWrite | BloomNoZWrite
| DebugLayer | DebugLayer
| FixedCoordLayer | FixedCoordLayer
deriving (Eq, Ord, Enum, Bounded, Show, Read) deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic, Flat)
layerNum :: Layer -> Int layerNum :: Layer -> Int
layerNum = fromEnum layerNum = fromEnum
@@ -37,7 +40,7 @@ numLayers :: Int
numLayers = length [minBound :: Layer .. maxBound] numLayers = length [minBound :: Layer .. maxBound]
newtype ShadNum = ShadNum {_unShadNum :: Int} newtype ShadNum = ShadNum {_unShadNum :: Int}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum
{-# INLINE polyNum #-} {-# INLINE polyNum #-}
@@ -91,6 +94,3 @@ makeLenses ''Verx
deriveJSON defaultOptions ''Verx deriveJSON defaultOptions ''Verx
deriveJSON defaultOptions ''Layer deriveJSON defaultOptions ''Layer
deriveJSON defaultOptions ''ShadNum deriveJSON defaultOptions ''ShadNum
$($(derive [d| instance Deriving (Store Verx) |]))
$($(derive [d| instance Deriving (Store Layer) |]))
$($(derive [d| instance Deriving (Store ShadNum) |]))
+14 -14
View File
@@ -1,28 +1,30 @@
--{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveAnyClass #-}
--{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE ScopedTypeVariables #-}
{- | {- |
WARNING: orphan instances concerning Aeson classes and Linear.Quaternion datatypes have been introduced. WARNING: orphan instances concerning Aeson classes and Linear.Quaternion datatypes have been introduced.
The warnings have been disabled. The warnings have been disabled.
-} -}
module Quaternion module Quaternion (
( rotateToZ rotateToZ,
, vToQuat vToQuat,
, module Linear.Quaternion module Linear.Quaternion,
) where ) where
import Data.Aeson import Data.Aeson
import Flat
import Geometry.Data import Geometry.Data
import Geometry.Vector3D import Geometry.Vector3D
import qualified Linear.Quaternion as Q
import Linear.Quaternion import Linear.Quaternion
import TH.Derive import qualified Linear.Quaternion as Q
import Data.Store
import LinearHelp import LinearHelp
instance ToJSON a => ToJSON (Q.Quaternion a) where instance ToJSON a => ToJSON (Q.Quaternion a) where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
instance FromJSON a => FromJSON (Q.Quaternion a) instance FromJSON a => FromJSON (Q.Quaternion a)
-- apply a rotation as if the z axis moves to the new point. -- apply a rotation as if the z axis moves to the new point.
@@ -41,6 +43,4 @@ vToQuat a b
where where
cprod = crossProd a b cprod = crossProd a b
$($(derive [d| deriving instance (Flat a => Flat (Quaternion a))
instance (Store a => Deriving (Store (Quaternion a)))
|]))
+31 -19
View File
@@ -1,20 +1,25 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralisedNewtypeDeriving #-} {-# LANGUAGE GeneralisedNewtypeDeriving #-}
module Shape.Data {-# LANGUAGE StrictData #-}
where {-# LANGUAGE TemplateHaskell #-}
import LinearHelp {-# OPTIONS_GHC -Wno-missing-signatures #-}
import Geometry.Data
import GHC.Generics module Shape.Data where
import Data.Aeson
import Control.Lens import Control.Lens
import Data.Aeson
import Data.Store
import Flat
import GHC.Generics
import Geometry.Data
import LinearHelp
import Streaming import Streaming
import TH.Derive import TH.Derive
import Data.Store
type Shape' = Stream (Of ShapeObj) IO () type Shape' = Stream (Of ShapeObj) IO ()
type Shape = [ShapeObj] type Shape = [ShapeObj]
{-# INLINE shVfromList #-} {-# INLINE shVfromList #-}
@@ -27,29 +32,36 @@ data ShapeObj = ShapeObj
{ _shType :: ShapeType { _shType :: ShapeType
, _shVs :: [ShapeV] , _shVs :: [ShapeV]
} }
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSON ShapeObj where instance ToJSON ShapeObj where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
instance FromJSON ShapeObj instance FromJSON ShapeObj
newtype ShapeType = TopPrism Int newtype ShapeType = TopPrism Int
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSON ShapeType where instance ToJSON ShapeType where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
instance FromJSON ShapeType instance FromJSON ShapeType
-- edges are given by four consecutive points -- edges are given by four consecutive points
data ShapeV = ShapeV data ShapeV = ShapeV
{_svPos :: Point3 { _svPos :: Point3
,_svCol :: Point4 , _svCol :: Point4
} }
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance ToJSON ShapeV where instance ToJSON ShapeV where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
instance FromJSON ShapeV instance FromJSON ShapeV
pairToSV :: (Point3,Point4) -> ShapeV
pairToSV :: (Point3, Point4) -> ShapeV
{-# INLINE pairToSV #-} {-# INLINE pairToSV #-}
pairToSV = uncurry ShapeV pairToSV = uncurry ShapeV
makeLenses ''ShapeV makeLenses ''ShapeV
makeLenses ''ShapeObj makeLenses ''ShapeObj
$($(derive [d| instance Deriving (Store ShapeV) |]))
$($(derive [d| instance Deriving (Store ShapeObj) |]))
$($(derive [d| instance Deriving (Store ShapeType) |]))
+4 -8
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Sound.Data where module Sound.Data where
import Flat
import TH.Derive import TH.Derive
import Data.Store import Data.Store
import LinearHelp import LinearHelp
@@ -31,7 +34,7 @@ data PlayStatus
deriving (Eq, Ord, Show) deriving (Eq, Ord, Show)
newtype SoundID = SoundID {_getSoundID :: Int} newtype SoundID = SoundID {_getSoundID :: Int}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read, Generic, Flat)
newtype SoundData = SoundData newtype SoundData = SoundData
{ _loadedChunks :: IM.IntMap Mix.Chunk { _loadedChunks :: IM.IntMap Mix.Chunk
@@ -67,10 +70,3 @@ deriveJSON defaultOptions ''SoundStatus
deriveJSON defaultOptions ''PlayStatus deriveJSON defaultOptions ''PlayStatus
deriveJSON defaultOptions ''SoundID deriveJSON defaultOptions ''SoundID
deriveJSON defaultOptions ''ToPlaySound deriveJSON defaultOptions ''ToPlaySound
{- FOURMOLU_DISABLE -}
$($(derive [d| instance Deriving (Store SoundStatus) |]))
$($(derive [d| instance Deriving (Store PlayStatus) |]))
$($(derive [d| instance Deriving (Store SoundID) |]))
$($(derive [d| instance Deriving (Store ToPlaySound) |]))
{- FOURMOLU_ENABLE -}