Cleanup, remove old item orientation code

This commit is contained in:
2025-07-06 13:08:13 +01:00
parent 76cb03b07b
commit b6cd988c82
3 changed files with 80 additions and 132 deletions
-44
View File
@@ -4,12 +4,10 @@ module Dodge.Item.HeldOffset (
turretItemOffset,
twoFlatHRot,
heldItemOffset,
heldItemRelativeOrient,
locOrient,
handHandleOrient,
) where
import Dodge.Creature.Radius
import Dodge.Data.AimStance
import Dodge.Data.ComposedItem
import Dodge.Data.Creature
@@ -30,32 +28,6 @@ transToHandle itm = (-.-.- V3 x y 0)
where
V2 x y = handlePos itm
heldItemRelativeOrient :: Item -> Creature -> Point3Q -> Point3Q
heldItemRelativeOrient itm cr (p, q)
| Aiming{} <- _posture (_crStance cr) =
(p + aimingWeaponZeroPos cr itm `v2z` shoulderHeight, Q.qID * q)
| TwoHandFlat <- itemBaseStance itm =
( V3 (crRad $ cr ^. crType) 0 handD + rotate3 (twoFlatHRot cr) (transToHandle itm p)
, Q.axisAngle (V3 0 0 1) (twoFlatHRot cr) * q
)
| OneHand <- itemBaseStance itm =
( V3 (crRad (cr ^. crType) * 0.7 + handPos) (crRad (cr ^. crType) * negate 0.7) handD
+ transToHandle itm p
, Q.qID * q
)
| otherwise =
( V3 (crRad $ cr ^. crType) 0 handD
+ rotate3 (strideRot cr + 1.2) (V3 (-8) 0 0 + transToHandle itm p)
, Q.axisAngle (V3 0 0 1) (strideRot cr + 1.2) * q
)
where
handD = 15
handPos = case cr ^? crStance . carriage of
Just (Walking x LeftForward) -> f x * 50 -2
_ -> 0 - 2
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
sLen = _strideLength $ _crStance cr
handleOrient :: LocationLDT ItemLink CItem -> Point3Q
handleOrient loc = case loc ^. locLDT . ldtValue . _1 . itType of
HELD FLAMETHROWER -> (V3 (-1) 0 0, Q.qID)
@@ -86,22 +58,6 @@ locOrient loc cr =
handHandleOrient (fmap (\(x, y, _) -> (x, y)) loc) cr
`Q.comp` (loc ^. locLDT . ldtValue . _3)
-- heldItemRelativeOrient
-- (locToTop loc ^. locLDT . ldtValue . _1)
-- cr
-- (loc ^. locLDT . ldtValue . _3)
aimingWeaponZeroPos :: Creature -> Item -> Point2
aimingWeaponZeroPos cr it = aimStanceHandlePos cr it - handlePos it
-- the position of a weapon handle
aimStanceHandlePos :: Creature -> Item -> Point2
aimStanceHandlePos _ it = case itemBaseStance it of
TwoHandUnder -> V2 (-2) 0
TwoHandOver -> V2 (-7) 0
OneHand -> V2 10 (-2)
TwoHandFlat -> V2 10 0
heldItemOffset :: LocationLDT ItemLink CItem -> Creature -> Point3 -> Point3
heldItemOffset loc cr p = x + Q.rotate q p
where