Go back to JSON encoding

This commit is contained in:
2022-08-21 21:23:59 +01:00
parent dd62e30026
commit f1ef75f511
95 changed files with 9 additions and 586 deletions
+2 -2
View File
@@ -51,8 +51,8 @@ dependencies:
- linear
- aeson
- aeson-pretty
- store
- binary
#- store
#- binary
- flat
- th-utilities
- directory
-4
View File
@@ -6,9 +6,6 @@
module Color where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Geometry
@@ -30,7 +27,6 @@ data PaletteColor
| WHITE
| BLACK
deriving (Eq, Ord, Enum, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store PaletteColor) |]))
instance ToJSON PaletteColor where
toEncoding = genericToEncoding defaultOptions
-9
View File
@@ -5,9 +5,6 @@
module Dodge.Data.ActionPlan where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -206,9 +203,3 @@ 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) |]))
-5
View File
@@ -5,9 +5,6 @@
module Dodge.Data.ArcStep where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -22,13 +19,11 @@ data ArcStep = ArcStep
, _asObject :: CrWlID --Maybe (Either Creature Wall)
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store ArcStep ) |]))
data NextArcStep
= EndArc
| DefaultArcStep
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store NextArcStep) |]))
makeLenses ''ArcStep
deriveJSON defaultOptions ''ArcStep
-7
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Beam where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -60,7 +57,3 @@ 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) |]))
-6
View File
@@ -9,9 +9,6 @@ module Dodge.Data.Block (
module Dodge.Data.PathGraph,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Color
@@ -55,6 +52,3 @@ 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) |]))
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Bounds where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -20,7 +17,6 @@ data Bounds = Bounds
, _bdMaxY :: Float
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Bounds ) |]))
defaultBounds :: Bounds
defaultBounds = Bounds 0 0 0 0
-9
View File
@@ -8,9 +8,6 @@ module Dodge.Data.Bullet
, module Dodge.Data.Damage
)where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -65,9 +62,3 @@ 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 ) |]))
-7
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Button where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Color
@@ -74,7 +71,3 @@ 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 ) |]))
+1 -9
View File
@@ -48,11 +48,8 @@ module Dodge.Data.CWorld (
module Dodge.Data.WorldEffect,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp
--import LinearHelp
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
@@ -231,8 +228,3 @@ 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 ) |]))
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.CamouflageStatus where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
@@ -16,6 +13,5 @@ data CamouflageStatus
= FullyVisible
| Invisible
deriving (Eq, Ord, Enum, Read, Show, Bounded, Generic, Flat)
$($(derive [d| instance Deriving (Store CamouflageStatus) |]))
deriveJSON defaultOptions ''CamouflageStatus
-6
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Cloud where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -40,6 +37,3 @@ 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 ) |]))
-6
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Corpse where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -17,9 +14,7 @@ import Geometry.Data
import ShapePicture.Data
data CorpseResurrection = NoResurrection
| HackCorpseResurrection
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store CorpseResurrection ) |]))
data Corpse = Corpse
{ _cpID :: Int
@@ -29,7 +24,6 @@ data Corpse = Corpse
, _cpRes :: CorpseResurrection
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Corpse ) |]))
makeLenses ''Corpse
deriveJSON defaultOptions ''CorpseResurrection
-6
View File
@@ -5,9 +5,6 @@
module Dodge.Data.CrGroupParams where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -25,11 +22,8 @@ data CrGroupParams = CrGroupParams
deriving (Eq, Ord, Show, Read, Generic, Flat)
data CrGroupUpdate = DefaultCrGroupUpdate
| HackCrGroupUpdate
deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''CrGroupParams
deriveJSON defaultOptions ''CrGroupParams
deriveJSON defaultOptions ''CrGroupUpdate
$($(derive [d| instance Deriving (Store CrGroupParams ) |]))
$($(derive [d| instance Deriving (Store CrGroupUpdate ) |]))
-6
View File
@@ -5,19 +5,13 @@
module Dodge.Data.CrWlID where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import TH.Derive
import Data.Store
data CrWlID = CrID Int | WlID Int | NothingID -- TODO rewrite/remove this
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store CrWlID ) |]))
makeLenses ''CrWlID
deriveJSON defaultOptions ''CrWlID
-7
View File
@@ -17,9 +17,6 @@ module Dodge.Data.Creature (
module Dodge.Data.Hammer,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -81,7 +78,6 @@ data Creature = Creature
deriving (Eq, Show, Read, Generic, Flat)
data CreatureCorpse = MakeDefaultCorpse
| HackCreatureCorpse
deriving (Eq, Ord, Show, Read, Generic, Flat)
data Intention = Intention
@@ -99,6 +95,3 @@ 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 ) |]))
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Creature.Memory where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -20,7 +17,6 @@ data Memory = Memory
, _nodesSearched :: [Int]
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Memory ) |]))
makeLenses ''Memory
deriveJSON defaultOptions ''Memory
-9
View File
@@ -8,9 +8,6 @@ module Dodge.Data.Creature.Misc (
module Dodge.Data.CamouflageStatus,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -90,9 +87,3 @@ 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) |]))
-9
View File
@@ -23,9 +23,6 @@ module Dodge.Data.Creature.Perception (
auDist,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -70,7 +67,6 @@ data Awareness
= Suspicious Float
| Cognizant Float
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Awareness) |]))
makeLenses ''Perception
makeLenses ''Vision
@@ -82,8 +78,3 @@ 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) |]))
-7
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Creature.Stance where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -44,7 +41,6 @@ data Posture
= Aiming
| AtEase
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Posture) |]))
makeLenses ''Stance
makeLenses ''Carriage
@@ -53,6 +49,3 @@ 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) |]))
-8
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Creature.State where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -64,8 +61,3 @@ 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) |]))
-24
View File
@@ -5,40 +5,28 @@
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)
data CrWdImp = NoCrWdImp
| HackCrWdImp
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store CrWdImp ) |]))
data CrWdWd = CrWdWdId
| HackCrWdWd
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store CrWdWd ) |]))
data IntImp = NoIntImp
| HackNoIntImp
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store IntImp ) |]))
data CrImp
= NoCrImp
| TurnTowardCr Float -- turn amount
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store CrImp) |]))
data P2Imp = P2ImpNo
| HackP2ImpNo
deriving (Eq, Ord, Show, Read, Generic, Flat)
data WdCrBl
@@ -55,35 +43,26 @@ data CrBl
| CrIsAiming
| CrIsAnimate
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store CrBl) |]))
data MCrAc = MCrNoAction
| HackMCrAc
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store MCrAc ) |]))
data CrAc
= CrTurnAround
| CrFleeFromTarget
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store CrAc) |]))
data P2Ac = P2NoAction
| HackP2Ac
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store P2Ac ) |]))
data MP2Ac = MP2NoAction
| HackMP2Ac
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store MP2Ac ) |]))
data CrWdAc
= CrWdBFSThenReturn Int
| ChooseMovementSpreadGun
| ChooseMovementLtAuto
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store CrWdAc) |]))
deriveJSON defaultOptions ''WdCrCr
deriveJSON defaultOptions ''CrWdImp
@@ -98,6 +77,3 @@ 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 ) |]))
-5
View File
@@ -12,9 +12,6 @@ module Dodge.Data.Damage (
module Dodge.Data.Damage.Type,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -33,7 +30,6 @@ data DamageEffect
| PushBackDamage {_dePushBack :: Float}
| NoDamageEffect
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store DamageEffect) |]))
data Damage = Damage
{ _dmType :: DamageType
@@ -44,7 +40,6 @@ data Damage = Damage
, _dmEffect :: DamageEffect
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Damage ) |]))
isElectrical :: Damage -> Bool
isElectrical dm = case _dmType dm of
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Damage.Type where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
@@ -29,7 +26,6 @@ data DamageType
| POISONDAM
| ENTERREMENT
deriving (Eq, Ord, Show, Read, Enum, Bounded, Generic, Flat)
$($(derive [d| instance Deriving (Store DamageType) |]))
instance ToJSONKey DamageType
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Distortion where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Geometry
import LinearHelp ()
@@ -17,6 +14,5 @@ import Data.Aeson.TH
data Distortion
= RadialDistortion Point2 Point2 Point2 Float
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Distortion) |]))
deriveJSON defaultOptions ''Distortion
-6
View File
@@ -10,9 +10,6 @@ module Dodge.Data.Door (
module Dodge.Data.WorldEffect,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -26,14 +23,12 @@ import Geometry.Data
data DoorStatus = DoorOpen | DoorClosed | DoorHalfway | DoorInt Int
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store DoorStatus ) |]))
data PushSource
= PushesItself
| PushedBy Int
| NotPushed
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store PushSource) |]))
data Door = Door
{ _drID :: Int
@@ -54,7 +49,6 @@ data Door = Door
, _drObstacleType :: EdgeObstacle
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Door ) |]))
makeLenses ''Door
deriveJSON defaultOptions ''DoorStatus
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.EnergyBall where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -27,7 +24,6 @@ data EnergyBall = EnergyBall
, _ebRot :: Float
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store EnergyBall ) |]))
makeLenses ''EnergyBall
deriveJSON defaultOptions ''EnergyBall
-5
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Equipment.Misc where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
@@ -20,7 +17,6 @@ data EquipSite
| GoesOnLegs
| GoesOnSpecial
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store EquipSite) |]))
data EquipPosition
= OnHead
@@ -31,7 +27,6 @@ data EquipPosition
| OnLegs
| OnSpecial
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store EquipPosition) |]))
instance ToJSONKey EquipPosition
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Flame where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -25,7 +22,6 @@ data Flame = Flame
, _flOriginalVel :: Point2
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Flame ) |]))
makeLenses ''Flame
deriveJSON defaultOptions ''Flame
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Flare where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Color
@@ -30,7 +27,6 @@ data Flare
, _flareTime :: Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Flare) |]))
makeLenses ''Flare
deriveJSON defaultOptions ''Flare
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.FloatFunction where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
@@ -19,6 +16,5 @@ data FloatFloat
| FloatAbsCheckGreaterLess Float Float Float
| FloatConst Float
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store FloatFloat) |]))
deriveJSON defaultOptions ''FloatFloat
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.FloorItem where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -18,7 +15,6 @@ import Geometry.Data
data FloorItem = FlIt {_flIt :: Item, _flItPos :: Point2, _flItRot :: Float, _flItID :: Int}
deriving (Eq, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store FloorItem ) |]))
makeLenses ''FloorItem
deriveJSON defaultOptions ''FloorItem
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.ForegroundShape where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -24,7 +21,6 @@ data ForegroundShape = ForegroundShape
, _fsSPic :: SPic
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store ForegroundShape ) |]))
makeLenses ''ForegroundShape
deriveJSON defaultOptions ''ForegroundShape
-5
View File
@@ -5,9 +5,6 @@
module Dodge.Data.GenParams where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -27,5 +24,3 @@ data DecorationShape = PLUS | SQUARE | CIRCLE | THREELINES
makeLenses ''GenParams
deriveJSON defaultOptions ''GenParams
deriveJSON defaultOptions ''DecorationShape
$($(derive [d| instance Deriving (Store GenParams ) |]))
$($(derive [d| instance Deriving (Store DecorationShape ) |]))
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Gust where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -22,7 +19,6 @@ data Gust = Gust
, _guTime :: Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Gust ) |]))
makeLenses ''Gust
deriveJSON defaultOptions ''Gust
-6
View File
@@ -5,9 +5,6 @@
module Dodge.Data.HUD where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -28,7 +25,6 @@ data SubInventory
| LockedInventory
| DisplayTerminal {_termID :: Int}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store SubInventory) |]))
data HUD = HUD
{ _hudElement :: HUDElement
@@ -37,7 +33,6 @@ data HUD = HUD
, _carteRot :: Float
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store HUD ) |]))
makeLenses ''HUD
makeLenses ''HUDElement
@@ -45,4 +40,3 @@ makeLenses ''SubInventory
deriveJSON defaultOptions ''HUDElement
deriveJSON defaultOptions ''SubInventory
deriveJSON defaultOptions ''HUD
$($(derive [d| instance Deriving (Store HUDElement) |]))
-5
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Hammer where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -23,9 +20,7 @@ data HammerPosition
| HammerReleased
| HammerUp
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store HammerPosition) |]))
makeLenses ''HammerType
deriveJSON defaultOptions ''HammerType
deriveJSON defaultOptions ''HammerPosition
$($(derive [d| instance Deriving (Store HammerType) |]))
+1 -5
View File
@@ -1,6 +1,6 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
--{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item (
@@ -17,9 +17,6 @@ module Dodge.Data.Item (
module Dodge.Data.Item.Location,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -54,7 +51,6 @@ data Item = Item
, _itParams :: ItemParams
}
deriving (Eq, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Item ) |]))
_itUseAimStance :: Item -> AimStance
_itUseAimStance = _aimStance . _heldAim . _itUse
-14
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Item.Combine where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -225,14 +222,3 @@ 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) |]))
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Item.CurseStatus where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
@@ -17,6 +14,5 @@ data CurseStatus
| UndroppableIdentified
| UndroppableUnidentified
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store CurseStatus) |]))
deriveJSON defaultOptions ''CurseStatus
-9
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Item.Effect where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -31,14 +28,11 @@ data ItInvEffect
| RemoveShieldWall
| EffectWhileHeld ItInvEffect
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store ItInvEffect) |]))
data ItFloorEffect = NoFloorEffect
| HackItFloorEffect
deriving (Eq, Ord, Show, Read, Generic, Flat)
data ItDropEffect = NoDropEffect
| HackItDropEffect
deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''ItEffect
@@ -46,6 +40,3 @@ 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 ) |]))
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Item.HeldDelay where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -30,7 +27,6 @@ data UseDelay -- should just be Delay
, _warmMax :: Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store UseDelay ) |]))
makeLenses ''UseDelay
deriveJSON defaultOptions ''UseDelay
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Item.HeldScroll where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -24,7 +21,6 @@ data HeldScroll
, _hsMaxInt :: Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store HeldScroll) |]))
makeLenses ''HeldScroll
deriveJSON defaultOptions ''HeldScroll
-8
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Item.HeldUse where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
@@ -31,13 +28,11 @@ data HeldUse
| HeldForceField
| HeldShatter
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store HeldUse) |]))
data Cuse
= CDoNothing
| CHeal Int
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Cuse) |]))
data Euse
= EDoNothing
@@ -49,7 +44,6 @@ data Euse
| EonWristShield
| EoffWristShield
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Euse) |]))
data Luse
= LDoNothing
@@ -59,7 +53,6 @@ data Luse
| LUnsafeBlink
| LBoost
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Luse) |]))
data HeldMod
= HeldModNothing
@@ -98,7 +91,6 @@ data HeldMod
| RevolverXRepeatMod
| BangConeMod
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store HeldMod) |]))
deriveJSON defaultOptions ''Cuse
deriveJSON defaultOptions ''HeldMod
-4
View File
@@ -4,9 +4,6 @@
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Location where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -18,7 +15,6 @@ data ItemLocation
| OnFloor {_ipFlID :: Int}
| InVoid
deriving (Eq, Show, Read, Ord, Generic, Flat)
$($(derive [d| instance Deriving (Store ItemLocation) |]))
makeLenses ''ItemLocation
deriveJSON defaultOptions ''ItemLocation
-7
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Item.Misc where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -21,7 +18,6 @@ data ItemDimension = ItemDimension
, _dimAttachPos :: Point3
}
deriving (Eq, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store ItemDimension ) |]))
data ItemPortage
= HeldItem
@@ -31,18 +27,15 @@ data ItemPortage
| WornItem
| NoPortage
deriving (Eq, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store ItemPortage) |]))
--data ItemValue = ItemValue
-- { _ivInt :: Int
-- , _ivType :: ItemValueType
-- }
-- deriving (Eq, Show, Read, Generic, Flat)
-- $($(derive [d| instance Deriving (Store ItemValue ) |]))
--
--data ItemValueType = MundaneItem | ArtefactItem
-- deriving (Eq, Show, Read, Generic, Flat)
-- $($(derive [d| instance Deriving (Store ItemValueType ) |]))
makeLenses ''ItemDimension
makeLenses ''ItemPortage
-9
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Item.Params where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -119,9 +116,3 @@ 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 ) |]))
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Item.Scope where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -34,7 +31,6 @@ data Scope
_scopeIsCamera :: Bool
}
deriving (Eq, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Scope) |]))
makeLenses ''Scope
deriveJSON defaultOptions ''Scope
-6
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Item.Targeting where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -45,6 +42,3 @@ 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) |]))
-6
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Item.Tweak where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -35,12 +32,9 @@ data TweakParam = TweakParam
, _tweakMax :: Int
}
deriving (Eq, Show, Read, Generic, Flat)
$($(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) |]))
-7
View File
@@ -13,9 +13,6 @@ module Dodge.Data.Item.Use (
module Dodge.Data.Hammer,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -86,7 +83,3 @@ 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) |]))
-6
View File
@@ -11,9 +11,6 @@ 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
import Data.Aeson
@@ -32,7 +29,6 @@ data HeldConsumption
}
| NoConsumption
deriving (Eq, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store HeldConsumption) |]))
data LeftConsumption
= AutoRecharging
@@ -46,14 +42,12 @@ data LeftConsumption
, _wpCharge :: Int
}
deriving (Eq, Show, Read, Generic, Flat)
$($(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)
$($(derive [d| instance Deriving (Store ItAmount) |]))
makeLenses ''HeldConsumption
makeLenses ''LeftConsumption
@@ -9,9 +9,6 @@ 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
import Data.Aeson
@@ -62,7 +59,6 @@ data AmmoType
deriving (Eq, Ord, Show, Read, Generic, Flat)
data ForceFieldType = DefaultForceField
| HackForceFieldType
deriving (Eq, Ord, Show, Read, Generic, Flat)
data GasCreate = CreatePoisonGas | CreateFlame
@@ -76,9 +72,3 @@ 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,9 +5,6 @@
module Dodge.Data.Item.Use.Consumption.LoadAction where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -36,6 +33,3 @@ 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 ) |]))
-5
View File
@@ -8,9 +8,6 @@ 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
import Data.Aeson
@@ -38,5 +35,3 @@ makeLenses ''EquipEffect
makeLenses ''EquipParams
deriveJSON defaultOptions ''EquipEffect
deriveJSON defaultOptions ''EquipParams
$($(derive [d| instance Deriving (Store EquipEffect ) |]))
$($(derive [d| instance Deriving (Store EquipParams) |]))
-6
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Laser where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -19,7 +16,6 @@ data LaserType
= DamageLaser {_laserTypeDamage :: Int}
| TargetLaser
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store LaserType) |]))
data LaserStart = LaserStart
{ _lpPhaseV :: Float
@@ -29,7 +25,6 @@ data LaserStart = LaserStart
, _lpType :: LaserType
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store LaserStart ) |]))
data Laser = Laser
{ _laColor :: Color
@@ -37,7 +32,6 @@ data Laser = Laser
, _laType :: LaserType
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Laser ) |]))
makeLenses ''Laser
makeLenses ''LaserStart
-10
View File
@@ -5,9 +5,6 @@
module Dodge.Data.LightSource where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -16,22 +13,18 @@ import Data.Aeson.TH
import Geometry
data LightSourceDraw = DefaultLightSourceDraw
| HackLightSourceDraw
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store LightSourceDraw ) |]))
data TLSIntensity
= ConstantIntensity
| TLSFade Point3 Int
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store TLSIntensity) |]))
data TLSUpdate
= DestroyTLS
| TimerTLS
| IntensityTLS TLSIntensity
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store TLSUpdate) |]))
data LSParam = LSParam
{ _lsPos :: !Point3
@@ -39,7 +32,6 @@ data LSParam = LSParam
, _lsCol :: !Point3
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store LSParam ) |]))
data LightSource = LS
{ _lsID :: Int
@@ -48,7 +40,6 @@ data LightSource = LS
, _lsPict :: LightSourceDraw --LightSource -> Picture
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store LightSource ) |]))
data TempLightSource = TLS
{ _tlsParam :: LSParam
@@ -56,7 +47,6 @@ data TempLightSource = TLS
, _tlsTime :: Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store TempLightSource ) |]))
makeLenses ''LSParam
makeLenses ''LightSource
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.LinearShockwave where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -22,7 +19,6 @@ data LinearShockwave = LinearShockwave
, _lwTimer :: Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store LinearShockwave ) |]))
makeLenses ''LinearShockwave
deriveJSON defaultOptions ''LinearShockwave
-6
View File
@@ -13,9 +13,6 @@ module Dodge.Data.Machine (
module Dodge.Data.GenParams,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Color
@@ -74,6 +71,3 @@ 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) |]))
-6
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Machine.Sensor where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Dodge.Data.GenParams
@@ -48,6 +45,3 @@ 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 ) |]))
-6
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Magnet where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -17,13 +14,11 @@ import Geometry.Data
newtype MagnetUpdate = MagnetUpdateTimer Int
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store MagnetUpdate) |]))
data MagnetBuBu
= MagnetBuId
| MagnetBuBuCurveAroundField Float Float
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store MagnetBuBu) |]))
data Magnet = Magnet
{ _mgID :: Int
@@ -32,7 +27,6 @@ data Magnet = Magnet
, _mgField :: MagnetBuBu
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Magnet ) |]))
makeLenses ''Magnet
deriveJSON defaultOptions ''MagnetUpdate
-4
View File
@@ -5,15 +5,11 @@
module Dodge.Data.Material where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
data Material = Wood | Dirt | Stone | Glass | Metal | Crystal | Flesh | Electronics
deriving (Eq, Ord, Show, Bounded, Enum, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Material ) |]))
deriveJSON defaultOptions ''Material
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Modification where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -32,7 +29,6 @@ data Modification
, _mdUpdate :: MdWdWd
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Modification) |]))
makeLenses ''Modification
deriveJSON defaultOptions ''Modification
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.MountedObject where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
@@ -16,6 +13,5 @@ data MountedObject
= MountedLS Int
| MountedProp Int
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store MountedObject) |]))
deriveJSON defaultOptions ''MountedObject
-6
View File
@@ -5,14 +5,9 @@
module Dodge.Data.ObjectType where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
import TH.Derive
import Data.Store
data ObjectType
= ObTerminal
@@ -33,4 +28,3 @@ instance ToJSONKey ObjectType
instance FromJSONKey ObjectType
deriveJSON defaultOptions ''ObjectType
$($(derive [d| instance Deriving (Store ObjectType) |]))
-6
View File
@@ -14,9 +14,6 @@ The warnings have been disabled.
-}
module Dodge.Data.PathGraph where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -58,7 +55,6 @@ data EdgeObstacle
| AutoDoorObstacle
| WallObstacle
deriving (Eq, Ord, Show, Read, Bounded, Enum, Generic, Flat)
$($(derive [d| instance Deriving (Store EdgeObstacle) |]))
instance ToJSON EdgeObstacle where
toEncoding = genericToEncoding defaultOptions
@@ -74,5 +70,3 @@ deriving instance (Flat (Gr Point2 PathEdge))
makeLenses ''PathGraph
makeLenses ''PathEdge
$($(derive [d| instance Deriving (Store PathEdge ) |]))
$($(derive [d| instance Deriving (Store (Gr Point2 PathEdge) ) |]))
-4
View File
@@ -5,15 +5,11 @@
module Dodge.Data.Payload where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
data Payload = ExplosionPayload | DudPayload
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
$($(derive [d| instance Deriving (Store Payload ) |]))
deriveJSON defaultOptions ''Payload
-6
View File
@@ -5,9 +5,6 @@
module Dodge.Data.PosEvent where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -16,9 +13,7 @@ import Data.Aeson.TH
import Geometry.Data
data PosEventType = SparkSpawner
| HackSparkSpawner
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store PosEventType ) |]))
data PosEvent = PosEvent
{ _pvType :: PosEventType
@@ -26,7 +21,6 @@ data PosEvent = PosEvent
, _pvPos :: Point2
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store PosEvent ) |]))
makeLenses ''PosEvent
deriveJSON defaultOptions ''PosEventType
-5
View File
@@ -5,9 +5,6 @@
module Dodge.Data.PressPlate where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -20,7 +17,6 @@ data PressPlateEvent
= PressPlateId
| PPLevelReset
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store PressPlateEvent) |]))
data PressPlate = PressPlate
{ _ppPict :: Picture
@@ -31,7 +27,6 @@ data PressPlate = PressPlate
, _ppText :: String
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store PressPlate ) |]))
makeLenses ''PressPlate
deriveJSON defaultOptions ''PressPlateEvent
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Projectile where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -32,7 +29,6 @@ data Proj
, _prjMITID :: Maybe Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Proj) |]))
makeLenses ''Proj
deriveJSON defaultOptions ''Proj
-7
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Prop where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -81,7 +78,3 @@ 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) |]))
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.RadarBlip where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Color
@@ -24,7 +21,6 @@ data RadarBlip = RadarBlip
, _rbPos :: Point2
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store RadarBlip ) |]))
makeLenses ''RadarBlip
deriveJSON defaultOptions ''RadarBlip
-4
View File
@@ -8,9 +8,6 @@ module Dodge.Data.RadarSweep (
module Dodge.Data.ObjectType,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -26,7 +23,6 @@ data RadarSweep = RadarSweep
, _rsTimer :: Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store RadarSweep ) |]))
makeLenses ''RadarSweep
deriveJSON defaultOptions ''RadarSweep
-6
View File
@@ -5,9 +5,6 @@
module Dodge.Data.RightButtonOptions where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -61,6 +58,3 @@ 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) |]))
-4
View File
@@ -4,9 +4,6 @@
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.SaveSlot where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
@@ -15,6 +12,5 @@ data SaveSlot
| LevelStartSlot Int
| SaveSlotNum Int
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store SaveSlot) |]))
makeLenses ''SaveSlot
-5
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Shockwave where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Color
import Control.Lens
@@ -17,7 +14,6 @@ import Geometry.Data
data ShockwaveDirection = OutwardShockwave | InwardShockwave
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store ShockwaveDirection ) |]))
data Shockwave = Shockwave
{ _swColor :: Color
@@ -31,7 +27,6 @@ data Shockwave = Shockwave
, _swTimer :: Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Shockwave ) |]))
makeLenses ''Shockwave
deriveJSON defaultOptions ''ShockwaveDirection
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.SoundOrigin where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
@@ -40,7 +37,6 @@ data SoundOrigin
| Explosion Int
| Tap Int
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store SoundOrigin) |]))
instance ToJSONKey SoundOrigin
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Spark where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Color
@@ -26,7 +23,6 @@ data Spark = Spark
, _skDamageType :: DamageType
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store Spark ) |]))
makeLenses ''Spark
deriveJSON defaultOptions ''Spark
-15
View File
@@ -5,9 +5,6 @@
module Dodge.Data.Terminal where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Color
@@ -141,15 +138,3 @@ 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 ) |]))
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.TeslaArc where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Color
@@ -24,7 +21,6 @@ data TeslaArc = TeslaArc
, _taColor :: Color
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store TeslaArc ) |]))
makeLenses ''TeslaArc
deriveJSON defaultOptions ''TeslaArc
-4
View File
@@ -5,9 +5,6 @@
module Dodge.Data.TractorBeam where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -22,7 +19,6 @@ data TractorBeam = TractorBeam
, _tbTime :: Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store TractorBeam ) |]))
makeLenses ''TractorBeam
deriveJSON defaultOptions ''TractorBeam
-4
View File
@@ -11,9 +11,6 @@ module Dodge.Data.Universe (
module Picture.Data,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
--import qualified Data.Map.Strict as M
@@ -98,4 +95,3 @@ makeLenses ''Universe
makeLenses ''ScreenLayer
makeLenses ''ConcEffect
makeLenses ''MenuOptionDisplay
$($(derive [d| instance Deriving (Store OptionScreenFlag ) |]))
-8
View File
@@ -8,9 +8,6 @@ module Dodge.Data.Wall (
module Dodge.Data.Material,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Color
@@ -49,7 +46,6 @@ data Opacity
deriving (Eq, Ord, Show, Read, Generic, Flat)
data WallDraw = DrawForceField
| HackWallDraw
deriving (Eq, Ord, Show, Read, Enum, Bounded, Generic, Flat)
data WallStructure
@@ -69,7 +65,3 @@ 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) |]))
-4
View File
@@ -12,9 +12,6 @@ module Dodge.Data.World (
module Dodge.Data.Hammer,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Dodge.Data.SaveSlot
import Control.Lens
@@ -69,4 +66,3 @@ type HitEffect' =
(World, Maybe Flame)
makeLenses ''World
$($(derive [d| instance Deriving (Store TimeFlowStatus) |]))
-11
View File
@@ -5,9 +5,6 @@
module Dodge.Data.WorldEffect where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Data.Aeson
import Data.Aeson.TH
@@ -21,7 +18,6 @@ data ItCrWdWd
= ItCrWdId
| ItCrWdItemEffect
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store ItCrWdWd) |]))
data WdWd
= NoWorldEffect
@@ -38,13 +34,11 @@ data WdWd
| WdWdFromItCrixWdWd Item Int ItCrWdWd
deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store WdWd) |]))
data WdP2
= WdP2Const Point2
| WdYouPos
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store WdP2) |]))
data MdWdWd
= MdWdId
@@ -52,7 +46,6 @@ data MdWdWd
| MdSetLSCol Point3
| MdFlickerUpdate
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store MdWdWd) |]))
data WdBl
= WdTrig Int
@@ -63,13 +56,11 @@ data WdBl
| WdBlBtOn Int
| WdBlBtNotOff Int
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store WdBl) |]))
data WdP2f
= WdP2f0
| WdP2fDoorPosition Int
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store WdP2f) |]))
data DrWdWd
= DrWdId
@@ -77,7 +68,6 @@ data DrWdWd
| DrWdMechanismStepwise Int [Int] [(Point2, Point2)]
| DoorMechanism
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store DrWdWd) |]))
data TmWdWd
= TmWdId
@@ -87,7 +77,6 @@ data TmWdWd
| TmWdWdDoDeathTriggers
deriving (Eq, Show, Read, Generic)
--hderiving (Eq, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store TmWdWd) |]))
deriveJSON defaultOptions ''ItCrWdWd
deriveJSON defaultOptions ''WdWd
-4
View File
@@ -7,9 +7,6 @@
-- | 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
import Data.Aeson
@@ -26,7 +23,6 @@ data GameRoom = GameRoom
, _grName :: String
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store GameRoom ) |]))
instance ToJSON GameRoom where
toEncoding = genericToEncoding defaultOptions
+5 -32
View File
@@ -6,52 +6,25 @@ module Dodge.Save (
writeSaveSlot,
readSaveSlot,
reloadLevelStart,
toJSONSaveSlot,
fromJSONSaveSlot,
) where
import Data.Binary
import Flat
--import Flat
import Dodge.Concurrent
import Control.Lens
import Dodge.Data.SaveSlot
import Data.Aeson
import qualified Data.Aeson.Encode.Pretty as AEP
import qualified Data.ByteString.Lazy as BS
import qualified Data.ByteString as BSS
--import qualified Data.ByteString as BSS
import Dodge.Data.Universe
--import qualified Data.Set as S
import System.Directory
writeSaveSlot :: SaveSlot -> Universe -> IO (Universe -> Maybe Universe)
writeSaveSlot ss u = do
putStrLn $ "Saving " ++ saveSlotPath ss
createDirectoryIfMissing True "saveSlot"
-- BSS.writeFile (saveSlotPath ss) $
-- flat
-- (u ^. uvWorld . cWorld)
return Just
readSaveSlot :: SaveSlot -> IO (Universe -> Maybe Universe)
readSaveSlot ss = do
fExists <- doesFileExist $ saveSlotPath ss
-- if fExists
-- then do
-- bsstr <- BSS.readFile $ saveSlotPath ss
-- let cwstr = unflat bsstr
-- case cwstr of
-- Left _ -> putStrLn "loadSaveSlot failed to read saved file" >> return removescreenlayers
-- Right cw -> return $ \uv -> Just $ uv & uvWorld . cWorld .~ cw
-- & uvScreenLayers .~ []
-- else putStrLn "loadSaveSlot failed to find saved file" >> return removescreenlayers
return Just
where
removescreenlayers = Just . (uvScreenLayers .~ [])
toJSONSaveSlot :: SaveSlot -> Universe -> IO (Universe -> Maybe Universe)
toJSONSaveSlot ss u = do
putStrLn $ "Saving " ++ saveSlotPath ss
createDirectoryIfMissing True "saveSlot"
BS.writeFile (saveSlotPath ss) $
AEP.encodePretty'
(AEP.Config (AEP.Spaces 2) compare AEP.Generic False)
@@ -59,8 +32,8 @@ toJSONSaveSlot ss u = do
return Just
fromJSONSaveSlot :: SaveSlot -> IO (Universe -> Maybe Universe)
fromJSONSaveSlot ss = do
readSaveSlot :: SaveSlot -> IO (Universe -> Maybe Universe)
readSaveSlot ss = do
fExists <- doesFileExist $ saveSlotPath ss
if fExists
then do
-4
View File
@@ -14,11 +14,8 @@ module Geometry.ConvexPoly (
pointInPolyPoints,
) where
import TH.Derive
import Data.Store
import Control.Lens
import Data.Aeson
import Data.Binary
import Flat
import Geometry.Data
import Geometry.Intersect
@@ -34,7 +31,6 @@ data ConvexPoly = ConvexPoly
, _cpRad :: Float
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store ConvexPoly ) |]))
instance ToJSON ConvexPoly where
toEncoding = genericToEncoding defaultOptions
-1
View File
@@ -10,7 +10,6 @@ module IntSetHelp (
import Data.IntSet.Internal
import Data.IntSet
import Data.Binary
import Flat
-- IntSet is not an instance of Generic?!
-6
View File
@@ -6,9 +6,6 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
module LinearHelp where
import Data.Store
import TH.Derive
import Data.Binary
import Flat
import Linear.V2
import Linear.V3
@@ -17,6 +14,3 @@ 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)) |]))
-5
View File
@@ -6,16 +6,12 @@
module MaybeHelp where
import TH.Derive
import Data.Store
import Control.Lens
import Data.Aeson
import Data.Binary
import Flat
data Maybe' a = Just' {__Just' :: a} | Nothing'
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance (Binary a => Binary (Maybe' a))
instance ToJSON a => ToJSON (Maybe' a) where
toEncoding = genericToEncoding defaultOptions
@@ -44,4 +40,3 @@ toggleJust Nothing = Just ()
toggleJust _ = Nothing
makeLenses ''Maybe'
$($(derive [d| instance Store a => Deriving (Store (Maybe' a)) |]))
-6
View File
@@ -5,9 +5,6 @@
module Picture.Data where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -42,7 +39,6 @@ numLayers = length [minBound :: Layer .. maxBound]
newtype ShadNum = ShadNum {_unShadNum :: Int}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store ShadNum) |]))
polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum
{-# INLINE polyNum #-}
@@ -96,5 +92,3 @@ makeLenses ''Verx
deriveJSON defaultOptions ''Verx
deriveJSON defaultOptions ''Layer
deriveJSON defaultOptions ''ShadNum
$($(derive [d| instance Deriving (Store Verx ) |]))
$($(derive [d| instance Deriving (Store Layer) |]))
-4
View File
@@ -15,10 +15,7 @@ module Quaternion (
module Linear.Quaternion,
) where
import TH.Derive
import Data.Store
import Data.Aeson
import Data.Binary
import Flat
import Geometry.Data
import Geometry.Vector3D
@@ -48,4 +45,3 @@ vToQuat a b
cprod = crossProd a b
deriving instance (Flat a => Flat (Quaternion a))
$($(derive [d| instance Store a => Deriving (Store (Quaternion a)) |]))
-7
View File
@@ -8,12 +8,8 @@
module Shape.Data where
import TH.Derive
import Data.Store
import Data.Binary
import Control.Lens
import Data.Aeson
import Data.Binary
import Flat
import Geometry.Data
import LinearHelp ()
@@ -30,7 +26,6 @@ newtype ShapeType = TopPrism Int
deriving stock Generic
deriving anyclass Flat
$($(derive [d| instance Deriving (Store ShapeType) |]))
data ShapeObj = ShapeObj
{ _shType :: ShapeType
@@ -71,5 +66,3 @@ type Shape' = Stream (Of ShapeObj) IO ()
type Shape = [ShapeObj]
$($(derive [d| instance Deriving (Store ShapeV ) |]))
$($(derive [d| instance Deriving (Store ShapeObj ) |]))
-4
View File
@@ -5,9 +5,6 @@
module Sound.Data where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -36,7 +33,6 @@ data PlayStatus
newtype SoundID = SoundID {_getSoundID :: Int}
deriving (Eq, Ord, Show, Read, Generic, Flat)
$($(derive [d| instance Deriving (Store SoundID) |]))
newtype SoundData = SoundData
{ _loadedChunks :: IM.IntMap Mix.Chunk