This commit is contained in:
2021-05-05 17:36:10 +02:00
parent f0e5095b5f
commit 05086d6f4a
29 changed files with 760 additions and 766 deletions
+4 -33
View File
@@ -10,16 +10,14 @@ module Dodge.Data
( module Dodge.Data
, module Dodge.Data.DamageType
, module Dodge.Data.SoundOrigin
, module Dodge.Creature.Data
, module Dodge.Creature.State.Data
, Point2 (..)
, Sound (..)
, soundTime
)
where
) where
import Dodge.Picture.Layer.Data
import Dodge.Creature.Data
import Dodge.Creature.State.Data
import Dodge.Creature.Stance.Data
import Dodge.Data.Menu
import Dodge.Data.SoundOrigin
import Dodge.Data.DamageType
@@ -46,7 +44,6 @@ import SDL (Scancode, MouseButton)
import qualified SDL.Mixer as Mix
import Graphics.Rendering.OpenGL (PrimitiveMode (..),GLfloat,Program,VertexArrayObject,BufferObject)
import Codec.Picture (Image,PixelRGBA8)
data World = World
{ _keys :: !(S.Set Scancode)
, _mouseButtons :: !(S.Set MouseButton)
@@ -103,14 +100,11 @@ data World = World
, _sideEffects :: [PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)]
, _doneSideEffects :: [PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)]
}
data Corpse = Corpse
{ _cpPos :: Point2
, _cpPict :: Picture
, _cpRes :: Creature
}
data Cloud = Cloud
{ _clID :: Int
, _clPos :: Point2
@@ -120,7 +114,6 @@ data Cloud = Cloud
, _clTimer :: Int
, _clEffect :: Cloud -> World -> World
}
data LightSource = LS
{ _lsID :: !Int
, _lsPos :: !Point2
@@ -128,14 +121,12 @@ data LightSource = LS
, _lsRad :: !Float
, _lsIntensity :: !Float
}
data TempLightSource = TLS
{ _tlsPos :: !Point2
, _tlsRad :: !Float
, _tlsIntensity :: !Float
, _tlsUpdate :: World -> TempLightSource -> (World, Maybe TempLightSource)
}
data Creature = Creature
{ _crPos :: Point2
, _crOldPos :: Point2
@@ -158,12 +149,10 @@ data Creature = Creature
, _crCorpse :: Picture
, _crApplyDamage :: [DamageType] -> Creature -> (World -> World,Creature)
}
data WorldState
= DoorNumOpen Int
| CrNumAlive Int
deriving (Eq,Ord)
data Button = Button
{ _btPict :: Picture
, _btPos :: Point2
@@ -173,10 +162,8 @@ data Button = Button
, _btText :: String
, _btState :: ButtonState
}
data ButtonState = BtOn | BtOff | BtNoLabel
deriving (Eq, Show)
data PressPlate = PressPlate
{ _ppPict :: Picture
, _ppPos :: Point2
@@ -185,13 +172,10 @@ data PressPlate = PressPlate
, _ppID :: Int
, _ppText :: String
}
data FloorItem = FlIt { _flIt :: Item , _flItPos :: Point2 , _flItRot :: Float, _flItID :: Int}
data ItemPos
= InInv { _itCrId :: Int , _itInvId :: Int }
| OnFloor { _itFlID :: Int }
data Item
= Weapon
{ _itName :: String
@@ -287,7 +271,6 @@ data Item
, _itScrollDown :: Int -> World -> World
}
| NoItem
data ItEffect = NoItEffect
| ItInvEffect
{_itInvEffect :: Creature -> Int -> World -> World
@@ -306,15 +289,12 @@ data ItZoom = ItZoom
,_itZoomMin :: Float
,_itZoomFac :: Float
}
data IntID a = IntID Int a
data HammerPosition
= HammerDown
| HammerReleased
| HammerUp
| NoHammer
data ItemIdentity
= Pistol
| SpreadGun
@@ -346,11 +326,8 @@ data ItemIdentity
| LightningGun
| PoisonSprayer
deriving (Eq,Show,Ord,Enum)
{-
Objects without ids.
Update themselves, perhaps with side effects.
-}
{- Objects without ids.
Update themselves, perhaps with side effects. -}
data Particle
= Particle
{ _ptDraw :: Particle -> Picture
@@ -389,10 +366,8 @@ data Particle
, _btMaxTime' :: Int
, _btTimer' :: Int
}
type HitEffect = Particle -> [(Point2, (Either3 Creature Wall ForceField))] -> World
-> (World,Maybe Particle)
data Projectile
= Projectile
{ _pjPos :: Point2
@@ -411,9 +386,7 @@ data Projectile
, _pjUpdate :: World -> World
, _pjPayload :: Point2-> World -> World
}
data Either3 a b c = E3x1 a | E3x2 b | E3x3 c
data Wall
= Wall
{ _wlLine :: (Point2,Point2)
@@ -454,7 +427,6 @@ data Wall
, _blDegrades :: [Int]
, _blShadows :: [Int]
}
data ForceField = FF
{ _ffLine :: [Point2] , _ffID :: Int
, _ffColor :: Color
@@ -468,7 +440,6 @@ makeLenses ''Cloud
makeLenses ''Creature
makeLenses ''LightSource
makeLenses ''TempLightSource
makeLenses ''Stance
makeLenses ''Item
makeLenses ''ItemPos
makeLenses ''ItEffect