Bugfix and cleanup
This commit is contained in:
@@ -18,7 +18,7 @@ medkit i = defaultConsumable
|
||||
, _itUse = ConsumeUse
|
||||
{_cUse = \_ cr w -> w & creatures . ix (_crID cr) . crHP +~ i
|
||||
}
|
||||
, _itEquipPict = pictureItem $ (,) emptySH $ color blue $ circleSolid 3
|
||||
, _itEquipPict = pictureWeaponAim $ const $ (,) emptySH $ color blue $ circleSolid 3
|
||||
, _itID = Nothing
|
||||
}
|
||||
|
||||
|
||||
+10
-21
@@ -23,14 +23,13 @@ itSPic it = _dimSPic (_itDimension it) it
|
||||
pictureWeaponAim
|
||||
:: (Item -> SPic)
|
||||
-> Creature
|
||||
-> Item -- ^ Position of item in inventory
|
||||
-> Item
|
||||
-> SPic
|
||||
pictureWeaponAim = const
|
||||
--pictureWeaponAim f cr itm = pictureWeaponOnAimItem pic cr i
|
||||
-- where
|
||||
-- pic = f itm
|
||||
-- i = fromJust $ _itInvPos itm
|
||||
--pic = f (_crInv cr IM.! i)
|
||||
pictureWeaponAim f cr itm = case _itInvPos itm of
|
||||
Just i -> pictureWeaponOnAimItem pic cr i
|
||||
Nothing -> mempty
|
||||
where
|
||||
pic = f itm
|
||||
|
||||
{- | Places an item picture onto a creature when the item is selected. -}
|
||||
pictureWeaponOnAimItem
|
||||
@@ -66,6 +65,7 @@ pictureWeaponOnAimItem p' cr posInInv
|
||||
x <- theIt ^? itDimension . dimPortage . handlePos
|
||||
return $translateSPf (-x) 0 p'
|
||||
isOneHand = theIt ^? itUseAimStance == Just OneHand
|
||||
|| isNothing (theIt ^? itUseAimStance)
|
||||
isTwoHandFlat = theIt ^? itUseAimStance == Just TwoHandFlat
|
||||
itUseAimStance = itUse . useAim . aimStance
|
||||
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
|
||||
@@ -74,23 +74,12 @@ pictureWeaponOnAimItem p' cr posInInv
|
||||
|
||||
strideRot :: Creature -> Float
|
||||
strideRot cr = case cr ^? crStance . carriage of
|
||||
Just (Walking x LeftForward) -> f x
|
||||
Just (Walking x RightForward) -> - f x
|
||||
_ -> 0
|
||||
Just (Walking x LeftForward) -> f x
|
||||
Just (Walking x RightForward) -> - f x
|
||||
_ -> 0
|
||||
where
|
||||
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
|
||||
sLen = _strideLength $ _crStance cr
|
||||
|
||||
twoFlatHRot :: Creature -> Float
|
||||
twoFlatHRot cr = 2*strideRot cr
|
||||
|
||||
pictureItem
|
||||
:: SPic
|
||||
-> Creature
|
||||
-> Item -- ^ Position of item in inventory
|
||||
-> SPic
|
||||
pictureItem p cr itm = case _itInvPos itm of
|
||||
Just posInInv | _crInvSel cr == posInInv -> drawnWep
|
||||
_ -> emptyBlank
|
||||
where
|
||||
drawnWep = translateSPf (_crRad cr) 0 p
|
||||
|
||||
Reference in New Issue
Block a user