Enable duct taping torches to rifles
This commit is contained in:
+1
-52
@@ -7,15 +7,13 @@ module Dodge.Item.Draw
|
||||
, heldItemOffset
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Item.HeldOffset
|
||||
import ShapePicture
|
||||
import Dodge.Creature.HandPos
|
||||
import Dodge.Item.Equipment.Shape
|
||||
import Dodge.Item.Draw.SPic
|
||||
import Geometry
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
|
||||
itemEquipPict :: Creature -> Item -> SPic
|
||||
itemEquipPict cr it = case it ^?! itUse of
|
||||
@@ -81,53 +79,4 @@ pictureWeaponOnAimItem p' cr posInInv
|
||||
-- f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
|
||||
-- sLen = _strideLength $ _crStance cr
|
||||
|
||||
heldItemOffset :: Item -> Creature -> Point3 -> Point3
|
||||
heldItemOffset itm cr
|
||||
| isSelected && _posture (_crStance cr) == Aiming =
|
||||
(+.+.+ V3 (aimingWeaponZeroPos cr itm) 0 shoulderD)
|
||||
| isSelected && isTwoHandFlat
|
||||
= (+.+.+ V3 (_crRad cr) 0 handD)
|
||||
. rotate3 (twoFlatHRot cr)
|
||||
. transToHandle
|
||||
| isSelected && isOneHand
|
||||
= (+.+.+ V3 0 0 handD)
|
||||
. (+.+.+ V3 (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) 0)
|
||||
. (+.+.+ V3 (-2) 0 0)
|
||||
. transToHandle
|
||||
| isSelected
|
||||
= (+.+.+ V3 0 0 handD)
|
||||
. (+.+.+ V3 (_crRad cr) 0 0)
|
||||
. rotate3 (strideRot cr + 1.2)
|
||||
. (+.+.+ V3 (-5) 0 0)
|
||||
-- . (+.+.+ V3 (-5) 0 0)
|
||||
. transToHandle
|
||||
| otherwise = id
|
||||
where
|
||||
transToHandle = fromMaybe id $ do
|
||||
x <- itm ^? itUse . useAim . aimHandlePos
|
||||
return (-.-.- V3 x 0 0)
|
||||
shoulderD = 18
|
||||
handD = 15
|
||||
isSelected = _itIsHeld itm
|
||||
handPos = case cr^? crStance . carriage of
|
||||
Just (Walking x LeftForward) -> f x * 50
|
||||
_ -> 0
|
||||
theIt = itm
|
||||
isOneHand = theIt ^? itUseAimStance == Just OneHand
|
||||
|| isNothing (theIt ^? itUseAimStance)
|
||||
isTwoHandFlat = theIt ^? itUseAimStance == Just TwoHandFlat
|
||||
itUseAimStance = itUse . useAim . aimStance
|
||||
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
|
||||
sLen = _strideLength $ _crStance cr
|
||||
|
||||
strideRot :: Creature -> Float
|
||||
strideRot cr = case cr ^? crStance . carriage of
|
||||
Just (Walking x LeftForward) -> f x
|
||||
Just (Walking x RightForward) -> - f x
|
||||
_ -> 0
|
||||
where
|
||||
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
|
||||
sLen = _strideLength $ _crStance cr
|
||||
|
||||
twoFlatHRot :: Creature -> Float
|
||||
twoFlatHRot cr = 2*strideRot cr
|
||||
|
||||
Reference in New Issue
Block a user