Simplify props (should they be removed?)

This commit is contained in:
2025-11-09 11:59:59 +00:00
parent dd4ac80159
commit 397980a83f
4 changed files with 0 additions and 65 deletions
-17
View File
@@ -7,7 +7,6 @@ import Color
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Dodge.Data.WorldEffect
import Geometry.Data
import qualified Quaternion as Q
import ShapePicture.Data
@@ -15,10 +14,8 @@ import ShapePicture.Data
data Prop = ShapeProp
{ _prPos :: Point2
, _prDraw :: SPic
, _prUpdate :: PropUpdate
, _prID :: Int
, _prRot :: Float
-- , _prToggle :: Bool
}
data DebrisType
@@ -33,23 +30,9 @@ data Debris = DebrisChunk
, _dbSpin :: Q.Quaternion Float
}
data PropUpdate
= PropUpdateId
| PropUpdates [PropUpdate]
| PropUpdatePosition WdP2f
| PropUpdateWhen WdBl PropUpdate
| PropUpdateIf WdBl PropUpdate PropUpdate
data PrWdLsLs
= PrWdLsId
| PrWdLsSetPosition WdP2f Point3
| PrWdLsSetColor Point3
makeLenses ''Prop
makeLenses ''Debris
makeLenses ''DebrisType
deriveJSON defaultOptions ''DebrisType
deriveJSON defaultOptions ''Debris
deriveJSON defaultOptions ''PrWdLsLs
deriveJSON defaultOptions ''PropUpdate
deriveJSON defaultOptions ''Prop
-14
View File
@@ -1,14 +0,0 @@
module Dodge.Default.Prop where
import Dodge.Data.Prop
import Geometry
defaultProp :: Prop
defaultProp =
ShapeProp
{ _prPos = V2 0 0
, _prDraw = mempty
, _prID = 0
, _prUpdate = PropUpdateId
, _prRot = 0
}
-31
View File
@@ -1,31 +0,0 @@
module Dodge.Prop.Update (updateProp) where
import Control.Lens
import Data.Foldable
import Dodge.Data.World
import Dodge.WdP2f
import Dodge.WorldBool
updateProp :: Prop -> World -> World
updateProp pr = case _prUpdate pr of
PropUpdateId -> id
PropUpdates pus -> doPropUpdates pr pus
PropUpdatePosition x -> propUpdatePosition x pr
PropUpdateWhen t x -> propUpdateIf t x PropUpdateId pr
PropUpdateIf t x y -> propUpdateIf t x y pr
propUpdateIf :: WdBl -> PropUpdate -> PropUpdate -> Prop -> World -> World
propUpdateIf wb x y pr w
| doWdBl wb w = updateProp (pr & prUpdate .~ x) w
| otherwise = updateProp (pr & prUpdate .~ y) w
propUpdatePosition :: WdP2f -> Prop -> World -> World
propUpdatePosition x pr w =
w
& cWorld . lWorld . props . ix (_prID pr) . prPos .~ fst (doWdP2f x w)
& cWorld . lWorld . props . ix (_prID pr) . prRot .~ snd (doWdP2f x w)
doPropUpdates :: Prop -> [PropUpdate] -> World -> World
doPropUpdates pr pus w = foldl' f w pus
where
f w' pu = updateProp (pr & prUpdate .~ pu) w'
-3
View File
@@ -38,7 +38,6 @@ import Dodge.Machine.Update
import Dodge.ModificationEffect
import Dodge.Projectile.Update
import Dodge.Prop.Moving
import Dodge.Prop.Update
import Dodge.RadarBlip
import Dodge.RadarSweep
import Dodge.ScreenPos
@@ -275,13 +274,11 @@ functionalUpdate =
. over
uvWorld
(updateIMl' (_linearShockwaves . _lWorld . _cWorld) updateLinearShockwave)
. over uvWorld (updateIMl' (_props . _lWorld . _cWorld) updateProp)
. over uvWorld (updateIMl' (_projectiles . _lWorld . _cWorld) updateProjectile)
. over uvWorld updateClouds
. over uvWorld updateDusts
. over uvWorld updateGusts
. over uvWorld (updateIMl' (_terminals . _lWorld . _cWorld) tmUpdate)
-- . updateIMl _machines mcChooseUpdate
. over uvWorld (updateIMl' (_machines . _lWorld . _cWorld) updateMachine)
. over uvWorld (updateIMl' (_creatures . _lWorld . _cWorld) updateCreature)
-- creatures should be updated early so that crOldPos is set before any position change