Cleanup warnings
This commit is contained in:
+23
-29
@@ -6,27 +6,25 @@ import Dodge.Base
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.WorldEvent
|
||||
import Dodge.WallCreatureCollisions
|
||||
--import Dodge.WallCreatureCollisions
|
||||
import Dodge.Creature.Action
|
||||
import Geometry
|
||||
import Picture
|
||||
|
||||
import Data.List
|
||||
import Data.Char
|
||||
import Data.Maybe
|
||||
--import Data.Char
|
||||
--import Data.Maybe
|
||||
import Data.Function
|
||||
import Control.Lens
|
||||
import Control.Applicative
|
||||
--import Control.Applicative
|
||||
import Control.Monad.State
|
||||
import Control.Monad
|
||||
import qualified SDL
|
||||
import qualified SDL.Mixer as Mix
|
||||
--import Control.Monad
|
||||
--import qualified SDL
|
||||
--import qualified SDL.Mixer as Mix
|
||||
import System.Random
|
||||
import qualified Data.Set as S
|
||||
--import qualified Data.Set as S
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import qualified Data.Map as M
|
||||
import Foreign.ForeignPtr
|
||||
import Control.Concurrent
|
||||
--import qualified Data.Map as M
|
||||
|
||||
type CRUpdate = World -> (World -> World,StdGen) -> Creature -> ((World -> World,StdGen), Maybe Creature)
|
||||
|
||||
@@ -45,15 +43,15 @@ stateUpdate u w (f,g) cr =
|
||||
, fmap (updateReloadCounter . doDamage . crAutoReload) $ crOrCorpse =<< maybeCr
|
||||
)
|
||||
where
|
||||
crOrCorpse cr
|
||||
| cr ^. crHP > 0 = Just cr
|
||||
crOrCorpse cr'
|
||||
| cr' ^. crHP > 0 = Just cr'
|
||||
| otherwise = Nothing
|
||||
deathEff
|
||||
| cr ^.crHP > 0 = id
|
||||
| otherwise = stopSoundFrom (CrWeaponSound (_crID cr))
|
||||
. over decorations addCorpse
|
||||
. dropByState cr
|
||||
crBeforeDeath = colCrWall w cr
|
||||
--crBeforeDeath = colCrWall w cr
|
||||
addCorpse = insertNewKey
|
||||
$ uncurry translate (_crOldPos cr)
|
||||
$ rotate (_crDir cr)
|
||||
@@ -75,7 +73,7 @@ Given a creature and a velocity, applies friction to that creature and evaluates
|
||||
velocity to carry across frames.
|
||||
-}
|
||||
crFriction :: Creature -> Point2 -> Point2
|
||||
crFriction cr vel = (0,0)
|
||||
crFriction _ _ = (0,0)
|
||||
|
||||
doDamage :: Creature -> Creature
|
||||
doDamage cr = set (crState . crDamage) []
|
||||
@@ -84,9 +82,6 @@ doDamage cr = set (crState . crDamage) []
|
||||
dams = _crDamage $ _crState cr
|
||||
damagedCr = snd $ _crApplyDamage cr dams cr
|
||||
|
||||
sumDamage :: Creature -> DamageType -> Int -> Int
|
||||
sumDamage cr dm x = x + _dmAmount dm
|
||||
|
||||
movementSideEff :: Creature -> World -> World
|
||||
movementSideEff cr w
|
||||
| hasJetPack
|
||||
@@ -178,18 +173,17 @@ updateBarrel
|
||||
-> (World -> World,StdGen)
|
||||
-> Creature
|
||||
-> ((World -> World , StdGen), Maybe Creature)
|
||||
updateBarrel w (f,g) cr
|
||||
updateBarrel _ (f,g) cr
|
||||
| _crHP cr > 0 = ((f, g), newCr)
|
||||
| otherwise = ((f, g), Nothing)
|
||||
where
|
||||
damages = _crDamage $ _crState cr
|
||||
newCr = Just $ doDamage cr
|
||||
|
||||
-- it is easy to leave off the "f" here
|
||||
-- should find some better way of doing all this that is less prone to error
|
||||
updateExpBarrel ::
|
||||
World -> (World -> World,StdGen) -> Creature -> ((World -> World , StdGen), Maybe Creature)
|
||||
updateExpBarrel w (f,g) cr
|
||||
updateExpBarrel _ (f,g) cr
|
||||
| _crHP cr > 0 = ((f . foldr (.) id pierceSparks . hiss, g'), newCr)
|
||||
| otherwise = ((f . makeExplosionAt (_crPos cr) . stopSounds , g'), Nothing)
|
||||
where
|
||||
@@ -205,13 +199,13 @@ updateExpBarrel w (f,g) cr
|
||||
poss = _piercedPoints $ _crSpState $ _crState cr
|
||||
--newCr = Just $ doDamage $ applyFuseDamage cr -- $ foldr perforate cr damages
|
||||
newCr = Just $ applyFuseDamage $ set (crState . crDamage) [] $ damToExpBarrel damages cr
|
||||
perforate :: DamageType -> Creature -> Creature
|
||||
perforate (Piercing amount sp int ep) cr = over (crState . crSpState . piercedPoints)
|
||||
((:) $ int -.- _crPos cr) cr
|
||||
perforate _ cr = cr
|
||||
applyFuseDamage cr = over crHP (\hp -> hp - length (_piercedPoints
|
||||
$ _crSpState $ _crState cr))
|
||||
cr
|
||||
--perforate :: DamageType -> Creature -> Creature
|
||||
--perforate (Piercing amount sp int ep) cr = over (crState . crSpState . piercedPoints)
|
||||
-- ((:) $ int -.- _crPos cr) cr
|
||||
--perforate _ cr = cr
|
||||
applyFuseDamage cr' = over crHP (subtract $ length (_piercedPoints
|
||||
$ _crSpState $ _crState cr'))
|
||||
cr'
|
||||
hiss | null poss = id
|
||||
| otherwise = soundMultiFrom [BarrelHiss 0,BarrelHiss 1] 41 50 1
|
||||
stopSounds = stopSoundFrom (BarrelHiss 0) . stopSoundFrom (BarrelHiss 1)
|
||||
@@ -224,7 +218,7 @@ damToExpBarrel ds cr = foldr damToExpBarrel' (foldr damToExpBarrel' cr pierceDam
|
||||
isPierce _ = False
|
||||
|
||||
damToExpBarrel' :: DamageType -> Creature -> Creature
|
||||
damToExpBarrel' (Piercing amount sp int ep) cr
|
||||
damToExpBarrel' (Piercing amount _ int _) cr
|
||||
= over (crState . crSpState . piercedPoints) ((:) $ int -.- _crPos cr)
|
||||
$ over crHP (\hp -> hp - div amount 200) cr
|
||||
damToExpBarrel' PoisonDam {} cr = cr
|
||||
|
||||
Reference in New Issue
Block a user