79 lines
1.8 KiB
Haskell
79 lines
1.8 KiB
Haskell
{-# LANGUAGE DeriveAnyClass #-}
|
|
{-# LANGUAGE DeriveGeneric #-}
|
|
{-# LANGUAGE StrictData #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
module Dodge.Data.CWorld (
|
|
module Dodge.Data.CWorld,
|
|
module Dodge.Data.LWorld,
|
|
module Dodge.Data.CamPos
|
|
) where
|
|
|
|
import Data.Tile
|
|
import Geometry.Data
|
|
import Dodge.Data.LWorld
|
|
import Control.Lens
|
|
import Data.Aeson
|
|
import Data.Aeson.TH
|
|
--import Dodge.Data.GenParams
|
|
import Dodge.GameRoom
|
|
import Geometry.ConvexPoly
|
|
import Dodge.Data.CamPos
|
|
import qualified Data.IntSet as IS
|
|
import Data.Graph.Inductive
|
|
|
|
data CWorld = CWorld
|
|
{ _lWorld :: LWorld
|
|
, _camPos :: CamPos
|
|
, _cwGen :: CWGen
|
|
, _cClock :: Int
|
|
, _pastWorlds :: [LWorld]
|
|
, _timeFlow :: TimeFlowStatus
|
|
, _seenWalls :: IS.IntSet
|
|
, _floorTiles :: [(Point3, Point3)]
|
|
, _cwTiles :: [Tile]
|
|
, _pathGraph :: Gr Point2 PathEdge
|
|
, _numberFloorVerxs :: Int
|
|
}
|
|
|
|
data TimeFlowStatus
|
|
= DeathTime
|
|
{ _deathDelay :: Int }
|
|
| NormalTimeFlow
|
|
| ScrollTimeFlow
|
|
{ _scrollSmoothing :: Int
|
|
, _reverseAmount :: Int
|
|
, _futureWorlds :: [LWorld]
|
|
, _scrollItemLocation :: Int
|
|
}
|
|
| RewindLeftClick
|
|
{ _reverseAmount :: Int
|
|
, _scrollItemLocation :: Int
|
|
}
|
|
| PausedTimeFlow
|
|
{ _timeFlowCharge :: Int
|
|
, _scrollItemLocation :: Int
|
|
}
|
|
|
|
data CWGen = CWGen
|
|
{ _cwgParams :: GenParams
|
|
, _cwgWorldBounds :: Bounds
|
|
, _cwgGameRooms :: [GameRoom] -- consider using an IntMap
|
|
, _cwgRoomClipping :: [ConvexPoly]
|
|
, _cwgSeed :: Int
|
|
}
|
|
|
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
|
|
makeLenses ''CWorld
|
|
makeLenses ''CWGen
|
|
makeLenses ''TimeFlowStatus
|
|
concat
|
|
<$> mapM
|
|
(deriveJSON defaultOptions)
|
|
[ ''CWGen
|
|
, ''CWorld
|
|
, ''TimeFlowStatus
|
|
]
|