Decrease muzzle flare light time

This commit is contained in:
2021-03-20 18:51:03 +01:00
parent 19fc1f2468
commit 4365185f9f
5 changed files with 34 additions and 25 deletions
+1 -1
View File
@@ -573,9 +573,9 @@ data Wall
, _blHP :: Int , _blHP :: Int
, _wlIsSeeThrough :: Bool , _wlIsSeeThrough :: Bool
, _blVisible :: Bool , _blVisible :: Bool
, _blShadows :: [Int]
, _blDegrades :: [Int] , _blDegrades :: [Int]
, _wlCastShadow :: Bool , _wlCastShadow :: Bool
, _blShadows :: [Int]
} }
| MultiBlock | MultiBlock
{ _wlLine :: [Point2] { _wlLine :: [Point2]
+22 -16
View File
@@ -62,6 +62,7 @@ pistol = Weapon
, _wpFireState = 0 , _wpFireState = 0
, _wpFire = shootWithSound 0 , _wpFire = shootWithSound 0
. withRandomDir 0.1 . withRandomDir 0.1
. withMuzFlare
. withVelWthHiteff (30,0) 2 . withVelWthHiteff (30,0) 2
$ threeEff' bulHitCr' bulHitWall' bulHitFF' $ threeEff' bulHitCr' bulHitWall' bulHitFF'
, _wpSpread = 0.02 , _wpSpread = 0.02
@@ -124,16 +125,18 @@ autoGun = defaultGun
, _itInvDisplay = displayAutoGun , _itInvDisplay = displayAutoGun
} }
autoFireMode = shootWithSound (fromIntegral autoGunSound) autoFireMode = shootWithSound (fromIntegral autoGunSound)
$ withRecoil 40 . withRecoil 40
$ torqueBefore 0.05 . torqueBefore 0.05
$ withRandomDir (autogunSpread/2) . withRandomDir (autogunSpread/2)
$ withVelWthHiteff (50,0) 3 . withMuzFlare
. withVelWthHiteff (50,0) 3
$ threeEff' bulHitCr' bulHitWall' bulHitFF' $ threeEff' bulHitCr' bulHitWall' bulHitFF'
singleFireMode = shootWithSound (fromIntegral autoGunSound) singleFireMode = shootWithSound (fromIntegral autoGunSound)
$ withRecoil 40 . withRecoil 40
$ torqueAfter 0.03 . torqueAfter 0.03
$ withRandomDir (autogunSpread/2) . withRandomDir (autogunSpread/2)
$ withVelWthHiteff (50,0) 3 . withMuzFlare
. withVelWthHiteff (50,0) 3
$ threeEff' bulHitCr' bulHitWall' bulHitFF' $ threeEff' bulHitCr' bulHitWall' bulHitFF'
incMode :: Int -> World -> World incMode :: Int -> World -> World
@@ -422,8 +425,9 @@ hvAutoGun = defaultAutoGun
, _itEquipPict = drawWeapon $ color orange $ polygon $ rectNESW 5 5 (-5) (-5) , _itEquipPict = drawWeapon $ color orange $ polygon $ rectNESW 5 5 (-5) (-5)
} }
where mkHvBul = withSound (fromIntegral longGunSound) where mkHvBul = withSound (fromIntegral longGunSound)
$ withThinSmoke . withThinSmoke
$ withVelWthHiteff (80,0) 6 . withMuzFlare
. withVelWthHiteff (80,0) 6
$ threeEff' $ threeEff'
hvBulHitCr' hvBulHitWall' bulHitFF' hvBulHitCr' hvBulHitWall' bulHitFF'
@@ -436,7 +440,8 @@ ltAutoGun = defaultAutoGun
, _wpReloadState = 0 , _wpReloadState = 0
, _wpFireRate = 4 , _wpFireRate = 4
, _wpFireState = 0 , _wpFireState = 0
, _wpFire = shootWithSound 0 . withRandomDir 0.3 $ withVelWthHiteff (30,0) 2 bulletEffect' , _wpFire = shootWithSound 0 . withRandomDir 0.3
. withMuzFlare $ withVelWthHiteff (30,0) 2 bulletEffect'
, _wpSpread = 0.5 , _wpSpread = 0.5
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = onLayer FlItLayer $ color green $ pictures [polygon $ rectNSWE 4 (-4) (-4) 0 , _itFloorPict = onLayer FlItLayer $ color green $ pictures [polygon $ rectNSWE 4 (-4) (-4) 0
@@ -463,6 +468,7 @@ miniGun = defaultAutoGun
, _wpFire = withWarmUp 50 . torqueBefore 0.03 . withSidePush 50 . withRecoil 15 , _wpFire = withWarmUp 50 . torqueBefore 0.03 . withSidePush 50 . withRecoil 15
. withRandomDir 0.1 . withRandomDir 0.1
. withRandomOffset 9 . withRandomOffset 9
. withMuzFlare
$ withVelWthHiteff (30,0) 2 bulletEffect' $ withVelWthHiteff (30,0) 2 bulletEffect'
, _wpSpread = autogunSpread , _wpSpread = autogunSpread
, _wpRange = 20 , _wpRange = 20
@@ -555,11 +561,11 @@ longGun = defaultGun
, _wpFireRate = 100 , _wpFireRate = 100
, _wpFireState = 0 , _wpFireState = 0
, _wpFire = shootWithSound (fromIntegral longGunSound) , _wpFire = shootWithSound (fromIntegral longGunSound)
$ withThickSmoke . withThickSmoke
$ torqueAfter 0.05 . torqueAfter 0.05
$ withVelWthHiteff (60,0) 6 . withMuzFlare
$ threeEff' . withVelWthHiteff (60,0) 6
hvBulHitCr' hvBulHitWall' bulHitFF' $ threeEff' hvBulHitCr' hvBulHitWall' bulHitFF'
, _wpSpread = 0.0 , _wpSpread = 0.0
, _wpRange = 200 , _wpRange = 200
+3 -3
View File
@@ -94,7 +94,7 @@ shoot f cid w | fireCondition = over (pointerToItem . wpLoadedAmmo) (\ammo -> am
reloadCondition = _wpLoadedAmmo item == 0 reloadCondition = _wpLoadedAmmo item == 0
withMuzFlare :: (Int -> World -> World) -> Int -> World -> World withMuzFlare :: (Int -> World -> World) -> Int -> World -> World
withMuzFlare f cid w = over tempLightSources (tLightAt 4 pos :) withMuzFlare f cid w = over tempLightSources (tLightAt 3 pos :)
. lowLightAt pos2 $ f cid w . lowLightAt pos2 $ f cid w
where cr = _creatures w IM.! cid where cr = _creatures w IM.! cid
dir = _crDir cr dir = _crDir cr
@@ -112,8 +112,8 @@ withRandomDir acc f cid w = over (creatures . ix cid . crDir) (\d -> d - a)
withVelWthHiteff :: Point2 -> Float -> HitEffect' -> Int -> World -> World withVelWthHiteff :: Point2 -> Float -> HitEffect' -> Int -> World -> World
withVelWthHiteff vel width hiteff cid w withVelWthHiteff vel width hiteff cid w
= over particles' ((:) newbul) = over particles' ((:) newbul)
. over tempLightSources ((:) (tLightAt 4 pos)) -- . over tempLightSources ((:) (tLightAt 4 pos))
. lowLightAt pos2 -- . lowLightAt pos2
$ set randGen g $ set randGen g
w w
where cr = _creatures w IM.! cid where cr = _creatures w IM.! cid
+5 -1
View File
@@ -36,6 +36,7 @@ closestPointOnLineParam a b p
rectNESW :: Float -> Float -> Float -> Float -> [Point2] rectNESW :: Float -> Float -> Float -> Float -> [Point2]
rectNESW a b c d = [(b,a),(b,c),(d,c),(d,a) rectNESW a b c d = [(b,a),(b,c),(d,c),(d,a)
] ]
rectNSEW :: Float -> Float -> Float -> Float -> [Point2]
rectNSEW n s e w = rectNESW n e s w rectNSEW n s e w = rectNESW n e s w
rectNSWE :: Float -> Float -> Float -> Float -> [Point2] rectNSWE :: Float -> Float -> Float -> Float -> [Point2]
@@ -89,6 +90,7 @@ safeNormalizeV p = normalizeV p
-- this has been called somewhere with l1 == l2 -- this has been called somewhere with l1 == l2
isLHS :: Point2 -> Point2 -> Point2 -> Bool isLHS :: Point2 -> Point2 -> Point2 -> Bool
{-# INLINE isLHS #-} {-# INLINE isLHS #-}
isLHS' :: (Float, Float) -> (Float, Float) -> Point2 -> Bool
isLHS' l1 l2 p | l1 == l2 = False isLHS' l1 l2 p | l1 == l2 = False
| otherwise = closestPointOnLineParam l1 (l1 +.+ vNormal (l2 -.- l1)) p < 0 | otherwise = closestPointOnLineParam l1 (l1 +.+ vNormal (l2 -.- l1)) p < 0
@@ -138,6 +140,7 @@ circOnLine p1 p2 c rad = magV (p1 -.- c) <= rad || magV (p2 -.- c) <= rad
isJustTrue (Just True) = True isJustTrue (Just True) = True
isJustTrue _ = False isJustTrue _ = False
difference :: (Ord a, Num a) => a -> a -> a
difference x y | x > y = x - y difference x y | x > y = x - y
| otherwise = y - x | otherwise = y - x
@@ -145,6 +148,7 @@ reflectIn :: Point2 -> Point2 -> Point2
reflectIn line vec = let angle = 2 * angleBetween line vec reflectIn line vec = let angle = 2 * angleBetween line vec
in rotateV angle vec in rotateV angle vec
angleBetween :: Point2 -> Point2 -> Float
angleBetween v1 v2 = argV v1 - argV v2 angleBetween v1 v2 = argV v1 - argV v2
doublePair :: (a,a) -> [(a,a)] doublePair :: (a,a) -> [(a,a)]
@@ -195,7 +199,7 @@ ssaTri :: Float -> Float -> Float -> Float
ssaTri ab bc a ssaTri ab bc a
| sin a == 0 = 0 | sin a == 0 = 0
| bc == 0 = ab | bc == 0 = ab
| otherwise = let c = asin ( (ab * (sin a))/bc) | otherwise = let c = asin ( (ab * sin a)/bc)
b = pi - (a + c) b = pi - (a + c)
in sin b * bc / sin a in sin b * bc / sin a
-1
View File
@@ -10,7 +10,6 @@ import qualified Graphics.Rendering.OpenGL as GL
import Control.Monad import Control.Monad
import System.Mem import System.Mem
import Foreign.C import Foreign.C
import Geometry
import Preload import Preload