Add Store instances

This commit is contained in:
2022-08-21 12:21:05 +01:00
parent 1ce7d4a72d
commit dd62e30026
92 changed files with 465 additions and 255 deletions
+4 -2
View File
@@ -2,10 +2,12 @@
{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
--{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Color where module Color where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -28,7 +30,7 @@ data PaletteColor
| WHITE | WHITE
| BLACK | BLACK
deriving (Eq, Ord, Enum, Show, Read, Generic, Flat) deriving (Eq, Ord, Enum, Show, Read, Generic, Flat)
instance Binary PaletteColor $($(derive [d| instance Deriving (Store PaletteColor) |]))
instance ToJSON PaletteColor where instance ToJSON PaletteColor where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
+8 -6
View File
@@ -5,6 +5,8 @@
module Dodge.Data.ActionPlan where module Dodge.Data.ActionPlan where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -24,13 +26,11 @@ data ActionPlan
, _apGoal :: [Goal] , _apGoal :: [Goal]
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ActionPlan
data RandImpulse data RandImpulse
= RandImpulseList [Impulse] = RandImpulseList [Impulse]
| RandImpulseCircMove Float | RandImpulseCircMove Float
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary RandImpulse
data Impulse data Impulse
= Move Point2 = Move Point2
@@ -65,7 +65,6 @@ data Impulse
} }
| ImpulseNothing | ImpulseNothing
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Impulse
infixr 9 `WaitThen` infixr 9 `WaitThen`
@@ -173,7 +172,6 @@ data Action
, _mainAction :: Action , _mainAction :: Action
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Action
data Strategy data Strategy
= Flank Int = Flank Int
@@ -192,14 +190,12 @@ data Strategy
| Flee | Flee
| MeleeStrike | MeleeStrike
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Strategy
data Goal data Goal
= LiveLongAndProsper = LiveLongAndProsper
| Kill Int | Kill Int
| SentinelAt Point2 Float | SentinelAt Point2 Float
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Goal
deriveJSON defaultOptions ''ActionPlan deriveJSON defaultOptions ''ActionPlan
deriveJSON defaultOptions ''RandImpulse deriveJSON defaultOptions ''RandImpulse
@@ -210,3 +206,9 @@ deriveJSON defaultOptions ''Goal
makeLenses ''ActionPlan makeLenses ''ActionPlan
makeLenses ''Impulse makeLenses ''Impulse
makeLenses ''Action makeLenses ''Action
$($(derive [d| instance Deriving (Store Goal) |]))
$($(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) |]))
+4 -2
View File
@@ -5,6 +5,8 @@
module Dodge.Data.ArcStep where module Dodge.Data.ArcStep where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -20,13 +22,13 @@ data ArcStep = ArcStep
, _asObject :: CrWlID --Maybe (Either Creature Wall) , _asObject :: CrWlID --Maybe (Either Creature Wall)
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ArcStep $($(derive [d| instance Deriving (Store ArcStep ) |]))
data NextArcStep data NextArcStep
= EndArc = EndArc
| DefaultArcStep | DefaultArcStep
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary NextArcStep $($(derive [d| instance Deriving (Store NextArcStep) |]))
makeLenses ''ArcStep makeLenses ''ArcStep
deriveJSON defaultOptions ''ArcStep deriveJSON defaultOptions ''ArcStep
+6 -4
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Beam where module Dodge.Data.Beam where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -31,13 +33,11 @@ data Beam = Beam
, _bmType :: BeamType , _bmType :: BeamType
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Beam
data BeamDraw data BeamDraw
= BasicBeamDraw = BasicBeamDraw
| BeamDrawColor Color | BeamDrawColor Color
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary BeamDraw
data BeamCombineType data BeamCombineType
= FlameBeamCombine = FlameBeamCombine
@@ -46,7 +46,6 @@ data BeamCombineType
| SplitBeamCombine | SplitBeamCombine
| NoBeamCombine | NoBeamCombine
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary BeamCombineType
data BeamType data BeamType
= BeamCombine = BeamCombine
@@ -54,7 +53,6 @@ data BeamType
} }
| BeamSimple | BeamSimple
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary BeamType
makeLenses ''BeamType makeLenses ''BeamType
makeLenses ''Beam makeLenses ''Beam
@@ -62,3 +60,7 @@ 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 Beam ) |]))
$($(derive [d| instance Deriving (Store BeamDraw) |]))
$($(derive [d| instance Deriving (Store BeamCombineType) |]))
$($(derive [d| instance Deriving (Store BeamType) |]))
+5 -3
View File
@@ -9,6 +9,8 @@ module Dodge.Data.Block (
module Dodge.Data.PathGraph, module Dodge.Data.PathGraph,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -36,7 +38,6 @@ data Block = Block
, _blObstructs :: [(Int, Int, PathEdge)] , _blObstructs :: [(Int, Int, PathEdge)]
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Block
data BlockDraw data BlockDraw
= BlockDrawMempty = BlockDrawMempty
@@ -44,15 +45,16 @@ data BlockDraw
| BlockDraws [BlockDraw] | BlockDraws [BlockDraw]
| BlockDrawColHeightPoss Color Float [Point2] | BlockDrawColHeightPoss Color Float [Point2]
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary BlockDraw
data BlSh data BlSh
= BlShMempty = BlShMempty
| BlShConst Shape | BlShConst Shape
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary BlSh
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 BlSh) |]))
$($(derive [d| instance Deriving (Store Block ) |]))
$($(derive [d| instance Deriving (Store BlockDraw) |]))
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Bounds where module Dodge.Data.Bounds where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -18,7 +20,7 @@ data Bounds = Bounds
, _bdMaxY :: Float , _bdMaxY :: Float
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Bounds $($(derive [d| instance Deriving (Store Bounds ) |]))
defaultBounds :: Bounds defaultBounds :: Bounds
defaultBounds = Bounds 0 0 0 0 defaultBounds = Bounds 0 0 0 0
+8 -6
View File
@@ -8,6 +8,8 @@ module Dodge.Data.Bullet
, module Dodge.Data.Damage , module Dodge.Data.Damage
)where )where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -32,27 +34,22 @@ data Bullet = Bullet
, _buDamages :: [Damage] , _buDamages :: [Damage]
} }
deriving (Show, Read, Eq, Ord, Generic, Flat) deriving (Show, Read, Eq, Ord, Generic, Flat)
instance Binary Bullet
data EnergyBallType = IncBall | TeslaBall | ConcBall data EnergyBallType = IncBall | TeslaBall | ConcBall
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat) deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
instance Binary EnergyBallType
data BulletUpdateMod = NoBulletUpdateMod data BulletUpdateMod = NoBulletUpdateMod
| ABulletUpdateMod -- hack for template splicing | ABulletUpdateMod -- hack for template splicing
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat) deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
instance Binary BulletUpdateMod
data BulletEffect data BulletEffect
= DestroyBullet = DestroyBullet
| BounceBullet | BounceBullet
| PenetrateBullet | PenetrateBullet
deriving (Eq, Ord, Show, Read, Enum, Bounded, Generic, Flat) deriving (Eq, Ord, Show, Read, Enum, Bounded, Generic, Flat)
instance Binary BulletEffect
data BulletSpawn = BulBall EnergyBallType | BulSpark data BulletSpawn = BulBall EnergyBallType | BulSpark
deriving (Show, Read, Eq, Ord, Generic, Flat) deriving (Show, Read, Eq, Ord, Generic, Flat)
instance Binary BulletSpawn
data BulletTrajectory data BulletTrajectory
= BasicBulletTrajectory = BasicBulletTrajectory
@@ -60,7 +57,6 @@ data BulletTrajectory
| FlechetteTrajectory Point2 | FlechetteTrajectory Point2
| MagnetTrajectory Point2 | MagnetTrajectory Point2
deriving (Show, Read, Eq, Ord, Generic, Flat) deriving (Show, Read, Eq, Ord, Generic, Flat)
instance Binary BulletTrajectory
makeLenses ''Bullet makeLenses ''Bullet
deriveJSON defaultOptions ''Bullet deriveJSON defaultOptions ''Bullet
@@ -69,3 +65,9 @@ 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 BulletTrajectory) |]))
$($(derive [d| instance Deriving (Store BulletSpawn ) |]))
+6 -4
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Button where module Dodge.Data.Button where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -21,7 +23,6 @@ data ButtonDraw
| DefaultDrawSwitch Color Color | DefaultDrawSwitch Color Color
| DrawNoButton | DrawNoButton
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ButtonDraw
data ButtonEvent data ButtonEvent
= ButtonDoNothing = ButtonDoNothing
@@ -48,7 +49,6 @@ data ButtonEvent
| ButtonAccessTerminal | ButtonAccessTerminal
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary ButtonEvent
data Button = Button data Button = Button
{ _btPict :: ButtonDraw --Button -> SPic { _btPict :: ButtonDraw --Button -> SPic
@@ -64,11 +64,9 @@ data Button = Button
} }
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary Button
data ButtonState = BtOn | BtOff | BtNoLabel data ButtonState = BtOn | BtOff | BtNoLabel
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ButtonState
makeLenses ''Button makeLenses ''Button
makeLenses ''ButtonEvent makeLenses ''ButtonEvent
@@ -76,3 +74,7 @@ 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 -5
View File
@@ -48,8 +48,11 @@ module Dodge.Data.CWorld (
module Dodge.Data.WorldEffect, module Dodge.Data.WorldEffect,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -115,7 +118,6 @@ data CWCam = CWCam
, _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) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CWCam
data CWorld = CWorld data CWorld = CWorld
--{ _cameraCenter :: Point2 --{ _cameraCenter :: Point2
@@ -191,7 +193,6 @@ data CWorld = CWorld
} }
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary CWorld
data CWTime = CWTime data CWTime = CWTime
{ _maybeWorld :: Maybe' CWorld { _maybeWorld :: Maybe' CWorld
@@ -201,7 +202,6 @@ data CWTime = CWTime
} }
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary CWTime
data CWGen = CWGen data CWGen = CWGen
@@ -212,7 +212,6 @@ data CWGen = CWGen
, _cwgSeed :: Int , _cwgSeed :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CWGen
data WorldBeams = WorldBeams data WorldBeams = WorldBeams
{ _blockingBeams :: [Beam] { _blockingBeams :: [Beam]
@@ -221,7 +220,6 @@ data WorldBeams = WorldBeams
, _electronBeams :: [Beam] , _electronBeams :: [Beam]
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary WorldBeams
deriveJSON defaultOptions ''CWorld deriveJSON defaultOptions ''CWorld
deriveJSON defaultOptions ''WorldBeams deriveJSON defaultOptions ''WorldBeams
@@ -233,3 +231,8 @@ makeLenses ''WorldBeams
makeLenses ''CWCam makeLenses ''CWCam
makeLenses ''CWGen makeLenses ''CWGen
makeLenses ''CWTime makeLenses ''CWTime
$($(derive [d| instance Deriving (Store CWCam ) |]))
$($(derive [d| instance Deriving (Store CWorld ) |]))
$($(derive [d| instance Deriving (Store CWTime ) |]))
$($(derive [d| instance Deriving (Store CWGen ) |]))
$($(derive [d| instance Deriving (Store WorldBeams ) |]))
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.CamouflageStatus where module Dodge.Data.CamouflageStatus where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -14,6 +16,6 @@ data CamouflageStatus
= FullyVisible = FullyVisible
| Invisible | Invisible
deriving (Eq, Ord, Enum, Read, Show, Bounded, Generic, Flat) deriving (Eq, Ord, Enum, Read, Show, Bounded, Generic, Flat)
instance Binary CamouflageStatus $($(derive [d| instance Deriving (Store CamouflageStatus) |]))
deriveJSON defaultOptions ''CamouflageStatus deriveJSON defaultOptions ''CamouflageStatus
+5 -3
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Cloud where module Dodge.Data.Cloud where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -17,7 +19,6 @@ 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, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CloudDraw
data Cloud = Cloud data Cloud = Cloud
{ _clPos :: Point3 { _clPos :: Point3
@@ -29,15 +30,16 @@ data Cloud = Cloud
, _clType :: CloudType , _clType :: CloudType
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Cloud
data CloudType data CloudType
= SmokeCloud = SmokeCloud
| GasCloud | GasCloud
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CloudType
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 CloudType) |]))
$($(derive [d| instance Deriving (Store CloudDraw) |]))
$($(derive [d| instance Deriving (Store Cloud ) |]))
+5 -2
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Corpse where module Dodge.Data.Corpse where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -15,8 +17,9 @@ import Geometry.Data
import ShapePicture.Data import ShapePicture.Data
data CorpseResurrection = NoResurrection data CorpseResurrection = NoResurrection
| HackCorpseResurrection
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CorpseResurrection $($(derive [d| instance Deriving (Store CorpseResurrection ) |]))
data Corpse = Corpse data Corpse = Corpse
{ _cpID :: Int { _cpID :: Int
@@ -26,7 +29,7 @@ data Corpse = Corpse
, _cpRes :: CorpseResurrection , _cpRes :: CorpseResurrection
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Corpse $($(derive [d| instance Deriving (Store Corpse ) |]))
makeLenses ''Corpse makeLenses ''Corpse
deriveJSON defaultOptions ''CorpseResurrection deriveJSON defaultOptions ''CorpseResurrection
+5 -2
View File
@@ -5,6 +5,8 @@
module Dodge.Data.CrGroupParams where module Dodge.Data.CrGroupParams where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -21,12 +23,13 @@ data CrGroupParams = CrGroupParams
, _crGroupUpdate :: CrGroupUpdate --World -> CrGroupParams -> Maybe CrGroupParams , _crGroupUpdate :: CrGroupUpdate --World -> CrGroupParams -> Maybe CrGroupParams
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrGroupParams
data CrGroupUpdate = DefaultCrGroupUpdate data CrGroupUpdate = DefaultCrGroupUpdate
| HackCrGroupUpdate
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrGroupUpdate
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 ) |]))
+3 -2
View File
@@ -5,6 +5,8 @@
module Dodge.Data.CrWlID where module Dodge.Data.CrWlID where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -15,8 +17,7 @@ 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, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrWlID $($(derive [d| instance Deriving (Store CrWlID ) |]))
makeLenses ''CrWlID makeLenses ''CrWlID
deriveJSON defaultOptions ''CrWlID deriveJSON defaultOptions ''CrWlID
$($(derive [d| instance Deriving (Store CrWlID) |]))
+6 -3
View File
@@ -17,6 +17,8 @@ module Dodge.Data.Creature (
module Dodge.Data.Hammer, module Dodge.Data.Hammer,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -77,11 +79,10 @@ data Creature = Creature
, _crCamouflage :: CamouflageStatus , _crCamouflage :: CamouflageStatus
} }
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary Creature
data CreatureCorpse = MakeDefaultCorpse data CreatureCorpse = MakeDefaultCorpse
| HackCreatureCorpse
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CreatureCorpse
data Intention = Intention data Intention = Intention
{ _targetCr :: Maybe Creature { _targetCr :: Maybe Creature
@@ -89,7 +90,6 @@ data Intention = Intention
, _viewPoint :: Maybe Point2 , _viewPoint :: Maybe Point2
} }
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary Intention
crSel :: Creature -> Int crSel :: Creature -> Int
crSel = _iselPos . _crInvSel crSel = _iselPos . _crInvSel
@@ -99,3 +99,6 @@ makeLenses ''Intention
deriveJSON defaultOptions ''Creature deriveJSON defaultOptions ''Creature
deriveJSON defaultOptions ''CreatureCorpse deriveJSON defaultOptions ''CreatureCorpse
deriveJSON defaultOptions ''Intention deriveJSON defaultOptions ''Intention
$($(derive [d| instance Deriving (Store Intention ) |]))
$($(derive [d| instance Deriving (Store Creature ) |]))
$($(derive [d| instance Deriving (Store CreatureCorpse ) |]))
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Creature.Memory where module Dodge.Data.Creature.Memory where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -18,7 +20,7 @@ data Memory = Memory
, _nodesSearched :: [Int] , _nodesSearched :: [Int]
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Memory $($(derive [d| instance Deriving (Store Memory ) |]))
makeLenses ''Memory makeLenses ''Memory
deriveJSON defaultOptions ''Memory deriveJSON defaultOptions ''Memory
+8 -6
View File
@@ -8,6 +8,8 @@ module Dodge.Data.Creature.Misc (
module Dodge.Data.CamouflageStatus, module Dodge.Data.CamouflageStatus,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -25,7 +27,6 @@ data CreatureStatistics = CreatureStatistics
, _intelligence :: Int , _intelligence :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CreatureStatistics
data Vocalization data Vocalization
= Mute = Mute
@@ -36,7 +37,6 @@ data Vocalization
, _vcCoolDown :: Int , _vcCoolDown :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Vocalization
data CrMvType data CrMvType
= NoMvType = NoMvType
@@ -48,7 +48,6 @@ data CrMvType
, _mvAimSpeed :: FloatFloat , _mvAimSpeed :: FloatFloat
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrMvType
data HumanoidAI data HumanoidAI
= YourAI = YourAI
@@ -65,7 +64,6 @@ data HumanoidAI
| LongAI | LongAI
| MultGunAI | MultGunAI
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary HumanoidAI
data CreatureType data CreatureType
= Humanoid = Humanoid
@@ -78,11 +76,9 @@ data CreatureType
| Lampoid {_lampHeight :: Float, _lampColor :: Point3, _lampLSID :: Maybe Int} | Lampoid {_lampHeight :: Float, _lampColor :: Point3, _lampLSID :: Maybe Int}
| NonDrawnCreature | NonDrawnCreature
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CreatureType
data BarrelType = PlainBarrel | ExplosiveBarrel data BarrelType = PlainBarrel | ExplosiveBarrel
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary BarrelType
makeLenses ''CreatureStatistics makeLenses ''CreatureStatistics
makeLenses ''Vocalization makeLenses ''Vocalization
@@ -94,3 +90,9 @@ deriveJSON defaultOptions ''CrMvType
deriveJSON defaultOptions ''HumanoidAI deriveJSON defaultOptions ''HumanoidAI
deriveJSON defaultOptions ''CreatureType deriveJSON defaultOptions ''CreatureType
deriveJSON defaultOptions ''BarrelType deriveJSON defaultOptions ''BarrelType
$($(derive [d| instance Deriving (Store CrMvType) |]))
$($(derive [d| instance Deriving (Store HumanoidAI) |]))
$($(derive [d| instance Deriving (Store CreatureType) |]))
$($(derive [d| instance Deriving (Store BarrelType ) |]))
$($(derive [d| instance Deriving (Store CreatureStatistics ) |]))
$($(derive [d| instance Deriving (Store Vocalization) |]))
+8 -6
View File
@@ -23,6 +23,8 @@ module Dodge.Data.Creature.Perception (
auDist, auDist,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -39,20 +41,17 @@ data Perception = Perception
, _cpAudition :: Audition , _cpAudition :: Audition
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Perception
data Vision = Eyes data Vision = Eyes
{ _viFOV :: FloatFloat { _viFOV :: FloatFloat
, _viDist :: FloatFloat , _viDist :: FloatFloat
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Vision
newtype Audition = Ears newtype Audition = Ears
{ _auDist :: FloatFloat { _auDist :: FloatFloat
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Audition
data Vigilance data Vigilance
= Comatose = Comatose
@@ -61,19 +60,17 @@ data Vigilance
| Vigilant | Vigilant
| Overstrung | Overstrung
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Vigilance
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, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Attention
data Awareness data Awareness
= Suspicious Float = Suspicious Float
| Cognizant Float | Cognizant Float
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Awareness $($(derive [d| instance Deriving (Store Awareness) |]))
makeLenses ''Perception makeLenses ''Perception
makeLenses ''Vision makeLenses ''Vision
@@ -85,3 +82,8 @@ 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) |]))
+6 -4
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Creature.Stance where module Dodge.Data.Creature.Stance where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -19,7 +21,6 @@ data Stance = Stance
, _strideLength :: Int , _strideLength :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Stance
data Carriage data Carriage
= Walking = Walking
@@ -31,7 +32,6 @@ data Carriage
| Flying | Flying
| Boosting Point2 | Boosting Point2
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Carriage
data FootForward data FootForward
= LeftForward = LeftForward
@@ -39,13 +39,12 @@ data FootForward
| WasLeftForward | WasLeftForward
| WasRightForward | WasRightForward
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary FootForward
data Posture data Posture
= Aiming = Aiming
| AtEase | AtEase
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Posture $($(derive [d| instance Deriving (Store Posture) |]))
makeLenses ''Stance makeLenses ''Stance
makeLenses ''Carriage makeLenses ''Carriage
@@ -54,3 +53,6 @@ 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) |]))
+7 -5
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Creature.State where module Dodge.Data.Creature.State where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -21,20 +23,17 @@ data CreatureState = CrSt
, _csDropsOnDeath :: CreatureDropType , _csDropsOnDeath :: CreatureDropType
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CreatureState
data CreatureDropType data CreatureDropType
= DropAll = DropAll
| DropAmount Int | DropAmount Int
| DropSpecific [Int] | DropSpecific [Int]
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CreatureDropType
data CrSpState data CrSpState
= Barrel {_piercedPoints :: [Point2]} = Barrel {_piercedPoints :: [Point2]}
| GenCr | GenCr
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrSpState
data Faction data Faction
= GenericFaction Int = GenericFaction Int
@@ -46,7 +45,6 @@ data Faction
| ColorFaction Color | ColorFaction Color
| PlayerFaction | PlayerFaction
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Faction
data CrGroup data CrGroup
= LoneWolf = LoneWolf
@@ -57,7 +55,6 @@ data CrGroup
| CrGroupID {_crGroupID :: Int} | CrGroupID {_crGroupID :: Int}
| ShieldGroup | ShieldGroup
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrGroup
makeLenses ''CreatureState makeLenses ''CreatureState
makeLenses ''CrSpState makeLenses ''CrSpState
@@ -67,3 +64,8 @@ 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) |]))
+23 -13
View File
@@ -5,36 +5,41 @@
module Dodge.Data.CreatureEffect where module Dodge.Data.CreatureEffect where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
data WdCrCr = NoCreatureEffect data WdCrCr = NoCreatureEffect
| HackWdCrCr
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary WdCrCr
data CrWdImp = NoCrWdImp data CrWdImp = NoCrWdImp
| HackCrWdImp
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrWdImp $($(derive [d| instance Deriving (Store CrWdImp ) |]))
data CrWdWd = CrWdWdId data CrWdWd = CrWdWdId
| HackCrWdWd
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrWdWd $($(derive [d| instance Deriving (Store CrWdWd ) |]))
data IntImp = NoIntImp data IntImp = NoIntImp
| HackNoIntImp
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary IntImp $($(derive [d| instance Deriving (Store IntImp ) |]))
data CrImp data CrImp
= NoCrImp = NoCrImp
| TurnTowardCr Float -- turn amount | TurnTowardCr Float -- turn amount
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrImp $($(derive [d| instance Deriving (Store CrImp) |]))
data P2Imp = P2ImpNo data P2Imp = P2ImpNo
| HackP2ImpNo
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary P2Imp
data WdCrBl data WdCrBl
= WdCrTrue = WdCrTrue
@@ -43,7 +48,6 @@ data WdCrBl
| WdCrLOSTarget | WdCrLOSTarget
| WdCrSafeDistFromTarget Float | WdCrSafeDistFromTarget Float
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary WdCrBl
data CrBl data CrBl
= CrCanShoot = CrCanShoot
@@ -51,32 +55,35 @@ data CrBl
| CrIsAiming | CrIsAiming
| CrIsAnimate | CrIsAnimate
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrBl $($(derive [d| instance Deriving (Store CrBl) |]))
data MCrAc = MCrNoAction data MCrAc = MCrNoAction
| HackMCrAc
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary MCrAc $($(derive [d| instance Deriving (Store MCrAc ) |]))
data CrAc data CrAc
= CrTurnAround = CrTurnAround
| CrFleeFromTarget | CrFleeFromTarget
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrAc $($(derive [d| instance Deriving (Store CrAc) |]))
data P2Ac = P2NoAction data P2Ac = P2NoAction
| HackP2Ac
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary P2Ac $($(derive [d| instance Deriving (Store P2Ac ) |]))
data MP2Ac = MP2NoAction data MP2Ac = MP2NoAction
| HackMP2Ac
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary MP2Ac $($(derive [d| instance Deriving (Store MP2Ac ) |]))
data CrWdAc data CrWdAc
= CrWdBFSThenReturn Int = CrWdBFSThenReturn Int
| ChooseMovementSpreadGun | ChooseMovementSpreadGun
| ChooseMovementLtAuto | ChooseMovementLtAuto
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CrWdAc $($(derive [d| instance Deriving (Store CrWdAc) |]))
deriveJSON defaultOptions ''WdCrCr deriveJSON defaultOptions ''WdCrCr
deriveJSON defaultOptions ''CrWdImp deriveJSON defaultOptions ''CrWdImp
@@ -91,3 +98,6 @@ 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 P2Imp ) |]))
$($(derive [d| instance Deriving (Store WdCrBl) |]))
$($(derive [d| instance Deriving (Store WdCrCr ) |]))
+4 -2
View File
@@ -12,6 +12,8 @@ module Dodge.Data.Damage (
module Dodge.Data.Damage.Type, module Dodge.Data.Damage.Type,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -31,7 +33,7 @@ data DamageEffect
| PushBackDamage {_dePushBack :: Float} | PushBackDamage {_dePushBack :: Float}
| NoDamageEffect | NoDamageEffect
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary DamageEffect $($(derive [d| instance Deriving (Store DamageEffect) |]))
data Damage = Damage data Damage = Damage
{ _dmType :: DamageType { _dmType :: DamageType
@@ -42,7 +44,7 @@ data Damage = Damage
, _dmEffect :: DamageEffect , _dmEffect :: DamageEffect
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Damage $($(derive [d| instance Deriving (Store Damage ) |]))
isElectrical :: Damage -> Bool isElectrical :: Damage -> Bool
isElectrical dm = case _dmType dm of isElectrical dm = case _dmType dm of
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Damage.Type where module Dodge.Data.Damage.Type where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -27,7 +29,7 @@ data DamageType
| POISONDAM | POISONDAM
| ENTERREMENT | ENTERREMENT
deriving (Eq, Ord, Show, Read, Enum, Bounded, Generic, Flat) deriving (Eq, Ord, Show, Read, Enum, Bounded, Generic, Flat)
instance Binary DamageType $($(derive [d| instance Deriving (Store DamageType) |]))
instance ToJSONKey DamageType instance ToJSONKey DamageType
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Distortion where module Dodge.Data.Distortion where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Geometry import Geometry
@@ -15,6 +17,6 @@ import Data.Aeson.TH
data Distortion data Distortion
= RadialDistortion Point2 Point2 Point2 Float = RadialDistortion Point2 Point2 Point2 Float
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Distortion $($(derive [d| instance Deriving (Store Distortion) |]))
deriveJSON defaultOptions ''Distortion deriveJSON defaultOptions ''Distortion
+5 -3
View File
@@ -10,6 +10,8 @@ module Dodge.Data.Door (
module Dodge.Data.WorldEffect, module Dodge.Data.WorldEffect,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -24,14 +26,14 @@ import Geometry.Data
data DoorStatus = DoorOpen | DoorClosed | DoorHalfway | DoorInt Int data DoorStatus = DoorOpen | DoorClosed | DoorHalfway | DoorInt Int
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary DoorStatus $($(derive [d| instance Deriving (Store DoorStatus ) |]))
data PushSource data PushSource
= PushesItself = PushesItself
| PushedBy Int | PushedBy Int
| NotPushed | NotPushed
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary PushSource $($(derive [d| instance Deriving (Store PushSource) |]))
data Door = Door data Door = Door
{ _drID :: Int { _drID :: Int
@@ -52,7 +54,7 @@ data Door = Door
, _drObstacleType :: EdgeObstacle , _drObstacleType :: EdgeObstacle
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Door $($(derive [d| instance Deriving (Store Door ) |]))
makeLenses ''Door makeLenses ''Door
deriveJSON defaultOptions ''DoorStatus deriveJSON defaultOptions ''DoorStatus
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.EnergyBall where module Dodge.Data.EnergyBall where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -25,7 +27,7 @@ data EnergyBall = EnergyBall
, _ebRot :: Float , _ebRot :: Float
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary EnergyBall $($(derive [d| instance Deriving (Store EnergyBall ) |]))
makeLenses ''EnergyBall makeLenses ''EnergyBall
deriveJSON defaultOptions ''EnergyBall deriveJSON defaultOptions ''EnergyBall
+4 -2
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Equipment.Misc where module Dodge.Data.Equipment.Misc where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -18,7 +20,7 @@ data EquipSite
| GoesOnLegs | GoesOnLegs
| GoesOnSpecial | GoesOnSpecial
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary EquipSite $($(derive [d| instance Deriving (Store EquipSite) |]))
data EquipPosition data EquipPosition
= OnHead = OnHead
@@ -29,7 +31,7 @@ data EquipPosition
| OnLegs | OnLegs
| OnSpecial | OnSpecial
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary EquipPosition $($(derive [d| instance Deriving (Store EquipPosition) |]))
instance ToJSONKey EquipPosition instance ToJSONKey EquipPosition
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Flame where module Dodge.Data.Flame where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -23,7 +25,7 @@ data Flame = Flame
, _flOriginalVel :: Point2 , _flOriginalVel :: Point2
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Flame $($(derive [d| instance Deriving (Store Flame ) |]))
makeLenses ''Flame makeLenses ''Flame
deriveJSON defaultOptions ''Flame deriveJSON defaultOptions ''Flame
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Flare where module Dodge.Data.Flare where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -28,7 +30,7 @@ data Flare
, _flareTime :: Int , _flareTime :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Flare $($(derive [d| instance Deriving (Store Flare) |]))
makeLenses ''Flare makeLenses ''Flare
deriveJSON defaultOptions ''Flare deriveJSON defaultOptions ''Flare
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.FloatFunction where module Dodge.Data.FloatFunction where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -17,6 +19,6 @@ data FloatFloat
| FloatAbsCheckGreaterLess Float Float Float | FloatAbsCheckGreaterLess Float Float Float
| FloatConst Float | FloatConst Float
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary FloatFloat $($(derive [d| instance Deriving (Store FloatFloat) |]))
deriveJSON defaultOptions ''FloatFloat deriveJSON defaultOptions ''FloatFloat
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.FloorItem where module Dodge.Data.FloorItem where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -16,7 +18,7 @@ import Geometry.Data
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, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary FloorItem $($(derive [d| instance Deriving (Store FloorItem ) |]))
makeLenses ''FloorItem makeLenses ''FloorItem
deriveJSON defaultOptions ''FloorItem deriveJSON defaultOptions ''FloorItem
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.ForegroundShape where module Dodge.Data.ForegroundShape where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -22,7 +24,7 @@ data ForegroundShape = ForegroundShape
, _fsSPic :: SPic , _fsSPic :: SPic
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ForegroundShape $($(derive [d| instance Deriving (Store ForegroundShape ) |]))
makeLenses ''ForegroundShape makeLenses ''ForegroundShape
deriveJSON defaultOptions ''ForegroundShape deriveJSON defaultOptions ''ForegroundShape
+4 -2
View File
@@ -5,6 +5,8 @@
module Dodge.Data.GenParams where module Dodge.Data.GenParams where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -18,12 +20,12 @@ newtype GenParams = GenParams
{ _sensorCoding :: M.Map DamageType (PaletteColor, DecorationShape) { _sensorCoding :: M.Map DamageType (PaletteColor, DecorationShape)
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary GenParams
data DecorationShape = PLUS | SQUARE | CIRCLE | THREELINES data DecorationShape = PLUS | SQUARE | CIRCLE | THREELINES
deriving (Eq, Ord, Enum, Show, Read, Generic, Flat) deriving (Eq, Ord, Enum, Show, Read, Generic, Flat)
instance Binary DecorationShape
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 ) |]))
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Gust where module Dodge.Data.Gust where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -20,7 +22,7 @@ data Gust = Gust
, _guTime :: Int , _guTime :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Gust $($(derive [d| instance Deriving (Store Gust ) |]))
makeLenses ''Gust makeLenses ''Gust
deriveJSON defaultOptions ''Gust deriveJSON defaultOptions ''Gust
+5 -3
View File
@@ -5,6 +5,8 @@
module Dodge.Data.HUD where module Dodge.Data.HUD where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -17,7 +19,6 @@ data HUDElement
= DisplayInventory {_subInventory :: SubInventory} = DisplayInventory {_subInventory :: SubInventory}
| DisplayCarte | DisplayCarte
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary HUDElement
data SubInventory data SubInventory
= NoSubInventory = NoSubInventory
@@ -27,7 +28,7 @@ data SubInventory
| LockedInventory | LockedInventory
| DisplayTerminal {_termID :: Int} | DisplayTerminal {_termID :: Int}
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary SubInventory $($(derive [d| instance Deriving (Store SubInventory) |]))
data HUD = HUD data HUD = HUD
{ _hudElement :: HUDElement { _hudElement :: HUDElement
@@ -36,7 +37,7 @@ data HUD = HUD
, _carteRot :: Float , _carteRot :: Float
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary HUD $($(derive [d| instance Deriving (Store HUD ) |]))
makeLenses ''HUD makeLenses ''HUD
makeLenses ''HUDElement makeLenses ''HUDElement
@@ -44,3 +45,4 @@ 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) |]))
+4 -2
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Hammer where module Dodge.Data.Hammer where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -15,15 +17,15 @@ data HammerType
= NoHammer = NoHammer
| HasHammer {_hammerPosition :: HammerPosition} | HasHammer {_hammerPosition :: HammerPosition}
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary HammerType
data HammerPosition data HammerPosition
= HammerDown = HammerDown
| HammerReleased | HammerReleased
| HammerUp | HammerUp
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary HammerPosition $($(derive [d| instance Deriving (Store HammerPosition) |]))
makeLenses ''HammerType makeLenses ''HammerType
deriveJSON defaultOptions ''HammerType deriveJSON defaultOptions ''HammerType
deriveJSON defaultOptions ''HammerPosition deriveJSON defaultOptions ''HammerPosition
$($(derive [d| instance Deriving (Store HammerType) |]))
+3 -1
View File
@@ -17,6 +17,8 @@ module Dodge.Data.Item (
module Dodge.Data.Item.Location, module Dodge.Data.Item.Location,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -52,7 +54,7 @@ data Item = Item
, _itParams :: ItemParams , _itParams :: ItemParams
} }
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary Item $($(derive [d| instance Deriving (Store Item ) |]))
_itUseAimStance :: Item -> AimStance _itUseAimStance :: Item -> AimStance
_itUseAimStance = _aimStance . _heldAim . _itUse _itUseAimStance = _aimStance . _heldAim . _itUse
+13 -11
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Item.Combine where module Dodge.Data.Item.Combine where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -20,11 +22,9 @@ data ItemType = ItemType
, _iyStack :: Stack , _iyStack :: Stack
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ItemType
data Stack = NoStack | Stack ItAmount data Stack = NoStack | Stack ItAmount
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Stack
data CraftType data CraftType
= PIPE = PIPE
@@ -74,7 +74,6 @@ data CraftType
| SIZEMODULE | SIZEMODULE
| GRAVITYMODULE | GRAVITYMODULE
deriving (Eq, Ord, Show, Enum, Read, Generic, Flat) deriving (Eq, Ord, Show, Enum, Read, Generic, Flat)
instance Binary CraftType
data ItemBaseType data ItemBaseType
= NoItemType = NoItemType
@@ -84,13 +83,11 @@ data ItemBaseType
| Consumable {_ibtConsumable :: ConsumableItemType} | Consumable {_ibtConsumable :: ConsumableItemType}
| CRAFT CraftType | CRAFT CraftType
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ItemBaseType
data ConsumableItemType data ConsumableItemType
= MEDKIT Int = MEDKIT Int
| EXPLOSIVES | EXPLOSIVES
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ConsumableItemType
data EquipItemType data EquipItemType
= MAGSHIELD = MAGSHIELD
@@ -107,7 +104,6 @@ data EquipItemType
| JETPACK | JETPACK
| AUTODETECTOR Detector | AUTODETECTOR Detector
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary EquipItemType
data LeftItemType data LeftItemType
= BOOSTER = BOOSTER
@@ -117,7 +113,6 @@ data LeftItemType
| SHRINKER | SHRINKER
| SPAWNER | SPAWNER
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LeftItemType
data HeldItemType data HeldItemType
= BANGSTICK {_xNum :: Int} = BANGSTICK {_xNum :: Int}
@@ -166,7 +161,6 @@ data HeldItemType
| FLATSHIELD | FLATSHIELD
| KEYCARD Int | KEYCARD Int
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary HeldItemType
data ItemModuleType data ItemModuleType
= EMPTYMODULE = EMPTYMODULE
@@ -192,14 +186,12 @@ data ItemModuleType
| EXTRABATTERY | EXTRABATTERY
| ATTACHTORCH | ATTACHTORCH
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ItemModuleType
data Detector data Detector
= ITEMDETECTOR = ITEMDETECTOR
| CREATUREDETECTOR | CREATUREDETECTOR
| WALLDETECTOR | WALLDETECTOR
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Detector
data ModuleSlot data ModuleSlot
= ModBullet = ModBullet
@@ -214,7 +206,6 @@ data ModuleSlot
| ModDualBeam | ModDualBeam
| ModHeldAttach | ModHeldAttach
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ModuleSlot
instance ToJSONKey ModuleSlot instance ToJSONKey ModuleSlot
@@ -234,3 +225,14 @@ 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) |]))
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Item.CurseStatus where module Dodge.Data.Item.CurseStatus where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -15,6 +17,6 @@ data CurseStatus
| UndroppableIdentified | UndroppableIdentified
| UndroppableUnidentified | UndroppableUnidentified
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CurseStatus $($(derive [d| instance Deriving (Store CurseStatus) |]))
deriveJSON defaultOptions ''CurseStatus deriveJSON defaultOptions ''CurseStatus
+8 -4
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Item.Effect where module Dodge.Data.Item.Effect where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -19,7 +21,6 @@ data ItEffect = ItEffect
, _ieOnStash :: ItInvEffect , _ieOnStash :: ItInvEffect
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ItEffect
data ItInvEffect data ItInvEffect
= NoInvEffect = NoInvEffect
@@ -30,18 +31,21 @@ data ItInvEffect
| RemoveShieldWall | RemoveShieldWall
| EffectWhileHeld ItInvEffect | EffectWhileHeld ItInvEffect
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ItInvEffect $($(derive [d| instance Deriving (Store ItInvEffect) |]))
data ItFloorEffect = NoFloorEffect data ItFloorEffect = NoFloorEffect
| HackItFloorEffect
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ItFloorEffect
data ItDropEffect = NoDropEffect data ItDropEffect = NoDropEffect
| HackItDropEffect
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ItDropEffect
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 ItDropEffect ) |]))
$($(derive [d| instance Deriving (Store ItFloorEffect ) |]))
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Item.HeldDelay where module Dodge.Data.Item.HeldDelay where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -28,7 +30,7 @@ data UseDelay -- should just be Delay
, _warmMax :: Int , _warmMax :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary UseDelay $($(derive [d| instance Deriving (Store UseDelay ) |]))
makeLenses ''UseDelay makeLenses ''UseDelay
deriveJSON defaultOptions ''UseDelay deriveJSON defaultOptions ''UseDelay
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Item.HeldScroll where module Dodge.Data.Item.HeldScroll where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -22,7 +24,7 @@ data HeldScroll
, _hsMaxInt :: Int , _hsMaxInt :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary HeldScroll $($(derive [d| instance Deriving (Store HeldScroll) |]))
makeLenses ''HeldScroll makeLenses ''HeldScroll
deriveJSON defaultOptions ''HeldScroll deriveJSON defaultOptions ''HeldScroll
+7 -5
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Item.HeldUse where module Dodge.Data.Item.HeldUse where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -29,13 +31,13 @@ data HeldUse
| HeldForceField | HeldForceField
| HeldShatter | HeldShatter
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary HeldUse $($(derive [d| instance Deriving (Store HeldUse) |]))
data Cuse data Cuse
= CDoNothing = CDoNothing
| CHeal Int | CHeal Int
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Cuse $($(derive [d| instance Deriving (Store Cuse) |]))
data Euse data Euse
= EDoNothing = EDoNothing
@@ -47,7 +49,7 @@ data Euse
| EonWristShield | EonWristShield
| EoffWristShield | EoffWristShield
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Euse $($(derive [d| instance Deriving (Store Euse) |]))
data Luse data Luse
= LDoNothing = LDoNothing
@@ -57,7 +59,7 @@ data Luse
| LUnsafeBlink | LUnsafeBlink
| LBoost | LBoost
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Luse $($(derive [d| instance Deriving (Store Luse) |]))
data HeldMod data HeldMod
= HeldModNothing = HeldModNothing
@@ -96,7 +98,7 @@ data HeldMod
| RevolverXRepeatMod | RevolverXRepeatMod
| BangConeMod | BangConeMod
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary HeldMod $($(derive [d| instance Deriving (Store HeldMod) |]))
deriveJSON defaultOptions ''Cuse deriveJSON defaultOptions ''Cuse
deriveJSON defaultOptions ''HeldMod deriveJSON defaultOptions ''HeldMod
+3 -1
View File
@@ -4,6 +4,8 @@
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Location where module Dodge.Data.Item.Location where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -16,7 +18,7 @@ data ItemLocation
| OnFloor {_ipFlID :: Int} | OnFloor {_ipFlID :: Int}
| InVoid | InVoid
deriving (Eq, Show, Read, Ord, Generic, Flat) deriving (Eq, Show, Read, Ord, Generic, Flat)
instance Binary ItemLocation $($(derive [d| instance Deriving (Store ItemLocation) |]))
makeLenses ''ItemLocation makeLenses ''ItemLocation
deriveJSON defaultOptions ''ItemLocation deriveJSON defaultOptions ''ItemLocation
+6 -4
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Item.Misc where module Dodge.Data.Item.Misc where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -19,7 +21,7 @@ data ItemDimension = ItemDimension
, _dimAttachPos :: Point3 , _dimAttachPos :: Point3
} }
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary ItemDimension $($(derive [d| instance Deriving (Store ItemDimension ) |]))
data ItemPortage data ItemPortage
= HeldItem = HeldItem
@@ -29,18 +31,18 @@ data ItemPortage
| WornItem | WornItem
| NoPortage | NoPortage
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary ItemPortage $($(derive [d| instance Deriving (Store ItemPortage) |]))
--data ItemValue = ItemValue --data ItemValue = ItemValue
-- { _ivInt :: Int -- { _ivInt :: Int
-- , _ivType :: ItemValueType -- , _ivType :: ItemValueType
-- } -- }
-- deriving (Eq, Show, Read, Generic, Flat) -- deriving (Eq, Show, Read, Generic, Flat)
-- instance Binary ItemValue -- $($(derive [d| instance Deriving (Store ItemValue ) |]))
-- --
--data ItemValueType = MundaneItem | ArtefactItem --data ItemValueType = MundaneItem | ArtefactItem
-- deriving (Eq, Show, Read, Generic, Flat) -- deriving (Eq, Show, Read, Generic, Flat)
-- instance Binary ItemValueType -- $($(derive [d| instance Deriving (Store ItemValueType ) |]))
makeLenses ''ItemDimension makeLenses ''ItemDimension
makeLenses ''ItemPortage makeLenses ''ItemPortage
+8 -6
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Item.Params where module Dodge.Data.Item.Params where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -71,15 +73,12 @@ data ItemParams
| ParamMID {_paramMID :: Maybe Int} | ParamMID {_paramMID :: Maybe Int}
| BoostPropIX {_boostPropIX :: Maybe Int} | BoostPropIX {_boostPropIX :: Maybe Int}
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ItemParams
data ShrinkGunStatus = FullSize | Shrunk data ShrinkGunStatus = FullSize | Shrunk
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ShrinkGunStatus
data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary PreviousArcEffect
data GunBarrels data GunBarrels
= MultiBarrel = MultiBarrel
@@ -93,7 +92,6 @@ data GunBarrels
} }
| SingleBarrel {_brlInaccuracy :: Float} | SingleBarrel {_brlInaccuracy :: Float}
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary GunBarrels
data Nozzle = Nozzle data Nozzle = Nozzle
{ _nzPressure :: Float { _nzPressure :: Float
@@ -104,14 +102,12 @@ data Nozzle = Nozzle
, _nzLength :: Float , _nzLength :: Float
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Nozzle
data BarrelSpread data BarrelSpread
= AlignedBarrels = AlignedBarrels
| SpreadBarrels {_spreadAngle :: Float} | SpreadBarrels {_spreadAngle :: Float}
| RotatingBarrels {_rotatingBarrelInaccuracy :: Float} | RotatingBarrels {_rotatingBarrelInaccuracy :: Float}
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary BarrelSpread
makeLenses ''BarrelSpread makeLenses ''BarrelSpread
makeLenses ''ItemParams makeLenses ''ItemParams
@@ -123,3 +119,9 @@ 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 PreviousArcEffect ) |]))
$($(derive [d| instance Deriving (Store GunBarrels) |]))
$($(derive [d| instance Deriving (Store Nozzle ) |]))
$($(derive [d| instance Deriving (Store BarrelSpread) |]))
$($(derive [d| instance Deriving (Store ItemParams) |]))
$($(derive [d| instance Deriving (Store ShrinkGunStatus ) |]))
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Item.Scope where module Dodge.Data.Item.Scope where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -32,7 +34,7 @@ data Scope
_scopeIsCamera :: Bool _scopeIsCamera :: Bool
} }
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary Scope $($(derive [d| instance Deriving (Store Scope) |]))
makeLenses ''Scope makeLenses ''Scope
deriveJSON defaultOptions ''Scope deriveJSON defaultOptions ''Scope
+5 -3
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Item.Targeting where module Dodge.Data.Item.Targeting where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -23,7 +25,6 @@ data Targeting
, _tgActive :: Bool , _tgActive :: Bool
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Targeting
data TargetUpdate data TargetUpdate
= NoTargetUpdate = NoTargetUpdate
@@ -32,7 +33,6 @@ data TargetUpdate
| TargetRBCreatureUpdate | TargetRBCreatureUpdate
| TargetCursorUpdate | TargetCursorUpdate
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TargetUpdate
data TargetDraw data TargetDraw
= NoTargetDraw = NoTargetDraw
@@ -40,9 +40,11 @@ data TargetDraw
| SimpleDrawTarget | SimpleDrawTarget
| TargetRBCreatureDraw | TargetRBCreatureDraw
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TargetDraw
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 TargetDraw) |]))
$($(derive [d| instance Deriving (Store TargetUpdate) |]))
+5 -3
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Item.Tweak where module Dodge.Data.Item.Tweak where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -18,7 +20,6 @@ data ItemTweaks
{ _tweakParams :: IM.IntMap TweakParam { _tweakParams :: IM.IntMap TweakParam
} }
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary ItemTweaks
data TweakType data TweakType
= TweakPhaseV = TweakPhaseV
@@ -27,7 +28,6 @@ data TweakType
| TweakSpinAmount | TweakSpinAmount
| TweakThrustDelay | TweakThrustDelay
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary TweakType
data TweakParam = TweakParam data TweakParam = TweakParam
{ _tweakType :: TweakType -- Int -> Item -> Item { _tweakType :: TweakType -- Int -> Item -> Item
@@ -35,10 +35,12 @@ data TweakParam = TweakParam
, _tweakMax :: Int , _tweakMax :: Int
} }
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary TweakParam $($(derive [d| instance Deriving (Store TweakParam ) |]))
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) |]))
+6 -4
View File
@@ -13,6 +13,8 @@ module Dodge.Data.Item.Use (
module Dodge.Data.Hammer, module Dodge.Data.Hammer,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -52,7 +54,6 @@ data ItemUse
| CraftUse | CraftUse
{_useAmount :: ItAmount} {_useAmount :: ItAmount}
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary ItemUse
data AimParams = AimParams data AimParams = AimParams
{ _aimWeight :: Int { _aimWeight :: Int
@@ -63,7 +64,6 @@ data AimParams = AimParams
, _aimMuzPos :: Float , _aimMuzPos :: Float
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary AimParams
data AimStance data AimStance
= TwoHandTwist = TwoHandTwist
@@ -71,7 +71,6 @@ data AimStance
| OneHand | OneHand
| LeaveHolstered | LeaveHolstered
deriving (Eq, Show, Ord, Enum, Read, Generic, Flat) deriving (Eq, Show, Ord, Enum, Read, Generic, Flat)
instance Binary AimStance
data ItZoom = ItZoom data ItZoom = ItZoom
{ _itZoomMax :: Float { _itZoomMax :: Float
@@ -79,7 +78,6 @@ data ItZoom = ItZoom
, _itZoomFac :: Float , _itZoomFac :: Float
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ItZoom
makeLenses ''ItemUse makeLenses ''ItemUse
makeLenses ''AimParams makeLenses ''AimParams
@@ -88,3 +86,7 @@ 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 AimParams ) |]))
$($(derive [d| instance Deriving (Store AimStance) |]))
$($(derive [d| instance Deriving (Store ItZoom ) |]))
$($(derive [d| instance Deriving (Store ItemUse) |]))
+5 -3
View File
@@ -11,6 +11,8 @@ module Dodge.Data.Item.Use.Consumption (
module Dodge.Data.Item.Use.Consumption.LoadAction, module Dodge.Data.Item.Use.Consumption.LoadAction,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -30,7 +32,7 @@ data HeldConsumption
} }
| NoConsumption | NoConsumption
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary HeldConsumption $($(derive [d| instance Deriving (Store HeldConsumption) |]))
data LeftConsumption data LeftConsumption
= AutoRecharging = AutoRecharging
@@ -44,14 +46,14 @@ data LeftConsumption
, _wpCharge :: Int , _wpCharge :: Int
} }
deriving (Eq, Show, Read, Generic, Flat) deriving (Eq, Show, Read, Generic, Flat)
instance Binary LeftConsumption $($(derive [d| instance Deriving (Store LeftConsumption) |]))
newtype ItAmount = ItAmount {_getItAmount :: Int} newtype ItAmount = ItAmount {_getItAmount :: Int}
-- deriving (Eq, Ord, Read, Show, Num, Real, Generic, Flat) -- deriving (Eq, Ord, Read, Show, Num, Real, Generic, Flat)
deriving newtype (Eq, Ord, Read, Show, Num, Real, Enum, Integral) deriving newtype (Eq, Ord, Read, Show, Num, Real, Enum, Integral)
deriving stock (Generic) deriving stock (Generic)
deriving anyclass (Flat) deriving anyclass (Flat)
instance Binary ItAmount $($(derive [d| instance Deriving (Store ItAmount) |]))
makeLenses ''HeldConsumption makeLenses ''HeldConsumption
makeLenses ''LeftConsumption makeLenses ''LeftConsumption
+9 -6
View File
@@ -9,6 +9,8 @@ module Dodge.Data.Item.Use.Consumption.Ammo (
module Dodge.Data.Payload, module Dodge.Data.Payload,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -19,11 +21,9 @@ import Dodge.Data.Payload
data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat) deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
instance Binary ProjectileDraw
data ProjectileCreate = CreateShell | CreateTrackingShell data ProjectileCreate = CreateShell | CreateTrackingShell
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat) deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
instance Binary ProjectileCreate
data ProjectileUpdate data ProjectileUpdate
= PJThrust {_pjuStart :: Int, _pjuEnd :: Int} = PJThrust {_pjuStart :: Int, _pjuEnd :: Int}
@@ -37,7 +37,6 @@ data ProjectileUpdate
| PJShellCollisionCheck | PJShellCollisionCheck
| PJRemoteShellCollisionCheck | PJRemoteShellCollisionCheck
deriving (Show, Read, Eq, Ord, Generic, Flat) deriving (Show, Read, Eq, Ord, Generic, Flat)
instance Binary ProjectileUpdate
data AmmoType data AmmoType
= ProjectileAmmo = ProjectileAmmo
@@ -61,15 +60,13 @@ data AmmoType
} }
| GenericAmmo | GenericAmmo
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary AmmoType
data ForceFieldType = DefaultForceField data ForceFieldType = DefaultForceField
| HackForceFieldType
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ForceFieldType
data GasCreate = CreatePoisonGas | CreateFlame data GasCreate = CreatePoisonGas | CreateFlame
deriving (Eq, Ord, Show, Enum, Bounded, Read, Generic, Flat) deriving (Eq, Ord, Show, Enum, Bounded, Read, Generic, Flat)
instance Binary GasCreate
makeLenses ''ProjectileUpdate makeLenses ''ProjectileUpdate
makeLenses ''AmmoType makeLenses ''AmmoType
@@ -79,3 +76,9 @@ 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 AmmoType) |]))
$($(derive [d| instance Deriving (Store ProjectileDraw ) |]))
$($(derive [d| instance Deriving (Store ProjectileCreate ) |]))
$($(derive [d| instance Deriving (Store ProjectileUpdate) |]))
$($(derive [d| instance Deriving (Store ForceFieldType ) |]))
$($(derive [d| instance Deriving (Store GasCreate ) |]))
@@ -5,6 +5,8 @@
module Dodge.Data.Item.Use.Consumption.LoadAction where module Dodge.Data.Item.Use.Consumption.LoadAction where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -19,17 +21,14 @@ data LoadAction
| 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, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LoadAction
data InvSel = InvSel {_iselPos :: Int, _iselAction :: InvSelAction} data InvSel = InvSel {_iselPos :: Int, _iselAction :: InvSelAction}
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary InvSel
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, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary InvSelAction
makeLenses ''LoadAction makeLenses ''LoadAction
makeLenses ''InvSel makeLenses ''InvSel
@@ -37,3 +36,6 @@ 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 InvSelAction) |]))
$($(derive [d| instance Deriving (Store InvSel ) |]))
+4 -2
View File
@@ -8,6 +8,8 @@ module Dodge.Data.Item.Use.Equipment (
module Dodge.Data.Item.Use.Equipment, module Dodge.Data.Item.Use.Equipment,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -25,16 +27,16 @@ data EquipEffect = EquipEffect
, _eeViewDist :: Maybe Float , _eeViewDist :: Maybe Float
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary EquipEffect
data EquipParams data EquipParams
= NoEquipParams = NoEquipParams
| EquipID {_eparamID :: Int} | EquipID {_eparamID :: Int}
| EquipCounter {_eparamInt :: Int} | EquipCounter {_eparamInt :: Int}
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary EquipParams
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) |]))
+5 -3
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Laser where module Dodge.Data.Laser where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -17,7 +19,7 @@ data LaserType
= DamageLaser {_laserTypeDamage :: Int} = DamageLaser {_laserTypeDamage :: Int}
| TargetLaser | TargetLaser
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LaserType $($(derive [d| instance Deriving (Store LaserType) |]))
data LaserStart = LaserStart data LaserStart = LaserStart
{ _lpPhaseV :: Float { _lpPhaseV :: Float
@@ -27,7 +29,7 @@ data LaserStart = LaserStart
, _lpType :: LaserType , _lpType :: LaserType
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LaserStart $($(derive [d| instance Deriving (Store LaserStart ) |]))
data Laser = Laser data Laser = Laser
{ _laColor :: Color { _laColor :: Color
@@ -35,7 +37,7 @@ data Laser = Laser
, _laType :: LaserType , _laType :: LaserType
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Laser $($(derive [d| instance Deriving (Store Laser ) |]))
makeLenses ''Laser makeLenses ''Laser
makeLenses ''LaserStart makeLenses ''LaserStart
+9 -6
View File
@@ -5,6 +5,8 @@
module Dodge.Data.LightSource where module Dodge.Data.LightSource where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -14,21 +16,22 @@ import Data.Aeson.TH
import Geometry import Geometry
data LightSourceDraw = DefaultLightSourceDraw data LightSourceDraw = DefaultLightSourceDraw
| HackLightSourceDraw
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LightSourceDraw $($(derive [d| instance Deriving (Store LightSourceDraw ) |]))
data TLSIntensity data TLSIntensity
= ConstantIntensity = ConstantIntensity
| TLSFade Point3 Int | TLSFade Point3 Int
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TLSIntensity $($(derive [d| instance Deriving (Store TLSIntensity) |]))
data TLSUpdate data TLSUpdate
= DestroyTLS = DestroyTLS
| TimerTLS | TimerTLS
| IntensityTLS TLSIntensity | IntensityTLS TLSIntensity
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TLSUpdate $($(derive [d| instance Deriving (Store TLSUpdate) |]))
data LSParam = LSParam data LSParam = LSParam
{ _lsPos :: !Point3 { _lsPos :: !Point3
@@ -36,7 +39,7 @@ data LSParam = LSParam
, _lsCol :: !Point3 , _lsCol :: !Point3
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LSParam $($(derive [d| instance Deriving (Store LSParam ) |]))
data LightSource = LS data LightSource = LS
{ _lsID :: Int { _lsID :: Int
@@ -45,7 +48,7 @@ data LightSource = LS
, _lsPict :: LightSourceDraw --LightSource -> Picture , _lsPict :: LightSourceDraw --LightSource -> Picture
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LightSource $($(derive [d| instance Deriving (Store LightSource ) |]))
data TempLightSource = TLS data TempLightSource = TLS
{ _tlsParam :: LSParam { _tlsParam :: LSParam
@@ -53,7 +56,7 @@ data TempLightSource = TLS
, _tlsTime :: Int , _tlsTime :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TempLightSource $($(derive [d| instance Deriving (Store TempLightSource ) |]))
makeLenses ''LSParam makeLenses ''LSParam
makeLenses ''LightSource makeLenses ''LightSource
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.LinearShockwave where module Dodge.Data.LinearShockwave where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -20,7 +22,7 @@ data LinearShockwave = LinearShockwave
, _lwTimer :: Int , _lwTimer :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LinearShockwave $($(derive [d| instance Deriving (Store LinearShockwave ) |]))
makeLenses ''LinearShockwave makeLenses ''LinearShockwave
deriveJSON defaultOptions ''LinearShockwave deriveJSON defaultOptions ''LinearShockwave
+5 -3
View File
@@ -13,6 +13,8 @@ module Dodge.Data.Machine (
module Dodge.Data.GenParams, module Dodge.Data.GenParams,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -48,7 +50,6 @@ data Machine = Machine
} }
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary Machine
data MachineType data MachineType
= McStatic = McStatic
@@ -57,7 +58,6 @@ data MachineType
| McTurret Turret | McTurret Turret
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary MachineType
data Turret = Turret data Turret = Turret
{ _tuWeapon :: Item { _tuWeapon :: Item
@@ -67,7 +67,6 @@ data Turret = Turret
} }
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary Turret
makeLenses ''Machine makeLenses ''Machine
makeLenses ''Turret makeLenses ''Turret
@@ -75,3 +74,6 @@ 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 Turret ) |]))
$($(derive [d| instance Deriving (Store Machine ) |]))
$($(derive [d| instance Deriving (Store MachineType) |]))
+5 -3
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Machine.Sensor where module Dodge.Data.Machine.Sensor where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -31,21 +33,21 @@ data Sensor
, _sensToggle :: Bool , _sensToggle :: Bool
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Sensor
data ProximityRequirement data ProximityRequirement
= RequireHealth {_proxReqMinHealth :: Int} = RequireHealth {_proxReqMinHealth :: Int}
| RequireEquipment {_proxReqEquipment :: ItemBaseType} | RequireEquipment {_proxReqEquipment :: ItemBaseType}
| RequireImpossible | RequireImpossible
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ProximityRequirement
data CloseToggle = NotClose | IsClose data CloseToggle = NotClose | IsClose
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary CloseToggle
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 ) |]))
+5 -3
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Magnet where module Dodge.Data.Magnet where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -15,13 +17,13 @@ import Geometry.Data
newtype MagnetUpdate = MagnetUpdateTimer Int newtype MagnetUpdate = MagnetUpdateTimer Int
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary MagnetUpdate $($(derive [d| instance Deriving (Store MagnetUpdate) |]))
data MagnetBuBu data MagnetBuBu
= MagnetBuId = MagnetBuId
| MagnetBuBuCurveAroundField Float Float | MagnetBuBuCurveAroundField Float Float
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary MagnetBuBu $($(derive [d| instance Deriving (Store MagnetBuBu) |]))
data Magnet = Magnet data Magnet = Magnet
{ _mgID :: Int { _mgID :: Int
@@ -30,7 +32,7 @@ data Magnet = Magnet
, _mgField :: MagnetBuBu , _mgField :: MagnetBuBu
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Magnet $($(derive [d| instance Deriving (Store Magnet ) |]))
makeLenses ''Magnet makeLenses ''Magnet
deriveJSON defaultOptions ''MagnetUpdate deriveJSON defaultOptions ''MagnetUpdate
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Material where module Dodge.Data.Material where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -12,6 +14,6 @@ import Data.Aeson.TH
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, Generic, Flat) deriving (Eq, Ord, Show, Bounded, Enum, Read, Generic, Flat)
instance Binary Material $($(derive [d| instance Deriving (Store Material ) |]))
deriveJSON defaultOptions ''Material deriveJSON defaultOptions ''Material
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Modification where module Dodge.Data.Modification where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -30,7 +32,7 @@ data Modification
, _mdUpdate :: MdWdWd , _mdUpdate :: MdWdWd
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Modification $($(derive [d| instance Deriving (Store Modification) |]))
makeLenses ''Modification makeLenses ''Modification
deriveJSON defaultOptions ''Modification deriveJSON defaultOptions ''Modification
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.MountedObject where module Dodge.Data.MountedObject where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -14,6 +16,6 @@ data MountedObject
= MountedLS Int = MountedLS Int
| MountedProp Int | MountedProp Int
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary MountedObject $($(derive [d| instance Deriving (Store MountedObject) |]))
deriveJSON defaultOptions ''MountedObject deriveJSON defaultOptions ''MountedObject
+2 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.ObjectType where module Dodge.Data.ObjectType where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -25,7 +27,6 @@ data ObjectType
| ObTrigger | ObTrigger
| ObItem | ObItem
deriving (Eq, Show, Ord, Read, Enum, Bounded, Generic, Flat) deriving (Eq, Show, Ord, Read, Enum, Bounded, Generic, Flat)
instance Binary ObjectType
instance ToJSONKey ObjectType instance ToJSONKey ObjectType
+5 -2
View File
@@ -14,6 +14,8 @@ The warnings have been disabled.
-} -}
module Dodge.Data.PathGraph where module Dodge.Data.PathGraph where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -44,7 +46,6 @@ data PathEdge = PathEdge
, _peObstacles :: Set.Set EdgeObstacle , _peObstacles :: Set.Set EdgeObstacle
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary PathEdge
instance ToJSON PathEdge where instance ToJSON PathEdge where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
@@ -57,7 +58,7 @@ data EdgeObstacle
| AutoDoorObstacle | AutoDoorObstacle
| WallObstacle | WallObstacle
deriving (Eq, Ord, Show, Read, Bounded, Enum, Generic, Flat) deriving (Eq, Ord, Show, Read, Bounded, Enum, Generic, Flat)
instance Binary EdgeObstacle $($(derive [d| instance Deriving (Store EdgeObstacle) |]))
instance ToJSON EdgeObstacle where instance ToJSON EdgeObstacle where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
@@ -73,3 +74,5 @@ deriving instance (Flat (Gr Point2 PathEdge))
makeLenses ''PathGraph makeLenses ''PathGraph
makeLenses ''PathEdge makeLenses ''PathEdge
$($(derive [d| instance Deriving (Store PathEdge ) |]))
$($(derive [d| instance Deriving (Store (Gr Point2 PathEdge) ) |]))
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Payload where module Dodge.Data.Payload where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -12,6 +14,6 @@ import Data.Aeson.TH
data Payload = ExplosionPayload | DudPayload data Payload = ExplosionPayload | DudPayload
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat) deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
instance Binary Payload $($(derive [d| instance Deriving (Store Payload ) |]))
deriveJSON defaultOptions ''Payload deriveJSON defaultOptions ''Payload
+5 -2
View File
@@ -5,6 +5,8 @@
module Dodge.Data.PosEvent where module Dodge.Data.PosEvent where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -14,8 +16,9 @@ import Data.Aeson.TH
import Geometry.Data import Geometry.Data
data PosEventType = SparkSpawner data PosEventType = SparkSpawner
| HackSparkSpawner
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary PosEventType $($(derive [d| instance Deriving (Store PosEventType ) |]))
data PosEvent = PosEvent data PosEvent = PosEvent
{ _pvType :: PosEventType { _pvType :: PosEventType
@@ -23,7 +26,7 @@ data PosEvent = PosEvent
, _pvPos :: Point2 , _pvPos :: Point2
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary PosEvent $($(derive [d| instance Deriving (Store PosEvent ) |]))
makeLenses ''PosEvent makeLenses ''PosEvent
deriveJSON defaultOptions ''PosEventType deriveJSON defaultOptions ''PosEventType
+4 -2
View File
@@ -5,6 +5,8 @@
module Dodge.Data.PressPlate where module Dodge.Data.PressPlate where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -18,7 +20,7 @@ data PressPlateEvent
= PressPlateId = PressPlateId
| PPLevelReset | PPLevelReset
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary PressPlateEvent $($(derive [d| instance Deriving (Store PressPlateEvent) |]))
data PressPlate = PressPlate data PressPlate = PressPlate
{ _ppPict :: Picture { _ppPict :: Picture
@@ -29,7 +31,7 @@ data PressPlate = PressPlate
, _ppText :: String , _ppText :: String
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary PressPlate $($(derive [d| instance Deriving (Store PressPlate ) |]))
makeLenses ''PressPlate makeLenses ''PressPlate
deriveJSON defaultOptions ''PressPlateEvent deriveJSON defaultOptions ''PressPlateEvent
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Projectile where module Dodge.Data.Projectile where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -30,7 +32,7 @@ data Proj
, _prjMITID :: Maybe Int , _prjMITID :: Maybe Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Proj $($(derive [d| instance Deriving (Store Proj) |]))
makeLenses ''Proj makeLenses ''Proj
deriveJSON defaultOptions ''Proj deriveJSON defaultOptions ''Proj
+6 -4
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Prop where module Dodge.Data.Prop where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -41,7 +43,6 @@ data Prop
, _prToggle :: Bool , _prToggle :: Bool
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Prop
data PropDraw data PropDraw
= PropDrawSPic SPic = PropDrawSPic SPic
@@ -54,7 +55,6 @@ data PropDraw
| PropDrawToggle PropDraw | PropDrawToggle PropDraw
| PropDrawGib Float | PropDrawGib Float
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary PropDraw
data PropUpdate data PropUpdate
= PropUpdateAnd PropUpdate PropUpdate = PropUpdateAnd PropUpdate PropUpdate
@@ -69,17 +69,19 @@ data PropUpdate
| PropUpdateWhen WdBl PropUpdate | PropUpdateWhen WdBl PropUpdate
| PropUpdateIf WdBl PropUpdate PropUpdate | PropUpdateIf WdBl PropUpdate PropUpdate
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary PropUpdate
data PrWdLsLs data PrWdLsLs
= PrWdLsId = PrWdLsId
| PrWdLsSetPosition WdP2f Point3 | PrWdLsSetPosition WdP2f Point3
| PrWdLsSetColor Point3 | PrWdLsSetColor Point3
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary PrWdLsLs
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 Prop) |]))
$($(derive [d| instance Deriving (Store PropDraw) |]))
$($(derive [d| instance Deriving (Store PropUpdate) |]))
$($(derive [d| instance Deriving (Store PrWdLsLs) |]))
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.RadarBlip where module Dodge.Data.RadarBlip where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -22,7 +24,7 @@ data RadarBlip = RadarBlip
, _rbPos :: Point2 , _rbPos :: Point2
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary RadarBlip $($(derive [d| instance Deriving (Store RadarBlip ) |]))
makeLenses ''RadarBlip makeLenses ''RadarBlip
deriveJSON defaultOptions ''RadarBlip deriveJSON defaultOptions ''RadarBlip
+3 -1
View File
@@ -8,6 +8,8 @@ module Dodge.Data.RadarSweep (
module Dodge.Data.ObjectType, module Dodge.Data.ObjectType,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -24,7 +26,7 @@ data RadarSweep = RadarSweep
, _rsTimer :: Int , _rsTimer :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary RadarSweep $($(derive [d| instance Deriving (Store RadarSweep ) |]))
makeLenses ''RadarSweep makeLenses ''RadarSweep
deriveJSON defaultOptions ''RadarSweep deriveJSON defaultOptions ''RadarSweep
+5 -3
View File
@@ -5,6 +5,8 @@
module Dodge.Data.RightButtonOptions where module Dodge.Data.RightButtonOptions where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -22,7 +24,6 @@ data RightButtonOptions
, _opActivateEquipment :: ActivateEquipment , _opActivateEquipment :: ActivateEquipment
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary RightButtonOptions
data ActivateEquipment data ActivateEquipment
= ActivateEquipment {_activateEquipment :: Int} = ActivateEquipment {_activateEquipment :: Int}
@@ -30,7 +31,6 @@ data ActivateEquipment
| ActivateDeactivateEquipment {_activateEquipment :: Int, _deactivateEquipment :: Int} | ActivateDeactivateEquipment {_activateEquipment :: Int, _deactivateEquipment :: Int}
| NoChangeActivateEquipment | NoChangeActivateEquipment
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ActivateEquipment
data AllocateEquipment data AllocateEquipment
= DoNotMoveEquipment = DoNotMoveEquipment
@@ -54,7 +54,6 @@ data AllocateEquipment
{ _allocOldPos :: EquipPosition { _allocOldPos :: EquipPosition
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary AllocateEquipment
makeLenses ''RightButtonOptions makeLenses ''RightButtonOptions
makeLenses ''AllocateEquipment makeLenses ''AllocateEquipment
@@ -62,3 +61,6 @@ makeLenses ''ActivateEquipment
deriveJSON defaultOptions ''RightButtonOptions deriveJSON defaultOptions ''RightButtonOptions
deriveJSON defaultOptions ''ActivateEquipment deriveJSON defaultOptions ''ActivateEquipment
deriveJSON defaultOptions ''AllocateEquipment deriveJSON defaultOptions ''AllocateEquipment
$($(derive [d| instance Deriving (Store RightButtonOptions) |]))
$($(derive [d| instance Deriving (Store ActivateEquipment) |]))
$($(derive [d| instance Deriving (Store AllocateEquipment) |]))
+3 -1
View File
@@ -4,6 +4,8 @@
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.SaveSlot where module Dodge.Data.SaveSlot where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -13,6 +15,6 @@ data SaveSlot
| LevelStartSlot Int | LevelStartSlot Int
| SaveSlotNum Int | SaveSlotNum Int
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary SaveSlot $($(derive [d| instance Deriving (Store SaveSlot) |]))
makeLenses ''SaveSlot makeLenses ''SaveSlot
+4 -2
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Shockwave where module Dodge.Data.Shockwave where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Color import Color
@@ -15,7 +17,7 @@ import Geometry.Data
data ShockwaveDirection = OutwardShockwave | InwardShockwave data ShockwaveDirection = OutwardShockwave | InwardShockwave
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ShockwaveDirection $($(derive [d| instance Deriving (Store ShockwaveDirection ) |]))
data Shockwave = Shockwave data Shockwave = Shockwave
{ _swColor :: Color { _swColor :: Color
@@ -29,7 +31,7 @@ data Shockwave = Shockwave
, _swTimer :: Int , _swTimer :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Shockwave $($(derive [d| instance Deriving (Store Shockwave ) |]))
makeLenses ''Shockwave makeLenses ''Shockwave
deriveJSON defaultOptions ''ShockwaveDirection deriveJSON defaultOptions ''ShockwaveDirection
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.SoundOrigin where module Dodge.Data.SoundOrigin where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -38,7 +40,7 @@ data SoundOrigin
| Explosion Int | Explosion Int
| Tap Int | Tap Int
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary SoundOrigin $($(derive [d| instance Deriving (Store SoundOrigin) |]))
instance ToJSONKey SoundOrigin instance ToJSONKey SoundOrigin
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Spark where module Dodge.Data.Spark where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -24,7 +26,7 @@ data Spark = Spark
, _skDamageType :: DamageType , _skDamageType :: DamageType
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Spark $($(derive [d| instance Deriving (Store Spark ) |]))
makeLenses ''Spark makeLenses ''Spark
deriveJSON defaultOptions ''Spark deriveJSON defaultOptions ''Spark
+14 -12
View File
@@ -5,6 +5,8 @@
module Dodge.Data.Terminal where module Dodge.Data.Terminal where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -18,7 +20,6 @@ import Dodge.Data.WorldEffect
data TerminalStatus = TerminalOff | TerminalBusy | TerminalReady data TerminalStatus = TerminalOff | TerminalBusy | TerminalReady
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TerminalStatus
data TerminalInput = TerminalInput data TerminalInput = TerminalInput
{ _tiText :: T.Text { _tiText :: T.Text
@@ -26,14 +27,12 @@ data TerminalInput = TerminalInput
, _tiSel :: (Int, Int) , _tiSel :: (Int, Int)
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TerminalInput
data TerminalBootProgram data TerminalBootProgram
= TerminalBootMempty = TerminalBootMempty
| TerminalBootLines [TerminalLine] | TerminalBootLines [TerminalLine]
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary TerminalBootProgram
data Terminal = Terminal data Terminal = Terminal
{ _tmID :: Int { _tmID :: Int
@@ -55,18 +54,15 @@ data Terminal = Terminal
} }
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary Terminal
data TerminalLineString = TerminalLineConst String Color data TerminalLineString = TerminalLineConst String Color
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TerminalLineString
data TmTm data TmTm
= TmId = TmId
| TmTmClearDisplayedLines | TmTmClearDisplayedLines
| TmTmSetStatus TerminalStatus | TmTmSetStatus TerminalStatus
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TmTm
data TerminalLine data TerminalLine
= TerminalLineDisplay = TerminalLineDisplay
@@ -83,21 +79,18 @@ data TerminalLine
} }
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary TerminalLine
data TerminalToggle = TerminalToggle data TerminalToggle = TerminalToggle
{ _ttTriggerID :: Int { _ttTriggerID :: Int
, _ttDeathEffect :: BlBl , _ttDeathEffect :: BlBl
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TerminalToggle
data BlBl data BlBl
= BlNegate = BlNegate
| BlConst Bool | BlConst Bool
| BlId | BlId
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary BlBl
data EffectArguments data EffectArguments
= NoArguments {_cmdEffect :: [TerminalLine]} = NoArguments {_cmdEffect :: [TerminalLine]}
@@ -107,7 +100,6 @@ data EffectArguments
} }
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary EffectArguments
data TerminalCommandEffect data TerminalCommandEffect
= TerminalCommandArguments EffectArguments = TerminalCommandArguments EffectArguments
@@ -121,7 +113,6 @@ data TerminalCommandEffect
| TerminalCommandEffectNone | TerminalCommandEffectNone
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary TerminalCommandEffect
data TerminalCommand = TerminalCommand data TerminalCommand = TerminalCommand
{ _tcString :: String { _tcString :: String
@@ -131,7 +122,6 @@ data TerminalCommand = TerminalCommand
} }
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary TerminalCommand
makeLenses ''TerminalInput makeLenses ''TerminalInput
makeLenses ''Terminal makeLenses ''Terminal
@@ -151,3 +141,15 @@ 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 BlBl) |]))
$($(derive [d| instance Deriving (Store EffectArguments) |]))
$($(derive [d| instance Deriving (Store TerminalCommandEffect) |]))
$($(derive [d| instance Deriving (Store 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 ) |]))
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.TeslaArc where module Dodge.Data.TeslaArc where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -22,7 +24,7 @@ data TeslaArc = TeslaArc
, _taColor :: Color , _taColor :: Color
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TeslaArc $($(derive [d| instance Deriving (Store TeslaArc ) |]))
makeLenses ''TeslaArc makeLenses ''TeslaArc
deriveJSON defaultOptions ''TeslaArc deriveJSON defaultOptions ''TeslaArc
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.TractorBeam where module Dodge.Data.TractorBeam where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -20,7 +22,7 @@ data TractorBeam = TractorBeam
, _tbTime :: Int , _tbTime :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TractorBeam $($(derive [d| instance Deriving (Store TractorBeam ) |]))
makeLenses ''TractorBeam makeLenses ''TractorBeam
deriveJSON defaultOptions ''TractorBeam deriveJSON defaultOptions ''TractorBeam
+3 -1
View File
@@ -11,6 +11,8 @@ module Dodge.Data.Universe (
module Picture.Data, module Picture.Data,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -43,7 +45,6 @@ data ConcEffect = NoConcEffect
data OptionScreenFlag = NormalOptions | GameOverOptions | SplashOptions data OptionScreenFlag = NormalOptions | GameOverOptions | SplashOptions
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary OptionScreenFlag
data ScreenLayer data ScreenLayer
= OptionScreen = OptionScreen
@@ -97,3 +98,4 @@ makeLenses ''Universe
makeLenses ''ScreenLayer makeLenses ''ScreenLayer
makeLenses ''ConcEffect makeLenses ''ConcEffect
makeLenses ''MenuOptionDisplay makeLenses ''MenuOptionDisplay
$($(derive [d| instance Deriving (Store OptionScreenFlag ) |]))
+7 -4
View File
@@ -8,6 +8,8 @@ module Dodge.Data.Wall (
module Dodge.Data.Material, module Dodge.Data.Material,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -38,7 +40,6 @@ data Wall = Wall
, _wlMaterial :: Material , _wlMaterial :: Material
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Wall
data Opacity data Opacity
= SeeThrough = SeeThrough
@@ -46,11 +47,10 @@ data Opacity
| DrawnWall {_opDraw :: WallDraw} -- Wall -> SPic | DrawnWall {_opDraw :: WallDraw} -- Wall -> SPic
| Opaque | Opaque
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Opacity
data WallDraw = DrawForceField data WallDraw = DrawForceField
| HackWallDraw
deriving (Eq, Ord, Show, Read, Enum, Bounded, Generic, Flat) deriving (Eq, Ord, Show, Read, Enum, Bounded, Generic, Flat)
instance Binary WallDraw
data WallStructure data WallStructure
= StandaloneWall = StandaloneWall
@@ -61,7 +61,6 @@ data WallStructure
{ _wlStCreature :: Int { _wlStCreature :: Int
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary WallStructure
makeLenses ''Wall makeLenses ''Wall
makeLenses ''Opacity makeLenses ''Opacity
@@ -70,3 +69,7 @@ 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) |]))
+3 -1
View File
@@ -12,6 +12,8 @@ module Dodge.Data.World (
module Dodge.Data.Hammer, module Dodge.Data.Hammer,
) where ) where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Dodge.Data.SaveSlot import Dodge.Data.SaveSlot
@@ -54,7 +56,6 @@ data TimeFlowStatus
| RewindingLastFrame | RewindingLastFrame
| NormalTimeFlow | NormalTimeFlow
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TimeFlowStatus
data WorldHammer data WorldHammer
= SubInvHam = SubInvHam
@@ -68,3 +69,4 @@ type HitEffect' =
(World, Maybe Flame) (World, Maybe Flame)
makeLenses ''World makeLenses ''World
$($(derive [d| instance Deriving (Store TimeFlowStatus) |]))
+10 -8
View File
@@ -5,6 +5,8 @@
module Dodge.Data.WorldEffect where module Dodge.Data.WorldEffect where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Data.Aeson import Data.Aeson
@@ -19,7 +21,7 @@ data ItCrWdWd
= ItCrWdId = ItCrWdId
| ItCrWdItemEffect | ItCrWdItemEffect
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ItCrWdWd $($(derive [d| instance Deriving (Store ItCrWdWd) |]))
data WdWd data WdWd
= NoWorldEffect = NoWorldEffect
@@ -36,13 +38,13 @@ data WdWd
| WdWdFromItCrixWdWd Item Int ItCrWdWd | WdWdFromItCrixWdWd Item Int ItCrWdWd
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary WdWd $($(derive [d| instance Deriving (Store WdWd) |]))
data WdP2 data WdP2
= WdP2Const Point2 = WdP2Const Point2
| WdYouPos | WdYouPos
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary WdP2 $($(derive [d| instance Deriving (Store WdP2) |]))
data MdWdWd data MdWdWd
= MdWdId = MdWdId
@@ -50,7 +52,7 @@ data MdWdWd
| MdSetLSCol Point3 | MdSetLSCol Point3
| MdFlickerUpdate | MdFlickerUpdate
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary MdWdWd $($(derive [d| instance Deriving (Store MdWdWd) |]))
data WdBl data WdBl
= WdTrig Int = WdTrig Int
@@ -61,13 +63,13 @@ data WdBl
| WdBlBtOn Int | WdBlBtOn Int
| WdBlBtNotOff Int | WdBlBtNotOff Int
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary WdBl $($(derive [d| instance Deriving (Store WdBl) |]))
data WdP2f data WdP2f
= WdP2f0 = WdP2f0
| WdP2fDoorPosition Int | WdP2fDoorPosition Int
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary WdP2f $($(derive [d| instance Deriving (Store WdP2f) |]))
data DrWdWd data DrWdWd
= DrWdId = DrWdId
@@ -75,7 +77,7 @@ data DrWdWd
| DrWdMechanismStepwise Int [Int] [(Point2, Point2)] | DrWdMechanismStepwise Int [Int] [(Point2, Point2)]
| DoorMechanism | DoorMechanism
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary DrWdWd $($(derive [d| instance Deriving (Store DrWdWd) |]))
data TmWdWd data TmWdWd
= TmWdId = TmWdId
@@ -85,7 +87,7 @@ data TmWdWd
| TmWdWdDoDeathTriggers | TmWdWdDoDeathTriggers
deriving (Eq, Show, Read, Generic) deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat) --hderiving (Eq, Show, Read, Generic, Flat)
--instance Binary TmWdWd $($(derive [d| instance Deriving (Store TmWdWd) |]))
deriveJSON defaultOptions ''ItCrWdWd deriveJSON defaultOptions ''ItCrWdWd
deriveJSON defaultOptions ''WdWd deriveJSON defaultOptions ''WdWd
+3 -1
View File
@@ -7,6 +7,8 @@
-- | GameRooms contain information about given positions in the world -- | GameRooms contain information about given positions in the world
module Dodge.GameRoom where module Dodge.GameRoom where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import Control.Lens import Control.Lens
@@ -24,7 +26,7 @@ data GameRoom = GameRoom
, _grName :: String , _grName :: String
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary GameRoom $($(derive [d| instance Deriving (Store GameRoom ) |]))
instance ToJSON GameRoom where instance ToJSON GameRoom where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
+3 -1
View File
@@ -14,6 +14,8 @@ module Geometry.ConvexPoly (
pointInPolyPoints, pointInPolyPoints,
) where ) where
import TH.Derive
import Data.Store
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Binary import Data.Binary
@@ -32,7 +34,7 @@ data ConvexPoly = ConvexPoly
, _cpRad :: Float , _cpRad :: Float
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ConvexPoly $($(derive [d| instance Deriving (Store ConvexPoly ) |]))
instance ToJSON ConvexPoly where instance ToJSON ConvexPoly where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
+7
View File
@@ -1,9 +1,13 @@
--{-# LANGUAGE DeriveGeneric #-} --{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE StandaloneDeriving #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
module LinearHelp where module LinearHelp where
import Data.Store
import TH.Derive
import Data.Binary import Data.Binary
import Flat import Flat
import Linear.V2 import Linear.V2
@@ -13,3 +17,6 @@ import Linear.V4
deriving instance (Flat a => Flat (V2 a)) deriving instance (Flat a => Flat (V2 a))
deriving instance (Flat a => Flat (V3 a)) deriving instance (Flat a => Flat (V3 a))
deriving instance (Flat a => Flat (V4 a)) deriving instance (Flat a => Flat (V4 a))
$($(derive [d| instance Store a => Deriving (Store (V2 a)) |]))
$($(derive [d| instance Store a => Deriving (Store (V3 a)) |]))
$($(derive [d| instance Store a => Deriving (Store (V4 a)) |]))
+3
View File
@@ -6,6 +6,8 @@
module MaybeHelp where module MaybeHelp where
import TH.Derive
import Data.Store
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Binary import Data.Binary
@@ -42,3 +44,4 @@ toggleJust Nothing = Just ()
toggleJust _ = Nothing toggleJust _ = Nothing
makeLenses ''Maybe' makeLenses ''Maybe'
$($(derive [d| instance Store a => Deriving (Store (Maybe' a)) |]))
+5 -3
View File
@@ -5,6 +5,8 @@
module Picture.Data where module Picture.Data where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -22,7 +24,6 @@ data Verx = Verx
, _vxShadNum :: !ShadNum , _vxShadNum :: !ShadNum
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Verx
data Layer data Layer
= BottomLayer = BottomLayer
@@ -32,7 +33,6 @@ data Layer
| DebugLayer | DebugLayer
| FixedCoordLayer | FixedCoordLayer
deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic, Flat) deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic, Flat)
instance Binary Layer
layerNum :: Layer -> Int layerNum :: Layer -> Int
layerNum = fromEnum layerNum = fromEnum
@@ -42,7 +42,7 @@ numLayers = length [minBound :: Layer .. maxBound]
newtype ShadNum = ShadNum {_unShadNum :: Int} newtype ShadNum = ShadNum {_unShadNum :: Int}
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ShadNum $($(derive [d| instance Deriving (Store ShadNum) |]))
polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum
{-# INLINE polyNum #-} {-# INLINE polyNum #-}
@@ -96,3 +96,5 @@ 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) |]))
+5 -1
View File
@@ -1,7 +1,8 @@
{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveAnyClass #-}
--{-# LANGUAGE DeriveGeneric #-} --{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE StandaloneDeriving #-}
--{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
{- | {- |
@@ -14,6 +15,8 @@ module Quaternion (
module Linear.Quaternion, module Linear.Quaternion,
) where ) where
import TH.Derive
import Data.Store
import Data.Aeson import Data.Aeson
import Data.Binary import Data.Binary
import Flat import Flat
@@ -45,3 +48,4 @@ vToQuat a b
cprod = crossProd a b cprod = crossProd a b
deriving instance (Flat a => Flat (Quaternion a)) deriving instance (Flat a => Flat (Quaternion a))
$($(derive [d| instance Store a => Deriving (Store (Quaternion a)) |]))
+14 -11
View File
@@ -8,6 +8,8 @@
module Shape.Data where module Shape.Data where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
@@ -17,34 +19,30 @@ import Geometry.Data
import LinearHelp () import LinearHelp ()
import Streaming import Streaming
type Shape' = Stream (Of ShapeObj) IO ()
type Shape = [ShapeObj]
{-# INLINE shVfromList #-} {-# INLINE shVfromList #-}
shVfromList = id shVfromList = id
{-# INLINE shEfromList #-} {-# INLINE shEfromList #-}
shEfromList = id shEfromList = id
newtype ShapeType = TopPrism Int
deriving newtype (Eq, Ord, Show, Read)
deriving stock Generic
deriving anyclass Flat
$($(derive [d| instance Deriving (Store ShapeType) |]))
data ShapeObj = ShapeObj data ShapeObj = ShapeObj
{ _shType :: ShapeType { _shType :: ShapeType
, _shVs :: [ShapeV] , _shVs :: [ShapeV]
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ShapeObj
instance ToJSON ShapeObj where instance ToJSON ShapeObj where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
instance FromJSON ShapeObj instance FromJSON ShapeObj
newtype ShapeType = TopPrism Int
deriving newtype (Eq, Ord, Show, Read)
deriving stock Generic
deriving anyclass Flat
instance Binary ShapeType
instance ToJSON ShapeType where instance ToJSON ShapeType where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
@@ -57,7 +55,6 @@ data ShapeV = ShapeV
, _svCol :: Point4 , _svCol :: Point4
} }
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ShapeV
instance ToJSON ShapeV where instance ToJSON ShapeV where
toEncoding = genericToEncoding defaultOptions toEncoding = genericToEncoding defaultOptions
@@ -70,3 +67,9 @@ pairToSV = uncurry ShapeV
makeLenses ''ShapeV makeLenses ''ShapeV
makeLenses ''ShapeObj makeLenses ''ShapeObj
type Shape' = Stream (Of ShapeObj) IO ()
type Shape = [ShapeObj]
$($(derive [d| instance Deriving (Store ShapeV ) |]))
$($(derive [d| instance Deriving (Store ShapeObj ) |]))
+3 -1
View File
@@ -5,6 +5,8 @@
module Sound.Data where module Sound.Data where
import TH.Derive
import Data.Store
import Data.Binary import Data.Binary
import Flat import Flat
import LinearHelp () import LinearHelp ()
@@ -34,7 +36,7 @@ data PlayStatus
newtype SoundID = SoundID {_getSoundID :: Int} newtype SoundID = SoundID {_getSoundID :: Int}
deriving (Eq, Ord, Show, Read, Generic, Flat) deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary SoundID $($(derive [d| instance Deriving (Store SoundID) |]))
newtype SoundData = SoundData newtype SoundData = SoundData
{ _loadedChunks :: IM.IntMap Mix.Chunk { _loadedChunks :: IM.IntMap Mix.Chunk