Add twisting weapons and feet

This commit is contained in:
2021-06-07 15:03:15 +02:00
parent edd947a857
commit c9ca94e82e
16 changed files with 226 additions and 117 deletions
+13 -4
View File
@@ -1,25 +1,34 @@
module Dodge.Item.Draw
where
import Dodge.Data
import Dodge.Item.Data
import Dodge.Picture.Layer
import Dodge.Creature.Stance.Data
import Picture
{- |
Places an item picture onto a creature when the item is selected. -}
import qualified Data.IntMap.Strict as IM
{- | Places an item picture onto a creature when the item is selected. -}
pictureWeaponOnAim
:: Picture
-> Creature
-> Int -- ^ Position of item in inventory
-> Picture
pictureWeaponOnAim p cr posInInv
| _crInvSel cr == posInInv && _posture (_crStance cr) == Aiming
| isSelected && _posture (_crStance cr) == Aiming
&& isTwisting
= onLayer PtLayer twistWep
| isSelected && _posture (_crStance cr) == Aiming
= onLayer PtLayer drawnWep
| _crInvSel cr == posInInv
| isSelected
= onLayer PtLayer 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)
theIt = _crInv cr IM.! posInInv
isTwisting = _itAimStance theIt == TwoHandTwist
pictureItem
:: Picture