From b71726d1cab166904d895010fd8c3b957ea4e252 Mon Sep 17 00:00:00 2001 From: justin Date: Sun, 22 May 2022 23:55:10 +0100 Subject: [PATCH] Add visuals for legs equipment --- src/Dodge/Creature/HandPos.hs | 22 ++++++++++++++++++++++ src/Dodge/Item/Equipment.hs | 3 +++ src/Dodge/Item/Weapon/Radar.hs | 5 ++--- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/Dodge/Creature/HandPos.hs b/src/Dodge/Creature/HandPos.hs index 4e9111c35..b5d3e8f40 100644 --- a/src/Dodge/Creature/HandPos.hs +++ b/src/Dodge/Creature/HandPos.hs @@ -49,6 +49,28 @@ translateToLeftHand cr sLen = _strideLength $ _crStance cr f i = negate 2 + negate 6 * fromIntegral (sLen - i) / fromIntegral sLen +translateToLeftLeg :: Creature -> SPic -> SPic +translateToLeftLeg cr = case cr ^? crStance . carriage of + Just (Walking sa LeftForward) -> translateSPf ( f sa) off + Just (Walking sa RightForward) -> translateSPf (-f sa) off + _ -> translateSPf 0 off + where + off = 5 + sLen = _strideLength $ _crStance cr + f i = 6 * fromIntegral (sLen - i) / fromIntegral sLen + +translateToRightLeg :: Creature -> SPic -> SPic +translateToRightLeg cr = case cr ^? crStance . carriage of + Just (Walking sa LeftForward) -> translateSPf (-f sa) (-off) + Just (Walking sa RightForward) -> translateSPf ( f sa) (-off) + _ -> translateSPf 0 (-off) + where + aFoot :: Shape + aFoot = upperPrismPoly 10 $ polyCirc 3 4 + off = 5 + sLen = _strideLength $ _crStance cr + f i = 6 * fromIntegral (sLen - i) / fromIntegral sLen + oneH :: Creature -> Bool oneH = crInStance OneHand diff --git a/src/Dodge/Item/Equipment.hs b/src/Dodge/Item/Equipment.hs index d9941dc2d..c703d6bd5 100644 --- a/src/Dodge/Item/Equipment.hs +++ b/src/Dodge/Item/Equipment.hs @@ -75,6 +75,8 @@ equipPosition :: EquipPosition -> Creature -> SPic -> SPic equipPosition epos cr sh = case epos of OnLeftWrist -> translateToLeftHand cr sh OnRightWrist -> translateToRightHand cr $ mirrorSPxz sh + OnLegs -> translateToLeftLeg cr sh <> + translateToRightLeg cr (mirrorSPxz sh) _ -> sh flatShield :: Item @@ -199,6 +201,7 @@ powerLegs = defaultEquipment {_eqUse = \_ _ -> id ,_eqSite = GoesOnLegs } + , _itEquipPict = pictureOnEquip (noPic $ translateSH (V3 0 4 0) $ colorSH yellow $ upperPrismPoly 3 $ rectWH 2 2) , _itEffect = NoItEffect , _itID = Nothing } diff --git a/src/Dodge/Item/Weapon/Radar.hs b/src/Dodge/Item/Weapon/Radar.hs index f60eb705a..429af151c 100644 --- a/src/Dodge/Item/Weapon/Radar.hs +++ b/src/Dodge/Item/Weapon/Radar.hs @@ -60,7 +60,7 @@ autoSonar :: Item autoSonar = defaultEquipment { _itType = RADAR , _itName = "AUTOSONAR" - , _itEquipPict = \_ _ -> (,) emptySH blank + , _itEquipPict = shapeForWrist (colorSH red $ upperPrismPoly 3 $ rectWH 2 2) , _itEffect = autoSonarEffect , _itID = Nothing } & itUse . eqSite .~ GoesOnWrist @@ -70,8 +70,7 @@ autoRadar :: Item autoRadar = defaultEquipment { _itType = RADAR , _itName = "AUTORADAR" - , _itEquipPict = pictureOnEquip $ noPic (colorSH yellow $ translateSH (V3 0 4 (-4)) $ upperPrismPoly 3 - $ rectWH 2 2) + , _itEquipPict = shapeForWrist (colorSH yellow $ upperPrismPoly 3 $ rectWH 2 2) , _itEffect = autoRadarEffect , _itID = Nothing } & itUse . eqSite .~ GoesOnWrist