Fix bug in flame wall damages, cleanup
This commit is contained in:
@@ -16,7 +16,7 @@ wlIsSeeThrough wl = case _wlOpacity wl of
|
|||||||
reflDirWall :: Point2 -> Point2 -> Wall -> Float
|
reflDirWall :: Point2 -> Point2 -> Wall -> Float
|
||||||
reflDirWall sp ep wl = argV (reflectIn (uncurry (-.-) (_wlLine wl)) (ep -.- sp))
|
reflDirWall sp ep wl = argV (reflectIn (uncurry (-.-) (_wlLine wl)) (ep -.- sp))
|
||||||
|
|
||||||
-- point free nonsense
|
-- point free nonsense. 0 for no damping, 1 for full damping
|
||||||
reflVelWallDamp :: Float -> Wall -> Point2 -> Point2
|
reflVelWallDamp :: Float -> Wall -> Point2 -> Point2
|
||||||
reflVelWallDamp x = reflectInParam x . uncurry (-.-) . _wlLine
|
reflVelWallDamp x = reflectInParam x . uncurry (-.-) . _wlLine
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -118,7 +118,7 @@ useBulletPayload bu = case _buPayload bu of
|
|||||||
BulBall ExplosiveBall -> \p -> cWorld . lWorld . shockwaves .:~ concBall p
|
BulBall ExplosiveBall -> \p -> cWorld . lWorld . shockwaves .:~ concBall p
|
||||||
BulBall ElectricalBall -> makeStaticBall
|
BulBall ElectricalBall -> makeStaticBall
|
||||||
BulBall FlashBall -> makeFlashBall
|
BulBall FlashBall -> makeFlashBall
|
||||||
BulBall (FlameletBall x) -> \p -> makeFlamelet p 0 x 10
|
BulBall (FlameletBall x _) -> \p -> makeFlamelet p 0 x 10
|
||||||
|
|
||||||
makeFragBullets :: Point2 -> World -> World
|
makeFragBullets :: Point2 -> World -> World
|
||||||
makeFragBullets p w = w & cWorld . lWorld . bullets .++~ bus
|
makeFragBullets p w = w & cWorld . lWorld . bullets .++~ bus
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ inventoryX c = case c of
|
|||||||
] <>
|
] <>
|
||||||
-- [bulletTargetingModule btt | btt <- [minBound .. maxBound]]
|
-- [bulletTargetingModule btt | btt <- [minBound .. maxBound]]
|
||||||
[bulletModule (BulletModPayload (BulBall x)) | x <- [ FlamingBall
|
[bulletModule (BulletModPayload (BulBall x)) | x <- [ FlamingBall
|
||||||
, FlameletBall 5
|
, FlameletBall 5 0
|
||||||
, ElectricalBall
|
, ElectricalBall
|
||||||
, ExplosiveBall
|
, ExplosiveBall
|
||||||
, FlashBall ]]
|
, FlashBall ]]
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ data EnergyBall = EnergyBall
|
|||||||
, _ebPos :: Point2
|
, _ebPos :: Point2
|
||||||
, _ebTimer :: Int
|
, _ebTimer :: Int
|
||||||
, _ebEff :: EnergyBallType
|
, _ebEff :: EnergyBallType
|
||||||
, _ebRot :: Float
|
|
||||||
}
|
}
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
|||||||
@@ -5,15 +5,17 @@
|
|||||||
|
|
||||||
module Dodge.Data.EnergyBall.Type where
|
module Dodge.Data.EnergyBall.Type where
|
||||||
|
|
||||||
|
import Control.Lens
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.Aeson.TH
|
import Data.Aeson.TH
|
||||||
|
|
||||||
data EnergyBallType
|
data EnergyBallType
|
||||||
= FlamingBall
|
= FlamingBall
|
||||||
| FlameletBall Float
|
| FlameletBall {_fbSize :: Float, _fbRot :: Float}
|
||||||
| ElectricalBall
|
| ElectricalBall
|
||||||
| ExplosiveBall
|
| ExplosiveBall
|
||||||
| FlashBall
|
| FlashBall
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
makeLenses ''EnergyBallType
|
||||||
deriveJSON defaultOptions ''EnergyBallType
|
deriveJSON defaultOptions ''EnergyBallType
|
||||||
|
|||||||
@@ -11,10 +11,9 @@ import Data.Aeson.TH
|
|||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
|
|
||||||
data Flame = Flame
|
data Flame = Flame
|
||||||
{ _flVel :: Point2
|
{ _flTimer :: Int
|
||||||
, _flPos :: Point2
|
, _flPos :: Point2
|
||||||
, _flTimer :: Int
|
, _flVel :: Point2
|
||||||
-- , _flOriginalVel :: Point2
|
|
||||||
}
|
}
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
|||||||
+20
-36
@@ -1,17 +1,18 @@
|
|||||||
{-# LANGUAGE LambdaCase #-}
|
{-# LANGUAGE LambdaCase #-}
|
||||||
module Dodge.EnergyBall
|
|
||||||
( updateEnergyBall
|
module Dodge.EnergyBall (
|
||||||
, incBallAt
|
updateEnergyBall,
|
||||||
, makeFlashBall
|
incBallAt,
|
||||||
, makeFlamelet
|
makeFlashBall,
|
||||||
|
makeFlamelet,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.List (foldl')
|
|
||||||
import Dodge.WorldEvent.ThingsHit
|
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
import Dodge.Base.Collide
|
import Data.List (foldl')
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Dodge.Base.Collide
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
|
import Dodge.WorldEvent.ThingsHit
|
||||||
import Geometry
|
import Geometry
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import Picture
|
import Picture
|
||||||
@@ -28,19 +29,18 @@ makeFlamelet ::
|
|||||||
Int ->
|
Int ->
|
||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
makeFlamelet (V2 x y) vel s t w =
|
makeFlamelet p v s t w =
|
||||||
w
|
w
|
||||||
& randGen .~ g
|
& randGen .~ g
|
||||||
& cWorld . lWorld . energyBalls
|
& cWorld . lWorld . energyBalls
|
||||||
.:~ EnergyBall
|
.:~ EnergyBall
|
||||||
{ _ebVel = vel
|
{ _ebVel = v
|
||||||
, _ebPos = V2 x y
|
, _ebPos = p
|
||||||
, _ebTimer = t
|
, _ebTimer = t
|
||||||
, _ebEff = FlameletBall s
|
, _ebEff = FlameletBall s a
|
||||||
, _ebRot = rot
|
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
(rot, g) = randomR (0, 3) $ _randGen w
|
(a, g) = randomR (0, 3) $ _randGen w
|
||||||
|
|
||||||
updateEnergyBall :: World -> EnergyBall -> (World, Maybe EnergyBall)
|
updateEnergyBall :: World -> EnergyBall -> (World, Maybe EnergyBall)
|
||||||
updateEnergyBall w eb
|
updateEnergyBall w eb
|
||||||
@@ -52,40 +52,24 @@ updateEnergyBall w eb
|
|||||||
where
|
where
|
||||||
p = eb ^. ebPos + eb ^. ebVel
|
p = eb ^. ebPos + eb ^. ebVel
|
||||||
(bp, bv) = fromMaybe (p, eb ^. ebVel) $ bouncePoint (const True) 0 (eb ^. ebPos) p w
|
(bp, bv) = fromMaybe (p, eb ^. ebVel) $ bouncePoint (const True) 0 (eb ^. ebPos) p w
|
||||||
-- (bp,bv) = fromMaybe (p,eb^.ebVel) $ bouncePoint (const True) 0.5 (eb ^. ebPos) p w
|
|
||||||
|
|
||||||
incBallAt :: Point2 -> World -> World
|
incBallAt :: Point2 -> World -> World
|
||||||
incBallAt p w =
|
incBallAt p = cWorld . lWorld . energyBalls
|
||||||
w & cWorld . lWorld . energyBalls .:~ theincball
|
.:~ EnergyBall
|
||||||
& randGen .~ g
|
|
||||||
where
|
|
||||||
(theincball, g) = runState thestate (_randGen w)
|
|
||||||
thestate = do
|
|
||||||
rot <- state $ randomR (0, 3)
|
|
||||||
return
|
|
||||||
EnergyBall
|
|
||||||
{ _ebVel = 0
|
{ _ebVel = 0
|
||||||
, _ebPos = p
|
, _ebPos = p
|
||||||
, _ebTimer = 20
|
, _ebTimer = 20
|
||||||
, _ebEff = FlamingBall
|
, _ebEff = FlamingBall
|
||||||
, _ebRot = rot
|
|
||||||
}
|
}
|
||||||
|
|
||||||
makeFlashBall :: Point2 -> World -> World
|
makeFlashBall :: Point2 -> World -> World
|
||||||
makeFlashBall p w =
|
makeFlashBall p =
|
||||||
w & cWorld . lWorld . energyBalls .:~ theincball
|
cWorld . lWorld . energyBalls
|
||||||
& randGen .~ g
|
.:~ EnergyBall
|
||||||
where
|
|
||||||
(theincball, g) = runState thestate (_randGen w)
|
|
||||||
thestate = do
|
|
||||||
rot <- state $ randomR (0, 3)
|
|
||||||
return
|
|
||||||
EnergyBall
|
|
||||||
{ _ebVel = 0
|
{ _ebVel = 0
|
||||||
, _ebPos = p
|
, _ebPos = p
|
||||||
, _ebTimer = 20
|
, _ebTimer = 20
|
||||||
, _ebEff = FlashBall
|
, _ebEff = FlashBall
|
||||||
, _ebRot = rot
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ebFlicker :: EnergyBall -> World -> World
|
ebFlicker :: EnergyBall -> World -> World
|
||||||
@@ -120,7 +104,7 @@ damageCircle sp dt w =
|
|||||||
ebtToDamage :: Point2 -> EnergyBallType -> Damage
|
ebtToDamage :: Point2 -> EnergyBallType -> Damage
|
||||||
ebtToDamage p = \case
|
ebtToDamage p = \case
|
||||||
FlamingBall -> Flaming 10
|
FlamingBall -> Flaming 10
|
||||||
FlameletBall _ -> Flaming 1
|
FlameletBall {} -> Flaming 1
|
||||||
ElectricalBall -> Electrical 10
|
ElectricalBall -> Electrical 10
|
||||||
ExplosiveBall -> Explosive 10 p
|
ExplosiveBall -> Explosive 10 p
|
||||||
FlashBall -> Flashing 10 p
|
FlashBall -> Flashing 10 p
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import Picture
|
|||||||
|
|
||||||
drawEnergyBall :: EnergyBall -> Picture
|
drawEnergyBall :: EnergyBall -> Picture
|
||||||
drawEnergyBall eb = case _ebEff eb of
|
drawEnergyBall eb = case _ebEff eb of
|
||||||
FlamingBall -> drawFlamelet 5 eb
|
FlamingBall -> drawFlamelet 5 0 eb
|
||||||
FlameletBall x -> drawFlamelet x eb
|
FlameletBall x a -> drawFlamelet x a eb
|
||||||
ElectricalBall -> drawStaticBall eb
|
ElectricalBall -> drawStaticBall eb
|
||||||
ExplosiveBall -> mempty
|
ExplosiveBall -> mempty
|
||||||
FlashBall -> mempty
|
FlashBall -> mempty
|
||||||
@@ -24,8 +24,8 @@ drawStaticBall pt =
|
|||||||
. uncurryV translate (_ebPos pt)
|
. uncurryV translate (_ebPos pt)
|
||||||
$ circleSolidCol blue (withAlpha 0.5 white) 8
|
$ circleSolidCol blue (withAlpha 0.5 white) 8
|
||||||
|
|
||||||
drawFlamelet :: Float -> EnergyBall -> Picture
|
drawFlamelet :: Float -> Float -> EnergyBall -> Picture
|
||||||
drawFlamelet size pt =
|
drawFlamelet size rot pt =
|
||||||
fold
|
fold
|
||||||
[ setLayer BloomLayer pic
|
[ setLayer BloomLayer pic
|
||||||
, setLayer BloomNoZWrite piu
|
, setLayer BloomNoZWrite piu
|
||||||
@@ -89,4 +89,3 @@ drawFlamelet size pt =
|
|||||||
sc = (*) 2 $ log $ 1 + fromIntegral time / 20
|
sc = (*) 2 $ log $ 1 + fromIntegral time / 20
|
||||||
s1 = (*) 2 $ log $ 2 + fromIntegral time / 40
|
s1 = (*) 2 $ log $ 2 + fromIntegral time / 40
|
||||||
s2 = 0.5 * (sc + s1)
|
s2 = 0.5 * (sc + s1)
|
||||||
rot = _ebRot pt
|
|
||||||
|
|||||||
+26
-130
@@ -1,166 +1,62 @@
|
|||||||
module Dodge.Flame (
|
module Dodge.Flame (
|
||||||
aFlameParticle,
|
|
||||||
makeFlame,
|
makeFlame,
|
||||||
updateFlame,
|
updateFlame,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Dodge.Flame.Size
|
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import Data.Tuple
|
import Dodge.Base.Wall
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
|
import Dodge.Flame.Size
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
import Dodge.WorldEvent.Cloud
|
import Dodge.WorldEvent.Cloud
|
||||||
import Dodge.WorldEvent.ThingsHit
|
import Dodge.WorldEvent.ThingsHit
|
||||||
import Dodge.Zoning.Wall
|
|
||||||
import Geometry
|
import Geometry
|
||||||
import qualified IntMapHelp as IM
|
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import qualified ListHelp as List
|
import qualified ListHelp as List
|
||||||
import Picture
|
import Picture
|
||||||
import RandomHelp
|
import RandomHelp
|
||||||
|
|
||||||
aFlameParticle ::
|
|
||||||
-- | Timer
|
|
||||||
Int ->
|
|
||||||
-- | Position
|
|
||||||
Point2 ->
|
|
||||||
-- | Velocity
|
|
||||||
Point2 ->
|
|
||||||
Flame
|
|
||||||
aFlameParticle t pos vel =
|
|
||||||
Flame
|
|
||||||
{ _flVel = vel
|
|
||||||
, _flPos = pos
|
|
||||||
, _flTimer = t
|
|
||||||
-- , _flOriginalVel = vel
|
|
||||||
}
|
|
||||||
|
|
||||||
expireAndDamageFL ::
|
|
||||||
Flame ->
|
|
||||||
[(Point2, Either Creature Wall)] ->
|
|
||||||
World ->
|
|
||||||
(World, Maybe Flame)
|
|
||||||
expireAndDamageFL bt things w = case List.safeHead things of
|
|
||||||
Nothing -> (w, Just $ bt & flTimer -~ 1)
|
|
||||||
Just (_,x) -> (doDamagesFL x w, Nothing)
|
|
||||||
|
|
||||||
doDamagesFL ::
|
|
||||||
Either Creature Wall ->
|
|
||||||
-- Flame ->
|
|
||||||
World ->
|
|
||||||
World
|
|
||||||
doDamagesFL thhit = case thhit of
|
|
||||||
Left cr ->
|
|
||||||
cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage
|
|
||||||
.:~ Flaming 1
|
|
||||||
--Right wl -> cWorld . lWorld . wallDamages %~ IM.insertWith (++) (_wlID wl) dams
|
|
||||||
Right wl -> cWorld . lWorld . wallDamages . ix (_wlID wl) .:~ Flaming 1
|
|
||||||
|
|
||||||
{- TODO: add generalised area damage particles/hiteffects. -}
|
|
||||||
updateFlame :: World -> Flame -> (World, Maybe Flame)
|
updateFlame :: World -> Flame -> (World, Maybe Flame)
|
||||||
updateFlame w pt
|
updateFlame w pt
|
||||||
| time <= 0 = (makeFlamerSmokeAt (addZ 20 ep) w, Nothing)
|
| time <= 0 = (makeFlamerSmokeAt (addZ 20 ep) w, Nothing)
|
||||||
| otherwise = case List.safeHead $ thingsHit sp ep w of
|
| Just (_, Right wl) <- thit = (doupdate, Just $ reflame wl)
|
||||||
Just (_, Left _) -> (doSound $ dodamage, mvPt' 0.7)
|
-- might want to move differently if we hit a creature?
|
||||||
Just (p, Right wl) -> (doSound $ dodamage, rfl wl p)
|
| otherwise = (flFlicker pt doupdate, Just mvflame)
|
||||||
_ -> (flFlicker pt $ doSound $ dodamage, mvPt' 0.98)
|
|
||||||
where
|
where
|
||||||
|
reflame wl = pt & flTimer -~ 1 & flVel %~ reflVelWallDamp 0.9 wl
|
||||||
|
doupdate = soundContinue FlameSound sp fireLoudS (Just 2) dodamage
|
||||||
|
thit = List.safeHead $ thingsHit sp ep w
|
||||||
time = _flTimer pt
|
time = _flTimer pt
|
||||||
doSound = soundContinue FlameSound (V2 x y) fireLoudS (Just 2)
|
sp = _flPos pt
|
||||||
sp@(V2 x y) = _flPos pt
|
ep = sp +.+ _flVel pt
|
||||||
vel = _flVel pt
|
mvflame =
|
||||||
ep = sp +.+ vel
|
|
||||||
mvPt' drag =
|
|
||||||
Just $
|
|
||||||
pt
|
pt
|
||||||
& flTimer -~ 1
|
& flTimer -~ 1
|
||||||
& flPos .~ ep
|
& flPos .~ ep
|
||||||
& flVel %~ (drag *.*)
|
& flVel *~ 0.98
|
||||||
dodamage :: World
|
dodamage =
|
||||||
dodamage = foldl' damcr
|
|
||||||
(foldl' damwl w (wlsHitRadial ep r w)) (crsHitRadial ep r w)
|
|
||||||
r = flameSize pt
|
|
||||||
damcr w' (_,cr) = w' & cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage
|
|
||||||
.:~ Flaming 1
|
|
||||||
damwl w' (_,wl) = w' & cWorld . lWorld . wallDamages . ix (_wlID wl)
|
|
||||||
.:~ Flaming 1
|
|
||||||
closeWls wl = uncurry segOnCirc (_wlLine wl) ep 5
|
|
||||||
angleCoeff x' = abs $ 1 - abs ((x' * 2 - pi) / pi)
|
|
||||||
rfl wl p =
|
|
||||||
Just $
|
|
||||||
pt
|
|
||||||
{ _flTimer = time - 1
|
|
||||||
, _flPos = pOut p
|
|
||||||
, _flVel = reflV wl
|
|
||||||
}
|
|
||||||
pOut p = p +.+ squashNormalizeV (sp -.- p)
|
|
||||||
reflV wall =
|
|
||||||
(0.3 *.* reflectIn (uncurry (-.-) . swap $ _wlLine wall) vel)
|
|
||||||
+.+ (0.2 *.* vel)
|
|
||||||
--updateFlame w pt
|
|
||||||
-- | time <= 0 = (makeFlamerSmokeAt (addZ 20 ep) w, Nothing)
|
|
||||||
-- | otherwise = case List.safeHead $ thingsHit sp ep w of
|
|
||||||
-- Just (_, Left _) -> (doSound $ dodamage w, mvPt' 0.7)
|
|
||||||
-- Just (p, Right wl) -> (doSound $ dodamage w, rfl wl p)
|
|
||||||
-- _ -> (flFlicker pt $ doSound $ dodamage w, mvPt' 0.98)
|
|
||||||
-- where
|
|
||||||
-- rotd = _flOriginalVel pt
|
|
||||||
-- time = _flTimer pt
|
|
||||||
-- doSound = soundContinue FlameSound (V2 x y) fireLoudS (Just 2)
|
|
||||||
-- sp@(V2 x y) = _flPos pt
|
|
||||||
-- vel = _flVel pt
|
|
||||||
-- ep = sp +.+ vel
|
|
||||||
-- mvPt' drag =
|
|
||||||
-- Just $
|
|
||||||
-- pt
|
|
||||||
-- & flTimer -~ 1
|
|
||||||
-- & flPos .~ ep
|
|
||||||
-- & flVel %~ (drag *.*)
|
|
||||||
-- dodamage = flDamageInArea closeCrs closeWls pt
|
|
||||||
-- closeWls wl = uncurry segOnCirc (_wlLine wl) ep 5
|
|
||||||
-- closeCrs cr =
|
|
||||||
-- dist ep (_crPos cr)
|
|
||||||
-- < crRad (cr ^. crType) + 10 - min 9 (max 0 (fromIntegral time - 80))
|
|
||||||
-- + 5 * angleCoeff (angleVV (ep -.- _crPos cr) rotd)
|
|
||||||
-- angleCoeff x' = abs $ 1 - abs ((x' * 2 - pi) / pi)
|
|
||||||
-- rfl wl p =
|
|
||||||
-- Just $
|
|
||||||
-- pt
|
|
||||||
-- { _flTimer = time - 1
|
|
||||||
-- , _flPos = pOut p
|
|
||||||
-- , _flVel = reflV wl
|
|
||||||
-- }
|
|
||||||
-- pOut p = p +.+ squashNormalizeV (sp -.- p)
|
|
||||||
-- reflV wall =
|
|
||||||
-- (0.3 *.* reflectIn (uncurry (-.-) . swap $ _wlLine wall) vel)
|
|
||||||
-- +.+ (0.2 *.* vel)
|
|
||||||
|
|
||||||
flDamageInArea :: (Creature -> Bool) -> (Wall -> Bool) -> Flame -> World -> World
|
|
||||||
{-# INLINE flDamageInArea #-}
|
|
||||||
flDamageInArea crt wlt pt w = damwls damcrs
|
|
||||||
where
|
|
||||||
p = _flPos pt
|
|
||||||
damcrs = foldl' (flip $ \cr -> fst . hiteff [(p, Left cr)]) w $ IM.filter crt $ w ^. cWorld . lWorld . creatures --_creatures (_cWorld w)
|
|
||||||
damwls w' =
|
|
||||||
foldl'
|
foldl'
|
||||||
(flip $ \wl -> fst . hiteff [(p, Right wl)])
|
damcr
|
||||||
w'
|
(foldl' damwl w (wlsHitRadial ep r w))
|
||||||
. filter wlt
|
(crsHitRadial ep r w)
|
||||||
$ wlsNearPoint p w'
|
r = flameSize pt
|
||||||
hiteff = expireAndDamageFL pt
|
damcr w' (_, cr) =
|
||||||
|
w' & cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage
|
||||||
|
.:~ Flaming 1
|
||||||
|
damwl w' (_, wl) =
|
||||||
|
w' & cWorld . lWorld . wallDamages . at (_wlID wl)
|
||||||
|
. non [] <>~ [Flaming 1]
|
||||||
|
|
||||||
flFlicker :: Flame -> World -> World
|
flFlicker :: Flame -> World -> World
|
||||||
flFlicker pt
|
flFlicker pt
|
||||||
| _flTimer pt `mod` 7 == 0 =
|
| _flTimer pt `mod` 7 == 0 =
|
||||||
cWorld . lWorld . lights
|
cWorld . lWorld . lights
|
||||||
.:~ LSParam (addZ 10 $ _flPos pt) 70 (0.5 *.*.* xyzV4 red)
|
.:~ LSParam (addZ 10 $ _flPos pt) 70 (0.5 *.*.* xyzV4 red)
|
||||||
-- .:~ tlsTimeRadColPos 1 70 (0.5 *.*.* xyzV4 (_flColor pt)) (addZ 10 $ _flPos pt)
|
|
||||||
| otherwise = id
|
| otherwise = id
|
||||||
|
|
||||||
makeFlame :: Point2 -> Point2 -> World -> World
|
makeFlame :: Point2 -> Point2 -> World -> World
|
||||||
makeFlame pos vel w =
|
makeFlame pos vel w = w
|
||||||
w
|
& cWorld . lWorld . flames .:~ Flame t pos vel
|
||||||
& cWorld . lWorld . flames .:~ aFlameParticle t pos vel
|
|
||||||
& randGen .~ g
|
& randGen .~ g
|
||||||
where
|
where
|
||||||
(t, g) = randomR (99, 101) (_randGen w)
|
(t, g) = randomR (99, 102) (_randGen w)
|
||||||
|
|||||||
+3
-37
@@ -1,46 +1,12 @@
|
|||||||
module Dodge.Flame.Draw (drawFlame) where
|
module Dodge.Flame.Draw (drawFlame) where
|
||||||
|
|
||||||
import Dodge.Flame.Size
|
|
||||||
import Dodge.Data.Flame
|
import Dodge.Data.Flame
|
||||||
|
import Dodge.Flame.Size
|
||||||
import Geometry
|
import Geometry
|
||||||
import Picture
|
import Picture
|
||||||
|
|
||||||
drawFlame :: Flame -> Picture
|
drawFlame :: Flame -> Picture
|
||||||
drawFlame fl = setLayer BloomLayer . setDepth 25
|
drawFlame fl =
|
||||||
|
setLayer BloomLayer . setDepth 25
|
||||||
. uncurryV translate (_flPos fl + rotateV (fromIntegral (_flTimer fl)) (V2 1 0))
|
. uncurryV translate (_flPos fl + rotateV (fromIntegral (_flTimer fl)) (V2 1 0))
|
||||||
$ circleSolidCol (V4 1 1 1 0.5) (V4 5 2 0 2) . flameSize $ fl
|
$ circleSolidCol (V4 1 1 1 0.5) (V4 5 2 0 2) . flameSize $ fl
|
||||||
|
|
||||||
|
|
||||||
--drawFlame :: Flame -> Picture
|
|
||||||
--drawFlame pt =
|
|
||||||
-- fold
|
|
||||||
-- [ glow
|
|
||||||
-- , aPic BloomNoZWrite prot2 25 (V2 (scaleChange + 1) 2) $ V4 2 (-1) (-1) 0.5
|
|
||||||
-- , aPic BloomNoZWrite prot 22 (V2 (scaleChange + 0.5) 1) $ V4 1 0.5 0 2
|
|
||||||
-- , aPic BloomLayer prot3 20 (V2 scaleChange 0.5) $ V4 1 1 1 1
|
|
||||||
-- ]
|
|
||||||
-- where
|
|
||||||
-- rotd = _flOriginalVel pt -- rotate direction
|
|
||||||
-- ep = _flPos pt
|
|
||||||
-- aPic :: Layer -> (Point2 -> Point2) -> Float -> Point2 -> Color -> Picture
|
|
||||||
-- aPic lay offset depth (V2 scalex scaley) col =
|
|
||||||
-- setLayer lay
|
|
||||||
-- . setDepth depth
|
|
||||||
-- . uncurryV translate (offset ep)
|
|
||||||
-- . rotate (pi * 0.5 + argV rotd)
|
|
||||||
-- . scale scalex scaley
|
|
||||||
---- . scale scalex scalex
|
|
||||||
-- . color col
|
|
||||||
-- $ circleSolid 5
|
|
||||||
-- glow =
|
|
||||||
-- setLayer BloomNoZWrite $
|
|
||||||
-- setDepth 0.3 $
|
|
||||||
-- uncurryV translate ep $
|
|
||||||
-- circleSolidCol (withAlpha 0 orange) (withAlpha 0.02 orange) 50
|
|
||||||
-- time = _flTimer pt
|
|
||||||
-- scaleChange
|
|
||||||
-- | time < 80 = 3
|
|
||||||
-- | otherwise = 3 - (fromIntegral time - 80) * 0.2
|
|
||||||
-- prot p' = p' +.+ rotateV (fromIntegral time) (V2 0 1)
|
|
||||||
-- prot2 p' = p' +.+ rotateV (negate $ fromIntegral time) (V2 0 1)
|
|
||||||
-- prot3 p' = p' +.+ rotateV (2 + fromIntegral time * 0.1) (V2 0 2)
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ flameSize :: Flame -> Float
|
|||||||
flameSize fl
|
flameSize fl
|
||||||
| x > 95 = x - 95
|
| x > 95 = x - 95
|
||||||
| x > 80 = 95.1 - x
|
| x > 80 = 95.1 - x
|
||||||
|
| x < 15 = x
|
||||||
| otherwise = 15
|
| otherwise = 15
|
||||||
where
|
where
|
||||||
x = fromIntegral (_flTimer fl)
|
x = fromIntegral (_flTimer fl)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import qualified IntMapHelp as IM
|
|||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
|
|
||||||
testStringInit :: Universe -> [String]
|
testStringInit :: Universe -> [String]
|
||||||
testStringInit _ = []
|
testStringInit u = fmap show $ u ^.. uvWorld . cWorld . lWorld . terminals . each . tmID
|
||||||
-- foldMap prettyShort $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crTwist
|
-- foldMap prettyShort $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crTwist
|
||||||
-- prettyShort $ u ^.. uvWorld . cWorld . lWorld . teslaArcs . ix 0 . taArcSteps . each . asObject
|
-- prettyShort $ u ^.. uvWorld . cWorld . lWorld . teslaArcs . ix 0 . taArcSteps . each . asObject
|
||||||
--testStringInit u = foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . projectiles
|
--testStringInit u = foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . projectiles
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import Control.Monad
|
|||||||
import Data.List
|
import Data.List
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
import Dodge.EnergyBall
|
import Dodge.EnergyBall
|
||||||
import Dodge.Flame
|
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
import Dodge.WorldEvent.Shockwave
|
import Dodge.WorldEvent.Shockwave
|
||||||
import Dodge.WorldEvent.SpawnParticle
|
import Dodge.WorldEvent.SpawnParticle
|
||||||
@@ -62,7 +61,7 @@ makeFlameExplosionAt p w =
|
|||||||
& cWorld . lWorld . flames .++~ newFlames
|
& cWorld . lWorld . flames .++~ newFlames
|
||||||
where
|
where
|
||||||
newFlames = zipWith makeFlameWithVelAndTime velocities timers
|
newFlames = zipWith makeFlameWithVelAndTime velocities timers
|
||||||
makeFlameWithVelAndTime vel time = aFlameParticle time p vel
|
makeFlameWithVelAndTime vel time = Flame time vel p
|
||||||
velocities = replicateM 15 (randInCirc 1) & evalState $ _randGen w
|
velocities = replicateM 15 (randInCirc 1) & evalState $ _randGen w
|
||||||
timers = randomRs (80, 100) $ _randGen w
|
timers = randomRs (80, 100) $ _randGen w
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ aStaticBall p =
|
|||||||
, _ebPos = p
|
, _ebPos = p
|
||||||
, _ebTimer = 20
|
, _ebTimer = 20
|
||||||
, _ebEff = ElectricalBall
|
, _ebEff = ElectricalBall
|
||||||
, _ebRot = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{- | Note damgeInRadius by itself never destroys the particle
|
{- | Note damgeInRadius by itself never destroys the particle
|
||||||
|
|||||||
+1
-1
@@ -225,7 +225,7 @@ heron x y z
|
|||||||
area = sqrt (s * (s - a) * (s - b) * (s - c))
|
area = sqrt (s * (s - a) * (s - b) * (s - c))
|
||||||
in 2 * area / a
|
in 2 * area / a
|
||||||
|
|
||||||
-- | Multiplies reflection in normal by factor.
|
-- | Multiplies reflection in normal by factor. With 0 same as reflectAngle
|
||||||
reflectInParam :: Float -> Point2 -> Point2 -> Point2
|
reflectInParam :: Float -> Point2 -> Point2 -> Point2
|
||||||
reflectInParam x line vec =
|
reflectInParam x line vec =
|
||||||
let angle = 2 * angleBetween line vec
|
let angle = 2 * angleBetween line vec
|
||||||
|
|||||||
@@ -2573,8 +2573,8 @@ _flItID src/Dodge/Data/FloorItem.hs 16;" f
|
|||||||
_flItPos src/Dodge/Data/FloorItem.hs 16;" f
|
_flItPos src/Dodge/Data/FloorItem.hs 16;" f
|
||||||
_flItRot src/Dodge/Data/FloorItem.hs 16;" f
|
_flItRot src/Dodge/Data/FloorItem.hs 16;" f
|
||||||
_flPos src/Dodge/Data/Flame.hs 15;" f
|
_flPos src/Dodge/Data/Flame.hs 15;" f
|
||||||
_flTimer src/Dodge/Data/Flame.hs 16;" f
|
_flTimer src/Dodge/Data/Flame.hs 14;" f
|
||||||
_flVel src/Dodge/Data/Flame.hs 14;" f
|
_flVel src/Dodge/Data/Flame.hs 16;" f
|
||||||
_flames src/Dodge/Data/LWorld.hs 111;" f
|
_flames src/Dodge/Data/LWorld.hs 111;" f
|
||||||
_flankTarget src/Dodge/Data/ActionPlan.hs 177;" f
|
_flankTarget src/Dodge/Data/ActionPlan.hs 177;" f
|
||||||
_flares src/Dodge/Data/LWorld.hs 114;" f
|
_flares src/Dodge/Data/LWorld.hs 114;" f
|
||||||
@@ -3320,7 +3320,6 @@ _xNum src/Dodge/Data/Item/Combine.hs 149;" f
|
|||||||
_xNum src/Dodge/Data/Item/Combine.hs 171;" f
|
_xNum src/Dodge/Data/Item/Combine.hs 171;" f
|
||||||
aDroneWithItemParams src/Dodge/Item/Weapon/Drone.hs 30;" f
|
aDroneWithItemParams src/Dodge/Item/Weapon/Drone.hs 30;" f
|
||||||
aFlame src/Dodge/Gas.hs 18;" f
|
aFlame src/Dodge/Gas.hs 18;" f
|
||||||
aFlameParticle src/Dodge/Flame.hs 22;" f
|
|
||||||
aGasCloud src/Dodge/Gas.hs 13;" f
|
aGasCloud src/Dodge/Gas.hs 13;" f
|
||||||
aGib src/Dodge/Prop/Gib.hs 18;" f
|
aGib src/Dodge/Prop/Gib.hs 18;" f
|
||||||
aRadarPulse src/Dodge/RadarSweep.hs 19;" f
|
aRadarPulse src/Dodge/RadarSweep.hs 19;" f
|
||||||
@@ -4036,7 +4035,6 @@ doCrWdAc src/Dodge/CreatureEffect.hs 77;" f
|
|||||||
doCrWdImp src/Dodge/CreatureEffect.hs 16;" f
|
doCrWdImp src/Dodge/CreatureEffect.hs 16;" f
|
||||||
doCrWdWd src/Dodge/CreatureEffect.hs 20;" f
|
doCrWdWd src/Dodge/CreatureEffect.hs 20;" f
|
||||||
doDamage src/Dodge/Creature/State.hs 138;" f
|
doDamage src/Dodge/Creature/State.hs 138;" f
|
||||||
doDamagesFL src/Dodge/Flame.hs 47;" f
|
|
||||||
doDeathToggle src/Dodge/WorldEffect.hs 98;" f
|
doDeathToggle src/Dodge/WorldEffect.hs 98;" f
|
||||||
doDeathTriggers src/Dodge/WorldEffect.hs 93;" f
|
doDeathTriggers src/Dodge/WorldEffect.hs 93;" f
|
||||||
doDebugTest src/Dodge/Update/Input/DebugTest.hs 22;" f
|
doDebugTest src/Dodge/Update/Input/DebugTest.hs 22;" f
|
||||||
@@ -4155,7 +4153,7 @@ drawEnergyBall src/Dodge/EnergyBall/Draw.hs 9;" f
|
|||||||
drawEquipment src/Dodge/Creature/Picture.hs 144;" f
|
drawEquipment src/Dodge/Creature/Picture.hs 144;" f
|
||||||
drawExamineInventory src/Dodge/Render/HUD.hs 196;" f
|
drawExamineInventory src/Dodge/Render/HUD.hs 196;" f
|
||||||
drawFarWallDetect src/Dodge/Debug/Picture.hs 264;" f
|
drawFarWallDetect src/Dodge/Debug/Picture.hs 264;" f
|
||||||
drawFlame src/Dodge/Flame/Draw.hs 7;" f
|
drawFlame src/Dodge/Flame/Draw.hs 8;" f
|
||||||
drawFlamelet src/Dodge/EnergyBall/Draw.hs 27;" f
|
drawFlamelet src/Dodge/EnergyBall/Draw.hs 27;" f
|
||||||
drawFooterText src/Dodge/Render/MenuScreen.hs 72;" f
|
drawFooterText src/Dodge/Render/MenuScreen.hs 72;" f
|
||||||
drawForceField src/Dodge/Wall/Draw.hs 11;" f
|
drawForceField src/Dodge/Wall/Draw.hs 11;" f
|
||||||
@@ -4310,7 +4308,6 @@ expandPolyByFixed src/Dodge/LevelGen/StaticWalls.hs 97;" f
|
|||||||
expandPolyCorners src/Dodge/LevelGen/StaticWalls.hs 103;" f
|
expandPolyCorners src/Dodge/LevelGen/StaticWalls.hs 103;" f
|
||||||
expandToSquare src/Dodge/LevelGen/StaticWalls/Deprecated.hs 83;" f
|
expandToSquare src/Dodge/LevelGen/StaticWalls/Deprecated.hs 83;" f
|
||||||
expireAndDamage src/Dodge/Bullet.hs 184;" f
|
expireAndDamage src/Dodge/Bullet.hs 184;" f
|
||||||
expireAndDamageFL src/Dodge/Flame.hs 38;" f
|
|
||||||
explodeShell src/Dodge/Projectile/Update.hs 245;" f
|
explodeShell src/Dodge/Projectile/Update.hs 245;" f
|
||||||
explosionS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 422;" f
|
explosionS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 422;" f
|
||||||
explosiveBarrel src/Dodge/Creature/Inanimate.hs 29;" f
|
explosiveBarrel src/Dodge/Creature/Inanimate.hs 29;" f
|
||||||
@@ -4349,8 +4346,7 @@ firstBreather src/Dodge/Room/Breather.hs 9;" f
|
|||||||
firstWorldLoad appDodge/Main.hs 77;" f
|
firstWorldLoad appDodge/Main.hs 77;" f
|
||||||
fixedCoordPictures src/Dodge/Render/Picture.hs 17;" f
|
fixedCoordPictures src/Dodge/Render/Picture.hs 17;" f
|
||||||
fixedSizePicClampArrow src/Dodge/Picture/SizeInvariant.hs 57;" f
|
fixedSizePicClampArrow src/Dodge/Picture/SizeInvariant.hs 57;" f
|
||||||
flDamageInArea src/Dodge/Flame.hs 135;" f
|
flFlicker src/Dodge/Flame.hs 50;" f
|
||||||
flFlicker src/Dodge/Flame.hs 149;" f
|
|
||||||
flameMuzzles src/Dodge/HeldUse.hs 290;" f
|
flameMuzzles src/Dodge/HeldUse.hs 290;" f
|
||||||
flameShield src/Dodge/Item/Equipment.hs 33;" f
|
flameShield src/Dodge/Item/Equipment.hs 33;" f
|
||||||
flameSize src/Dodge/Flame/Size.hs 5;" f
|
flameSize src/Dodge/Flame/Size.hs 5;" f
|
||||||
@@ -4923,10 +4919,10 @@ makeDebrisToHeight src/Dodge/Block/Debris.hs 39;" f
|
|||||||
makeDefaultCorpse src/Dodge/Corpse/Make.hs 16;" f
|
makeDefaultCorpse src/Dodge/Corpse/Make.hs 16;" f
|
||||||
makeDoorDebris src/Dodge/Block/Debris.hs 18;" f
|
makeDoorDebris src/Dodge/Block/Debris.hs 18;" f
|
||||||
makeEnumOption src/Dodge/Menu/OptionType.hs 13;" f
|
makeEnumOption src/Dodge/Menu/OptionType.hs 13;" f
|
||||||
makeExplosionAt src/Dodge/WorldEvent/Explosion.hs 72;" f
|
makeExplosionAt src/Dodge/WorldEvent/Explosion.hs 71;" f
|
||||||
makeFlak src/Dodge/Bullet.hs 139;" f
|
makeFlak src/Dodge/Bullet.hs 139;" f
|
||||||
makeFlame src/Dodge/Flame.hs 157;" f
|
makeFlame src/Dodge/Flame.hs 57;" f
|
||||||
makeFlameExplosionAt src/Dodge/WorldEvent/Explosion.hs 55;" f
|
makeFlameExplosionAt src/Dodge/WorldEvent/Explosion.hs 54;" f
|
||||||
makeFlamelet src/Dodge/EnergyBall.hs 20;" f
|
makeFlamelet src/Dodge/EnergyBall.hs 20;" f
|
||||||
makeFlamerSmokeAt src/Dodge/WorldEvent/Cloud.hs 68;" f
|
makeFlamerSmokeAt src/Dodge/WorldEvent/Cloud.hs 68;" f
|
||||||
makeFlashBall src/Dodge/EnergyBall.hs 74;" f
|
makeFlashBall src/Dodge/EnergyBall.hs 74;" f
|
||||||
@@ -4939,7 +4935,7 @@ makeMuzzleFlare src/Dodge/HeldUse.hs 649;" f
|
|||||||
makeParagraph src/Justify.hs 6;" f
|
makeParagraph src/Justify.hs 6;" f
|
||||||
makePathBetween src/Dodge/Path.hs 35;" f
|
makePathBetween src/Dodge/Path.hs 35;" f
|
||||||
makePathBetweenPs src/Dodge/Path.hs 54;" f
|
makePathBetweenPs src/Dodge/Path.hs 54;" f
|
||||||
makePoisonExplosionAt src/Dodge/WorldEvent/Explosion.hs 24;" f
|
makePoisonExplosionAt src/Dodge/WorldEvent/Explosion.hs 23;" f
|
||||||
makeRect src/Grid.hs 82;" f
|
makeRect src/Grid.hs 82;" f
|
||||||
makeSelectionListPictures src/Dodge/Render/List.hs 65;" f
|
makeSelectionListPictures src/Dodge/Render/List.hs 65;" f
|
||||||
makeShaderEBO src/Shader/Compile.hs 53;" f
|
makeShaderEBO src/Shader/Compile.hs 53;" f
|
||||||
@@ -4961,7 +4957,7 @@ makeTermPara src/Dodge/Terminal.hs 123;" f
|
|||||||
makeTeslaArc src/Dodge/Tesla.hs 29;" f
|
makeTeslaArc src/Dodge/Tesla.hs 29;" f
|
||||||
makeTeslaArc src/Dodge/Tesla/Arc.hs 65;" f
|
makeTeslaArc src/Dodge/Tesla/Arc.hs 65;" f
|
||||||
makeTeslaBallAt src/Dodge/Tesla/Ball.hs 6;" f
|
makeTeslaBallAt src/Dodge/Tesla/Ball.hs 6;" f
|
||||||
makeTeslaExplosionAt src/Dodge/WorldEvent/Explosion.hs 39;" f
|
makeTeslaExplosionAt src/Dodge/WorldEvent/Explosion.hs 38;" f
|
||||||
makeThickSmokeAt src/Dodge/WorldEvent/Cloud.hs 54;" f
|
makeThickSmokeAt src/Dodge/WorldEvent/Cloud.hs 54;" f
|
||||||
makeThinSmokeAt src/Dodge/WorldEvent/Cloud.hs 57;" f
|
makeThinSmokeAt src/Dodge/WorldEvent/Cloud.hs 57;" f
|
||||||
makeTileFromPoly src/Tile.hs 34;" f
|
makeTileFromPoly src/Tile.hs 34;" f
|
||||||
@@ -6236,7 +6232,7 @@ updateEnterRegex src/Dodge/Update/Input/InGame.hs 480;" f
|
|||||||
updateExpBarrel src/Dodge/Barreloid.hs 20;" f
|
updateExpBarrel src/Dodge/Barreloid.hs 20;" f
|
||||||
updateFBOTO src/Framebuffer/Update.hs 97;" f
|
updateFBOTO src/Framebuffer/Update.hs 97;" f
|
||||||
updateFBOTO3 src/Framebuffer/Update.hs 131;" f
|
updateFBOTO3 src/Framebuffer/Update.hs 131;" f
|
||||||
updateFlame src/Dodge/Flame.hs 60;" f
|
updateFlame src/Dodge/Flame.hs 19;" f
|
||||||
updateFlames src/Dodge/Update.hs 595;" f
|
updateFlames src/Dodge/Update.hs 595;" f
|
||||||
updateFloatingCamera src/Dodge/Update/Camera.hs 34;" f
|
updateFloatingCamera src/Dodge/Update/Camera.hs 34;" f
|
||||||
updateFunctionKey src/Dodge/Update/Input/InGame.hs 364;" f
|
updateFunctionKey src/Dodge/Update/Input/InGame.hs 364;" f
|
||||||
|
|||||||
Reference in New Issue
Block a user