Add trajectory to grenades, various refactoring

This commit is contained in:
2021-09-25 18:39:53 +01:00
parent a0340eb024
commit 32367b5b2d
32 changed files with 339 additions and 253 deletions
+23 -11
View File
@@ -56,7 +56,7 @@ data World = World
, _itemPositions :: IM.IntMap ItemPos
, _clouds :: [Cloud]
, _cloudsZone :: Zone [Cloud]
, _projectiles :: IM.IntMap Projectile
, _props :: IM.IntMap Prop
, _particles :: ![Particle]
, _walls :: !(IM.IntMap Wall)
, _wallsZone :: Zone (IM.IntMap Wall)
@@ -455,7 +455,7 @@ data Ammo
{ _amPayload :: Point2 -> World -> World
, _amString :: String
, _amPjParams :: [PjParam]
, _amPjDraw :: Projectile -> Picture
, _amPjDraw :: Prop -> SPic
, _amParamSel :: Int
}
| BulletAmmo
@@ -466,19 +466,19 @@ data Ammo
}
| GenericAmmo
data PjParam = PjParam
{ _pjMoveParam :: Int -> Item -> Creature -> Projectile -> World -> World
{ _pjMoveParam :: Int -> Item -> Creature -> Prop -> World -> World
, _pjIntParam :: Int
, _pjMaxParam :: Int
, _pjDisplayParam :: Int -> String
}
data Projectile
data Prop
= Projectile
{ _pjPos :: Point2
, _pjStartPos :: Point2
, _pjVel :: Point2
, _pjDraw :: Projectile -> Picture
, _prDraw :: Prop -> SPic
, _pjID :: Int
, _pjUpdate :: Projectile -> World -> World
, _pjUpdate :: Prop -> World -> World
}
| Shell
{ _pjPos :: Point2
@@ -487,16 +487,28 @@ data Projectile
, _pjAcc :: Point2
, _pjDir :: Float
, _pjSpin :: Float
, _pjDraw :: Projectile -> Picture
, _prDraw :: Prop -> SPic
, _pjID :: Int
, _pjUpdate :: Projectile -> World -> World
, _pjUpdate :: Prop -> World -> World
, _pjPayload :: Point2 -> World -> World
, _pjTimer :: Int
, _pjZ :: Float
}
| Bomb
{ _pjPos :: Point2
, _pjVel :: Point2
, _pjZ :: Float
, _pjVelZ :: Float
, _prDraw :: Prop -> SPic
, _pjID :: Int
, _pjUpdate :: Prop -> World -> World
, _pjPayload :: Point2 -> World -> World
, _pjTimer :: Int
}
| LinearShockwave
{ _pjDraw :: Projectile -> Picture
{ _prDraw :: Prop -> SPic
, _pjID :: Int
, _pjUpdate :: Projectile -> World -> World
, _pjUpdate :: Prop -> World -> World
, _pjPoints :: [(Point2,Point2)]
, _pjTimer :: Int
}
@@ -720,7 +732,7 @@ makeLenses ''ItZoom
makeLenses ''FloorItem
makeLenses ''Ammo
makeLenses ''PjParam
makeLenses ''Projectile
makeLenses ''Prop
makeLenses ''Particle
makeLenses ''Wall
makeLenses ''ForceField