Cleanup
This commit is contained in:
@@ -4,7 +4,6 @@ module Dodge.Item.Weapon.Remote (
|
||||
|
||||
import Control.Lens
|
||||
import Dodge.Data.World
|
||||
import Dodge.Default
|
||||
import Geometry
|
||||
|
||||
setRemoteScope :: Int -> Point2 -> World -> World
|
||||
|
||||
@@ -60,7 +60,6 @@ module Dodge.Item.Weapon.TriggerType (
|
||||
repeatTransformed,
|
||||
) where
|
||||
|
||||
import Dodge.Item.Location
|
||||
import Dodge.Creature.HandPos
|
||||
import Data.Foldable
|
||||
import Data.Maybe
|
||||
|
||||
@@ -59,9 +59,7 @@ translateFloatingCamera theinput cam = fromMaybe cam $ do
|
||||
& camViewFrom +~ thetran
|
||||
|
||||
translateFloatingCameraKeys :: Input -> Camera -> Camera
|
||||
translateFloatingCameraKeys theinput =
|
||||
(camCenter -~ thetran)
|
||||
. (camViewFrom -~ thetran)
|
||||
translateFloatingCameraKeys theinput = (camCenter -~ thetran) . (camViewFrom -~ thetran)
|
||||
where
|
||||
thetran = 10 *.* wasdDir theinput
|
||||
|
||||
@@ -89,40 +87,31 @@ moveZoomCamera cfig theinput cr campos =
|
||||
& camDefaultZoom .~ newDefaultZoom
|
||||
& camItemZoom .~ newItemZoom
|
||||
where
|
||||
cpos = _crPos cr
|
||||
mitm = do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
cr ^? crInv . ix i
|
||||
newvf = cpos +.+ fromMaybe (V2 0 0) vfoffset
|
||||
newvf = _crPos cr +.+ fromMaybe (V2 0 0) vfoffset
|
||||
vfoffset = do
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||
mitm ^? _Just . itScope . remotePos
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
(cr ^? crInv . ix i . itScope . remotePos)
|
||||
mscopeoffset = do
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
(cr ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams . opticPos)
|
||||
<|> (mitm ^? _Just . itScope . remotePos)
|
||||
newcen = cpos +.+ fromMaybe (V2 0 0) mscopeoffset +.+ offset
|
||||
-- newcen = cpos +.+ fromMaybe offset mscopeoffset -- +.+ offset
|
||||
<|> (cr ^? crInv . ix i . itScope . remotePos)
|
||||
newcen = _crPos cr +.+ fromMaybe (V2 0 0) mscopeoffset +.+ offset
|
||||
offset =
|
||||
rotateV (campos ^. camRot) $
|
||||
((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput
|
||||
newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
(cr ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams . opticZoom)
|
||||
-- case mitm ^? _Just . itScope of
|
||||
---- Just zs@ZoomScope{} -> _scopeZoom zs
|
||||
-- _ -> newDefaultZoom * newItemZoom
|
||||
idealDefaultZoom = clipZoom wallZoom
|
||||
-- newDefaultZoom = case mitm ^? _Just . itScope of
|
||||
---- Just zs@ZoomScope{} -> _scopeZoom zs
|
||||
-- _ -> changeZoom (campos ^. camDefaultZoom) idealDefaultZoom
|
||||
newDefaultZoom = fromMaybe (changeZoom (campos ^. camDefaultZoom) idealDefaultZoom) $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
(cr ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams . opticZoom)
|
||||
idealItemZoom = fromMaybe 1 $ do
|
||||
guard $ crIsAiming cr
|
||||
zoomFromItem <$> (mitm ^? _Just . itUse . heldAim . aimZoom)
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
zoomFromItem <$> (cr ^? crInv . ix i . itUse . heldAim . aimZoom)
|
||||
newItemZoom = changeZoom (campos ^. camItemZoom) idealItemZoom
|
||||
changeZoom curZoom idealZoom
|
||||
| curZoom > idealZoom + 0.01 = ((zoomOutSpeed -1) * curZoom + idealZoom) / zoomOutSpeed
|
||||
|
||||
Reference in New Issue
Block a user