Remove explicit muzzle flares for picture updated every frame

This commit is contained in:
2024-10-04 01:31:04 +01:00
parent 075429088b
commit 71d4802a4a
9 changed files with 275 additions and 347 deletions
+23 -24
View File
@@ -26,6 +26,7 @@ import Dodge.Tesla.Arc
import Geometry
import LensHelp
import ListHelp
import Picture.Base
import RandomHelp
import qualified SDL
@@ -39,7 +40,6 @@ hammerCheck f it cr w = case it ^? ldtValue . itUse . heldTriggerType of
_ -> w
_ -> f it cr w
heldEffectMuzzles :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
heldEffectMuzzles t cr w =
uncurry (applyCME (_ldtValue t) cr) cmew
@@ -164,32 +164,25 @@ makeMuzzleFlare mz itmtree cr = case mz ^. mzFlareType of
muzFlareAt :: Color -> Point3 -> Float -> World -> World
muzFlareAt col tranv dir w =
w & randGen .~ g
& cWorld . lWorld . flares
.:~ MuzFlare
{ _flarePoly =
map
(rotateV dir)
[ V2 0 0
, V2 a (- b)
, V2 c d
]
, _flareColor = col
, _flareTran3 = tranv
, _flareTime = 2
}
& cWorld . lWorld . flares <>~ thepic
where
thestate = replicateM 4 $ state $ randomR (2,20)
thepic =
setLayer BloomNoZWrite . translate3 tranv . color col . rotate dir . polygon $
[ V2 0 0
, V2 a (- b)
, V2 c d
]
thestate = replicateM 4 $ state $ randomR (2, 20)
(a : b : c : d : _, g) = runState thestate $ _randGen w -- randomRs (2, 20) (_randGen w)
flareCircleAt :: Color -> Float -> Point3 -> World -> World
flareCircleAt col alphax tranv =
cWorld . lWorld . flares
.:~ CircFlare
{ _flareTime = 2
, _flareColor = col
, _flareAlpha = alphax
, _flareTran3 = tranv
}
<>~ setLayer
BloomNoZWrite
( translate3 tranv $
circleSolidCol (withAlpha 0 0) (withAlpha alphax col) 50
)
getLaserPhaseV :: LabelDoubleTree ComposeLinkType Item -> Float
getLaserPhaseV = const 1
@@ -207,7 +200,6 @@ basicMuzFlare pos dir =
. muzFlareAt (V4 10 10 1 3) (pos `v2z` 20) dir
. muzFlareAt (V4 10 10 1 3) (pos `v2z` 20) dir
isAmmoIntLink :: Int -> ComposeLinkType -> Bool
isAmmoIntLink i (AmmoInLink j _) = i == j
isAmmoIntLink _ _ = False
@@ -313,8 +305,15 @@ lasRayAt col dam phasev pos dir =
removeAmmoFromMag :: Int -> Maybe Int -> Creature -> World -> World
removeAmmoFromMag x mid cr = fromMaybe id $ do
magid <- mid
return $ cWorld . lWorld . creatures
. ix (_crID cr) . crInv . ix magid . itUse . amagLoadStatus . iaLoaded -~ x
return $
cWorld . lWorld . creatures
. ix (_crID cr)
. crInv
. ix magid
. itUse
. amagLoadStatus
. iaLoaded
-~ x
getBulletType ::
LabelDoubleTree ComposeLinkType Item ->