Add sounds, move data types out into separate folders

This commit is contained in:
2022-07-16 17:06:51 +01:00
parent f8f4766012
commit e4a4766ddf
48 changed files with 658 additions and 496 deletions
+14 -130
View File
@@ -10,7 +10,11 @@ circular imports are probably not a good idea.
{-# LANGUAGE DerivingStrategies #-}
module Dodge.Data
( module Dodge.Data
, module Dodge.Data.RightButtonOptions
, module Dodge.Data.Material
, module Dodge.Data.LightSource
, module Dodge.Data.Creature
, module Dodge.Data.Block
, module Dodge.Data.Flare
, module Dodge.Data.LoadAction
, module Dodge.Data.ForegroundShape
@@ -18,6 +22,7 @@ module Dodge.Data
, module Dodge.Data.Object
, module Dodge.Data.Zoning
, module Dodge.Data.Bounds
, module Dodge.Data.Sensor
, module Dodge.Combine.Data
, module Dodge.Distortion.Data
, module Dodge.Data.DamageType
@@ -38,7 +43,12 @@ module Dodge.Data
, module Dodge.Data.PathGraph
) where
import Dodge.Data.RadarBlip
import Dodge.Data.RightButtonOptions
import Dodge.Data.LightSource
import Dodge.Data.Creature
import Dodge.Data.Room
import Dodge.Data.Block
import Dodge.Data.Sensor
import Dodge.Data.Flare
import Dodge.Data.PathGraph
import Dodge.Data.Object
@@ -202,41 +212,6 @@ data HUDElement
= DisplayInventory {_subInventory :: SubInventory}
| DisplayCarte
-- deriving (Eq,Ord,Show)
data RightButtonOptions
= NoRightButtonOptions
| EquipOptions
{_opEquip :: [EquipPosition]
,_opSel :: Int
,_opCurInvPos :: Int
,_opAllocateEquipment :: AllocateEquipment
,_opActivateEquipment :: ActivateEquipment
}
data ActivateEquipment
= ActivateEquipment {_activateEquipment :: Int }
| DeactivateEquipment {_deactivateEquipment :: Int}
| ActivateDeactivateEquipment {_activateEquipment :: Int ,_deactivateEquipment :: Int}
| NoChangeActivateEquipment
data AllocateEquipment
= DoNotMoveEquipment
| PutOnEquipment
{ _allocNewPos :: EquipPosition
}
| MoveEquipment
{ _allocNewPos :: EquipPosition
, _allocOldPos :: EquipPosition
}
| SwapEquipment
{ _allocNewPos :: EquipPosition
, _allocOldPos :: EquipPosition
, _allocSwapID :: Int
}
| ReplaceEquipment
{ _allocNewPos :: EquipPosition
, _allocRemoveID :: Int
}
| RemoveEquipment
{ _allocOldPos :: EquipPosition
}
data SubInventory
= NoSubInventory
@@ -342,17 +317,6 @@ data Cloud = Cloud
data CloudType
= SmokeCloud
| GasCloud
data LSParam = LSParam
{ _lsPos :: !Point3
, _lsRad :: !Float
, _lsCol :: !Point3
}
data LightSource = LS
{ _lsID :: !Int
, _lsParam :: LSParam
, _lsDir :: !Float
, _lsPict :: LightSource -> Picture
}
data TempLightSource = TLS
{ _tlsParam :: LSParam
, _tlsUpdate :: World -> TempLightSource -> Maybe TempLightSource
@@ -389,7 +353,8 @@ data Creature = Creature
, _crLeftInvSel :: Maybe Int
, _crState :: CreatureState
, _crCorpse :: Creature -> Corpse -> SPic
, _crApplyDamage :: [Damage] -> Creature -> World -> World
, _crMaterial :: Material
-- , _crApplyDamage :: [Damage] -> Creature -> World -> World
, _crPastDamage :: Int
, _crStance :: Stance
, _crActionPlan :: ActionPlan
@@ -406,37 +371,11 @@ data Creature = Creature
, _crStatistics :: CreatureStatistics
, _crCamouflage :: CamouflageStatus
}
data CamouflageStatus
= FullyVisible
| Invisible
deriving (Eq,Ord,Enum)
data CreatureStatistics = CreatureStatistics
{ _strength :: Int
, _dexterity :: Int
, _intelligence :: Int
}
data Vocalization
= Mute
| Vocalization
{_vcSound :: SoundID
,_vcWarnings :: [SoundID]
,_vcMaxCoolDown :: Int
,_vcCoolDown :: Int
}
data Intention = Intention
{ _targetCr :: Maybe Creature
, _mvToPoint :: Maybe Point2
, _viewPoint :: Maybe Point2
}
data CrMvType
= NoMvType
| MvWalking { _mvSpeed :: Float }
| CrMvType
{ _mvSpeed :: Float
, _mvTurnRad :: Float -> Float
, _mvTurnJit :: Float
, _mvAimSpeed :: Float -> Float
}
data Button = Button
{ _btPict :: Button -> SPic
, _btPos :: Point2
@@ -511,10 +450,6 @@ data Equipment = Equipment
_itUseAimStance :: Item -> AimStance
_itUseAimStance = _aimStance . _useAim . _itUse
data HeldAttachment
= Torch
| NoHeldAttachment
data ItemConsumption
= LoadableAmmo
{ _laAmmoType :: AmmoType
@@ -978,19 +913,6 @@ data Prop
, _pjTimer :: Int
}
data Either3 a b c = E3x1 a | E3x2 b | E3x3 c
data Block = Block
{ _blID :: Int
, _blWallIDs :: IS.IntSet
, _blHP :: Int
, _blShadows :: [Int] -- a list of blocks/walls? that are not shown when this block exists
, _blFootprint :: [Point2]
, _blPos :: Point2
, _blDir :: Float
, _blHeight :: Float
, _blMaterial :: Material
, _blDraw :: Block -> SPic
, _blObstructs :: [(Int,Int,PathEdge)]
}
data TerminalStatus = TerminalOff | TerminalBusy | TerminalReady
deriving (Eq,Ord,Show)
data TerminalInput = TerminalInput
@@ -1000,7 +922,7 @@ data TerminalInput = TerminalInput
}
data Terminal = Terminal
{ _tmID :: Int
, _tmProgram :: Terminal -> World -> [TerminalLine]
, _tmBootProgram :: Terminal -> World -> [TerminalLine]
, _tmButtonID :: Int
, _tmMachineID :: Int
, _tmName :: String
@@ -1020,49 +942,22 @@ data TerminalToggle = TerminalToggle
{ _ttTriggerID :: Int
, _ttDeathEffect :: (World -> Bool) -> (World -> Bool)
}
--data DamageApplication
-- = ApplyNoDamage
-- | DefaultApplyDamage
data Machine = Machine
{ _mcID :: Int
, _mcWallIDs :: IS.IntSet
-- , _mcUpdate :: Machine -> World -> World
, _mcDraw :: Machine -> SPic
-- , _mcDamageApplication :: DamageApplication
, _mcMaterial :: Material
, _mcPos :: Point2
, _mcDir :: Float
, _mcColor :: Color
, _mcHP :: Int
, _mcSensor :: Sensor
, _mcDamage :: [Damage]
, _mcLSs :: [Int]
, _mcType :: MachineType
, _mcMounts :: M.Map Object Int
, _mcName :: String
-- , _mcTriggerCond :: Machine -> Bool
, _mcCloseSound :: Maybe SoundID
-- , _mcTermMID :: Maybe Int
}
data Sensor = NoSensor
| SensorToggleAmount
{ _sensToggle :: Bool
, _sensAmount :: Int
}
| ProximitySensor
{ _proxStatus :: CloseToggle
, _proxDist :: Float
, _proxRequirement :: ProximityRequirement
, _sensToggle :: Bool
}
deriving (Eq,Ord)
data ProximityRequirement
= RequireHealth {_proxReqMinHealth :: Int}
| RequireEquipment {_proxReqEquipment :: ItemBaseType}
| RequireImpossible
deriving (Eq,Ord,Show)
data CloseToggle = NotClose | IsClose
deriving (Eq,Ord,Show)
data MachineType
= StaticMachine
| Turret
@@ -1547,7 +1442,6 @@ makeLenses ''DamageEffect
makeLenses ''World
makeLenses ''Cloud
makeLenses ''Creature
makeLenses ''LightSource
makeLenses ''TempLightSource
makeLenses ''Item
makeLenses ''ItemUse
@@ -1566,17 +1460,13 @@ makeLenses ''ActionPlan
makeLenses ''Impulse
makeLenses ''Action
makeLenses ''CrGroupParams
makeLenses ''CrMvType
makeLenses ''Intention
makeLenses ''Door
makeLenses ''Block
makeLenses ''Terminal
makeLenses ''Machine
makeLenses ''MachineType
makeLenses ''ItemDimension
makeLenses ''Vocalization
makeLenses ''Universe
makeLenses ''LSParam
makeLenses ''ItemParams
makeLenses ''ItemTweaks
makeLenses ''ItemPortage
@@ -1592,16 +1482,10 @@ makeLenses ''TerminalLine
makeLenses ''ItemValue
makeLenses ''Equipment
makeLenses ''ScreenLayer
makeLenses ''Sensor
makeLenses ''ProximityRequirement
makeLenses ''Beam
makeLenses ''BeamType
makeLenses ''WorldBeams
makeLenses ''ArcStep
makeLenses ''CreatureStatistics
makeLenses ''RightButtonOptions
makeLenses ''AllocateEquipment
makeLenses ''ActivateEquipment
makeLenses ''EquipParams
makeLenses ''TerminalCommand
makeLenses ''TerminalInput