Add in "linear" lWorld to separate time reversable worlds
This commit is contained in:
@@ -79,7 +79,7 @@ addGib4 ::
|
||||
World
|
||||
addGib4 p col (v, zs, q, h) =
|
||||
plNew
|
||||
(cWorld . props)
|
||||
(cWorld . lWorld . props)
|
||||
prID
|
||||
( aGib & prPos .~ p +.+ (5 *.* normalizeV v)
|
||||
& prColor .~ col
|
||||
@@ -93,7 +93,7 @@ addGib4 p col (v, zs, q, h) =
|
||||
addGibAt :: Float -> Color -> Point2 -> World -> World
|
||||
addGibAt h col p w =
|
||||
w
|
||||
& plNew (cWorld . props) prID gib
|
||||
& plNew (cWorld . lWorld . props) prID gib
|
||||
& randGen .~ newg
|
||||
where
|
||||
(gib, newg) = runState f $ _randGen w
|
||||
@@ -116,7 +116,7 @@ addGibAt h col p w =
|
||||
addGibAtDir :: Float -> Float -> Color -> Point2 -> World -> World
|
||||
addGibAtDir dir h col p w =
|
||||
w
|
||||
& plNew (cWorld . props) prID gib
|
||||
& plNew (cWorld . lWorld . props) prID gib
|
||||
& randGen .~ newg
|
||||
where
|
||||
(gib, newg) = runState f $ _randGen w
|
||||
|
||||
@@ -12,12 +12,12 @@ fallSmallBounceDamage :: Prop -> World -> World
|
||||
fallSmallBounceDamage pr w =
|
||||
w
|
||||
& dodamage
|
||||
& cWorld . props . ix (_prID pr) %~ fallSmallBounce' w
|
||||
& cWorld . lWorld . props . ix (_prID pr) %~ fallSmallBounce' w
|
||||
where
|
||||
p = _prPos pr
|
||||
v = _prVel pr
|
||||
dodamage
|
||||
| _prPosZ pr < 25 = cWorld . creatures %~ fmap dodamage'
|
||||
| _prPosZ pr < 25 = cWorld . lWorld . creatures %~ fmap dodamage'
|
||||
| otherwise = id
|
||||
dodamage' cr
|
||||
| dist (_crPos cr) p < _crRad cr + 5 =
|
||||
@@ -28,7 +28,7 @@ fallSmallBounceDamage pr w =
|
||||
fallSmallBounce :: Prop -> World -> World
|
||||
fallSmallBounce pr w =
|
||||
w
|
||||
& cWorld . props . ix (_prID pr) %~ fallSmallBounce' w
|
||||
& cWorld . lWorld . props . ix (_prID pr) %~ fallSmallBounce' w
|
||||
|
||||
fallSmallBounce' :: World -> Prop -> Prop
|
||||
fallSmallBounce' w pr
|
||||
|
||||
@@ -16,7 +16,7 @@ updateProp pr = case _prUpdate pr of
|
||||
PropRotate x -> rotateProp x pr
|
||||
PropSetToggleAnd wb pu -> propSetToggleAnd wb pu pr
|
||||
PropUpdates pus -> doPropUpdates pr pus
|
||||
PropUpdateLS lsid x -> \w -> w & cWorld . lightSources . ix lsid %~ doPrWdLsLs x pr w
|
||||
PropUpdateLS lsid x -> \w -> w & cWorld . lWorld . lightSources . ix lsid %~ doPrWdLsLs x pr w
|
||||
PropUpdatePosition x -> propUpdatePosition x pr
|
||||
PropUpdateWhen t x -> propUpdateIf t x PropUpdateId pr
|
||||
PropUpdateAnd x y -> doPropUpdates pr [x, y]
|
||||
@@ -30,8 +30,8 @@ propUpdateIf wb x y pr w
|
||||
propUpdatePosition :: WdP2f -> Prop -> World -> World
|
||||
propUpdatePosition x pr w =
|
||||
w
|
||||
& cWorld . props . ix (_prID pr) . prPos .~ fst (doWdP2f x w)
|
||||
& cWorld . props . ix (_prID pr) . prRot .~ snd (doWdP2f x 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
|
||||
@@ -44,9 +44,9 @@ propSetToggleAnd wb pu pr = setToggle (doWdBl wb) pr . updateProp (pr & prUpdate
|
||||
-- fugly
|
||||
|
||||
setToggle :: (World -> Bool) -> Prop -> World -> World
|
||||
setToggle cond pr w = w & cWorld . props . ix (_prID pr) . prToggle .~ cond w
|
||||
setToggle cond pr w = w & cWorld . lWorld . props . ix (_prID pr) . prToggle .~ cond w
|
||||
|
||||
rotateProp :: Float -> Prop -> World -> World
|
||||
rotateProp rotAmount pr w =
|
||||
w
|
||||
& cWorld . props . ix (_prID pr) . prRot +~ rotAmount
|
||||
& cWorld . lWorld . props . ix (_prID pr) . prRot +~ rotAmount
|
||||
|
||||
Reference in New Issue
Block a user