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
|
||||
|
||||
@@ -83,7 +83,7 @@ updateUseInputInGame u = updateFunctionKeys $ case u ^. uvWorld . hud of
|
||||
& ciSelection .~ msel'
|
||||
& ciFilter .~ filts'
|
||||
|
||||
updateMouseInGame :: Configuration -> World -> World
|
||||
updateMouseInGame :: Config -> World -> World
|
||||
updateMouseInGame cfig w
|
||||
| Just 0 <- lbpress = updateMouseClickInGame cfig w
|
||||
| Just _ <- lbpress = updateMouseHeldInGame cfig w
|
||||
@@ -93,13 +93,13 @@ updateMouseInGame cfig w
|
||||
lbpress = w ^? input . mouseButtons . ix ButtonLeft
|
||||
lbrelease = w ^? input . mouseButtonsReleased . ix ButtonLeft
|
||||
|
||||
updateMouseHeldInGame :: Configuration -> World -> World
|
||||
updateMouseHeldInGame :: Config -> World -> World
|
||||
updateMouseHeldInGame cfig w = case w ^. input . mouseContext of
|
||||
OverInvDragSelect{} | ButtonRight `M.member` (w ^. input . mouseButtons) ->
|
||||
w & input . mouseContext .~ MouseGameRotate
|
||||
OverInvDragSelect (Just sstart) _ ->
|
||||
let sss = w ^. hud . diSections
|
||||
msel = inverseSelNumPos cfig invDP sss (w ^. input . mousePos)
|
||||
msel = inverseSelNumPos cfig invDP (w ^. input . mousePos) sss
|
||||
in case msel of
|
||||
Nothing -> w & input . mouseContext . mcoSelEnd .~ Nothing
|
||||
Just (i, j)
|
||||
@@ -123,7 +123,7 @@ updateMouseHeldInGame cfig w = case w ^. input . mouseContext of
|
||||
OverInvDrag k mmouseover -> doDrag cfig 30 k mmouseover w
|
||||
_ -> w
|
||||
|
||||
doDrag :: Configuration -> Int -> Int -> Maybe (Int, Int) -> World -> World
|
||||
doDrag :: Config -> Int -> Int -> Maybe (Int, Int) -> World -> World
|
||||
doDrag cfig n k mmouseover w = fromMaybe w $ do
|
||||
guard (n /= 0)
|
||||
ss <- w ^? hud . diSections . ix k . ssItems
|
||||
@@ -200,7 +200,7 @@ isGroupSelectableSection = \case
|
||||
3 -> True
|
||||
_ -> False
|
||||
|
||||
updateMouseClickInGame :: Configuration -> World -> World
|
||||
updateMouseClickInGame :: Config -> World -> World
|
||||
updateMouseClickInGame cfig w = case w ^. input . mouseContext of
|
||||
MouseInGame -> fromMaybe (w & input . mouseContext .~ OverInvDragSelect Nothing Nothing) $ do
|
||||
let sss = w ^. hud . diSections
|
||||
@@ -303,7 +303,7 @@ collectInvItems secid is w = fromMaybe w $ do
|
||||
return . h (j + 1) ks $ swapInvItems (\_ _ -> Just (j + 1)) k w'
|
||||
|
||||
shiftInvItems ::
|
||||
Configuration ->
|
||||
Config ->
|
||||
Int -> -- recurse limit
|
||||
Int -> -- section where drag started
|
||||
(Int, Int) -> -- selection item mouse is over
|
||||
|
||||
@@ -71,7 +71,7 @@ mouseClickOptionsList u = fromMaybe u $ do
|
||||
return $ f u & uvSoundQueue .:~ click1S
|
||||
_ -> Nothing
|
||||
|
||||
ldpVerticalSelection :: Configuration -> ListDisplayParams -> Point2 -> Maybe Int
|
||||
ldpVerticalSelection :: Config -> ListDisplayParams -> Point2 -> Maybe Int
|
||||
ldpVerticalSelection cfig ldp (V2 _ y)
|
||||
| yupper == ylower = Just yupper
|
||||
| otherwise = Nothing
|
||||
@@ -84,6 +84,6 @@ ldpVerticalSelection cfig ldp (V2 _ y)
|
||||
yupper = floor $ (top - (y + ygap)) / yoff
|
||||
ylower = ceiling ((top - y) / yoff) - 1
|
||||
|
||||
setSelectionListRestriction :: Configuration -> ScreenLayer -> ScreenLayer
|
||||
setSelectionListRestriction :: Config -> ScreenLayer -> ScreenLayer
|
||||
setSelectionListRestriction cfig =
|
||||
scAvailableLines .~ getAvailableListLines menuDisplayParams cfig
|
||||
|
||||
Reference in New Issue
Block a user