Add battery shape/picture

This commit is contained in:
2024-10-04 00:25:44 +01:00
parent 127d85e7ce
commit ac550bc6a4
14 changed files with 241 additions and 271 deletions
+1 -3
View File
@@ -1,7 +1,7 @@
module Dodge.Item.Display (
itemDisplay,
itemString,
itemBaseName,
itemString,
basicItemDisplay,
) where
@@ -33,7 +33,6 @@ basicItemDisplay itm =
itemBaseName itm :
--catMaybes [maybeWarmupStatus itm, maybeRateStatus itm]
catMaybes [maybeWarmupStatus itm]
-- ++ moduleStrings itm
++ repeat "*"
itemString :: Item -> String
@@ -100,7 +99,6 @@ itemNumberDisplay cr itm = case iu of
UseAttach {} -> []
UseAmmoMag {} -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
UseScope OpticScope {_opticZoom = x} -> [shortShow x]
UseScope {} -> []
UseTargeting {_tgPos = mp} -> [maybe "" shortShow mp]
-- this could be cleaner here...
UseBulletMod {} -> mempty
-2
View File
@@ -1,8 +1,6 @@
module Dodge.Item.Draw (
twoFlatHRot,
itemSPic,
itemEquipPict,
heldItemOffset,
) where
import Dodge.Data.ComposedItem
+7 -7
View File
@@ -44,19 +44,19 @@ itemSPic it = case it ^. itType of
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)
TINMAG -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- y) (-1) 1)
DRUMMAG -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- y) (-1) 1)
CHEMFUELPOUCH -> noPic $ colorSH yellow (upperPrismPolyST 3 $ polyCirc 3 5)
-- , setLayer MidLayer . color black $ translate3 (V3 0 0 4) $ circleSolid (5 * am)
BATTERY -> colorSH blue (upperBox Tiny Superfluous 1 (rectNSWE 0 (-2) (-2) 2))
:!: setLayer BloomNoZWrite (setDepth 2 . color (mixColorsFrac green red am) $ circleSolid 2)
_ -> noPic $ upperPrismPolyTS 1 (reverse $ rectNSWE 0 (- y) (-1) 1)
where
y = fromIntegral y' * 0.3
y' = fromMaybe 0 $ it ^? itUse . amagLoadStatus . iaLoaded
am = fractionLoadedAmmo (it ^?! itUse . amagLoadStatus)
-- am = fractionLoadedAmmo (it ^?! itUse . amagLoadStatus)
--fractionLoadedAmmo :: ReloadStatus -> Float
--fractionLoadedAmmo rs = fromIntegral (_iaLoaded rs) / fromIntegral (_iaMax rs)
fractionLoadedAmmo :: ReloadStatus -> Float
fractionLoadedAmmo rs = fromIntegral (_iaLoaded rs) / fromIntegral (_iaMax rs)
--
--fractionLoadedAmmo2 :: ReloadStatus -> Float
--fractionLoadedAmmo2 rs =
+9 -17
View File
@@ -23,38 +23,30 @@ transToHandle itm = fromMaybe id $ do
V2 x y <- itm ^? itUse . heldAim . aimHandlePos
return (-.-.- V3 x y 0)
-- there is a lot of duplication going on here, and also need to check
-- rotations
heldItemRelativeOrient :: Item -> Creature -> (Point3, Q.Quaternion Float) -> (Point3, Q.Quaternion Float)
heldItemRelativeOrient itm cr (p,q)
| _posture (_crStance cr) == Aiming =
(p +.+.+ aimingWeaponZeroPos cr itm `v2z` shoulderHeight, Q.qID * q)
(p + aimingWeaponZeroPos cr itm `v2z` shoulderHeight, Q.qID * q)
| isTwoHandFlat =
( (+.+.+ V3 (_crRad cr) 0 handD)
. rotate3 (twoFlatHRot cr)
$ transToHandle itm p
( V3 (_crRad cr) 0 handD
+ rotate3 (twoFlatHRot cr) (transToHandle itm p)
, (Q.axisAngle (V3 0 0 1) (twoFlatHRot cr)) * q
)
| isOneHand =
( (+.+.+ V3 0 0 handD)
. (+.+.+ V3 (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) 0)
. (+.+.+ V3 (-2) 0 0)
$ transToHandle itm p
( V3 (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) handD
+ transToHandle itm p
, Q.qID * q
)
| otherwise =
( (+.+.+ V3 0 0 handD)
. (+.+.+ V3 (_crRad cr) 0 0)
. rotate3 (strideRot cr + 1.2)
. (+.+.+ V3 (-8) 0 0)
$ transToHandle itm p
( V3 (_crRad cr) 0 handD
+ rotate3 (strideRot cr + 1.2) (V3 (-8) 0 0 + transToHandle itm p)
, (Q.axisAngle (V3 0 0 1) (strideRot cr + 1.2)) * q
)
where
handD = 15
handPos = case cr ^? crStance . carriage of
Just (Walking x LeftForward) -> f x * 50
_ -> 0
Just (Walking x LeftForward) -> f x * 50 -2
_ -> 0 - 2
isOneHand =
itm ^? itUseAimStance == Just OneHand
|| isNothing (itm ^? itUseAimStance)