Cleanup
This commit is contained in:
@@ -113,7 +113,7 @@ itemNumberDisplay cr itm = case iu of
|
||||
UseHotkey{} -> [showAutoRechargeProgress (_leftConsumption iu)]
|
||||
EquipUse{} -> showEquipmentNumber cr itm
|
||||
CraftUse -> []
|
||||
ConsumeUse {} -> []
|
||||
UseConsume {} -> []
|
||||
AttachUse {} -> []
|
||||
UseAmmoMag {} -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
|
||||
ScopeUse OpticScope {_opticZoom = x} -> [shortShow x]
|
||||
|
||||
+41
-71
@@ -1,48 +1,36 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
|
||||
module Dodge.Item.Draw.SPic (
|
||||
itemSPic,
|
||||
itemTreeSPic,
|
||||
) where
|
||||
|
||||
import Data.Strict.Tuple
|
||||
import Color
|
||||
import Data.Maybe
|
||||
import qualified Linear.Quaternion as Q
|
||||
import Data.Strict.Tuple
|
||||
import Dodge.Data.ComposedItem
|
||||
import Dodge.Data.DoubleTree
|
||||
import Color
|
||||
--import qualified Data.Map.Strict as M
|
||||
--import Data.Maybe
|
||||
import Dodge.Data.Item
|
||||
--import Dodge.Item.AmmoPosition
|
||||
--import Dodge.Item.Weapon.FractionLoaded
|
||||
import Geometry
|
||||
import LensHelp
|
||||
import qualified Linear.Quaternion as Q
|
||||
--import qualified Linear.Quaternion as Q
|
||||
import Picture
|
||||
import Shape
|
||||
import ShapePicture
|
||||
--import Data.Maybe
|
||||
|
||||
--itemHeldAmmoPic :: Item -> Item -> SPic
|
||||
--itemHeldAmmoPic itm amit = itemSPic itm <> addAmmoClip itm amit
|
||||
|
||||
--addAmmoClip :: Item -> Item -> SPic
|
||||
--addAmmoClip itm amit = fromMaybe mempty $ do
|
||||
-- hit <- itm ^? itType . iyBase . ibtHeld
|
||||
-- return mempty
|
||||
|
||||
itemTreeSPic :: LabelDoubleTree ItemLink ComposedItem -> SPic
|
||||
itemTreeSPic (LDT (itm,_) l r) = itemSPic itm
|
||||
<> foldMap (itemRotTreeSPic itm) (l <> r)
|
||||
itemTreeSPic (LDT (itm, _) l r) =
|
||||
itemSPic itm
|
||||
<> foldMap (itemRotTreeSPic itm) (l <> r)
|
||||
|
||||
itemRotTreeSPic :: Item -> (ItemLink,LabelDoubleTree ItemLink ComposedItem) -> SPic
|
||||
itemRotTreeSPic par (il,t) = fromMaybe mempty $ do
|
||||
(p,q) <- _iatOrient il par (_iatType il) itm
|
||||
itemRotTreeSPic :: Item -> (ItemLink, LabelDoubleTree ItemLink ComposedItem) -> SPic
|
||||
itemRotTreeSPic par (il, t) = fromMaybe mempty $ do
|
||||
(p, q) <- _iatOrient il par (_iatType il) itm
|
||||
return $ (translateSP p $ overPosSP (Q.rotate q) $ itemTreeSPic t)
|
||||
where
|
||||
itm = t ^. ldtValue . _1
|
||||
|
||||
|
||||
itemSPic :: Item -> SPic
|
||||
itemSPic it = case it ^. itType of
|
||||
CRAFT _ -> defSPic
|
||||
@@ -50,28 +38,29 @@ itemSPic it = case it ^. itType of
|
||||
LEFT lt -> leftItemSPic lt it
|
||||
EQUIP et -> equipItemSPic et it
|
||||
CONSUMABLE{} -> defSPic
|
||||
ATTACH {} -> defSPic
|
||||
ATTACH{} -> defSPic
|
||||
AMMOMAG amt -> ammoMagSPic it amt
|
||||
TARGETING {} -> defSPic
|
||||
BULLETMOD {} -> defSPic
|
||||
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 -> noPic $ colorSH yellow (upperPrismPolyST 3 $ polyCirc 3 5)
|
||||
-- , setLayer MidLayer . color black $ translate3 (V3 0 0 4) $ circleSolid (5 * am)
|
||||
-- , setLayer MidLayer . color black $ translate3 (V3 0 0 4) $ circleSolid (5 * am)
|
||||
_ -> 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)
|
||||
|
||||
--fractionLoadedAmmo :: ReloadStatus -> Float
|
||||
--fractionLoadedAmmo rs = fromIntegral (_iaLoaded rs) / fromIntegral (_iaMax rs)
|
||||
--
|
||||
--fractionLoadedAmmo2 :: ReloadStatus -> Float
|
||||
--fractionLoadedAmmo2 rs =
|
||||
--fractionLoadedAmmo2 rs =
|
||||
-- 1 - (1 - fromIntegral (_iaLoaded rs) / fromIntegral (_iaMax rs)) ** 2
|
||||
|
||||
equipItemSPic :: EquipItemType -> Item -> SPic
|
||||
@@ -79,13 +68,13 @@ equipItemSPic et _ = case et of
|
||||
MAGSHIELD -> defSPic
|
||||
FLAMESHIELD -> defSPic
|
||||
FRONTARMOUR -> defSPic
|
||||
-- ( mempty
|
||||
-- , setDepth 20 $
|
||||
-- fold
|
||||
-- [ color yellow $ thickArc 0 (pi / 2) 10 5
|
||||
-- , color yellow $ thickArc (3 * pi / 2) (2 * pi) 10 5
|
||||
-- ]
|
||||
-- )
|
||||
-- ( mempty
|
||||
-- , setDepth 20 $
|
||||
-- fold
|
||||
-- [ color yellow $ thickArc 0 (pi / 2) 10 5
|
||||
-- , color yellow $ thickArc (3 * pi / 2) (2 * pi) 10 5
|
||||
-- ]
|
||||
-- )
|
||||
WRISTARMOUR -> defSPic
|
||||
INVISIBILITYEQUIPMENT _ -> noPic (colorSH chartreuse $ upperPrismPolySI 3 $ rectWH 2 2)
|
||||
BRAINHAT -> noPic (colorSH yellow $ upperPrismPolySU 3 $ rectWH 4 4)
|
||||
@@ -100,8 +89,8 @@ equipItemSPic et _ = case et of
|
||||
noPic $ colorSH yellow $ upperPrismPolyMT 10 $ polyCirc 3 5
|
||||
BULLETBELTPACK ->
|
||||
noPic $ colorSH green backpackShape
|
||||
BULLETBELTBRACER
|
||||
-> noPic (colorSH green $ upperPrismPolySU 3 $ rectWH 2 2)
|
||||
BULLETBELTBRACER ->
|
||||
noPic (colorSH green $ upperPrismPolySU 3 $ rectWH 2 2)
|
||||
AUTODETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
|
||||
|
||||
backpackShape :: Shape
|
||||
@@ -166,7 +155,7 @@ leftItemSPic lt _ = case lt of
|
||||
--bangStickAmmoPos :: Int -> Item -> AmmoPosition
|
||||
--bangStickAmmoPos _ itm =
|
||||
-- Bullets
|
||||
-- [(rotate3z a (V3 5 0 3), Q.axisAngle (V3 0 0 1) a)
|
||||
-- [(rotate3z a (V3 5 0 3), Q.axisAngle (V3 0 0 1) a)
|
||||
-- | a <- map _mzRot (itm ^?! itUse . heldAim . aimMuzzles)]
|
||||
|
||||
--volleygunAmmoPos :: Int -> AmmoPosition
|
||||
@@ -183,14 +172,6 @@ leftItemSPic lt _ = case lt of
|
||||
-- where
|
||||
-- f n = fromIntegral n * 5 - ((fromIntegral i - 1) * 2.5)
|
||||
|
||||
--revolverAmmoPos :: AmmoPosition
|
||||
--revolverAmmoPos =
|
||||
-- Bullets
|
||||
-- [(V3 5 0 1 + Q.rotate q (V3 0 0 2), q) | q <- qs]
|
||||
-- where
|
||||
-- qs = [Q.axisAngle (V3 1 0 0) (f i) | i <- [1 .. 6 :: Int]]
|
||||
-- f i = fromIntegral i * pi / 3 + pi / 6
|
||||
|
||||
heldItemSPic :: HeldItemType -> Item -> SPic
|
||||
heldItemSPic ht it = case ht of
|
||||
FLATSHIELD -> flatShieldEquipSPic
|
||||
@@ -207,7 +188,6 @@ heldItemSPic ht it = case ht of
|
||||
MINIGUNX i -> miniGunXPictItem i it
|
||||
VOLLEYGUN i -> noPic $ volleyGunShape i -- <> addBullets it
|
||||
RIFLE -> noPic baseRifleShape -- <> addBullets it
|
||||
-- REPEATER -> noPic $ baseRifleShape <> addTinClip it
|
||||
AUTORIFLE -> noPic $ baseRifleShape
|
||||
BURSTRIFLE -> noPic $ baseRifleShape
|
||||
BANGROD -> noPic baseRodShape -- <> addBullets it
|
||||
@@ -215,7 +195,7 @@ heldItemSPic ht it = case ht of
|
||||
AMR -> noPic $ baseAMRShape
|
||||
AUTOAMR -> noPic $ baseAMRShape
|
||||
SNIPERRIFLE -> noPic baseAMRShape -- <> addBullets it
|
||||
-- MACHINEGUN -> noPic $ baseAMRShape <> addTinClip it
|
||||
-- MACHINEGUN -> noPic $ baseAMRShape <> addTinClip it
|
||||
FLAMESPITTER -> flamerPic it
|
||||
FLAMETHROWER -> flamerPic it
|
||||
FLAMETORRENT -> flamerPic it
|
||||
@@ -224,14 +204,9 @@ heldItemSPic ht it = case ht of
|
||||
SPARKGUN -> teslaGunPic
|
||||
TESLAGUN -> teslaGunPic
|
||||
LASGUN -> lasGunPic it
|
||||
-- LASCIRCLE -> lasGunPic it
|
||||
-- DUALBEAM -> dualBeamPic it
|
||||
-- LASWIDE _ -> lasGunPic it
|
||||
--SONICGUN -> noPic baseSonicShape
|
||||
TRACTORGUN -> tractorGunPic it
|
||||
LAUNCHER -> launcherPic it
|
||||
LAUNCHERX _ -> launcherPic it
|
||||
-- REMOTELAUNCHER -> launcherPic it
|
||||
POISONSPRAYER -> flamerPic it
|
||||
DRONELAUNCHER -> defSPic
|
||||
SHATTERGUN -> shatterGunSPic
|
||||
@@ -252,11 +227,6 @@ torchShape =
|
||||
bot = upperPrismPolySE 0.5 $ rectXH 9 2
|
||||
back = upperPrismPolySE 3 $ rectXH 1 2
|
||||
|
||||
--modulesSPic :: Item -> ModuleSlot -> ItemModuleType -> SPic
|
||||
--modulesSPic it _ imt = case imt of
|
||||
-- ATTACHTORCH -> noPic (overPosSH (+.+.+ _dimAttachPos (_itDimension it)) torchShape)
|
||||
-- _ -> mempty
|
||||
|
||||
baseStickShapeX :: Item -> Int -> Shape
|
||||
baseStickShapeX it _ = foldMap f (it ^?! itUse . heldAim . aimMuzzles)
|
||||
where
|
||||
@@ -269,14 +239,14 @@ bangConeShape :: Float -> Shape
|
||||
bangConeShape x =
|
||||
colorSH cyan $
|
||||
xCylinderST 3 x
|
||||
<> upperPrismPolyST 6 ( rectNSWE 4 (-4) x (10 + x))
|
||||
<> upperPrismPolyST 6 (rectNSWE 4 (-4) x (10 + x))
|
||||
|
||||
defSPic :: SPic
|
||||
defSPic = noPic $ colorSH green $ upperPrismPolyST 3 $ square 4
|
||||
|
||||
shatterGunSPic :: SPic
|
||||
shatterGunSPic =
|
||||
-- TODO cylinderize
|
||||
-- TODO cylinderize
|
||||
noPic $
|
||||
colorSH blue $
|
||||
upperPrismPolyST 5 (rectNESW xb 8 xa 0)
|
||||
@@ -332,16 +302,16 @@ volleyGunShape i =
|
||||
|
||||
-- to get this rotating should probably add extra state to the minigun
|
||||
miniGunXPictItem :: Int -> Item -> SPic
|
||||
miniGunXPictItem i it = miniGunXPict i spin
|
||||
miniGunXPictItem i it = miniGunXPict i spin
|
||||
where
|
||||
spin = (-10) -- * _iaLoaded (_laSource (_heldConsumption (_itUse it)))
|
||||
+ _warmTime (_heldDelay $ _itUse it)
|
||||
spin = (-10) + _warmTime (_heldDelay $ _itUse it)
|
||||
|
||||
miniGunXPict :: Int -> Int -> SPic
|
||||
miniGunXPict i spin = noPic
|
||||
( colorSH red (rotateSHx a barrels)
|
||||
<> baseRifleShape
|
||||
)
|
||||
miniGunXPict i spin =
|
||||
noPic
|
||||
( colorSH red (rotateSHx a barrels)
|
||||
<> baseRifleShape
|
||||
)
|
||||
where
|
||||
aBarrel = translateSH (V3 15 2 2) baseCaneShape
|
||||
barrels = foldMap (\an -> aBarrel & rotateSHx (2 * pi * fromIntegral an / fromIntegral i)) [1 .. i]
|
||||
@@ -363,6 +333,7 @@ flamerPic _ = noPic . colorSH yellow $ xCylinderST 5 18
|
||||
|
||||
launcherPic :: Item -> SPic
|
||||
launcherPic _ = noPic . colorSH cyan $ xCylinderST 5 20
|
||||
|
||||
--launcherPic _ = noPic . colorSH cyan $ xCylinder 4 5 20
|
||||
-- ( colorSH cyan $
|
||||
-- prismPoly
|
||||
@@ -392,8 +363,9 @@ lasGunPic _ =
|
||||
( colorSH blue $
|
||||
upperBoxST 4 (rectNESW 3 30 1 0)
|
||||
<> upperBoxSU 4 (rectNESW (-1) 30 (-3) 0)
|
||||
<> upperBoxSU 1 (rectNESW 3 30 (-3) 0))
|
||||
:!: (setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW 1 30 (-1) 0)
|
||||
<> upperBoxSU 1 (rectNESW 3 30 (-3) 0)
|
||||
)
|
||||
:!: (setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW 1 30 (-1) 0)
|
||||
where
|
||||
--amFrac = fractionLoadedAmmo it
|
||||
amFrac = 0.5
|
||||
@@ -455,5 +427,3 @@ keyPic =
|
||||
|
||||
legsSPic :: Color -> SPic
|
||||
legsSPic col = noPic $ translateSH (V3 0 4 0) $ colorSH col $ upperPrismPolyST 3 $ rectWH 2 2
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user