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 =