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, drawWeapon :: Action
holsterWeapon = DoImpulses [ChangePosture AtEase, MakeSound whiteNoiseFadeOutS] holsterWeapon = DoImpulses [ChangePosture AtEase, MakeSound whiteNoiseFadeOutS]
drawWeapon = DoImpulses [ChangePosture (Aiming 0), MakeSound whiteNoiseFadeInS] drawWeapon = DoImpulses [ChangePosture Aiming, MakeSound whiteNoiseFadeInS]
shootTillEmpty :: Action shootTillEmpty :: Action
--shootTillEmpty = (crCanShoot `DoActionWhile` DoImpulses [UseItem]) --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 astance <- cr ^? crInv . ix itRef . itUse . heldAim . aimStance
case astance of case astance of
TwoHandUnder -> TwoHandUnder ->
return $ cr & crStance . posture .~ Aiming (twistamount * pi) return $ cr & crStance . posture .~ Aiming
& crDir -~ (twistamount * pi) & crDir -~ twoHandTwistAmount
TwoHandOver -> TwoHandOver ->
return $ cr & crStance . posture .~ Aiming (twistamount * pi) return $ cr & crStance . posture .~ Aiming
& crDir -~ (twistamount * pi) & crDir -~ twoHandTwistAmount
_ -> return $ cr & crStance . posture .~ Aiming 0 _ -> return $ cr & crStance . posture .~ Aiming
where
twistamount :: Float twoHandTwistAmount :: Float
twistamount = 1.6 twoHandTwistAmount = 1.6 * pi
removeAimPosture :: Creature -> Creature removeAimPosture :: Creature -> Creature
removeAimPosture cr = fromMaybe cr $ do removeAimPosture cr = cr
x <- cr ^? crStance . posture . aimTwist & crDir +~ twoHandTwistAmount
return $ cr
& crDir +~ x
& crStance . posture .~ AtEase & crStance . posture .~ AtEase
wasdMovement :: Input -> Camera -> Float -> Creature -> Creature wasdMovement :: Input -> Camera -> Float -> Creature -> Creature
@@ -198,14 +196,6 @@ aimTurn a cr = creatureTurnTowardDir a (x * 0.2) cr
itRef <- cr ^? crManipulation . manObject . imRootSelectedItem itRef <- cr ^? crManipulation . manObject . imRootSelectedItem
cr ^? crInv . ix itRef . itUse . heldAim . aimTurnSpeed 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 :: M.Map SDL.MouseButton Int -> World -> World
tryClickUse pkeys w = fromMaybe w $ do tryClickUse pkeys w = fromMaybe w $ do
ltime <- pkeys ^? ix SDL.ButtonLeft ltime <- pkeys ^? ix SDL.ButtonLeft
+1 -1
View File
@@ -36,7 +36,7 @@ data FootForward
deriving (Eq, Ord, Show, Read) --Generic, Flat) deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Posture data Posture
= Aiming {_aimTwist :: Float} = Aiming
| AtEase | AtEase
deriving (Eq, Ord, Show, Read) --Generic, Flat) deriving (Eq, Ord, Show, Read) --Generic, Flat)
-1
View File
@@ -3,7 +3,6 @@ module Dodge.Render.Picture (
) where ) where
import Control.Lens import Control.Lens
import Control.Monad
import Data.Maybe import Data.Maybe
import Dodge.Base.Coordinate import Dodge.Base.Coordinate
import Dodge.Base.Window import Dodge.Base.Window
+1 -1
View File
@@ -26,7 +26,7 @@ import qualified IntMapHelp as IM
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
testStringInit :: Universe -> [String] testStringInit :: Universe -> [String]
testStringInit u = [] testStringInit _ = []
-- foldMap prettyShort $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crTwist -- foldMap prettyShort $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crTwist
-- prettyShort $ u ^.. uvWorld . cWorld . lWorld . teslaArcs . ix 0 . taArcSteps . each . asObject -- prettyShort $ u ^.. uvWorld . cWorld . lWorld . teslaArcs . ix 0 . taArcSteps . each . asObject
--testStringInit u = foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . projectiles --testStringInit u = foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . projectiles