Cleanup old muzzle position code

This commit is contained in:
2024-11-28 21:26:55 +00:00
parent 3763ff2c8a
commit 7db700042a
4 changed files with 36 additions and 39 deletions
+1 -25
View File
@@ -1,7 +1,5 @@
module Dodge.Creature.HandPos (
aimingWeaponZeroPos,
aimingMuzzlePos,
aimingMuzzleLength,
-- aimingWeaponZeroPos,
translatePointToLeftHand,
translatePointToRightHand,
translatePointToHead,
@@ -21,30 +19,8 @@ import Data.Maybe
import Dodge.Creature.Test
import Dodge.Data.Creature
import Geometry
import Linear
import ShapePicture
-- the position of a weapon handle
aimingWeaponHandlePos :: Creature -> Item -> Point2
aimingWeaponHandlePos _ it = case it ^? itUse . heldAim . aimStance of
Just TwoHandUnder -> V2 (-2) 0
Just TwoHandOver -> V2 (-7) 0
Just OneHand -> V2 10 (-2)
Just TwoHandFlat -> V2 10 0
Nothing -> 0
aimingWeaponZeroPos :: Creature -> Item -> Point2
aimingWeaponZeroPos cr it =
aimingWeaponHandlePos cr it
- fromMaybe 0 (it ^? itUse . heldAim . aimHandlePos)
aimingMuzzlePos :: Creature -> Item -> [Point2]
aimingMuzzlePos cr it = fmap ((+ zp) . _mzPos) (it ^.. itUse . heldAim . aimMuzzles . folded)
where
zp = aimingWeaponZeroPos cr it
aimingMuzzleLength :: Creature -> Item -> Float
aimingMuzzleLength cr it = head (aimingMuzzlePos cr it) ^. _x
translatePointToRightHand :: Creature -> Point3 -> Point3
translatePointToRightHand cr = translatePointToRightHand' cr . mirrorV3xz