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
+15
View File
@@ -61,6 +61,21 @@ heldItemRelativeOrient itm cr (p,q)
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
sLen = _strideLength $ _crStance cr
aimingWeaponZeroPos :: Creature -> Item -> Point2
aimingWeaponZeroPos cr it =
aimingWeaponHandlePos cr it
- fromMaybe 0 (it ^? itUse . heldAim . aimHandlePos)
-- 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
heldItemOffset :: Item -> Creature -> Point3 -> Point3
heldItemOffset itm cr p = fst (heldItemRelativeOrient itm cr (p,Q.qID))
+3 -3
View File
@@ -2,7 +2,6 @@ module Dodge.Item.Weapon.Shatter where
import Dodge.Base.Collide
import Dodge.Block.Debris
import Dodge.Creature.HandPos
import Dodge.Data.World
import Dodge.Wall.Damage
import Geometry
@@ -10,7 +9,7 @@ import LensHelp
shootShatter :: Item -> Creature -> World -> World
shootShatter it cr w =
shootShatter _ cr w =
maybe w (uncurry $ shatterWall w sp ep) $
sequence $
collidePointWallsFilter canshatter sp ep w
@@ -19,7 +18,8 @@ shootShatter it cr w =
Opaque {} -> True
SeeThrough -> True
_ -> False
sp = _crPos cr +.+ aimingMuzzleLength cr it *.* unitVectorAtAngle dir
sp = _crPos cr +.+ 10 *.* unitVectorAtAngle dir
-- the 10 is arbtrary and should be changed to a muzzle position
dir = _crDir cr
ep = sp +.+ 200 *.* unitVectorAtAngle dir