Add in "linear" lWorld to separate time reversable worlds
This commit is contained in:
@@ -15,21 +15,20 @@ import Dodge.Base
|
||||
import Dodge.Data.World
|
||||
import Dodge.Wall.Zone
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
moveWallIDUnsafe :: Int -> (Point2, Point2) -> World -> World
|
||||
moveWallIDUnsafe wlid wlline w = case w ^? cWorld . walls . ix wlid of
|
||||
moveWallIDUnsafe wlid wlline w = case w ^? cWorld . lWorld . walls . ix wlid of
|
||||
Nothing -> error "tried moving nonexistant wall"
|
||||
Just wl -> moveWall wlid wl wlline w
|
||||
|
||||
moveWallID :: Int -> (Point2, Point2) -> World -> World
|
||||
moveWallID wlid wlline w = case w ^? cWorld . walls . ix wlid of
|
||||
moveWallID wlid wlline w = case w ^? cWorld . lWorld . walls . ix wlid of
|
||||
Nothing -> w
|
||||
Just wl -> moveWall wlid wl wlline w
|
||||
|
||||
moveWall :: Int -> Wall -> (Point2, Point2) -> World -> World
|
||||
moveWall wlid wl wlline w =
|
||||
w & cWorld . walls . ix wlid .~ newwl
|
||||
w & cWorld . lWorld . walls . ix wlid .~ newwl
|
||||
& deleteWallFromZones wl
|
||||
& insertWallInZones newwl
|
||||
where
|
||||
@@ -37,18 +36,19 @@ moveWall wlid wl wlline w =
|
||||
|
||||
translateWallID :: Int -> Point2 -> World -> World
|
||||
translateWallID wlid p w = fromMaybe w $ do
|
||||
oldwl <- w ^? cWorld . walls . ix wlid
|
||||
oldwl <- w ^? cWorld . lWorld . walls . ix wlid
|
||||
let newwl = oldwl & wlLine . each +~ p
|
||||
return $
|
||||
w
|
||||
& cWorld . walls . ix wlid .~ newwl
|
||||
& cWorld . lWorld . walls . ix wlid .~ newwl
|
||||
& deleteWallFromZones oldwl
|
||||
& insertWallInZones newwl
|
||||
|
||||
moveWallIDToward :: Int -> Float -> (Point2, Point2) -> World -> World
|
||||
moveWallIDToward wlid speed ep w = moveWall wlid wl newwlline w
|
||||
where
|
||||
wl = _walls (_cWorld w) IM.! wlid
|
||||
--wl = _walls (_cWorld w) IM.! wlid
|
||||
wl = w ^?! cWorld . lWorld . walls . ix wlid
|
||||
newwlline = mvPs speed ep (_wlLine wl)
|
||||
|
||||
mvP :: Float -> Point2 -> Point2 -> Point2
|
||||
|
||||
Reference in New Issue
Block a user