Cleanup muzzle flare
This commit is contained in:
@@ -489,8 +489,9 @@ spreadGun = defaultGun
|
||||
, _wpFireRate = 20
|
||||
, _wpFireState = 0
|
||||
, _wpFire = shootWithSound (fromIntegral shotgunSound)
|
||||
$ withRecoil 100
|
||||
$ spreadNumVelWthHiteff' spreadGunSpread 9 (30,0) 2 bulletEffect'
|
||||
. withRecoil 100
|
||||
. withMuzFlare
|
||||
$ spreadNumVelWthHiteff spreadGunSpread 9 (30,0) 2 bulletEffect'
|
||||
, _wpSpread = spreadGunSpread
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color green $ pictures [ polygon [(-3,0),(3,6),(3,-6)]
|
||||
@@ -531,8 +532,9 @@ multGun = defaultGun
|
||||
, _wpFireRate = 20
|
||||
, _wpFireState = 0
|
||||
, _wpFire = shootWithSound (fromIntegral shotgunSound)
|
||||
$ withRecoil 200
|
||||
$ numVelWthHitEff' 5 (50,0) 4 bulletEffect'
|
||||
. withRecoil 200
|
||||
. withMuzFlare
|
||||
$ numVelWthHitEff 5 (50,0) 4 bulletEffect'
|
||||
, _wpSpread = spreadGunSpread
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ multGunPic
|
||||
@@ -905,13 +907,13 @@ moveFlame rotd w pt =
|
||||
-- ((p,(E3x1 cr)):_) -> (damcr cr p $ smokeGen damcrs, Nothing)
|
||||
((p,(E3x1 cr)):_)
|
||||
-> (soundFrom Flame fireSound 2 500
|
||||
$ over worldEvents ((.) $ lowLightRadAt orange 0.05 8 50 ep)
|
||||
$ 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 ((.) $ lowLightRadAt orange 0.05 8 50 ep)
|
||||
$ over worldEvents ((.) $ flameGlareAt ep)
|
||||
damcrs
|
||||
, mvPt)
|
||||
where sp = _btPos' pt
|
||||
|
||||
@@ -28,7 +28,7 @@ bulHitCr' bt p cr w =
|
||||
addDamageArmoured = over (creatures . ix cid . crState . crDamage)
|
||||
(\dams -> mvDams ++ dams)
|
||||
hitSound = soundMultiFrom [CrHitSound 0] 15 10 0
|
||||
flashEff = over worldEvents ((.) $ flareAt red p)
|
||||
flashEff = over worldEvents ((.) $ flareAt' red 0.02 0.05 p)
|
||||
bulVel = _btVel' bt
|
||||
ck cid = (+.+) (crKnockBack cid *.* bulVel)
|
||||
crKnockBack cid = (/) 1 $ (+) 2 $ _crMass $ _creatures w IM.! cid
|
||||
|
||||
@@ -95,7 +95,7 @@ shoot f cid w | fireCondition = over (pointerToItem . wpLoadedAmmo) (\ammo -> am
|
||||
|
||||
withMuzFlare :: (Int -> World -> World) -> Int -> World -> World
|
||||
withMuzFlare f cid w = over tempLightSources (tLightAt 3 pos :)
|
||||
. lowLightAt pos2 $ f cid w
|
||||
. muzFlareAt pos2 $ f cid w
|
||||
where cr = _creatures w IM.! cid
|
||||
dir = _crDir cr
|
||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
||||
@@ -157,32 +157,29 @@ torqueAfter torque feff cid w
|
||||
rotateScope w = w & creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
|
||||
. itAttachment . _Just . scopePos %~ rotateV rot
|
||||
|
||||
spreadNumVelWthHiteff' :: Float -> Int -> Point2 -> Float -> HitEffect -> Int -> World -> World
|
||||
spreadNumVelWthHiteff' spread num vel wth eff cid w
|
||||
spreadNumVelWthHiteff :: Float -> Int -> Point2 -> Float -> HitEffect -> Int -> World -> World
|
||||
spreadNumVelWthHiteff spread num vel wth eff cid w
|
||||
= over particles' (newbuls ++)
|
||||
$ flip (foldr muzFlareAt) poss
|
||||
w
|
||||
where cr = _creatures w IM.! cid
|
||||
newbuls = zipWith3 (\pos d colid -> aGenBulAt' (Just cid) (numColor colid)
|
||||
pos (rotateV d vel) eff wth
|
||||
) poss dirs colids
|
||||
pos' = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
||||
poss = map ((+.+) $ _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr))
|
||||
$ evalState ((sequence . take num . repeat . randInCirc) 5) $ _randGen w
|
||||
dirs = map ((+) (_crDir cr))
|
||||
$ zipWith (+) [-spread,-spread+(2*spread/(fromIntegral num))..]
|
||||
$ randomRs (0,spread/5) (_randGen w)
|
||||
-- $ randomRs (0,spreadGunSpread/5) (_randGen w)
|
||||
colids = take num $ randomRs (0,11) (_randGen w)
|
||||
|
||||
numVelWthHitEff' :: Int -> Point2 -> Float -> HitEffect -> Int -> World -> World
|
||||
numVelWthHitEff' num vel wth eff cid w
|
||||
numVelWthHitEff :: Int -> Point2 -> Float -> HitEffect -> Int -> World -> World
|
||||
numVelWthHitEff num vel wth eff cid w
|
||||
= over particles' (newbuls ++)
|
||||
$ flip (foldr muzFlareAt) (take num poss)
|
||||
w
|
||||
where cr = _creatures w IM.! cid
|
||||
newbuls = zipWith (\pos colid -> aGenBulAt' (Just cid) (numColor colid)
|
||||
pos (rotateV d vel) eff wth)
|
||||
pos (rotateV d vel) eff wth
|
||||
)
|
||||
poss colids
|
||||
d = _crDir cr
|
||||
poss = map (\o -> o +.+ pos) offsets
|
||||
@@ -190,4 +187,3 @@ numVelWthHitEff' num vel wth eff cid w
|
||||
offsets = map (\y -> rotateV d (0,y)) [-maxOffset,5-maxOffset..]
|
||||
colids = take num $ randomRs (0,11) (_randGen w)
|
||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle d
|
||||
pos2 = _crPos cr +.+ (2 * _crRad cr) *.* unitVectorAtAngle (_crDir cr)
|
||||
|
||||
Reference in New Issue
Block a user