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
+23
View File
@@ -0,0 +1,23 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.Data.Block where
import Dodge.Data.Material
import Dodge.Data.PathGraph
import ShapePicture
import Geometry
import Control.Lens
import qualified Data.IntSet as IS
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)]
}
makeLenses ''Block
+36
View File
@@ -0,0 +1,36 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.Data.Creature where
import Sound.Data
import Control.Lens
data CamouflageStatus
= FullyVisible
| Invisible
deriving (Eq,Ord,Enum)
data CreatureStatistics = CreatureStatistics
{ _strength :: Int
, _dexterity :: Int
, _intelligence :: Int
}
deriving (Eq,Ord,Show)
data Vocalization
= Mute
| Vocalization
{_vcSound :: SoundID
,_vcWarnings :: [SoundID]
,_vcMaxCoolDown :: Int
,_vcCoolDown :: Int
}
deriving (Eq,Ord,Show)
data CrMvType
= NoMvType
| MvWalking { _mvSpeed :: Float }
| CrMvType
{ _mvSpeed :: Float
, _mvTurnRad :: Float -> Float
, _mvTurnJit :: Float
, _mvAimSpeed :: Float -> Float
}
makeLenses ''CreatureStatistics
makeLenses ''Vocalization
makeLenses ''CrMvType
+20
View File
@@ -0,0 +1,20 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.Data.LightSource where
import Geometry
import Picture.Data
import Control.Lens
data LSParam = LSParam
{ _lsPos :: !Point3
, _lsRad :: !Float
, _lsCol :: !Point3
}
data LightSource = LS
{ _lsID :: !Int
, _lsParam :: LSParam
, _lsDir :: !Float
, _lsPict :: LightSource -> Picture
}
makeLenses ''LSParam
makeLenses ''LightSource
+1 -1
View File
@@ -3,5 +3,5 @@
{-# LANGUAGE FlexibleInstances #-}
--{-# LANGUAGE DeriveGeneric #-}
module Dodge.Data.Material where
data Material = Wood | Dirt | Stone | Glass | Metal | Crystal
data Material = Wood | Dirt | Stone | Glass | Metal | Crystal | Flesh | Electronics
deriving (Eq,Ord,Show,Bounded,Enum)
+44
View File
@@ -0,0 +1,44 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.Data.RightButtonOptions where
import Dodge.Equipment.Data
import Control.Lens
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
}
makeLenses ''RightButtonOptions
makeLenses ''AllocateEquipment
makeLenses ''ActivateEquipment
+29
View File
@@ -0,0 +1,29 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.Data.Sensor where
import Dodge.Combine.Data
import Dodge.Data.DamageType
import Control.Lens
data Sensor = NoSensor
| DamageSensor
{ _sensToggle :: Bool
, _sensAmount :: Int
, _sensType :: DamageType
}
| 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)
makeLenses ''Sensor
makeLenses ''ProximityRequirement
+1 -1
View File
@@ -19,7 +19,7 @@ data Wall = Wall
, _wlTouchThrough :: Bool
, _wlFireThrough :: Bool
, _wlReflect :: Bool
, _wlUnshadowed :: Bool
, _wlUnshadowed :: Bool
, _wlRotateTo :: Bool
, _wlStructure :: WallStructure
, _wlHeight :: Float