Continue to refactor body/equipment positionings

This commit is contained in:
2025-08-27 14:40:13 +01:00
parent 9d2a2e6730
commit 86696deb56
14 changed files with 151 additions and 189 deletions
+23 -22
View File
@@ -4,7 +4,6 @@ module Dodge.Item.Draw (
itemEquipPict,
) where
import qualified Data.IntMap.Strict as IM
import qualified Quaternion as Q
import Dodge.Data.Equipment.Misc
import Dodge.Data.ComposedItem
@@ -17,12 +16,12 @@ import Dodge.Item.Draw.SPic
import Dodge.Item.HeldOffset
import ShapePicture
itemEquipPict :: IM.IntMap Item -> Creature -> DTree CItem -> SPic
itemEquipPict m cr itmtree
itemEquipPict :: Creature -> DTree CItem -> SPic
itemEquipPict cr itmtree
| --Just i <- itm ^? itLocation . ilInvID
Just esite <- itm ^? itLocation . ilEquipSite . _Just
, Just attachpos <- equipAttachPos <$> itm ^? itType . ibtEquip
= equipPosition esite m cr attachpos (itemSPic itm)
= equipPosition esite cr attachpos (itemSPic itm)
| itm ^? itLocation . ilInvID == cr ^? crManipulation . manObject . imRootSelectedItem
= overPosSP (Q.prePos $ handHandleOrient loc cr) (itemTreeSPic itmtree)
| otherwise = mempty
@@ -30,23 +29,25 @@ itemEquipPict m cr itmtree
itm = itmtree ^. dtValue . _1
loc = LocDT TopDT itmtree
equipAttachPos :: EquipItemType -> Point3
equipAttachPos :: EquipItemType -> Point3Q
equipAttachPos = \case
BATTERYPACK -> V3 (-8) 0 10
FUELPACK -> V3 (-9) 0 10
BULLETBELTPACK -> V3 (-9) 0 10
BULLETBELTBRACER -> V3 (-9) 0 10
_ -> 0
BATTERYPACK -> (V3 (-8) 0 10, Q.qID)
FUELPACK -> (V3 (-9) 0 10, Q.qID)
BULLETBELTPACK -> (V3 (-9) 0 10, Q.qID)
BULLETBELTBRACER -> (V3 (-9) 0 10, Q.qID)
_ -> (0, Q.qID)
equipPosition :: EquipSite -> IM.IntMap Item -> Creature -> Point3 -> SPic -> SPic
equipPosition epos m cr p sh = case epos of
OnLeftWrist -> translateToLeftWrist cr sh
OnRightWrist -> translateToRightWrist cr sh
OnLegs ->
translateToLeftLeg cr sh
<> translateToRightLeg cr sh-- (mirrorSPxz sh)
OnHead -> translateToHead m cr sh
OnChest -> translateToChest m cr sh
--OnBack -> translateToBack cr p sh
OnBack -> overPosSP (\x -> fst $ backPQ cr `Q.comp` (p + x,Q.qID)) sh
-- OnSpecial -> sh
equipPosition :: EquipSite -> Creature -> Point3Q -> SPic -> SPic
equipPosition es cr q = overPosSP
(\x -> fst $ equipSitePQ es cr `Q.comp` q `Q.comp` (x,Q.qID))
-- case epos of
-- --OnLeftWrist -> translateToLeftWrist cr
-- --OnRightWrist -> translateToRightWrist cr
-- OnLeftWrist -> overPosSP (translateToES cr OnLeftWrist)
-- OnRightWrist -> overPosSP (translateToES cr OnRightWrist)
-- OnLegs ->
-- translateToLeftLeg cr
-- <> translateToRightLeg cr-- (mirrorSPxz sh)
-- OnHead -> overPosSP (translateToES cr OnHead)
-- OnChest -> overPosSP (translateToES cr OnChest)
-- OnBack -> overPosSP (\x -> fst $ backPQ cr `Q.comp` (p + x,Q.qID))
+1 -1
View File
@@ -257,7 +257,7 @@ equipSiteInfo es = case es of
GoesOnChest -> " on the chest"
GoesOnBack -> " on the back"
GoesOnWrist -> " on a wrist"
GoesOnLegs -> " on both legs"
GoesOnLeg -> " on a leg"
--makeCommaList :: [String] -> String
--makeCommaList [] = ""