This commit is contained in:
2025-07-12 21:47:08 +01:00
parent 06cf55aa73
commit 026dbf9d15
3 changed files with 78 additions and 50 deletions
-2
View File
@@ -1,10 +1,8 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
module Dodge.Data.ComposedItem where
import Dodge.Data.AmmoType
--import Control.Lens
import Dodge.Data.Item
import Linear
import qualified Linear.Quaternion as Q
+77 -46
View File
@@ -5,14 +5,14 @@ module Dodge.Item.Draw.SPic (
itemTreeSPic,
) where
import Dodge.Item.Orientation
import Dodge.Item.MaxAmmo
import Color
import Data.Maybe
import Data.Strict.Tuple
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Dodge.Data.Item
import Dodge.Item.MaxAmmo
import Dodge.Item.Orientation
import Geometry
import LensHelp
import qualified Linear.Quaternion as Q
@@ -22,7 +22,7 @@ import Shape
import ShapePicture
itemTreeSPic :: DTree CItem -> SPic
itemTreeSPic (DT (itm,_) l r) = itemSPic itm <> foldMap (itemRotTreeSPic itm) (l <> r)
itemTreeSPic (DT (itm, _) l r) = itemSPic itm <> foldMap (itemRotTreeSPic itm) (l <> r)
itemRotTreeSPic :: Item -> DTree CItem -> SPic
itemRotTreeSPic par t = translateSP p . overPosSP (Q.rotate q) $ itemTreeSPic t
@@ -43,7 +43,7 @@ itemSPic it = case it ^. itType of
ITEMSCAN -> defSPic
MAPPER -> defSPic
ARHUD -> defSPic
INTROSCAN {} -> defSPic
INTROSCAN{} -> defSPic
DETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
DROPPER{} -> defSPic
CLICKER{} -> defSPic
@@ -59,61 +59,88 @@ craftItemSPic = \case
HARDWARE -> colorSH orange $ upperPrismPolyST 3 $ square 4
SPRING -> colorSH green $ xCylinderST 1 5
HOSE -> colorSH green $ xCylinderST 1 10
TAPE -> colorSH (greyN 0.5)
. translateSH (V3 4 0 0) . upperCylinder Small Typical 1 $ polyCirc 3 5
CAN -> colorSH green
. translateSH (V3 4 0 0) . upperCylinder Small Typical 1 $ polyCirc 3 4
TAPE ->
colorSH (greyN 0.5)
. translateSH (V3 4 0 0)
. upperCylinder Small Typical 1
$ polyCirc 3 5
CAN ->
colorSH green
. translateSH (V3 4 0 0)
. upperCylinder Small Typical 1
$ polyCirc 3 4
TIN -> colorSH green . upperPrismPolyST 3 $ rectXH 2 2
STEELDRUM -> colorSH green
. translateSH (V3 4 0 0) . upperCylinder Small Typical 1 $ polyCirc 4 8
STEELDRUM ->
colorSH green
. translateSH (V3 4 0 0)
. upperCylinder Small Typical 1
$ polyCirc 4 8
PLANK -> colorSH orange $ upperPrismPolyST 3 $ rectXH 8 2
GLASSSHARD -> colorSH azure $ upperPrismPolyST 1 [V2 0 (-1), V2 4 (-0.5), V2 0 1]
SCRAPMETAL -> colorSH (greyN 0.3) $ upperPrismPolyST 3 $ square 4
PUMP -> colorSH yellow . translateSH (V3 4 0 0) $
upperCylinder Small Typical 1 (polyCirc 4 4)
<> upperPrismPolyST 1 (rectNSWE (-2) (-4) 4 0)
<> upperPrismPolyST 1 (rectNSWE 4 2 0 (-4))
PUMP ->
colorSH yellow . translateSH (V3 4 0 0) $
upperCylinder Small Typical 1 (polyCirc 4 4)
<> upperPrismPolyST 1 (rectNSWE (-2) (-4) 4 0)
<> upperPrismPolyST 1 (rectNSWE 4 2 0 (-4))
MOTOR -> colorSH orange $ xCylinderST 5 3 <> xCylinderST 3 5
TRANSFORMER -> colorSH blue $ upperPrismPolyST 3 $ square 4
PRISM -> colorSH azure $ upperPrismPolyST 1 [V2 0 (-3), V2 4 0, V2 0 3]
LIGHTER -> colorSH yellow . upperPrismPolyST 3 $ rectXH 2 2
MAGNET -> colorSH red (upperPrismPolyST 1 (rectNSWE 2 (-2) 2 0))
<> colorSH (greyN 0.5) (upperPrismPolyST 1 (rectNSWE 2 (-2) 4 2))
<> colorSH blue (upperPrismPolyST 1 (rectNSWE 2 (-2) 6 4))
MAGNET ->
colorSH red (upperPrismPolyST 1 (rectNSWE 2 (-2) 2 0))
<> colorSH (greyN 0.5) (upperPrismPolyST 1 (rectNSWE 2 (-2) 4 2))
<> colorSH blue (upperPrismPolyST 1 (rectNSWE 2 (-2) 6 4))
ANTIMATTER -> colorSH violet $ upperPrismPolyST 3 $ square 4
PLATE -> colorSH green $ upperPrismPolyST 8 $ rectXH 2 5
TRANSMITTER -> colorSH green $
xCylinderST 1 5 <> translateSH (V3 5 0 0) (upperPrismPolyHalfST 3 $ polyCirc 4 3)
TRANSMITTER ->
colorSH green $
xCylinderST 1 5 <> translateSH (V3 5 0 0) (upperPrismPolyHalfST 3 $ polyCirc 4 3)
MICROCHIP -> colorSH yellow $ upperPrismPolyST 1 $ square 4
HARDDRIVE -> colorSH green $ upperPrismPolyST 1 $ square 4
RAM -> colorSH orange $ upperPrismPolyST 1 $ square 4
AIUNIT -> colorSH blue $ upperPrismPolyST 1 $ square 4
CAMERA -> colorSH yellow $ xCylinderST 5 3 <> xCylinderST 3 5
MINIDISPLAY -> colorSH green $ upperPrismPolyST 1 (square 4)
<> upperPrismPolyST 2 (rectNSWE 4 (-4) 3 4)
MINIDISPLAY ->
colorSH green $
upperPrismPolyST 1 (square 4)
<> upperPrismPolyST 2 (rectNSWE 4 (-4) 3 4)
LED -> colorSH yellow $ upperPrismPolyST 1 (square 2)
NAILBOX -> colorSH green $ upperPrismPolyST 3 (rectXH 4 3)
IRONBAR -> colorSH (greyN 0.5) $ upperPrismPolyST 3 $ rectXH 8 2
LIGHTSENSOR -> colorSH green (upperPrismPolyST 1 $ square 3)
<> colorSH yellow (upperPrismPolyHalfST 3 $ polyCirc 4 3)
SOUNDSENSOR -> colorSH yellow (upperPrismPolyST 1 $ rectXH 4 1)
<> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
<> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
MICROPHONE -> colorSH yellow (upperPrismPolyST 1 $ rectXH 3 1)
<> translateSH (V3 3 0 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
HEATSENSOR -> colorSH red (upperPrismPolyST 1 $ rectXH 4 1)
<> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
<> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
THERMOMETER -> colorSH green (upperPrismPolyST 1 $ rectXH 3 1)
<> translateSH (V3 3 0 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
CREATURESENSOR -> colorSH azure (upperPrismPolyST 1 $ rectXH 4 1)
<> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
<> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
LIGHTSENSOR ->
colorSH green (upperPrismPolyST 1 $ square 3)
<> colorSH yellow (upperPrismPolyHalfST 3 $ polyCirc 4 3)
SOUNDSENSOR ->
colorSH yellow (upperPrismPolyST 1 $ rectXH 4 1)
<> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
<> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
MICROPHONE ->
colorSH yellow (upperPrismPolyST 1 $ rectXH 3 1)
<> translateSH (V3 3 0 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
HEATSENSOR ->
colorSH red (upperPrismPolyST 1 $ rectXH 4 1)
<> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
<> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
THERMOMETER ->
colorSH green (upperPrismPolyST 1 $ rectXH 3 1)
<> translateSH (V3 3 0 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
CREATURESENSOR ->
colorSH azure (upperPrismPolyST 1 $ rectXH 4 1)
<> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
<> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
WIRE -> colorSH blue $ xCylinderST 1 5
FUELCELL -> colorSH blue
. translateSH (V3 4 0 0) . upperCylinder Small Typical 1 $ polyCirc 3 4
PORTABLEFUSION -> colorSH azure
. translateSH (V3 4 0 0) . upperCylinder Small Typical 1 $ polyCirc 3 4
FUELCELL ->
colorSH blue
. translateSH (V3 4 0 0)
. upperCylinder Small Typical 1
$ polyCirc 3 4
PORTABLEFUSION ->
colorSH azure
. translateSH (V3 4 0 0)
. upperCylinder Small Typical 1
$ polyCirc 3 4
-- FRAGMODULE
-- FLASHMODULE
-- GASINJECTOR
@@ -125,8 +152,9 @@ ammoMagSPic it = \case
TINMAG -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- (am * 5)) (-1) 1)
DRUMMAG -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- (am * 15)) (-1) 1)
CHEMFUELPOUCH -> noPic $ colorSH yellow (upperPrismPolyST 3 $ polyCirc 3 5)
BATTERY -> colorSH blue (upperBox Tiny Superfluous 1 (rectNSWE 0 (-2) (-2) 2))
:!: setLayer BloomNoZWrite (setDepth 2 . color (mixColorsFrac green red am) $ circleSolid 2)
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 (rectNSWE 0 (- y) (-1) 1)
where
y = fromIntegral y' * 0.3
@@ -136,8 +164,9 @@ ammoMagSPic it = \case
fractionLoadedAmmo :: Item -> Float
fractionLoadedAmmo itm = fromMaybe 0 $ do
m <- maxAmmo itm
return $ fromIntegral (itm ^?! itConsumables . _Just)
/ fromIntegral m
return $
fromIntegral (itm ^?! itConsumables . _Just)
/ fromIntegral m
--
--fractionLoadedAmmo2 :: ReloadStatus -> Float
@@ -279,8 +308,9 @@ torchShape =
back = upperPrismPolySE 3 $ rectXH 1 2
baseStickShapeX :: Item -> Int -> Shape
baseStickShapeX _ _ = mempty
--baseStickShapeX it _ = mempty
baseStickShapeX _ _ = mempty
--baseStickShapeX it _ = mempty
-- foldMap f (it ^?! itUse . heldMuzzles)
-- where
-- f brl = rotateSH (_mzRot brl) baseStickShape
@@ -410,6 +440,7 @@ teslaGunPic = shatterGunSPic
lasGunPic :: Item -> SPic
lasGunPic _ = noPic $ colorSH blue $ upperPrismPolyST 3 $ square 4
-- colorSH
-- blue
-- ( upperBoxST 4 (rectNSWE 3 1 0 30)
+1 -2
View File
@@ -3,17 +3,16 @@
module Dodge.Item.HeldOffset (
turretItemOffset,
twoFlatHRot,
-- heldItemOffset,
locOrient,
handHandleOrient,
) where
import Dodge.DoubleTree
import Dodge.Data.AimStance
import Dodge.Data.ComposedItem
import Dodge.Data.Creature
import Dodge.Data.DoubleTree
import Dodge.Data.Machine
import Dodge.DoubleTree
import Dodge.Item.AimStance
import Geometry
import LensHelp