From 4932952ed42a9b3f321e808f16f58dc7f7e2ee43 Mon Sep 17 00:00:00 2001 From: justin Date: Thu, 16 Jan 2025 12:38:56 +0000 Subject: [PATCH] Cleanup --- src/Dodge/Update/Camera.hs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/Dodge/Update/Camera.hs b/src/Dodge/Update/Camera.hs index 32632ef85..bc640c63a 100644 --- a/src/Dodge/Update/Camera.hs +++ b/src/Dodge/Update/Camera.hs @@ -139,23 +139,18 @@ rotateCamera :: Configuration -> World -> World rotateCamera cfig w | Just ltime <- pkeys ^? ix SDL.ButtonLeft , Just rtime <- pkeys ^? ix SDL.ButtonRight - , rtime > 0 - , ltime > rtime = + , rtime > 0 + , ltime > rtime + , Just rotation <- + angleBetween (w ^. input . mousePos) + <$> (w ^. input . heldPos . at SDL.ButtonRight) = w & wCam . camRot -~ rotation - | otherwise = ifConfigWallRotate cfig (w ^. input . mouseButtons) w + | _gameplay_rotate_to_wall cfig + , isNothing $ pkeys ^? ix SDL.ButtonRight = + rotateToOverlappingWall w + | otherwise = w where pkeys = w ^. input . mouseButtons - rotation = - maybe - 0 - (angleBetween $ w ^. input . mousePos) - (w ^. input . heldPos . at SDL.ButtonRight) - -ifConfigWallRotate :: Configuration -> M.Map MouseButton Int -> World -> World -ifConfigWallRotate cfig mbs - | _gameplay_rotate_to_wall cfig && not (SDL.ButtonRight `M.member` mbs) = - rotateToOverlappingWall - | otherwise = id rotateToOverlappingWall :: World -> World rotateToOverlappingWall w =