Remove internal ammo

This commit is contained in:
2024-06-21 12:48:41 +01:00
parent d41604fcde
commit 0a1b0386b9
33 changed files with 838 additions and 789 deletions
+70 -69
View File
@@ -71,8 +71,6 @@ ammoPosition itm hit = case hit of
TORCH -> NoAmmoPosition
BANGSTICK i -> bangStickAmmoPos i itm
PISTOL -> Magazine (V3 5 2 0) lhs
REVOLVER -> revolverAmmoPos
REVOLVERX _ -> revolverAmmoPos
MACHINEPISTOL -> Magazine (V3 5 2 0) lhs
AUTOPISTOL -> Magazine (V3 5 2 0) lhs
SMG -> Magazine (V3 7 (-2) 0) rhs
@@ -137,23 +135,21 @@ multigunAmmoPos i =
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
--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
FORCEFIELDGUN -> defSPic
TORCH -> noPic torchShape
BANGSTICK i -> noPic $ baseStickShapeX it i <> addBullets it
BANGSTICK i -> noPic $ baseStickShapeX it i -- <> addBullets it
PISTOL -> noPic $ baseStickShape <> addTinClip it
REVOLVER -> noPic $ baseStickShape <> addBullets it
REVOLVERX _ -> noPic $ baseStickShape <> addBullets it
MACHINEPISTOL -> noPic $ baseStickShape <> addTinClip it
AUTOPISTOL -> noPic $ baseStickShape <> addTinClip it
SMG -> noPic $ baseSMGShape <> addTinClip it
@@ -161,17 +157,17 @@ heldItemSPic ht it = case ht of
BLUNDERBUSS -> noPic $ bangConeShape 20
GRAPECANNON _ -> noPic $ bangConeShape 20
MINIGUNX i -> miniGunXPictItem i it
VOLLEYGUN i -> noPic $ volleyGunShape i <> addBullets it
MULTIGUN i -> noPic $ volleyGunShape i <> addBullets it
RIFLE -> noPic $ baseRifleShape <> addBullets it
VOLLEYGUN i -> noPic $ volleyGunShape i -- <> addBullets it
MULTIGUN i -> noPic $ volleyGunShape i -- <> addBullets it
RIFLE -> noPic $ baseRifleShape -- <> addBullets it
REPEATER -> noPic $ baseRifleShape <> addTinClip it
AUTORIFLE -> noPic $ baseRifleShape <> addTinClip it
BURSTRIFLE -> noPic $ baseRifleShape <> addTinClip it
BANGROD -> noPic $ baseRodShape <> addBullets it
ELEPHANTGUN -> noPic $ baseAMRShape <> addBullets it
BANGROD -> noPic $ baseRodShape -- <> addBullets it
ELEPHANTGUN -> noPic $ baseAMRShape -- <> addBullets it
AMR -> noPic $ baseAMRShape <> addTinClip it
AUTOAMR -> noPic $ baseAMRShape <> addTinClip it
SNIPERRIFLE -> noPic $ baseAMRShape <> addBullets it
SNIPERRIFLE -> noPic $ baseAMRShape -- <> addBullets it
MACHINEGUN -> noPic $ baseAMRShape <> addTinClip it
FLAMESPITTER -> flamerPic it
FLAMETHROWER -> flamerPic it
@@ -251,12 +247,12 @@ baseRifleShape :: Shape
--baseRifleShape = colorSH red $ xCylinder 4 2 25
baseRifleShape = colorSH red $ xCylinderST 3 25
addBullets :: Item -> Shape
addBullets itm = fromMaybe mempty $ do
x <- itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
hit <- itm ^? itType . iyBase . ibtHeld
ps <- fmap (take x) $ ammoPosition itm hit ^? amPosDirs
return $ foldMap (uncurry (drawBullet itm)) ps
--addBullets :: Item -> Shape
--addBullets itm = fromMaybe mempty $ do
-- x <- itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
-- hit <- itm ^? itType . iyBase . ibtHeld
-- ps <- fmap (take x) $ ammoPosition itm hit ^? amPosDirs
-- return $ foldMap (uncurry (drawBullet itm)) ps
-- why is this duplicated?
drawBullet :: Item -> Point3 -> Q.Quaternion Float -> Shape
@@ -293,47 +289,49 @@ drawBullet itm p q =
rectNSWE 0.2 (- 0.2) (-2) (-1)
addTinClip :: Item -> Shape
addTinClip itm = fromMaybe mempty $ do
hit <- itm ^? itType . iyBase . ibtHeld
let ap = ammoPosition itm hit
p <- ap ^? amposPos
d <- ap ^? amposDir
return $ translateSH p $ overPosSH (Q.rotate d) $ makeTinClip itm
makeTinClip :: Item -> Shape
makeTinClip it =
colorSH
midcol
( upperPrismPolyTS
1
( reverse $
rectNSWE 0 (- y) (-1) 1
)
)
<> tips
<> tails
where
midcol =
maybe
black
bulletEffectColor
(it ^? itUse . heldConsumption . laAmmoType . amBullet . buEffect)
y = fromIntegral y' * 0.3
y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
tips = fromMaybe mempty $ do
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn
return $
colorSH (bulletPayloadColor ebt) $
upperPrismPolyTS 1.1 $
reverse $
rectNSWE 0 (- y) 1 2
tails = fromMaybe mempty $ do
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buTrajectory
return $
colorSH (bulletTrajColor ebt) $
upperPrismPolyTS 1.1 $
reverse $
rectNSWE 0 (- y) (-2) (-1)
addTinClip _ = mempty
--addTinClip :: Item -> Shape
--addTinClip itm = fromMaybe mempty $ do
-- hit <- itm ^? itType . iyBase . ibtHeld
-- let ap = ammoPosition itm hit
-- p <- ap ^? amposPos
-- d <- ap ^? amposDir
-- return $ translateSH p $ overPosSH (Q.rotate d) $ makeTinClip itm
--
--makeTinClip :: Item -> Shape
--makeTinClip it =
-- colorSH
-- midcol
-- ( upperPrismPolyTS
-- 1
-- ( reverse $
-- rectNSWE 0 (- y) (-1) 1
-- )
-- )
-- <> tips
-- <> tails
-- where
-- midcol =
-- maybe
-- black
-- bulletEffectColor
-- (it ^? itUse . heldConsumption . laAmmoType . amBullet . buEffect)
-- y = fromIntegral y' * 0.3
-- y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
-- tips = fromMaybe mempty $ do
-- ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn
-- return $
-- colorSH (bulletPayloadColor ebt) $
-- upperPrismPolyTS 1.1 $
-- reverse $
-- rectNSWE 0 (- y) 1 2
-- tails = fromMaybe mempty $ do
-- ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buTrajectory
-- return $
-- colorSH (bulletTrajColor ebt) $
-- upperPrismPolyTS 1.1 $
-- reverse $
-- rectNSWE 0 (- y) (-2) (-1)
bulletEffectColor :: BulletEffect -> Color
bulletEffectColor x = case x of
@@ -410,14 +408,15 @@ flamerPic it =
( colorSH yellow $
translateSHxy tx ty (upperPrismPolyST tz $ polyCirc 3 r)
<> xCylinderST 5 18
, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * am)
--, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * am)
, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * 0.5)
)
where
tx = 4
ty = - 6
tz = 3
r = 5
am = fractionLoadedAmmo2 it
-- am = fractionLoadedAmmo2 it
launcherPic :: Item -> SPic
launcherPic _ = noPic . colorSH cyan $ xCylinderST 5 20
@@ -454,7 +453,8 @@ lasGunPic it =
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW 1 30 (-1) 0
)
where
amFrac = fractionLoadedAmmo it
--amFrac = fractionLoadedAmmo it
amFrac = 0.5
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
dualBeamPic :: Item -> SPic
@@ -466,7 +466,8 @@ dualBeamPic it =
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW gap 1 (- gap) (-1)
)
where
amFrac = fractionLoadedAmmo it
--amFrac = fractionLoadedAmmo it
amFrac = 0.5
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
gap = _dbGap (_itParams it) - 3