Continue reorganising records into functions
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{- Functions controlling the movement of the screen camera:
|
||||
'_cameraCenter', '_cameraZoom', _cameraRot';
|
||||
and the position that the character sees from: '_cameraViewFrom'. -}
|
||||
@@ -113,7 +114,7 @@ moveZoomCamera cfig theinput cr w campos =
|
||||
idealItemZoom = fromMaybe 1 $ do
|
||||
guard $ crIsAiming cr
|
||||
i <- cr ^? crManipulation . manObject . imSelectedItem
|
||||
zoomFromItem <$> (cr ^? crInv . ix i . itUse . heldAim . aimZoom)
|
||||
getAimZoom <$> (cr ^? crInv . ix i)
|
||||
newItemZoom = changeZoom (campos ^. camItemZoom) idealItemZoom
|
||||
changeZoom curZoom idealZoom
|
||||
| curZoom > idealZoom + 0.01 = ((zoomOutSpeed -1) * curZoom + idealZoom) / zoomOutSpeed
|
||||
@@ -130,6 +131,55 @@ moveZoomCamera cfig theinput cr w campos =
|
||||
zoomInSpeed = 25
|
||||
zoomOutSpeed = 15
|
||||
|
||||
getAimZoom :: Item -> Float
|
||||
getAimZoom itm = case itm ^. itType of
|
||||
HELD hit -> heldAimZoom hit
|
||||
_ -> 1
|
||||
|
||||
heldAimZoom :: HeldItemType -> Float
|
||||
heldAimZoom = \case
|
||||
BANGSTICK{} -> 1
|
||||
REWINDER -> 1
|
||||
TIMESTOPPER -> 1
|
||||
TIMESCROLLER -> 1
|
||||
PISTOL -> 1
|
||||
MACHINEPISTOL -> 1
|
||||
AUTOPISTOL -> 1
|
||||
SMG -> 1
|
||||
BANGCONE -> 1
|
||||
BLUNDERBUSS -> 1.5
|
||||
GRAPECANNON{} -> 1.5
|
||||
MINIGUNX{} -> 1.5
|
||||
VOLLEYGUN{} -> 1.5
|
||||
RIFLE -> 1.5
|
||||
ALTERIFLE -> 1.5
|
||||
AUTORIFLE -> 1.5
|
||||
BURSTRIFLE -> 1.5
|
||||
BANGROD -> 1.5
|
||||
ELEPHANTGUN -> 1.5
|
||||
AMR -> 1.5
|
||||
AUTOAMR -> 1.5
|
||||
SNIPERRIFLE -> 0.5
|
||||
FLAMESPITTER -> 1
|
||||
FLAMETHROWER -> 1.5
|
||||
FLAMETORRENT -> 1
|
||||
FLAMEWALL -> 1
|
||||
BLOWTORCH -> 1
|
||||
SPARKGUN -> 1
|
||||
TESLAGUN -> 1.5
|
||||
LASER -> 1.5
|
||||
TRACTORGUN -> 1.5
|
||||
RLAUNCHER -> 1.5
|
||||
RLAUNCHERX{} -> 1.5
|
||||
GLAUNCHER -> 1.5
|
||||
POISONSPRAYER -> 1
|
||||
SHATTERGUN -> 1
|
||||
TORCH -> 1
|
||||
FLATSHIELD -> 1
|
||||
KEYCARD {} -> 1
|
||||
BLINKER -> 1
|
||||
BLINKERUNSAFE -> 1
|
||||
|
||||
-- for example, this should be 400 or so when you have an unsafe blink gun
|
||||
-- capable of firing, should be expanded when you have a radar of some sort, etc
|
||||
viewDistanceFromItems :: Creature -> Float
|
||||
@@ -168,10 +218,6 @@ doWallRotate wl w
|
||||
b = a * (4 / pi) -- for 8 way cardinal orientation wrt wall
|
||||
b' = fromIntegral (round b :: Int)
|
||||
|
||||
zoomFromItem :: ItZoom -> Float
|
||||
zoomFromItem ItZoom{_izMax = zMax, _izMin = zMin, _izFac = zFac} =
|
||||
min zMax $ max zMin zFac
|
||||
|
||||
clipZoom ::
|
||||
-- | Furthest viewable distance
|
||||
Float ->
|
||||
|
||||
Reference in New Issue
Block a user