Cleanup
This commit is contained in:
@@ -27,12 +27,12 @@ import SDL (MouseButton (..))
|
||||
|
||||
{- Update the screen camera rotation and position, including any in rold scope/remote camera modifiers;
|
||||
update where your avatar's view is from. -}
|
||||
updateCamera :: Configuration -> World -> World
|
||||
updateCamera :: Config -> World -> World
|
||||
updateCamera cfig w = case w ^. wCam . camControl of
|
||||
CamInGame{} -> updateInGameCamera cfig w
|
||||
CamFloat -> updateFloatingCamera cfig w
|
||||
|
||||
updateFloatingCamera :: Configuration -> World -> World
|
||||
updateFloatingCamera :: Config -> World -> World
|
||||
updateFloatingCamera cfig w =
|
||||
w
|
||||
& updateBounds cfig
|
||||
@@ -76,7 +76,7 @@ zoomFloatingCamera theinput
|
||||
|
||||
-- the 39/40 is taken from zoomSpeed
|
||||
|
||||
updateInGameCamera :: Configuration -> World -> World
|
||||
updateInGameCamera :: Config -> World -> World
|
||||
updateInGameCamera cfig w =
|
||||
w
|
||||
& updateBounds cfig
|
||||
@@ -84,7 +84,7 @@ updateInGameCamera cfig w =
|
||||
& rotateCamera cfig
|
||||
& over wCam (setViewDistance cfig) -- I think this should be updated after the zoom?
|
||||
|
||||
moveZoomCamera :: Configuration -> Input -> Creature -> World -> Camera -> Camera
|
||||
moveZoomCamera :: Config -> Input -> Creature -> World -> Camera -> Camera
|
||||
moveZoomCamera cfig theinput cr w campos =
|
||||
campos
|
||||
& camCenter .~ fromMaybe (_crPos cr +.+ offset) mremotepos
|
||||
@@ -192,7 +192,7 @@ heldAimZoom = \case
|
||||
viewDistanceFromItems :: Creature -> Float
|
||||
viewDistanceFromItems _ = 1
|
||||
|
||||
rotateCamera :: Configuration -> World -> World
|
||||
rotateCamera :: Config -> World -> World
|
||||
rotateCamera cfig w
|
||||
| MouseGameRotate <- w ^. input . mouseContext
|
||||
, Just rotation <-
|
||||
@@ -231,7 +231,7 @@ clipZoom ::
|
||||
Float
|
||||
clipZoom = min 20 . max 0.2
|
||||
|
||||
setViewDistance :: Configuration -> Camera -> Camera
|
||||
setViewDistance :: Config -> Camera -> Camera
|
||||
setViewDistance cfig w =
|
||||
w & camViewDistance
|
||||
.~ sqrt (halfWidth cfig ** 2 + halfHeight cfig ** 2) / (w ^. camZoom)
|
||||
@@ -243,7 +243,7 @@ farWallDistDirection p w = boundPoints $ map f $ getViewpoints p (_cWorld w)
|
||||
wls q = filter wlIsOpaque $ wlsNearSeg p q w
|
||||
findPoint q = fromMaybe q . uncurry (intersectSegSeg p q) . _wlLine
|
||||
|
||||
findBoundDists :: Configuration -> World -> (Float, Float, Float, Float)
|
||||
findBoundDists :: Config -> World -> (Float, Float, Float, Float)
|
||||
findBoundDists cfig w
|
||||
| debugOn Bound_box_screen cfig = (hh, - hh, hw, - hw)
|
||||
| otherwise = fromMaybe (0, 0, 0, 0) $ farWallDistDirection (w ^. wCam . camViewFrom) w
|
||||
@@ -253,7 +253,7 @@ findBoundDists cfig w
|
||||
|
||||
-- this probably doesn't need to be updated every frame,
|
||||
-- though I'm not sure how often it should be updated
|
||||
updateBounds :: Configuration -> World -> World
|
||||
updateBounds :: Config -> World -> World
|
||||
updateBounds cfig w = case (w ^. cWorld . cClock) `mod` 5 of
|
||||
0 ->
|
||||
w
|
||||
|
||||
Reference in New Issue
Block a user