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
|
||||
|
||||
@@ -160,15 +160,17 @@ lasGun = defaultAutoGun
|
||||
, _itUse = \_ -> shoot aLaser
|
||||
, _wpSpread = 0.001
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color blue $ polygon $ rectNESW 3 3 (-3) (-3)
|
||||
, _itFloorPict = onLayer FlItLayer lasGunPic
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 1
|
||||
, _itEquipPict = pictureWeaponOnAim $ color blue $ polygon $ rectNESW 3 3 (-3) (-3)
|
||||
, _itEquipPict = pictureWeaponOnAim lasGunPic
|
||||
, _itAttachment = Just $ ItCharMode $ Seq.fromList "/VZ"
|
||||
, _itScrollUp = incCharMode
|
||||
, _itScrollDown = decCharMode
|
||||
, _itInvDisplay = basicWeaponDisplay
|
||||
}
|
||||
lasGunPic :: Picture
|
||||
lasGunPic = color blue . polygon $ rectNESW 3 15 (-3) (-15)
|
||||
forceFieldGun :: Item
|
||||
forceFieldGun = defaultGun
|
||||
{ _itName = "FORCEFIELD"
|
||||
@@ -372,9 +374,12 @@ multGun = defaultGun
|
||||
, _itAimingRange = 1
|
||||
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
|
||||
, _itEquipPict = pictureWeaponOnAim multGunPic
|
||||
, _itAimStance = TwoHandTwist
|
||||
}
|
||||
where
|
||||
multGunPic = color red $ pictures
|
||||
multGunPic :: Picture
|
||||
multGunPic = color red $ pictures
|
||||
[ polygon $ rectNESW 4 8 (-4) (-12)
|
||||
, translate 8 0 $ pictures
|
||||
[ polygon $ rectNSEW 12 8 2 (-2)
|
||||
, polygon $ rectNSEW 7 3 2 (-2)
|
||||
, polygon $ rectNSEW 2 (-2) 2 (-2)
|
||||
@@ -382,6 +387,7 @@ multGun = defaultGun
|
||||
, polygon $ rectNSEW (-8) (-12) 2 (-2)
|
||||
, polygon [(-1.5,12),(-2,12),(-2,-12),(-1.5,-12)]
|
||||
]
|
||||
]
|
||||
longGun :: Item
|
||||
longGun = defaultGun
|
||||
{ _itName = "LONGGUN"
|
||||
|
||||
@@ -38,10 +38,10 @@ launcher = defaultGun
|
||||
, _itUse = \it -> shootWithSound (fromIntegral launcherSound) $ aRocketWithItemParams it
|
||||
, _wpSpread = 0.02
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||
, _itFloorPict = onLayer FlItLayer launcherPic
|
||||
, _itAimingSpeed = 0.2
|
||||
, _itAimingRange = 0.5
|
||||
, _itEquipPict = pictureWeaponOnAim $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||
, _itEquipPict = pictureWeaponOnAim launcherPic
|
||||
, _itHammer = NoHammer
|
||||
, _itEffect = NoItEffect
|
||||
, _wpAmmo = defaultShellAmmo
|
||||
@@ -50,8 +50,12 @@ launcher = defaultGun
|
||||
, _amPjParams = basicAmPjMoves
|
||||
, _amPjDraw = shellPic
|
||||
}
|
||||
, _itAimStance = TwoHandTwist
|
||||
}
|
||||
|
||||
launcherPic :: Picture
|
||||
launcherPic = color cyan $ polygon $ rectNESW 5 10 (-5) (-10)
|
||||
|
||||
basicAmPjMoves :: [PjParam]
|
||||
basicAmPjMoves =
|
||||
[spinDrag
|
||||
|
||||
Reference in New Issue
Block a user