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