This commit is contained in:
2021-03-24 02:11:33 +01:00
parent 26ac0142b1
commit 03587a7906
7 changed files with 21 additions and 116 deletions
+19 -50
View File
@@ -818,7 +818,6 @@ tractorBeamAt colID i pos dir = Projectile
where d = unitVectorAtAngle dir
p' = pos +.+ 400 *.* d
aGasCloud :: Int -> World -> World
aGasCloud cid w
= -- soundFrom Flame fireSound 2 500
@@ -871,7 +870,6 @@ aFlame a cid w
_crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
w1 = set randGen g w
i = newProjectileKey w1
-- vel = (_crPos cr -.- _crOldPos cr) +.+ 4 *.* unitVectorAtAngle dir
vel = (_crPos cr -.- _crOldPos cr) +.+ 4 *.* unitVectorAtAngle dir
insertFlame = makeFlame pos vel (Just cid) -- . makeFlame pos2 vel (Just cid)
resetAngle = set (creatures . ix cid . crInv . ix (_crInvSel cr) . wpFire)
@@ -892,24 +890,16 @@ makeFlame pos vel maycid = over particles' ((:) theFlame)
}
moveFlame :: Point2 -> World -> Particle' -> (World, Maybe Particle')
moveFlame rotd w pt =
case _btTimer' pt of
time | time <= 0 -> (smokeGen w, Nothing)
| otherwise ->
case thingsHitExceptCr (_btPassThrough' pt) sp ep w of
-- ((p,(E3x1 cr)):_) -> (damcr cr p $ smokeGen damcrs, Nothing)
((p,(E3x1 cr)):_)
-> (soundFrom Flame fireSound 2 500
$ over worldEvents ((.) $ flameGlareAt ep)
damcrs
, mvPt')
(thing@(p,(E3x2 wl)):_) -> (fst $ hiteff [thing] damcrs, rfl wl p)
_ -> (soundFrom Flame fireSound 2 500
-- adding reflective glare is too intensive for this laptop
$ over worldEvents ((.) $ flameGlareAt ep)
damcrs
, mvPt)
where sp = _btPos' pt
moveFlame rotd w pt
| time <= 0 = (smokeGen w, Nothing)
| otherwise = case thingsHitExceptCr (_btPassThrough' pt) sp ep w of
((p,(E3x1 cr)):_) -> (soundAndGlare damcrs , mvPt')
(thing@(p,(E3x2 wl)):_) -> (fst $ hiteff [thing] damcrs , rfl wl p)
_ -> (soundAndGlare damcrs , mvPt)
where time = _btTimer' pt
soundAndGlare = soundFrom Flame fireSound 2 500
. over worldEvents ((.) $ flameGlareAt ep)
sp = _btPos' pt
vel = _btVel' pt
ep = sp +.+ vel
mvPt = Just $ pt {_btTimer' = time - 1, _btPos' = ep, _ptPict' = thepic ep
@@ -924,51 +914,36 @@ moveFlame rotd w pt =
< _crRad cr + 10 - min 9 (max 0 (fromIntegral time - 80))
+ 5 * angleCoeff (angleVV (ep -.- _crPos cr) rotd)
angleCoeff x = abs $ 1 - (abs $ (x * 2 - pi) / (pi))
damcr cr p = over (creatures . ix (_crID cr) . crState . crDamage)
((:) $ Flaming (div time 10) sp p ep)
hiteff = _btHitEffect' pt pt
thepic p' = pictures $ reverse [ pic p' , piu p' , pi2 p' , glow p' ]
pic p' = setLayer 1 $ onLayerL [levLayer UPtLayer,6] $ uncurry translate (prot3 p')
pic p' = setLayer 1 . setDepth 0.2994 $ uncurry translate (prot3 p')
$ rotate (pi * 0.5 + argV rotd)
$ scale scaleChange 1
-- $ color white
-- $ circleSolid 5
$ pictures $ reverse [color white $ circleSolid 4
,color (withAlpha 0.5 white) $ circleSolid 5
]
-- $ rotate (radToDeg (fromIntegral time * 10))
-- $ polygon [(-5,-2),(5,-2),(5,2),(-5,2)]
pi2 p' = setLayer 1 $ onLayerL [levLayer UPtLayer,4] $ uncurry translate (prot p')
-- $ rotate ( (fromIntegral time * 5))
pi2 p' = setLayer 1
. setDepth 0.2996
. uncurry translate (prot p')
$ rotate (pi * 0.5 + argV rotd)
-- $ color (mixColors 0.5 0.5 orange white)
-- $ polygon [(-6,-6),(6,-6),(6,6),(-6,6)]
$ scale (scaleChange + 0.5) 1.5
$ pictures $ reverse [color orange $ circleSolid 4.5
,color (withAlpha 0.5 orange) $ circleSolid 5
]
-- $ color orange
-- $ circleSolid 5
prot p' = p' +.+ rotateV (fromIntegral time * 1) (0,1)
prot2 p' = p' +.+ rotateV (negate $ fromIntegral time * 1) (0,1)
prot3 p' = p' +.+ rotateV (2 + fromIntegral time * 0.1) (0,2)
piu p' = setLayer 1 $ onLayerL [levLayer UPtLayer,2] $ uncurry translate (prot2 p')
piu p' = setLayer 1 . setDepth 0.2998 $ uncurry translate (prot2 p')
$ rotate (pi*0.5 + argV rotd)
-- $ rotate ((fromIntegral time * (-10)))
$ scale (scaleChange + 1) 2
$ pictures $ reverse [color red $ circleSolid 4.5
,color (withAlpha 0.5 red) $ circleSolid 5
]
-- $ color (dark red)
-- $ circleSolid 5
-- $ polygon [(-8,-8),(8,-8),(8,8),(-8,8) ]
rfl wl p = Just $ pt {_btTimer' = time -1, _btPos' = pOut p
, _btVel' = reflV wl, _ptPict' = thepic $ pOut p
}
glow p' = setLayer 1 $ onLayerL [levLayer UPtLayer,0] $ uncurry translate p'
$ circleSolidCol (withAlpha 0 orange)
(withAlpha 0.02 orange) -- (withAlpha 0 orange) 50
50
, _btVel' = reflV wl, _ptPict' = thepic $ pOut p
}
glow p' = setLayer 1 $ setDepth 0.3 $ uncurry translate p'
$ circleSolidCol (withAlpha 0 orange) (withAlpha 0.02 orange) 50
pOut p = p +.+ safeNormalizeV (sp -.- p)
reflV wall = (0.3 *.* reflectIn (_wlLine wall !! 1 -.- _wlLine wall !! 0)
vel )
@@ -976,12 +951,6 @@ moveFlame rotd w pt =
(0.2 *.* vel)
scaleChange | time < 80 = 3
| otherwise = 3 - (fromIntegral time - 80) * 0.2
g = _randGen w
-- tms = randomRs (15,20) g
-- scs = randomRs (0.1,0.5) g
(rs,g1) = runState ((sequence . take 5 . repeat . randInCirc) 20) $ _randGen w
f sc tm r = makeColorSmokeAt (greyN 0.3) (0.5 *.* vel) sc tm (ep +.+ r)
-- smokeGen w = set randGen g1 $ foldr ($) w (zipWith3 f scs tms rs)
smokeGen = makeFlamerSmoke ep