Work on orienting and drawing attachments

This commit is contained in:
2024-09-30 23:02:22 +01:00
parent 48b8cfe7ef
commit 752b568a86
13 changed files with 340 additions and 229 deletions
+20 -5
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Item.Draw.SPic (
itemSPic,
itemTreeSPic,
@@ -35,7 +37,7 @@ itemTreeSPic (LDT (itm,_) l r) = itemSPic itm
itemRotTreeSPic :: Item -> (ItemLink,LabelDoubleTree ItemLink ComposedItem) -> SPic
itemRotTreeSPic par (il,t) = fromMaybe mempty $ do
(p,q) <- _iatOrient il par itm
(p,q) <- _iatOrient il par (_iatType il) itm
return $ (translateSP p $ overPosSP (Q.rotate q) $ itemTreeSPic t)
where
itm = t ^. ldtValue . _1
@@ -48,10 +50,21 @@ itemSPic it = case it ^. itType of
EQUIP et -> equipItemSPic et it
CONSUMABLE{} -> defSPic
ATTACH {} -> defSPic
AMMOMAG {} -> defSPic
AMMOMAG amt -> ammoMagSPic it amt
TARGETING {} -> defSPic
BULLETMOD {} -> defSPic
ammoMagSPic :: Item -> AmmoMagType -> SPic
ammoMagSPic it = \case
TINMAG -> noPic $ upperPrismPolyTS 1 (reverse $ rectNSWE 0 (- y) (-1) 1)
DRUMMAG -> noPic $ upperPrismPolyTS 1 (reverse $ rectNSWE 0 (- y) (-1) 1)
CHEMFUELPOUCH -> (colorSH yellow (upperPrismPolyST 3 $ polyCirc 3 5)
, mempty)
_ -> noPic $ upperPrismPolyTS 1 (reverse $ rectNSWE 0 (- y) (-1) 1)
where
y = fromIntegral y' * 0.3
y' = fromMaybe 0 $ it ^? itUse . amagLoadStatus . iaLoaded
equipItemSPic :: EquipItemType -> Item -> SPic
equipItemSPic et _ = case et of
MAGSHIELD -> defSPic
@@ -432,10 +445,12 @@ flamerPic :: Item -> SPic
--flamerPic it =
flamerPic _ =
( colorSH yellow $
translateSHxy tx ty (upperPrismPolyST tz $ polyCirc 3 r)
<> xCylinderST 5 18
-- translateSHxy tx ty (upperPrismPolyST tz $ polyCirc 3 r)
-- <>
xCylinderST 5 18
, mempty
--, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * am)
, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * 0.5)
-- , color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * 0.5)
)
where
tx = 4