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