Add laser central room, using new placement/roompos functionality

This commit is contained in:
2021-11-21 17:44:32 +00:00
parent 48cd59069c
commit 2f3896345d
12 changed files with 127 additions and 76 deletions
+31 -11
View File
@@ -29,7 +29,7 @@ import qualified SDL
{- Update the screen camera rotation and position, including any in rold scope/remote camera modifiers;
update where your avatar's view is from. -}
updateCamera :: World -> World
updateCamera = rotCam . moveCamera . updateScopeZoom
updateCamera = rotateCamera . autoZoomCamera . moveCamera . updateScopeZoom
{- Updte the center of the screen camera center and where your avatar's view is from in world. -}
moveCamera :: World -> World
moveCamera w = w
@@ -99,8 +99,28 @@ zoomOutLongGun w
wp = _crInv (_creatures w IM.! 0) IM.! _crInvSel (_creatures w IM.! 0)
Just currentZoom = wp ^? itAttachment . scopeZoom
rotCam :: World -> World
rotCam = rotateCameraKey . autoZoomCam
ifConfigWallRotate :: World -> World
ifConfigWallRotate w
| _rotate_to_wall (_config w) && not (SDL.ButtonRight `S.member` _mouseButtons w)
= rotateToOverlappingWall w
| otherwise = w
rotateToOverlappingWall :: World -> World
rotateToOverlappingWall w = maybe w dowallrotate theWall
where
dowallrotate wl' = rotateUsing $ (argV . uncurry (-.-) $ _wlLine wl') - _cameraRot w
rotateUsing a
| b - b' > 0.01 = w & cameraRot +~ 0.01
| b - b' < negate 0.01 = w & cameraRot -~ 0.01
| otherwise = w
where
--b = a * (2 / pi)
b = a * (4 / pi)
b' = fromIntegral (round b :: Int)
cr = you w
p = _crPos cr
theWall = overlapCircWallsReturnWall p (_crRad cr + 5) (IM.filter _wlRotateTo $ wallsNearPoint p w)
rotateCameraBy :: Float -> World -> World
rotateCameraBy x w = w
@@ -108,14 +128,14 @@ rotateCameraBy x w = w
& creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
. itAttachment . scopePos %~ rotateV x
rotateCameraKey :: World -> World
rotateCameraKey w
rotateCamera :: World -> World
rotateCamera w
| keyl && keyr = w
| keyl = rotateCameraBy 0.015 w
| keyr = rotateCameraBy (-0.015) w
| otherwise = w
| keyl = rotateCameraBy 0.025 w
| keyr = rotateCameraBy (-0.025) w
| otherwise = ifConfigWallRotate w
where
keyl = rotateCameraPlusKey (_keyConfig w) `S.member` _keys w
keyl = rotateCameraPlusKey (_keyConfig w) `S.member` _keys w
keyr = rotateCameraMinusKey (_keyConfig w) `S.member` _keys w
zoomCamBy :: Float -> World -> World
@@ -132,8 +152,8 @@ zoomNoItem
-> Float
zoomNoItem = min 20 . max 0.2
{- Automatically sets the zoom of the camera according to the surrounding walls. -}
autoZoomCam :: World -> World
autoZoomCam w
autoZoomCamera :: World -> World
autoZoomCamera w
| zoomInKey (_keyConfig w) `S.member` _keys w
= zoomCamBy 0.01 w
| zoomOutKey (_keyConfig w) `S.member` _keys w