Cleanup warnings
This commit is contained in:
+25
-27
@@ -13,40 +13,38 @@ import Dodge.Item.Attachment.Data
|
||||
import Geometry
|
||||
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
import Data.Maybe
|
||||
import qualified Data.Set as S
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
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.
|
||||
-}
|
||||
{- 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 = rotCam . 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 & cameraCenter .~ idealPos
|
||||
& cameraViewFrom .~ sightFrom
|
||||
where
|
||||
aimRangeFactor | _cameraZoom w == 0 = 0
|
||||
| otherwise = fromMaybe 0 (yourItem w ^? itAimingRange) / _cameraZoom w
|
||||
aimingMult | SDL.ButtonRight `S.member` _mouseButtons w = 1
|
||||
| otherwise = 0
|
||||
aimRangeFactor
|
||||
| _cameraZoom w == 0 = 0
|
||||
| otherwise = fromMaybe 0 (yourItem w ^? itAimingRange) / _cameraZoom w
|
||||
aimingMult
|
||||
| SDL.ButtonRight `S.member` _mouseButtons w = 1
|
||||
| otherwise = 0
|
||||
ypos = _crPos $ you w
|
||||
idealOffset = rotateV (_cameraRot w) (aimRangeFactor * aimingMult *.* _mousePos w)
|
||||
currentOffset = currentPos -.- camCenter
|
||||
--idealOffset = rotateV (_cameraRot w) (aimRangeFactor * aimingMult *.* _mousePos w)
|
||||
--currentOffset = currentPos -.- camCenter
|
||||
idealPos = camCenter +.+ rotateV (_cameraRot w)
|
||||
(aimRangeFactor * aimingMult *.* _mousePos w)
|
||||
currentPos = _cameraCenter w
|
||||
--currentPos = _cameraCenter w
|
||||
camCenter = ypos +.+ scope
|
||||
isCam :: Bool
|
||||
isCam = fromMaybe False $ yourItem w ^? itAttachment . _Just . scopeIsCamera
|
||||
scope = fromMaybe (0,0) $ yourItem w ^? itAttachment . _Just . scopePos
|
||||
sightFrom | isCam = camCenter
|
||||
| otherwise = ypos
|
||||
sightFrom
|
||||
| isCam = camCenter
|
||||
| otherwise = ypos
|
||||
|
||||
updateScopeZoom :: World -> World
|
||||
updateScopeZoom w
|
||||
@@ -73,6 +71,7 @@ updateScopeZoom w
|
||||
updateScope (ItScope _ _ _ bl) = ItScope (0,0) 0 1 bl
|
||||
updateScope otherAtt = otherAtt
|
||||
|
||||
zoomSpeed :: Float
|
||||
zoomSpeed = 39/40
|
||||
|
||||
zoomInLongGun :: World -> World
|
||||
@@ -96,16 +95,18 @@ zoomOutLongGun w
|
||||
wpPointer = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
|
||||
wp = _crInv (_creatures w IM.! 0) IM.! _crInvSel (_creatures w IM.! 0)
|
||||
Just currentZoom = wp ^? itAttachment . _Just . scopeZoom
|
||||
currentCursorDisplacement = fromJust $ _itAttachment wp
|
||||
--currentCursorDisplacement = fromJust $ _itAttachment wp
|
||||
|
||||
rotCam :: World -> World
|
||||
rotCam = rotateCameraL . rotateCameraR . zoomCamIn . zoomCamOut . autoZoomCam
|
||||
|
||||
rotateCameraL :: World -> World
|
||||
rotateCameraL w | rotateCameraPlusKey (_keyConfig w) `S.member` _keys w
|
||||
= w & cameraRot +~ 0.015
|
||||
& creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
|
||||
rotateCameraL w
|
||||
| rotateCameraPlusKey (_keyConfig w) `S.member` _keys w
|
||||
= w & cameraRot +~ 0.015
|
||||
& creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
|
||||
. itAttachment . _Just . scopePos %~ rotateV 0.015
|
||||
| otherwise = w
|
||||
| otherwise = w
|
||||
rotateCameraR :: World -> World
|
||||
rotateCameraR w | rotateCameraMinusKey (_keyConfig w) `S.member` _keys w
|
||||
= w & cameraRot -~ 0.015
|
||||
@@ -127,9 +128,7 @@ Automatically sets the zoom of the camera according to the surrounding walls.
|
||||
autoZoomCam :: World -> World
|
||||
autoZoomCam w = over cameraZoom changeZoom w
|
||||
where
|
||||
maxViewDistance = 800
|
||||
camPos = _cameraViewFrom w
|
||||
camRot = _cameraRot w
|
||||
wallZoom = farWallDist camPos w
|
||||
idealZoom | SDL.ButtonRight `S.member` _mouseButtons w
|
||||
= scZoom *
|
||||
@@ -168,6 +167,5 @@ farWallDist cpos w = min (halfWidth w / (horizontalMax+50) ) (halfHeight w / (ve
|
||||
zs = takeWhile (< maxViewDistance) [-maxViewDistance,negate $ 0.75*maxViewDistance..]
|
||||
maxViewDistance = 800
|
||||
|
||||
|
||||
dirRays :: Float -> [Point2]
|
||||
dirRays dir = take 11 $ iterate (rotateV (0.5 * pi / 10)) $ rotateV (dir-pi*0.25) (600,0)
|
||||
--dirRays :: Float -> [Point2]
|
||||
--dirRays dir = take 11 $ iterate (rotateV (0.5 * pi / 10)) $ rotateV (dir-pi*0.25) (600,0)
|
||||
|
||||
Reference in New Issue
Block a user