Partially working mounts on lerp doors

This commit is contained in:
2025-10-22 11:03:46 +01:00
parent f8073381ee
commit af245fb5bf
10 changed files with 78 additions and 150 deletions
-31
View File
@@ -3,15 +3,9 @@
module Dodge.Wall.Move (
moveWallID,
moveWallIDUnsafe,
moveWall,
moveWallIDToward,
translateWallID,
mvPs,
) where
import Control.Lens
import Data.Maybe
import Dodge.Base
import Dodge.Data.World
import Dodge.Wall.Zone
import Geometry
@@ -33,28 +27,3 @@ moveWall wlid wl wlline w =
& insertWallInZones newwl
where
newwl = wl{_wlLine = wlline}
translateWallID :: Int -> Point2 -> World -> World
translateWallID wlid p w = fromMaybe w $ do
oldwl <- w ^? cWorld . lWorld . walls . ix wlid
let newwl = oldwl & wlLine . each +~ p
return $
w
& 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 = w ^?! cWorld . lWorld . walls . ix wlid
newwlline = mvPs speed ep (_wlLine wl)
mvP :: Float -> Point2 -> Point2 -> Point2
{-# INLINE mvP #-}
mvP !speed !ep !p = mvPointTowardAtSpeed speed ep p
mvPs :: Float -> (Point2, Point2) -> (Point2, Point2) -> (Point2, Point2)
{-# INLINE mvPs #-}
mvPs !speed (!ex, !ey) (!sx, !sy) = (mvP speed ex sx, mvP speed ey sy)