From 39753755af58c45d4570ad9fa3b41775fd55e611 Mon Sep 17 00:00:00 2001 From: justin Date: Sun, 1 Jun 2025 09:31:29 +0100 Subject: [PATCH] Cleanup --- src/Dodge/Creature/YourControl.hs | 6 ++---- src/Dodge/Update/Camera.hs | 17 ++++++++--------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/Dodge/Creature/YourControl.hs b/src/Dodge/Creature/YourControl.hs index 7564b7027..00d028297 100644 --- a/src/Dodge/Creature/YourControl.hs +++ b/src/Dodge/Creature/YourControl.hs @@ -135,10 +135,8 @@ doAimTwist :: Float -> Creature -> Creature doAimTwist x cr = fromMaybe cr $ do itRef <- cr ^? crManipulation . manObject . imRootSelectedItem astance <- cr ^? crInv . ix itRef . itUse . heldAim . aimStance - return $ case astance of - TwoHandUnder -> cr & crDir +~ x - TwoHandOver -> cr & crDir +~ x - _ -> cr + guard $ astance == TwoHandOver || astance == TwoHandUnder + return $ cr & crDir +~ x removeAimPosture :: Creature -> Creature removeAimPosture = (crStance . posture .~ AtEase) . doAimTwist twoHandTwistAmount diff --git a/src/Dodge/Update/Camera.hs b/src/Dodge/Update/Camera.hs index 71864f694..0f6305dfa 100644 --- a/src/Dodge/Update/Camera.hs +++ b/src/Dodge/Update/Camera.hs @@ -157,22 +157,21 @@ rotateToOverlappingWall w = maybe id (doWallRotate . snd) - (overlapCircWallsClosest p (_crRad cr + 5) (filter _wlRotateTo $ wlsNearPoint p w)) + (overlapCircWallsClosest p (_crRad cr + 10) (filter _wlRotateTo $ wlsNearPoint p w)) w where cr = you w p = _crPos (you w) doWallRotate :: Wall -> World -> World -doWallRotate wl w = rotateUsing $ (argV . uncurry (-.-) $ _wlLine wl) - (w ^. wCam . camRot) +doWallRotate wl w + | b - b' > 0.01 = w & wCam . camRot +~ 0.01 + | b - b' < negate 0.01 = w & wCam . camRot -~ 0.01 + | otherwise = w where - rotateUsing a - | b - b' > 0.01 = w & wCam . camRot +~ 0.01 - | b - b' < negate 0.01 = w & wCam . camRot -~ 0.01 - | otherwise = w - where - b = a * (4 / pi) - b' = fromIntegral (round b :: Int) + a = argV (uncurry (-.-) $ _wlLine wl) - w ^. wCam . camRot + b = a * (4 / pi) -- for 8 way cardinal orientation wrt wall + b' = fromIntegral (round b :: Int) zoomFromItem :: ItZoom -> Float zoomFromItem ItZoom{_izMax = zMax, _izMin = zMin, _izFac = zFac} =