Refactor item drawing

This commit is contained in:
2021-10-01 23:01:36 +01:00
parent 5f17841811
commit 8c1496e140
28 changed files with 248 additions and 185 deletions
+21 -3
View File
@@ -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