Add different weapon positions based on handedness
This commit is contained in:
+22
-3
@@ -7,6 +7,7 @@ import Dodge.Creature.Stance.Data
|
||||
import Picture
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Control.Lens
|
||||
{- | Places an item picture onto a creature when the item is selected. -}
|
||||
pictureWeaponOnAim
|
||||
:: Picture
|
||||
@@ -17,18 +18,36 @@ pictureWeaponOnAim p cr posInInv
|
||||
| isSelected && _posture (_crStance cr) == Aiming
|
||||
&& isTwisting
|
||||
= onLayer PtLayer twistWep
|
||||
| isSelected && _posture (_crStance cr) == Aiming
|
||||
&& isOneHand
|
||||
= onLayer PtLayer oneHandWep
|
||||
| isSelected && _posture (_crStance cr) == Aiming
|
||||
= onLayer PtLayer drawnWep
|
||||
| isSelected && isOneHand
|
||||
= onLayerL [levLayer CrLayer, -3] holsteredOneHandWep
|
||||
| isSelected
|
||||
= onLayer PtLayer holsteredWep
|
||||
= onLayerL [levLayer CrLayer, -3] holsteredWep
|
||||
| otherwise = blank
|
||||
where
|
||||
isSelected = _crInvSel cr == posInInv
|
||||
drawnWep = uncurry translate (_crRad cr,0) p
|
||||
twistWep = uncurry translate (0.5 * _crRad cr,negate 0.5 * _crRad cr) p
|
||||
holsteredWep = uncurry translate (_crRad cr,0) (scale 0.1 1 p)
|
||||
twistWep = uncurry translate (0.5 * _crRad cr,0) p
|
||||
--twistWep = uncurry translate (0.5 * _crRad cr,negate 0.5 * _crRad cr) p
|
||||
oneHandWep = uncurry translate (1.5 * _crRad cr,0) p
|
||||
holsteredWep = uncurry translate (_crRad cr,0) (rotate (sRot + 1) p)
|
||||
holsteredOneHandWep = uncurry translate (_crRad cr * 0.7 + handPos,_crRad cr * negate 0.7) p
|
||||
handPos = case cr^? crStance . carriage of
|
||||
Just (Walking x LeftForward) -> f x * 50
|
||||
_ -> 0
|
||||
theIt = _crInv cr IM.! posInInv
|
||||
isTwisting = _itAimStance theIt == TwoHandTwist
|
||||
isOneHand = _itAimStance theIt == OneHand
|
||||
sRot = case cr ^? crStance . carriage of
|
||||
Just (Walking x LeftForward) -> f x
|
||||
Just (Walking x RightForward) -> - f x
|
||||
_ -> 0
|
||||
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
|
||||
sLen = _strideLength $ _crStance cr
|
||||
|
||||
pictureItem
|
||||
:: Picture
|
||||
|
||||
Reference in New Issue
Block a user