diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index ec0a85e4a..ad3cd4e2a 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -132,7 +132,7 @@ data Cloud = Cloud , _clRad :: Float , _clTimer :: Int , _clType :: CloudType --- , _clEffect :: Cloud -> World -> World + , _clEffect :: Cloud -> World -> World } data CloudType = SmokeCloud diff --git a/src/Dodge/Item/Weapon.hs b/src/Dodge/Item/Weapon.hs index 5d53fc923..9a331830a 100644 --- a/src/Dodge/Item/Weapon.hs +++ b/src/Dodge/Item/Weapon.hs @@ -541,17 +541,20 @@ poisonSprayer = defaultAutoGun , _itUseTime = 0 , _itUse = const aGasCloud , _itUseModifiers = - [ useTimeCheckI - , withSoundI buzzSound + [ ammoCheckI + , useTimeCheckI + , withSoundForI foamSpray 5 , useAmmo 1 + , spreadNumI ] - , _wpSpread = 0.3 , _wpRange = 8 , _itFloorPict = onLayer FlItLayer $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4) , _itAimingSpeed = 0.2 , _itAimingRange = 0 , _itZoom = defaultItZoom , _itEquipPict = pictureWeaponOnAim $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4) + , _wpSpread = 0.1 + , _wpNumBarrels = 3 } flamer :: Item flamer = defaultAutoGun diff --git a/src/Dodge/SoundLogic/Synonyms.hs b/src/Dodge/SoundLogic/Synonyms.hs index d4be0a834..83ad15fa6 100644 --- a/src/Dodge/SoundLogic/Synonyms.hs +++ b/src/Dodge/SoundLogic/Synonyms.hs @@ -24,6 +24,8 @@ launcherSound = 20 smokeTrailSound = 21 foot1Sound = 22 foot2Sound = 23 +foamSpray :: Int +foamSpray = 41 foamSprayFadeOutSound :: Int foamSprayFadeOutSound = 42 sineRaisePitchOneSecSound :: Int diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index 3c0b66c02..46832dfef 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -166,17 +166,22 @@ checkEndGame w | _crHP (you w) < 1 = haltSound $ w {_menuLayers = [GameOverMenu]} | otherwise = w +--updateClouds :: World -> World +--updateClouds w = w' & clouds %~ mapMaybe (updateCloud w) updateClouds :: World -> World -updateClouds w = w & clouds %~ mapMaybe (updateCloud w) ---updateClouds w = IM.foldl' updateCloud w $ _clouds w +updateClouds w = w' & clouds .~ catMaybes mclouds + where + (w',mclouds) = mapAccumR updateCloud' w (_clouds w) +-- did i write a mapMaybeAccumR ? -updateCloud :: World -> Cloud -> Maybe Cloud -updateCloud w c - | _clTimer c < 1 = Nothing - | otherwise = Just $ c +updateCloud' :: World -> Cloud -> (World,Maybe Cloud) +updateCloud' w c + | _clTimer c < 1 = (w, Nothing) + | otherwise = (_clEffect c c w, Just $ c & clPos .~ finalPos & clVel .~ finalVel & clTimer -~ 1 + ) where newVel = 0.95 *.* springVels springVels = foldl' (clClSpringVel c) (_clVel c) (cloudsNearPoint oldPos w) @@ -186,6 +191,22 @@ updateCloud w c finalPos = maybe newPos fst hitWl finalVel = maybe newVel snd hitWl +--updateCloud :: World -> Cloud -> Maybe Cloud +--updateCloud w c +-- | _clTimer c < 1 = Nothing +-- | otherwise = Just $ c +-- & clPos .~ finalPos +-- & clVel .~ finalVel +-- & clTimer -~ 1 +-- where +-- newVel = 0.95 *.* springVels +-- springVels = foldl' (clClSpringVel c) (_clVel c) (cloudsNearPoint oldPos w) +-- oldPos = _clPos c +-- newPos = oldPos +.+ newVel +-- hitWl = collideCircWalls' oldPos newPos 5 $ wallsNearPoint newPos w +-- finalPos = maybe newPos fst hitWl +-- finalVel = maybe newVel snd hitWl + clClSpringVel :: Cloud -> Point2 -> Cloud -> Point2 clClSpringVel a v b | dist pa pb < radDist = v +.+ 0.1 *.* safeNormalizeV (pa -.- pb) diff --git a/src/Dodge/WorldEvent/Cloud.hs b/src/Dodge/WorldEvent/Cloud.hs index 2e956eb57..4664ba49f 100644 --- a/src/Dodge/WorldEvent/Cloud.hs +++ b/src/Dodge/WorldEvent/Cloud.hs @@ -19,7 +19,7 @@ makeCloudAt rad t drawFunc p w = w & clouds %~ (theCloud :) , _clRad = rad , _clTimer = t , _clType = SmokeCloud - --, _clEffect = const id + , _clEffect = const id } drawCloudWith :: Float -> Float -> Color -> Cloud -> Picture diff --git a/src/Dodge/WorldEvent/SpawnParticle.hs b/src/Dodge/WorldEvent/SpawnParticle.hs index 96071afc3..38dbf709d 100644 --- a/src/Dodge/WorldEvent/SpawnParticle.hs +++ b/src/Dodge/WorldEvent/SpawnParticle.hs @@ -10,7 +10,7 @@ import Dodge.Base import Dodge.Base.Zone import Dodge.Base.Collide import Dodge.Picture -import Dodge.Picture.Layer +--import Dodge.Picture.Layer import Dodge.WorldEvent.HitEffect import Dodge.WorldEvent.ThingsHit import Dodge.WorldEvent.Cloud @@ -197,8 +197,8 @@ drawFlameletZ rot pt = pictures $ polygon (rectNSWE siz2 (-siz2) (-siz2) siz2) pic = setDepth (z + 20) . uncurryV translate ep - . color (brightX 1 2 $ mixColors (fromIntegral (max 0 (time-2))) (10-fromIntegral time) - white (dark red) + . color (mixColors (fromIntegral (max 0 (time-2))) (10-fromIntegral time) + (V4 1 1 1 3) (V4 1 0 0 1) ) . rotate (negate ( 0.1 * fromIntegral time + rot)) . scale (0.5* sc) (0.5 *sc) @@ -281,12 +281,12 @@ makeGasCloud pos vel w = w theCloud = Cloud { _clPos = pos , _clVel = vel - , _clPict = \_ -> onLayer CrLayer $ color (withAlpha 0.1 col) + , _clPict = \_ -> setLayer 2 . setDepth 30 $ color (withAlpha 0.1 col) $ circleSolid 20 , _clRad = 10 , _clTimer = 400 , _clType = GasCloud - -- , _clEffect = cloudPoisonDamage + , _clEffect = cloudPoisonDamage } (col, g) = runState (takeOne [green,yellow]) $ _randGen w