Cleanup movement
This commit is contained in:
@@ -3,28 +3,36 @@ import Dodge.Data
|
|||||||
import Geometry
|
import Geometry
|
||||||
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import qualified Data.IntMap.Strict as IM
|
--import qualified Data.IntMap.Strict as IM
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
{- | Creature attempts to moves under its own steam.
|
{- | Creature attempts to moves under its own steam.
|
||||||
The idea is that this may or may not work, depending on the status of the creature.
|
The idea is that this may or may not work, depending on the status of the creature.
|
||||||
For now, though, this cannot fail. -}
|
For now, though, this cannot fail. -}
|
||||||
|
--crMvBy
|
||||||
|
-- :: Point2 -- ^ Movement translation vector, will be made relative to creature direction
|
||||||
|
-- -> Creature
|
||||||
|
-- -> Creature
|
||||||
|
--crMvBy p' cr = advanceStepCounter (magV p) cr
|
||||||
|
-- & crPos %~ (+.+ p)
|
||||||
|
-- & crMvDir .~ argV p
|
||||||
|
-- where
|
||||||
|
-- p = (*.*) (equipFactor * aimingFactor) $ rotateV (_crDir cr) p'
|
||||||
|
-- equipFactor
|
||||||
|
-- | _posture (_crStance cr) == Aiming
|
||||||
|
-- = product $ map equipAimSpeed $ IM.elems $ _crInv cr
|
||||||
|
-- | otherwise = product $ map equipSpeed $ IM.elems $ _crInv cr
|
||||||
|
-- aimingFactor
|
||||||
|
-- | _posture (_crStance cr) == Aiming = fromMaybe 1 $ it ^? itUse . useAim . aimSpeed
|
||||||
|
-- | otherwise = 1
|
||||||
|
-- it = _crInv cr IM.! _crInvSel cr
|
||||||
|
|
||||||
crMvBy
|
crMvBy
|
||||||
:: Point2 -- ^ Movement translation vector, will be made relative to creature direction
|
:: Point2 -- ^ Movement translation vector, will be made relative to creature direction
|
||||||
-> Creature
|
-> Creature
|
||||||
-> Creature
|
-> Creature
|
||||||
crMvBy p' cr = advanceStepCounter (magV p) cr
|
crMvBy p' cr = crMvAbsolute p cr
|
||||||
& crPos %~ (+.+ p)
|
|
||||||
& crMvDir .~ argV p
|
|
||||||
where
|
where
|
||||||
p = (*.*) (equipFactor * aimingFactor) $ rotateV (_crDir cr) p'
|
p = rotateV (_crDir cr) p'
|
||||||
equipFactor
|
|
||||||
| _posture (_crStance cr) == Aiming
|
|
||||||
= product $ map equipAimSpeed $ IM.elems $ _crInv cr
|
|
||||||
| otherwise = product $ map equipSpeed $ IM.elems $ _crInv cr
|
|
||||||
aimingFactor
|
|
||||||
| _posture (_crStance cr) == Aiming = fromMaybe 1 $ it ^? itUse . useAim . aimSpeed
|
|
||||||
| otherwise = 1
|
|
||||||
it = _crInv cr IM.! _crInvSel cr
|
|
||||||
|
|
||||||
crMvAbsolute
|
crMvAbsolute
|
||||||
:: Point2 -- ^ Movement translation vector
|
:: Point2 -- ^ Movement translation vector
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ pictureWeaponOnAim
|
|||||||
-> Item
|
-> Item
|
||||||
-> SPic
|
-> SPic
|
||||||
pictureWeaponOnAim = pictureWeaponAim itSPic
|
pictureWeaponOnAim = pictureWeaponAim itSPic
|
||||||
--pictureWeaponOnAim cr itm = case _itInvPos itm of
|
|
||||||
-- Just i -> pictureWeaponOnAimItem (itSPic itm) cr i
|
|
||||||
-- Nothing -> mempty
|
|
||||||
|
|
||||||
itSPic :: Item -> SPic
|
itSPic :: Item -> SPic
|
||||||
itSPic it = _dimSPic (_itDimension it) it
|
itSPic it = _dimSPic (_itDimension it) it
|
||||||
@@ -33,10 +30,8 @@ pictureWeaponAim
|
|||||||
-> Item
|
-> Item
|
||||||
-> SPic
|
-> SPic
|
||||||
pictureWeaponAim f cr itm = case _itInvPos itm of
|
pictureWeaponAim f cr itm = case _itInvPos itm of
|
||||||
Just i -> pictureWeaponOnAimItem pic cr i
|
Just i -> pictureWeaponOnAimItem (f itm) cr i
|
||||||
Nothing -> mempty
|
Nothing -> mempty
|
||||||
where
|
|
||||||
pic = f itm
|
|
||||||
|
|
||||||
{- | 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
|
||||||
|
|||||||
Reference in New Issue
Block a user