Stop tracking aim twist amount, use fixed number

This commit is contained in:
2025-05-30 10:31:21 +01:00
parent 0bcf263db7
commit cdf300b824
6 changed files with 14 additions and 25 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -13,7 +13,7 @@ import Geometry
holsterWeapon, drawWeapon :: Action
holsterWeapon = DoImpulses [ChangePosture AtEase, MakeSound whiteNoiseFadeOutS]
drawWeapon = DoImpulses [ChangePosture (Aiming 0), MakeSound whiteNoiseFadeInS]
drawWeapon = DoImpulses [ChangePosture Aiming, MakeSound whiteNoiseFadeInS]
shootTillEmpty :: Action
--shootTillEmpty = (crCanShoot `DoActionWhile` DoImpulses [UseItem])
+10 -20
View File
@@ -162,21 +162,19 @@ setAimPosture cr = fromMaybe cr $ do
astance <- cr ^? crInv . ix itRef . itUse . heldAim . aimStance
case astance of
TwoHandUnder ->
return $ cr & crStance . posture .~ Aiming (twistamount * pi)
& crDir -~ (twistamount * pi)
return $ cr & crStance . posture .~ Aiming
& crDir -~ twoHandTwistAmount
TwoHandOver ->
return $ cr & crStance . posture .~ Aiming (twistamount * pi)
& crDir -~ (twistamount * pi)
_ -> return $ cr & crStance . posture .~ Aiming 0
where
twistamount :: Float
twistamount = 1.6
return $ cr & crStance . posture .~ Aiming
& crDir -~ twoHandTwistAmount
_ -> return $ cr & crStance . posture .~ Aiming
twoHandTwistAmount :: Float
twoHandTwistAmount = 1.6 * pi
removeAimPosture :: Creature -> Creature
removeAimPosture cr = fromMaybe cr $ do
x <- cr ^? crStance . posture . aimTwist
return $ cr
& crDir +~ x
removeAimPosture cr = cr
& crDir +~ twoHandTwistAmount
& crStance . posture .~ AtEase
wasdMovement :: Input -> Camera -> Float -> Creature -> Creature
@@ -198,14 +196,6 @@ aimTurn a cr = creatureTurnTowardDir a (x * 0.2) cr
itRef <- cr ^? crManipulation . manObject . imRootSelectedItem
cr ^? crInv . ix itRef . itUse . heldAim . aimTurnSpeed
{- | Set posture according to mouse presses.
(should you be aiming without a selected item?)
-}
setCrPosture :: M.Map SDL.MouseButton Int -> Creature -> Creature
setCrPosture pkeys
| SDL.ButtonRight `M.member` pkeys = crStance . posture .~ Aiming 0
| otherwise = crStance . posture .~ AtEase
tryClickUse :: M.Map SDL.MouseButton Int -> World -> World
tryClickUse pkeys w = fromMaybe w $ do
ltime <- pkeys ^? ix SDL.ButtonLeft
+1 -1
View File
@@ -36,7 +36,7 @@ data FootForward
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Posture
= Aiming {_aimTwist :: Float}
= Aiming
| AtEase
deriving (Eq, Ord, Show, Read) --Generic, Flat)
-1
View File
@@ -3,7 +3,6 @@ module Dodge.Render.Picture (
) where
import Control.Lens
import Control.Monad
import Data.Maybe
import Dodge.Base.Coordinate
import Dodge.Base.Window
+1 -1
View File
@@ -26,7 +26,7 @@ import qualified IntMapHelp as IM
import qualified Data.Map.Strict as M
testStringInit :: Universe -> [String]
testStringInit u = []
testStringInit _ = []
-- foldMap prettyShort $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crTwist
-- prettyShort $ u ^.. uvWorld . cWorld . lWorld . teslaArcs . ix 0 . taArcSteps . each . asObject
--testStringInit u = foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . projectiles