Remove explicit muzzle flares for picture updated every frame
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
All good (600 modules, at 00:59:03)
|
All good (598 modules, at 01:27:16)
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
{-# LANGUAGE DeriveGeneric #-}
|
|
||||||
{-# LANGUAGE DeriveAnyClass #-}
|
|
||||||
{-# LANGUAGE StrictData #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
|
|
||||||
module Dodge.Data.Flare where
|
|
||||||
|
|
||||||
import Color
|
|
||||||
import Control.Lens
|
|
||||||
import Data.Aeson
|
|
||||||
import Data.Aeson.TH
|
|
||||||
import Geometry
|
|
||||||
|
|
||||||
data Flare
|
|
||||||
= MuzFlare
|
|
||||||
{ _flarePoly :: [Point2]
|
|
||||||
, _flareColor :: Color
|
|
||||||
, _flareTran3 :: Point3
|
|
||||||
, _flareTime :: Int
|
|
||||||
}
|
|
||||||
| CircFlare
|
|
||||||
{ _flareColor :: Color
|
|
||||||
, _flareAlpha :: Float
|
|
||||||
, _flareTran3 :: Point3
|
|
||||||
, _flareTime :: Int
|
|
||||||
}
|
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
||||||
|
|
||||||
makeLenses ''Flare
|
|
||||||
deriveJSON defaultOptions ''Flare
|
|
||||||
@@ -19,7 +19,6 @@ module Dodge.Data.LWorld (
|
|||||||
module Dodge.Data.Door,
|
module Dodge.Data.Door,
|
||||||
module Dodge.Data.EnergyBall,
|
module Dodge.Data.EnergyBall,
|
||||||
module Dodge.Data.Flame,
|
module Dodge.Data.Flame,
|
||||||
module Dodge.Data.Flare,
|
|
||||||
module Dodge.Data.FloorItem,
|
module Dodge.Data.FloorItem,
|
||||||
module Dodge.Data.ForegroundShape,
|
module Dodge.Data.ForegroundShape,
|
||||||
module Dodge.Data.Gust,
|
module Dodge.Data.Gust,
|
||||||
@@ -65,7 +64,6 @@ import Dodge.Data.Distortion
|
|||||||
import Dodge.Data.Door
|
import Dodge.Data.Door
|
||||||
import Dodge.Data.EnergyBall
|
import Dodge.Data.EnergyBall
|
||||||
import Dodge.Data.Flame
|
import Dodge.Data.Flame
|
||||||
import Dodge.Data.Flare
|
|
||||||
import Dodge.Data.FloorItem
|
import Dodge.Data.FloorItem
|
||||||
import Dodge.Data.ForegroundShape
|
import Dodge.Data.ForegroundShape
|
||||||
import Dodge.Data.Gust
|
import Dodge.Data.Gust
|
||||||
@@ -111,7 +109,7 @@ data LWorld = LWorld
|
|||||||
, _flames :: [Flame]
|
, _flames :: [Flame]
|
||||||
, _sparks :: [Spark]
|
, _sparks :: [Spark]
|
||||||
, _radarBlips :: [RadarBlip]
|
, _radarBlips :: [RadarBlip]
|
||||||
, _flares :: [Flare]
|
, _flares :: Picture -- picture drawn for one frame
|
||||||
, _teslaArcs :: [TeslaArc]
|
, _teslaArcs :: [TeslaArc]
|
||||||
, _shockwaves :: [Shockwave]
|
, _shockwaves :: [Shockwave]
|
||||||
, _lasers :: [LaserStart]
|
, _lasers :: [LaserStart]
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
module Dodge.Flare (
|
|
||||||
drawFlare,
|
|
||||||
updateFlare,
|
|
||||||
) where
|
|
||||||
|
|
||||||
import Dodge.Data.Flare
|
|
||||||
import LensHelp
|
|
||||||
import Picture
|
|
||||||
|
|
||||||
updateFlare :: Flare -> Maybe Flare
|
|
||||||
updateFlare rb
|
|
||||||
| _flareTime rb <= 0 = Nothing
|
|
||||||
| otherwise = Just $ rb & flareTime -~ 1
|
|
||||||
|
|
||||||
drawFlare :: Flare -> Picture
|
|
||||||
drawFlare fl = case fl of
|
|
||||||
MuzFlare{} -> drawMuzFlare fl
|
|
||||||
CircFlare{} -> drawCircFlare fl
|
|
||||||
|
|
||||||
drawMuzFlare :: Flare -> Picture
|
|
||||||
drawMuzFlare pt = setLayer BloomNoZWrite . translate3 tranv $ theShape
|
|
||||||
where
|
|
||||||
tranv = _flareTran3 pt
|
|
||||||
col = _flareColor pt
|
|
||||||
poly = _flarePoly pt
|
|
||||||
theShape = color col $ polygon poly
|
|
||||||
|
|
||||||
drawCircFlare :: Flare -> Picture
|
|
||||||
drawCircFlare pt =
|
|
||||||
setLayer BloomNoZWrite . translate3 tranv $
|
|
||||||
circleSolidCol (withAlpha 0 0) (withAlpha alphax col) 50
|
|
||||||
where
|
|
||||||
col = _flareColor pt
|
|
||||||
tranv = _flareTran3 pt
|
|
||||||
alphax = _flareAlpha pt
|
|
||||||
+20
-21
@@ -26,6 +26,7 @@ import Dodge.Tesla.Arc
|
|||||||
import Geometry
|
import Geometry
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import ListHelp
|
import ListHelp
|
||||||
|
import Picture.Base
|
||||||
import RandomHelp
|
import RandomHelp
|
||||||
import qualified SDL
|
import qualified SDL
|
||||||
|
|
||||||
@@ -39,7 +40,6 @@ hammerCheck f it cr w = case it ^? ldtValue . itUse . heldTriggerType of
|
|||||||
_ -> w
|
_ -> w
|
||||||
_ -> f it cr w
|
_ -> f it cr w
|
||||||
|
|
||||||
|
|
||||||
heldEffectMuzzles :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
heldEffectMuzzles :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
||||||
heldEffectMuzzles t cr w =
|
heldEffectMuzzles t cr w =
|
||||||
uncurry (applyCME (_ldtValue t) cr) cmew
|
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 :: Color -> Point3 -> Float -> World -> World
|
||||||
muzFlareAt col tranv dir w =
|
muzFlareAt col tranv dir w =
|
||||||
w & randGen .~ g
|
w & randGen .~ g
|
||||||
& cWorld . lWorld . flares
|
& cWorld . lWorld . flares <>~ thepic
|
||||||
.:~ MuzFlare
|
where
|
||||||
{ _flarePoly =
|
thepic =
|
||||||
map
|
setLayer BloomNoZWrite . translate3 tranv . color col . rotate dir . polygon $
|
||||||
(rotateV dir)
|
|
||||||
[ V2 0 0
|
[ V2 0 0
|
||||||
, V2 a (- b)
|
, V2 a (- b)
|
||||||
, V2 c d
|
, V2 c d
|
||||||
]
|
]
|
||||||
, _flareColor = col
|
thestate = replicateM 4 $ state $ randomR (2, 20)
|
||||||
, _flareTran3 = tranv
|
|
||||||
, _flareTime = 2
|
|
||||||
}
|
|
||||||
where
|
|
||||||
thestate = replicateM 4 $ state $ randomR (2,20)
|
|
||||||
(a : b : c : d : _, g) = runState thestate $ _randGen w -- randomRs (2, 20) (_randGen w)
|
(a : b : c : d : _, g) = runState thestate $ _randGen w -- randomRs (2, 20) (_randGen w)
|
||||||
|
|
||||||
flareCircleAt :: Color -> Float -> Point3 -> World -> World
|
flareCircleAt :: Color -> Float -> Point3 -> World -> World
|
||||||
flareCircleAt col alphax tranv =
|
flareCircleAt col alphax tranv =
|
||||||
cWorld . lWorld . flares
|
cWorld . lWorld . flares
|
||||||
.:~ CircFlare
|
<>~ setLayer
|
||||||
{ _flareTime = 2
|
BloomNoZWrite
|
||||||
, _flareColor = col
|
( translate3 tranv $
|
||||||
, _flareAlpha = alphax
|
circleSolidCol (withAlpha 0 0) (withAlpha alphax col) 50
|
||||||
, _flareTran3 = tranv
|
)
|
||||||
}
|
|
||||||
|
|
||||||
getLaserPhaseV :: LabelDoubleTree ComposeLinkType Item -> Float
|
getLaserPhaseV :: LabelDoubleTree ComposeLinkType Item -> Float
|
||||||
getLaserPhaseV = const 1
|
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
|
||||||
. 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 :: Int -> ComposeLinkType -> Bool
|
||||||
isAmmoIntLink i (AmmoInLink j _) = i == j
|
isAmmoIntLink i (AmmoInLink j _) = i == j
|
||||||
isAmmoIntLink _ _ = False
|
isAmmoIntLink _ _ = False
|
||||||
@@ -313,8 +305,15 @@ lasRayAt col dam phasev pos dir =
|
|||||||
removeAmmoFromMag :: Int -> Maybe Int -> Creature -> World -> World
|
removeAmmoFromMag :: Int -> Maybe Int -> Creature -> World -> World
|
||||||
removeAmmoFromMag x mid cr = fromMaybe id $ do
|
removeAmmoFromMag x mid cr = fromMaybe id $ do
|
||||||
magid <- mid
|
magid <- mid
|
||||||
return $ cWorld . lWorld . creatures
|
return $
|
||||||
. ix (_crID cr) . crInv . ix magid . itUse . amagLoadStatus . iaLoaded -~ x
|
cWorld . lWorld . creatures
|
||||||
|
. ix (_crID cr)
|
||||||
|
. crInv
|
||||||
|
. ix magid
|
||||||
|
. itUse
|
||||||
|
. amagLoadStatus
|
||||||
|
. iaLoaded
|
||||||
|
-~ x
|
||||||
|
|
||||||
getBulletType ::
|
getBulletType ::
|
||||||
LabelDoubleTree ComposeLinkType Item ->
|
LabelDoubleTree ComposeLinkType Item ->
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module Dodge.Lampoid where
|
module Dodge.Lampoid (updateLampoid) where
|
||||||
|
|
||||||
import Dodge.Creature.State
|
import Dodge.Creature.State
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import Dodge.Creature.Picture
|
|||||||
import Dodge.Data.Universe
|
import Dodge.Data.Universe
|
||||||
import Dodge.Debug.Picture
|
import Dodge.Debug.Picture
|
||||||
import Dodge.Draw
|
import Dodge.Draw
|
||||||
import Dodge.Flare
|
|
||||||
import Dodge.RadarBlip
|
import Dodge.RadarBlip
|
||||||
import Dodge.Render.Picture
|
import Dodge.Render.Picture
|
||||||
import Geometry
|
import Geometry
|
||||||
@@ -142,7 +141,7 @@ extraPics cfig u =
|
|||||||
<> foldMap drawSpark (_sparks lw)
|
<> foldMap drawSpark (_sparks lw)
|
||||||
<> foldMap drawBul (_bullets lw)
|
<> foldMap drawBul (_bullets lw)
|
||||||
<> foldMap drawBlip (_radarBlips lw)
|
<> foldMap drawBlip (_radarBlips lw)
|
||||||
<> foldMap drawFlare (_flares lw)
|
<> _flares lw
|
||||||
-- <> foldMap (dbArg (drawBeam . _bmDraw)) (_positronBeams $ _beams lw)
|
-- <> foldMap (dbArg (drawBeam . _bmDraw)) (_positronBeams $ _beams lw)
|
||||||
-- <> foldMap (dbArg (drawBeam . _bmDraw)) (_electronBeams $ _beams lw)
|
-- <> foldMap (dbArg (drawBeam . _bmDraw)) (_electronBeams $ _beams lw)
|
||||||
<> foldMap (dbArg (drawLightSource . _lsPict)) (_lightSources lw)
|
<> foldMap (dbArg (drawLightSource . _lsPict)) (_lightSources lw)
|
||||||
|
|||||||
+1
-6
@@ -30,8 +30,6 @@ import Dodge.Distortion
|
|||||||
import Dodge.DrWdWd
|
import Dodge.DrWdWd
|
||||||
import Dodge.EnergyBall
|
import Dodge.EnergyBall
|
||||||
import Dodge.Flame
|
import Dodge.Flame
|
||||||
import Dodge.Flare
|
|
||||||
--import Dodge.InputFocus
|
|
||||||
import Dodge.Inventory
|
import Dodge.Inventory
|
||||||
import Dodge.Item.Location
|
import Dodge.Item.Location
|
||||||
import Dodge.Laser.Update
|
import Dodge.Laser.Update
|
||||||
@@ -250,7 +248,6 @@ functionalUpdate w =
|
|||||||
. over uvWorld updateEnergyBalls
|
. over uvWorld updateEnergyBalls
|
||||||
. over uvWorld updateBullets
|
. over uvWorld updateBullets
|
||||||
. over uvWorld updateRadarBlips
|
. over uvWorld updateRadarBlips
|
||||||
. over uvWorld updateFlares
|
|
||||||
-- . over uvWorld updateBeams
|
-- . over uvWorld updateBeams
|
||||||
. over uvWorld updateLasers
|
. over uvWorld updateLasers
|
||||||
. over uvWorld updateTeslaArcs
|
. over uvWorld updateTeslaArcs
|
||||||
@@ -278,6 +275,7 @@ functionalUpdate w =
|
|||||||
. over uvWorld zoneClouds
|
. over uvWorld zoneClouds
|
||||||
. over uvWorld zoneCreatures
|
. over uvWorld zoneCreatures
|
||||||
-- . over uvWorld updateInventorySelectionList
|
-- . over uvWorld updateInventorySelectionList
|
||||||
|
. set (uvWorld . cWorld . lWorld . flares) []
|
||||||
$ over uvWorld updatePastWorlds w
|
$ over uvWorld updatePastWorlds w
|
||||||
|
|
||||||
checkTermDist :: World -> World
|
checkTermDist :: World -> World
|
||||||
@@ -422,9 +420,6 @@ updateLightSources = updateObjMapMaybe tempLightSources (\b -> updateTempLightSo
|
|||||||
updateRadarBlips :: World -> World
|
updateRadarBlips :: World -> World
|
||||||
updateRadarBlips = updateObjMapMaybe radarBlips updateRadarBlip
|
updateRadarBlips = updateObjMapMaybe radarBlips updateRadarBlip
|
||||||
|
|
||||||
updateFlares :: World -> World
|
|
||||||
updateFlares = updateObjMapMaybe flares updateFlare
|
|
||||||
|
|
||||||
{- Apply internal particle updates, delete 'Nothing's. -}
|
{- Apply internal particle updates, delete 'Nothing's. -}
|
||||||
updateBullets :: World -> World
|
updateBullets :: World -> World
|
||||||
updateBullets w = updateInstantBullets $ set (cWorld . lWorld . bullets) (catMaybes ps) w'
|
updateBullets w = updateInstantBullets $ set (cWorld . lWorld . bullets) (catMaybes ps) w'
|
||||||
|
|||||||
Reference in New Issue
Block a user