Migrate LDTs to DTs
This commit is contained in:
@@ -7,13 +7,13 @@ import Dodge.Data.DoubleTree
|
||||
import Control.Lens
|
||||
import Dodge.Data.AimStance
|
||||
|
||||
aimStance :: LDTree ItemLink CItem -> AimStance
|
||||
aimStance ldt
|
||||
aimStance :: DTree CItem -> AimStance
|
||||
aimStance dt
|
||||
| islasweapon = TwoHandFlat
|
||||
| otherwise = itemBaseStance $ ldt ^. ldtValue . _1
|
||||
| otherwise = itemBaseStance $ dt ^. dtValue . _1
|
||||
where
|
||||
islasweapon = ldt ^. ldtValue . _1 . itType == CRAFT TRANSFORMER
|
||||
&& ldt ^? ldtRight . ix 0 . _2 . ldtValue . _2 == Just LaserWeaponSF
|
||||
islasweapon = dt ^. dtValue . _1 . itType == CRAFT TRANSFORMER
|
||||
&& dt ^? dtRight . ix 0 . dtValue . _2 == Just LaserWeaponSF
|
||||
|
||||
itemBaseStance :: Item -> AimStance
|
||||
itemBaseStance itm = case itm ^. itType of
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
module Dodge.Item.Grammar (
|
||||
invDT,
|
||||
invLDT,
|
||||
invLDT',
|
||||
invAdj,
|
||||
@@ -239,6 +240,11 @@ invLDT =
|
||||
joinItemsInList tryAttachItems . IM.elems
|
||||
. fmap (singleLDT . baseCI)
|
||||
|
||||
invDT :: IM.IntMap Item -> [DTree CItem]
|
||||
invDT = fmap ldtToDT .
|
||||
joinItemsInList tryAttachItems . IM.elems
|
||||
. fmap (singleLDT . baseCI)
|
||||
|
||||
invLDT' :: IM.IntMap Item -> [LDTree ItemLink OItem]
|
||||
invLDT' = fmap propagateOrientation . invLDT
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ transToHandle itm = (-.-.- V3 x y 0)
|
||||
where
|
||||
V2 x y = handlePos itm
|
||||
|
||||
handleOrient :: LocationLDT ItemLink CItem -> Point3Q
|
||||
handleOrient loc = case loc ^. locLDT . ldtValue . _1 . itType of
|
||||
handleOrient :: LocationDT CItem -> Point3Q
|
||||
handleOrient loc = case loc ^. locDT . dtValue . _1 . itType of
|
||||
HELD FLAMETHROWER -> (V3 (-1) 0 0, Q.qID)
|
||||
_ -> (V3 (-3) 0 0, Q.qID)
|
||||
|
||||
@@ -54,20 +54,22 @@ handOrient cr = case cr ^. crStance . posture of
|
||||
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
|
||||
sLen = _strideLength $ _crStance cr
|
||||
|
||||
locOrient :: LocationLDT ItemLink OItem -> Creature -> Point3Q
|
||||
locOrient :: LocationDT OItem -> Creature -> Point3Q
|
||||
locOrient loc cr =
|
||||
handHandleOrient (fmap (\(x, y, _) -> (x, y)) $ locToTop loc) cr
|
||||
`Q.comp` (loc ^. locLDT . ldtValue . _3)
|
||||
handHandleOrient (fmap (\(x, y, _) -> (x, y)) $ locToTop' loc) cr
|
||||
`Q.comp` (loc ^. locDT . dtValue . _3)
|
||||
|
||||
heldItemOffset :: LocationLDT ItemLink CItem -> Creature -> Point3 -> Point3
|
||||
heldItemOffset loc cr p = x + Q.rotate q p
|
||||
where
|
||||
(x, q) = handHandleOrient loc cr
|
||||
(x, q) = handHandleOrient (locLDTToLocDT loc) cr
|
||||
|
||||
handHandleOrient :: LocationLDT ItemLink CItem -> Creature -> Point3Q
|
||||
handHandleOrient :: LocationDT CItem -> Creature -> Point3Q
|
||||
handHandleOrient loc cr =
|
||||
handOrient cr (aimStance (loc ^. locLDT))
|
||||
`Q.comp` handleOrient loc
|
||||
handOrient cr (aimStance (loc' ^. locDT))
|
||||
`Q.comp` handleOrient loc'
|
||||
where
|
||||
loc' = locToTop' loc
|
||||
|
||||
shoulderHeight :: Float
|
||||
shoulderHeight = 18
|
||||
|
||||
Reference in New Issue
Block a user