Tweak drawing of backpack equipment

This commit is contained in:
2023-01-03 23:34:30 +00:00
parent 883e3513bc
commit ac8afe513b
9 changed files with 34 additions and 39 deletions
+9 -12
View File
@@ -5,6 +5,7 @@ module Dodge.Item.Draw (
heldItemOffset,
) where
import Geometry.Data
import Control.Lens
import Data.Maybe
import Dodge.Creature.HandPos
@@ -16,18 +17,14 @@ import ShapePicture
itemEquipPict :: Creature -> Item -> SPic
itemEquipPict cr it = case it ^. itUse of
HeldUse{} | _itIsHeld it -> overPosSP (heldItemOffset it cr) (itemSPic it)
ituse -> case ituse ^? equipEffect of
Just _ -> pictureOnEquip (itemSPic it) cr it
Nothing -> mempty
ituse -> fromMaybe mempty $ do
attachpos <- ituse ^? equipEffect . eeAttachPos
i <- it ^? itLocation . ipInvID
epos <- cr ^? crInvEquipped . ix i
return $ equipPosition epos cr attachpos (itemSPic it)
pictureOnEquip :: SPic -> Creature -> Item -> SPic
pictureOnEquip sp cr itm = fromMaybe mempty $ do
i <- itm ^? itLocation . ipInvID
epos <- cr ^? crInvEquipped . ix i
return $ equipPosition epos cr sp
equipPosition :: EquipPosition -> Creature -> SPic -> SPic
equipPosition epos cr sh = case epos of
equipPosition :: EquipPosition -> Creature -> Point3 -> SPic -> SPic
equipPosition epos cr p sh = case epos of
OnLeftWrist -> translateToLeftWrist cr sh
OnRightWrist -> translateToRightWrist cr sh
OnLegs ->
@@ -35,5 +32,5 @@ equipPosition epos cr sh = case epos of
<> translateToRightLeg cr (mirrorSPxz sh)
OnHead -> translateToHead cr sh
OnChest -> translateToChest cr sh
OnBack -> translateToBack cr sh
OnBack -> translateToBack cr p sh
OnSpecial -> sh
+6 -8
View File
@@ -40,17 +40,15 @@ equipItemSPic et _ = case et of
POWERLEGS -> legsSPic yellow
SPEEDLEGS -> legsSPic green
JUMPLEGS -> legsSPic red
JETPACK ->
(,) emptySH $
setDepth 20 $
pictures [color yellow $ polygon $ reverse $ rectNSWE 5 (-5) (-4) (-4)]
JETPACK -> noPic $ colorSH yellow backpackShape
BATTERYPACK -> noPic $ colorSH blue backpackShape
FUELPACK ->
(,) emptySH $
setDepth 20 $
--pictures [color yellow $ polygon $ reverse $ rectNSWE 5 (-5) (-11) (-3)]
pictures [color yellow $ polygon $ reverse $ polyCirc 3 5]
noPic $ colorSH yellow $ upperPrismPoly 10 $ polyCirc 3 5
AUTODETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2)
backpackShape :: Shape
backpackShape = upperPrismPoly 10 $ rectNSWE 5 (-5) (-4) 4
leftItemSPic :: LeftItemType -> Item -> SPic
leftItemSPic lt _ = case lt of
BLINKER -> defSPic
+11
View File
@@ -10,11 +10,13 @@ module Dodge.Item.Equipment (
headLamp,
jetPack,
fuelPack,
batteryPack,
speedLegs,
jumpLegs,
flameShield,
) where
import Geometry.Data
import Dodge.Data.CamouflageStatus
import Dodge.Data.Item
import Dodge.Default
@@ -50,17 +52,26 @@ wristArmour =
& itUse . equipEffect . eeOnRemove .~ EoffWristShield
& itType . iyBase .~ EQUIP WRISTARMOUR
batteryPack :: Item
batteryPack =
defaultEquipment
& itUse . equipEffect . eeSite .~ GoesOnBack
& itType . iyBase .~ EQUIP BATTERYPACK
& itUse . equipEffect . eeAttachPos .~ V3 (-8) 0 10
fuelPack :: Item
fuelPack =
defaultEquipment
& itUse . equipEffect . eeSite .~ GoesOnBack
& itType . iyBase .~ EQUIP FUELPACK
& itUse . equipEffect . eeAttachPos .~ V3 (-9) 0 10
jetPack :: Item
jetPack =
defaultEquipment
& itUse . equipEffect . eeSite .~ GoesOnBack
& itType . iyBase .~ EQUIP JETPACK
& itUse . equipEffect . eeAttachPos .~ V3 (-8) 0 10
brainHat :: Item
brainHat =
+1
View File
@@ -110,6 +110,7 @@ equipInfo eit = case eit of
JETPACK -> "A DEVICE ENABLING FLIGHT."
FUELPACK -> "A LIQUID CONTAINER WITH ATTACHED HOSE."
BATTERYPACK -> "A COLLECTION OF BATTERIES WITH A UNIVERSAL ADAPTER."
AUTODETECTOR d -> "A DEVICE THAT DETECTS "++detectorInfo d ++" IN AN EXPANDING RADIUS. PULSES AUTOMATICALLY. "