Add missing dependencies, fix arc rendering

This commit is contained in:
2021-08-28 16:22:21 +01:00
parent 4e97a1998c
commit c36654520d
9 changed files with 77 additions and 15 deletions
+3 -1
View File
@@ -6,7 +6,9 @@ out vec4 fColor;
void main()
{
float d = dot(vec2(vparams.xy),vec2(vparams.xy));
float d = (dot(vec2(vparams.xy),vec2(vparams.xy)));
if ( d > 1 || d < vparams.z ) {discard;}
//if ( d > 1 ) {discard;}
fColor = vColor;
//fColor = (10,0,0,10);
}
+2
View File
@@ -141,6 +141,7 @@ teslaGun = defaultGun
, _itUseModifiers =
[ ammoCheckI
, useTimeCheckI
, withTempLight 1 100 (V3 0 0 1)
, withSoundForI 25 1
, useAmmo 1
]
@@ -175,6 +176,7 @@ lasGun = defaultAutoGun
, _itUseModifiers =
[ ammoCheckI
, useTimeCheckI
, withTempLight 1 100 (V3 1 1 0)
, withSoundForI 24 1
, useAmmo 1
]
+48
View File
@@ -0,0 +1,48 @@
module Dodge.Item.Weapon.AmmoParams
where
import Dodge.Data
import Dodge.Particle.Bullet.Spawn
import Geometry
import Control.Lens
useAmmoParams :: Item -> Creature -> World -> World
useAmmoParams it = withVelWthHiteff (_amBulVel b) (_amBulWth b) (_amBulEff b)
where
b = _wpAmmo it
useAmmoParamsVelMod :: Float -> Item -> Creature -> World -> World
useAmmoParamsVelMod vfact it = withDelayedVelWthHiteff vfact (_amBulVel b) (_amBulWth b) (_amBulEff b)
where
b = _wpAmmo it
{- | Creates a bullet with a given velocity, width, and 'HitEffect' -}
withVelWthHiteff
:: Point2 -- ^ Velocity, x direction is forward with respect to the creature
-> Float -- ^ Bullet width
-> HitEffect -- ^ Bullet effect when hitting creature, wall etc
-> Creature -- ^ Creature id
-> World
-> World
withVelWthHiteff vel width hiteff cr = over particles (newbul : )
where
cid = _crID cr
newbul = aGenBulAt (Just cid) pos (rotateV dir vel) hiteff width
dir = _crDir cr
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
{- | Creates a bullet with a given velocity, width, and 'HitEffect' -}
withDelayedVelWthHiteff
:: Float -- ^ Velocity factor for first step
-> Point2 -- ^ Velocity, x direction is forward with respect to the creature
-> Float -- ^ Bullet width
-> HitEffect -- ^ Bullet effect when hitting creature, wall etc
-> Creature -- ^ Creature id
-> World
-> World
withDelayedVelWthHiteff vfact vel width hiteff cr = over particles (newbul : )
where
cid = _crID cr
newbul = aDelayedBulAt vfact (Just cid) pos (rotateV dir vel) hiteff width
dir = _crDir cr
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
+7
View File
@@ -0,0 +1,7 @@
module Dodge.Room.Listed
( roomList
) where
import Dodge.Room.Data
roomList :: [Room]
roomList = []
+1 -1
View File
@@ -27,7 +27,7 @@ startRoom = do
highPipe 80 (V2 0 (h/3)) (V2 w (h/2))
++ highPipe 40 (V2 0 (h/2)) (V2 w (h/3))
++ highPipe 60 (V2 (w/3) 0 ) (V2 (w/3) h )
theLamp = sPS (V2 (w/2) (h/2)) 0 $ putColorLamp (V3 0.75 0.25 0.25)
theLamp = sPS (V2 (w/2) (h/2)) 0 $ putColorLamp (V3 0.75 0.75 0.75)
treeFromPost [Left rezBox, Left door] . Right
<$> randomiseOutLinks (shiftRoomBy (V2 (-20) (-20),0)
$ roomRectAutoLinks w h & rmPS .~ [fground,theLamp])
-1
View File
@@ -86,7 +86,6 @@ flashFlareAt col alphax (V2 x y) = Particle
explosionFlashAt :: Point2 -> World -> World
explosionFlashAt p = over tempLightSources ((:) $ tLightFade 20 150 intensityFunc p)
. glareAt 20 10 5 (withAlpha 0.3 white) 75 150 p
where
intensityFunc x
| x < 10 = 1 / (10 - fromIntegral x)
+1 -1
View File
@@ -50,7 +50,7 @@ Shockwave picture.
drawShockwave :: Particle -> Picture
drawShockwave pt = pic
where
pic = setDepth 20 . uncurryV translate p
pic = setDepth 20 . setLayer 1 . uncurryV translate p
$ color (_btColor' pt) $ thickCircle rad thickness
p = _btPos' pt
r = _btRad' pt
+11 -8
View File
@@ -122,7 +122,7 @@ moveFlame rotd w pt
closeCrs cr = dist ep (_crPos cr)
< _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 )
angleCoeff x' = abs $ 1 - abs ( (x' * 2 - pi) / pi )
hiteff = _btHitEffect' pt pt
rfl wl p = Just $ pt
{ _btTimer' = time -1
@@ -167,10 +167,13 @@ drawFlameletZ
-> Particle
-> Picture
drawFlameletZ rot pt = pictures
[ setLayer 5 pic
, setLayer 4 pi2
, setLayer 3 piu
, setLayer 1 glow
--[ setLayer 5 pic
--, setLayer 4 pi2
--, setLayer 3 piu
[ setLayer 1 pic
, setLayer 1 pi2
, setLayer 1 piu
--, setLayer 1 glow
]
where
z = _ptZ pt
@@ -184,13 +187,13 @@ drawFlameletZ rot pt = pictures
$ circleSolidCol (withAlpha 0 red) (withAlpha 0.05 red) 30
piu = setDepth (z + 20)
. uncurryV translate ep
. color (dark red)
. color (brightX 2 2 $ dark red)
. rotate (negate (rot - 0.1 * fromIntegral time))
. scale s1 s1
$ polygon (rectNSWE siz2 (-siz2) (-siz2) siz2)
pi2 = setDepth (z + 20)
. uncurryV translate ep
. color (mixColors (fromIntegral (max 0 (time-2))) (10-fromIntegral time)
. color (brightX 2 2 $ mixColors (fromIntegral (max 0 (time-2))) (10-fromIntegral time)
orange (dark red)
)
. rotate (negate (rot + 0.2 * fromIntegral time))
@@ -198,7 +201,7 @@ drawFlameletZ rot pt = pictures
$ polygon (rectNSWE siz2 (-siz2) (-siz2) siz2)
pic = setDepth (z + 20)
. uncurryV translate ep
. color (mixColors (fromIntegral (max 0 (time-2))) (10-fromIntegral time)
. color (brightX 2 2 $ mixColors (fromIntegral (max 0 (time-2))) (10-fromIntegral time)
white (dark red)
)
. rotate (negate ( 0.1 * fromIntegral time + rot))
+4 -3
View File
@@ -301,9 +301,9 @@ arc startA endA rad = thickArc startA endA rad 1
thickArc :: Float -> Float -> Float -> Float -> Picture
{-# INLINE thickArc #-}
thickArc startA endA rad wdth
| endA - startA > pi = pictures
[ thickArc (startA + pi) endA rad wdth
, thickArcHelp startA (startA + pi) r w
| endA - startA > (pi/ 2) = pictures
[ thickArc (startA + pi/2) endA rad wdth
, thickArcHelp startA (startA + pi/2) r w
]
| otherwise = thickArcHelp startA endA r w
where
@@ -323,6 +323,7 @@ thickArcHelp startA endA rad wdth = map f
where
(V2 xa ya) = rotateV startA (V2 rad 0)
(V2 xb yb) = rotateV (0.5 * (startA + endA)) (V2 (rad * sqrt 2) 0)
--(V2 xb yb) = rotateV (0.5 * (startA + endA)) (V2 (rad * 2) 0)
(V2 xc yc) = rotateV endA (V2 rad 0)
f (pos,col,V3 a b c) = Verx pos col [a,b,c] 0 arcNum