From 633bf479b29f604829b43f782da380b6458a9eac Mon Sep 17 00:00:00 2001 From: justin Date: Mon, 30 Mar 2026 21:10:20 +0100 Subject: [PATCH] Make weapon position relative to hand positions, wonky for now --- src/Dodge/Creature/HandPos.hs | 3 ++- src/Dodge/Item/HeldOffset.hs | 43 ++++++++++++++++++++++++----------- src/Dodge/Update.hs | 1 - 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/Dodge/Creature/HandPos.hs b/src/Dodge/Creature/HandPos.hs index 55b4f1ed6..400db3468 100644 --- a/src/Dodge/Creature/HandPos.hs +++ b/src/Dodge/Creature/HandPos.hs @@ -12,6 +12,7 @@ module Dodge.Creature.HandPos ( headPQ, translateToES, rightHandPQ, + leftHandPQ, ) where import Control.Monad @@ -62,7 +63,7 @@ handWalkingPos b off cr = case cr ^. crStance . carriage of rightHandPQ :: Creature -> Point3Q rightHandPQ cr | oneH cr = (V3 11 (-3) 20, Q.qID) - | twists cr = (V3 0 5 20, Q.qz (-1)) `Q.comp` (V3 4 (-10) 0, Q.qID) + | twists cr = (V3 0 5 20, Q.qz (-1)) `Q.comp` (V3 4 (-10) 0, Q.qz 1) | twoFlat cr = (V3 4 (-8) 12, Q.qID) | Just p <- crRightHandWall cr = (20 & _xy .~ p, Q.qID) | otherwise = (handWalkingPos LeftForward (-8) cr, Q.qID) diff --git a/src/Dodge/Item/HeldOffset.hs b/src/Dodge/Item/HeldOffset.hs index 7f7d3e44c..e323a6768 100644 --- a/src/Dodge/Item/HeldOffset.hs +++ b/src/Dodge/Item/HeldOffset.hs @@ -34,20 +34,37 @@ handleOrient loc = case loc ^. locDT . dtValue . _1 . itType of HELD FLAMETHROWER -> (V3 (-1) 0 0, Q.qID) _ -> (V3 (-3) 0 0, Q.qID) --- note this is relative to the creature --- the aimstance here should match any aimstance in Aiming +---- note this is relative to the creature +---- the aimstance here should match any aimstance in Aiming +--handOrient :: Creature -> AimStance -> Point3Q +--handOrient cr = case cr ^. crStance . posture of +-- Aiming {} -> \case +-- TwoHandUnder -> (V3 (-3) 0 shoulderHeight, Q.qID) +-- TwoHandOver -> (V3 0 0 shoulderHeight, Q.qID) +-- OneHand -> (V3 13 (-2) shoulderHeight, Q.qID) +-- TwoHandFlat -> (V3 13 0 shoulderHeight, Q.qID) +-- AtEase -> \case +-- OneHand -> rightHandPQ cr +-- TwoHandFlat -> (V3 10 0 15, Q.axisAngle (V3 0 0 1) $ twoFlatHRot cr) +-- TwoHandUnder -> (V3 7 (-8) 15, Q.axisAngle (V3 0 0 1) (strideRot cr + 1.2)) +-- TwoHandOver -> (V3 10 0 15, Q.axisAngle (V3 0 0 1) (strideRot cr + 1.2)) + handOrient :: Creature -> AimStance -> Point3Q -handOrient cr = case cr ^. crStance . posture of - Aiming {} -> \case - TwoHandUnder -> (V3 (-3) 0 shoulderHeight, Q.qID) - TwoHandOver -> (V3 0 0 shoulderHeight, Q.qID) - OneHand -> (V3 13 (-2) shoulderHeight, Q.qID) - TwoHandFlat -> (V3 13 0 shoulderHeight, Q.qID) - AtEase -> \case - OneHand -> rightHandPQ cr - TwoHandFlat -> (V3 10 0 15, Q.axisAngle (V3 0 0 1) $ twoFlatHRot cr) - TwoHandUnder -> (V3 7 (-8) 15, Q.axisAngle (V3 0 0 1) (strideRot cr + 1.2)) - TwoHandOver -> (V3 10 0 15, Q.axisAngle (V3 0 0 1) (strideRot cr + 1.2)) +handOrient cr = \case + TwoHandUnder -> + let (rp,_) = rightHandPQ cr + (lp,_) = leftHandPQ cr + in (rp,Q.qz (argV $ (lp - rp) ^. _xy)) + TwoHandOver -> + let (rp,_) = rightHandPQ cr + (lp,_) = leftHandPQ cr + in (rp,Q.qz (argV $ (lp - rp) ^. _xy)) + OneHand -> rightHandPQ cr + TwoHandFlat -> + let (rp,_) = rightHandPQ cr + (lp,_) = leftHandPQ cr + in (0.5 *^ (rp + lp),Q.qz (argV (vNormal ((lp - rp) ^. _xy)))) + locOrient :: LocationDT OItem -> Creature -> Point3Q locOrient loc cr = diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index 3d8d686ff..a93defa9d 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -351,7 +351,6 @@ muzzleWallCheck w cr = fromMaybe cr $ do ^? ix invid . _2 let ps = reduceLocDT f loc ^.. each . _1 . _xy cp = cr ^. crPos . _xy - -- cop = cr ^. crOldPos . _xy r <- boundPointsRect (cp : ps) let wls = uncurry wlsNearRect r w & IM.elems & filter (not . _wlTouchThrough) vs = mapMaybe (g cp wls) ps