Refactor item drawing
This commit is contained in:
+21
-3
@@ -10,13 +10,31 @@ import ShapePicture
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Control.Lens
|
||||
{- | Places an item picture onto a creature when the item is selected. -}
|
||||
pictureWeaponOnAim
|
||||
:: (Item -> SPic)
|
||||
-> Creature
|
||||
-> Int -- ^ Position of item in inventory
|
||||
-> SPic
|
||||
pictureWeaponOnAim f cr i = pictureWeaponOnAimItem pic cr i
|
||||
where
|
||||
pic = f (_crInv cr IM.! i)
|
||||
|
||||
pictureWeaponAim
|
||||
:: (Item -> SPic)
|
||||
-> Creature
|
||||
-> Int -- ^ Position of item in inventory
|
||||
-> SPic
|
||||
pictureWeaponAim f cr i = pictureWeaponOnAimItem pic cr i
|
||||
where
|
||||
pic = f (_crInv cr IM.! i)
|
||||
|
||||
{- | Places an item picture onto a creature when the item is selected. -}
|
||||
pictureWeaponOnAimItem
|
||||
:: SPic
|
||||
-> Creature
|
||||
-> Int -- ^ Position of item in inventory
|
||||
-> SPic
|
||||
pictureWeaponOnAim p cr posInInv
|
||||
pictureWeaponOnAimItem p cr posInInv
|
||||
| isSelected && _posture (_crStance cr) == Aiming && isTwisting
|
||||
= shoulderD twistWep
|
||||
| isSelected && _posture (_crStance cr) == Aiming && isOneHand
|
||||
@@ -29,7 +47,7 @@ pictureWeaponOnAim p cr posInInv
|
||||
= handD holsteredWep
|
||||
| otherwise = emptyBlank
|
||||
where
|
||||
shoulderD = translateSPz 20.5
|
||||
shoulderD = translateSPz 18
|
||||
handD = translateSPz 15
|
||||
isSelected = _crInvSel cr == posInInv
|
||||
drawnWep = translateSPf (_crRad cr) 0 p
|
||||
|
||||
Reference in New Issue
Block a user