From 397980a83f89da2a4c91db815a5e7eea564145fc Mon Sep 17 00:00:00 2001 From: justin Date: Sun, 9 Nov 2025 11:59:59 +0000 Subject: [PATCH] Simplify props (should they be removed?) --- src/Dodge/Data/Prop.hs | 17 ----------------- src/Dodge/Default/Prop.hs | 14 -------------- src/Dodge/Prop/Update.hs | 31 ------------------------------- src/Dodge/Update.hs | 3 --- 4 files changed, 65 deletions(-) delete mode 100644 src/Dodge/Default/Prop.hs delete mode 100644 src/Dodge/Prop/Update.hs diff --git a/src/Dodge/Data/Prop.hs b/src/Dodge/Data/Prop.hs index 81f265c1d..e82c6387f 100644 --- a/src/Dodge/Data/Prop.hs +++ b/src/Dodge/Data/Prop.hs @@ -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 diff --git a/src/Dodge/Default/Prop.hs b/src/Dodge/Default/Prop.hs deleted file mode 100644 index f83f548f3..000000000 --- a/src/Dodge/Default/Prop.hs +++ /dev/null @@ -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 - } diff --git a/src/Dodge/Prop/Update.hs b/src/Dodge/Prop/Update.hs deleted file mode 100644 index 50c0b46f8..000000000 --- a/src/Dodge/Prop/Update.hs +++ /dev/null @@ -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' diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index 811bcac90..976cb9d5c 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -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