Move from store to flat

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