Refactor doors

This commit is contained in:
2022-07-24 20:36:27 +01:00
parent 2c1bc67a51
commit d6a94ec4bc
25 changed files with 186 additions and 135 deletions
+1
View File
@@ -29,6 +29,7 @@ data WdCrBl = WdCrTrue
data CrBl = CrCanShoot
| CrIsReloading
| CrIsAiming
| CrIsAnimate
deriving (Eq,Ord,Show,Read)
data MCrAc = MCrNoAction
+29 -3
View File
@@ -1,11 +1,37 @@
--{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.Data.Door where
import Dodge.Data.PathGraph
import Dodge.Data.MountedObject
import Geometry.Data
import Dodge.Data.WorldEffect
import qualified Data.IntSet as IS
import Control.Lens
data DoorStatus = DoorOpen | DoorClosed | DoorHalfway | DoorInt Int
deriving (Eq, Ord, Show)
deriving (Eq, Ord, Show,Read)
data PushSource = PushesItself
| PushedBy Int
| NotPushed
deriving (Eq,Ord,Show)
deriving (Eq,Ord,Show,Read)
data Door = Door
{ _drID :: Int
, _drWallIDs :: IS.IntSet
, _drStatus :: DoorStatus
, _drTrigger :: WdBl
, _drMech :: DrWdWd
, _drPos :: (Point2,Point2)
, _drOpenPos :: (Point2,Point2)
, _drClosePos :: (Point2,Point2)
, _drHP :: Int
, _drDeath :: DrWdWd
, _drSpeed :: Float
, _drPushedBy :: PushSource
, _drPushes :: Maybe Int
, _drMounts :: [MountedObject]
, _drObstructs :: [(Int,Int,PathEdge)]
, _drObstacleType :: EdgeObstacle
}
deriving (Eq,Ord,Show,Read)
makeLenses ''Door
+1
View File
@@ -16,4 +16,5 @@ data EnergyBall = EnergyBall
, _ebZ :: Float
, _ebRot :: Float
}
deriving (Eq,Ord,Show,Read)
makeLenses ''EnergyBall
+1
View File
@@ -13,4 +13,5 @@ data Flame = Flame
, _flZ :: Float
, _flOriginalVel :: Point2
}
deriving (Eq,Ord,Show,Read)
makeLenses ''Flame
+1 -2
View File
@@ -4,7 +4,6 @@ module Dodge.Data.Flare where
import Color
import Geometry
import Control.Lens
data Flare
= MuzFlare
{ _flarePoly :: [Point2]
@@ -18,5 +17,5 @@ data Flare
, _flareTran3 :: Point3
, _flareTime :: Int
}
deriving (Eq,Ord,Show,Read)
makeLenses ''Flare
+9
View File
@@ -0,0 +1,9 @@
--{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.Data.MountedObject
where
data MountedObject
= MountedLS Int
| MountedProp Int
deriving (Eq,Ord,Show,Read)
+3 -2
View File
@@ -12,19 +12,20 @@ data PathGraph = PathGraph
, _pgNodeCount :: Int
, _pgEdgeMap :: Map (V2 Point2) (Int,Int,PathEdge)
}
deriving (Eq,Show,Read)
data PathEdge = PathEdge
{_peStart :: Point2
,_peEnd :: Point2
,_peDist :: Float
,_peObstacles :: Set.Set EdgeObstacle
}
deriving (Eq,Ord,Show)
deriving (Eq,Ord,Show,Read)
data EdgeObstacle
= BlockObstacle
| DoorObstacle
| AutoDoorObstacle
| WallObstacle
deriving (Eq,Ord,Show,Bounded,Enum)
deriving (Eq,Ord,Show,Read,Bounded,Enum)
makeLenses ''PathGraph
makeLenses ''PathEdge
+2 -1
View File
@@ -5,10 +5,11 @@ import Geometry.Data
import Control.Lens
data PosEventType = SparkSpawner
deriving (Eq,Ord,Show,Read)
data PosEvent = PosEvent
{ _pvType :: PosEventType
, _pvTimer :: Int
, _pvPos :: Point2
}
deriving (Eq,Ord,Show,Read)
makeLenses ''PosEvent
+1 -2
View File
@@ -4,7 +4,6 @@ module Dodge.Data.RadarBlip where
import Color
import Geometry
import Control.Lens
data RadarBlip = RadarBlip
{ _rbColor :: Color
, _rbTime :: Int
@@ -12,5 +11,5 @@ data RadarBlip = RadarBlip
, _rbRad :: Float
, _rbPos :: Point2
}
deriving (Eq,Ord,Show,Read)
makeLenses ''RadarBlip
+1
View File
@@ -11,4 +11,5 @@ data RadarSweep = RadarSweep
, _rsObject :: Object
, _rsTimer :: Int
}
deriving (Eq,Ord,Show,Read)
makeLenses ''RadarSweep
+1
View File
@@ -13,4 +13,5 @@ data Spark = Spark
, _skWidth :: Float
, _skDamageType :: DamageType
}
deriving (Eq,Ord,Show,Read)
makeLenses ''Spark
+11
View File
@@ -1,4 +1,5 @@
module Dodge.Data.WorldEffect where
import Dodge.Data.CreatureEffect
import Sound.Data
import Geometry.Data
import Dodge.Data.SoundOrigin
@@ -22,7 +23,17 @@ data MdWdWd = MdWdId
deriving (Eq,Ord,Show,Read)
data WdBl = WdTrig Int
| WdBlDoorMoving Int
| WdBlConst Bool
| WdBlNegate WdBl
| WdBlCrFilterNearPoint Float Point2 CrBl
| WdBlBtOn Int
| WdBlBtNotOff Int
deriving (Eq,Ord,Show,Read)
data WdP2f = WdP2f0
| WdP2fDoorPosition Int
deriving (Eq,Ord,Show,Read)
data DrWdWd = DrWdId
| DrWdMakeDoorDebris
| DrWdMechanismStepwise Int [Int] [(Point2,Point2)]
| DoorMechanism
deriving (Eq,Ord,Show,Read)