Refector
This commit is contained in:
+402
-456
File diff suppressed because it is too large
Load Diff
+187
-187
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,9 @@ module Dodge.Creature
|
|||||||
, module Dodge.Creature.Inanimate
|
, module Dodge.Creature.Inanimate
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
import Dodge.Creature.Stance.Data
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
|
import Dodge.Creature.Impulse.Data
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.AIs
|
import Dodge.AIs
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
|
|||||||
@@ -227,15 +227,15 @@ goalPict cr = let r = _crRad cr in case _crState cr of
|
|||||||
-- | crDam > _crHP cr -> color white $ circleSolid r
|
-- | crDam > _crHP cr -> color white $ circleSolid r
|
||||||
| otherwise -> case head gls of
|
| otherwise -> case head gls of
|
||||||
[] -> sizeColEnemy r white
|
[] -> sizeColEnemy r white
|
||||||
(MoveToFor p i:_) -> dGoals $ sizeColEnemy r green
|
(MoveToFor p i:_) -> dImpulses $ sizeColEnemy r green
|
||||||
(WaitFor x:_) -> dGoals $ sizeColEnemy r yellow
|
(WaitFor x:_) -> dImpulses $ sizeColEnemy r yellow
|
||||||
(FireAt p:_) -> dGoals $ sizeColEnemy r red
|
(FireAt p:_) -> dImpulses $ sizeColEnemy r red
|
||||||
(Reload:_) -> dGoals $ sizeColEnemy r orange
|
(Reload:_) -> dImpulses $ sizeColEnemy r orange
|
||||||
(PathTo p:_) -> dGoals $ sizeColEnemy r cyan
|
(PathTo p:_) -> dImpulses $ sizeColEnemy r cyan
|
||||||
(SubPathTo p i _:_) -> dGoals $ sizeColEnemy r blue
|
(SubPathTo p i _:_) -> dImpulses $ sizeColEnemy r blue
|
||||||
(Search i:_) -> dGoals $ sizeColEnemy r black
|
(Search i:_) -> dImpulses $ sizeColEnemy r black
|
||||||
_ -> dGoals $ sizeColEnemy r magenta
|
_ -> dImpulses $ sizeColEnemy r magenta
|
||||||
where dGoals p = pictures [p, rotate (0 - _crDir cr) $ scale 0.1 0.1 $ color white $ text $ show gls]
|
where dImpulses p = pictures [p, rotate (0 - _crDir cr) $ scale 0.1 0.1 $ color white $ text $ show gls]
|
||||||
_ -> sizeColEnemy r (light $ dim green)
|
_ -> sizeColEnemy r (light $ dim green)
|
||||||
|
|
||||||
startCr :: Creature
|
startCr :: Creature
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
module Dodge.Creature.AI
|
||||||
|
where
|
||||||
|
import Dodge.Data
|
||||||
|
|
||||||
|
import Control.Lens
|
||||||
|
import System.Random
|
||||||
|
|
||||||
|
insectAI
|
||||||
|
:: ( World -> StdGen -> Creature -> (World -> World, StdGen, Creature) )
|
||||||
|
-> World -> (World -> World,StdGen) -> Creature -> ((World -> World,StdGen), Maybe Creature)
|
||||||
|
insectAI = undefined
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
{-# LANGUAGE StrictData #-}
|
||||||
|
module Dodge.Creature.AI.Data
|
||||||
|
where
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
|
import Dodge.Creature.Impulse.Data
|
||||||
|
|
||||||
|
import Control.Lens
|
||||||
|
data Intelligence
|
||||||
|
= Zombie { _crImpulse :: Impulse }
|
||||||
|
| Inanimate
|
||||||
|
|
||||||
@@ -9,8 +9,10 @@ module Dodge.Creature.Action
|
|||||||
where
|
where
|
||||||
import Dodge.Creature.Action.UseItem
|
import Dodge.Creature.Action.UseItem
|
||||||
import Dodge.Creature.Action.Movement
|
import Dodge.Creature.Action.Movement
|
||||||
|
import Dodge.Creature.Stance.Data
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.WorldEvent.Shockwave
|
import Dodge.WorldEvent.Shockwave
|
||||||
import Dodge.Data
|
import Dodge.Data hiding (carriage)
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
import Dodge.WorldEvent
|
import Dodge.WorldEvent
|
||||||
@@ -176,6 +178,16 @@ crTurnTo
|
|||||||
crTurnTo p cr = set crDir dirToTarget cr
|
crTurnTo p cr = set crDir dirToTarget cr
|
||||||
where dirToTarget = argV (p -.- _crPos cr)
|
where dirToTarget = argV (p -.- _crPos cr)
|
||||||
|
|
||||||
|
crRandomTurn
|
||||||
|
:: RandomGen g
|
||||||
|
=> Float -- ^ Max possible angle, supposed to be positive
|
||||||
|
-> Creature
|
||||||
|
-> g
|
||||||
|
-> (Creature, g)
|
||||||
|
crRandomTurn a cr g =
|
||||||
|
let (r, g') = randomR (negate a, a) g
|
||||||
|
in (cr & crDir +~ r, g')
|
||||||
|
|
||||||
crTurnTowardSpeed
|
crTurnTowardSpeed
|
||||||
:: Float -- ^ Turn speed
|
:: Float -- ^ Turn speed
|
||||||
-> Point2 -- ^ Target position
|
-> Point2 -- ^ Target position
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
{-# LANGUAGE StrictData #-}
|
||||||
|
module Dodge.Creature.Impulse.Data
|
||||||
|
where
|
||||||
|
import Dodge.Creature.Stance.Data
|
||||||
|
import Geometry.Data
|
||||||
|
|
||||||
|
import Control.Lens
|
||||||
|
data Impulse
|
||||||
|
= MoveTo Point2
|
||||||
|
| MoveToFor Point2 Int
|
||||||
|
| MoveFire Point2 Point2
|
||||||
|
| PathTo Point2
|
||||||
|
| PathAlong [Point2]
|
||||||
|
| SubPathTo Point2 Int Point2
|
||||||
|
| Wait
|
||||||
|
| WaitFor Int
|
||||||
|
| WaitForID Int Int
|
||||||
|
| FireAt Point2
|
||||||
|
| FireAtID Int Point2
|
||||||
|
| Fire
|
||||||
|
| Reload
|
||||||
|
| IncreaseAlert Int
|
||||||
|
| Guard Point2 Point2
|
||||||
|
| Search Int
|
||||||
|
| SearchNear Point2
|
||||||
|
| AimAt Point2 Int
|
||||||
|
| InitGuard
|
||||||
|
| Init
|
||||||
|
| MeleeAttack Int
|
||||||
|
| InitTrackYou
|
||||||
|
| TrackYou
|
||||||
|
| Track Int
|
||||||
|
| TrackFor Int Int
|
||||||
|
| TurnByFor Float Int
|
||||||
|
| TurnTo Point2
|
||||||
|
| TurnToward Point2
|
||||||
|
| TurnTowardAngle Float
|
||||||
|
| StrafeLeftAround Int Point2
|
||||||
|
| StrafeRightAround Int Point2
|
||||||
|
| StrafeLeftFor Int
|
||||||
|
| StrafeRightFor Int
|
||||||
|
| StrafeLeftForSpeed Int Float
|
||||||
|
| StrafeRightForSpeed Int Float
|
||||||
|
| StrafeLeftFire
|
||||||
|
| StrafeRightFire
|
||||||
|
| MoveForwardFor Int
|
||||||
|
| MoveForwardFire
|
||||||
|
| MoveBackwardFor Int
|
||||||
|
| MoveByFor Point2 Int
|
||||||
|
| MoveBackwardFire
|
||||||
|
| ImpulseID Int Impulse
|
||||||
|
| AtRange Float
|
||||||
|
| AtRanges Float Float
|
||||||
|
| RepeatAction Int Impulse
|
||||||
|
| MakeJudgement
|
||||||
|
| SetPosture Posture
|
||||||
|
deriving (Eq,Show)
|
||||||
@@ -4,6 +4,9 @@ Inanimate objects such as lamps, barrels, etc
|
|||||||
module Dodge.Creature.Inanimate
|
module Dodge.Creature.Inanimate
|
||||||
where
|
where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.Creature.Stance.Data
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
|
import Dodge.Creature.Impulse.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Picture.Layer
|
import Dodge.Picture.Layer
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ module Dodge.Creature.Picture
|
|||||||
, circLine
|
, circLine
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.Picture.Layer
|
import Dodge.Picture.Layer
|
||||||
import Picture
|
import Picture
|
||||||
import Geometry
|
import Geometry
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
{-# LANGUAGE StrictData #-}
|
||||||
|
module Dodge.Creature.Stance.Data
|
||||||
|
where
|
||||||
|
import Geometry.Data
|
||||||
|
|
||||||
|
import Control.Lens
|
||||||
|
data Stance = Stance
|
||||||
|
{_carriage :: Carriage
|
||||||
|
,_posture :: Posture
|
||||||
|
}
|
||||||
|
deriving (Eq,Show)
|
||||||
|
data Carriage
|
||||||
|
= Walking { _stepCycle :: Int, _stepToAdd :: Int }
|
||||||
|
| Standing
|
||||||
|
| Floating
|
||||||
|
| Flying
|
||||||
|
| Boosting Point2
|
||||||
|
deriving (Eq,Show)
|
||||||
|
data Posture = Aiming | AtEase
|
||||||
|
deriving (Eq,Show)
|
||||||
|
|
||||||
|
makeLenses ''Stance
|
||||||
|
makeLenses ''Carriage
|
||||||
|
makeLenses ''Posture
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
module Dodge.Creature.State where
|
module Dodge.Creature.State where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
|
import Dodge.Creature.Stance.Data
|
||||||
|
import Dodge.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
import Dodge.RandomHelp
|
import Dodge.RandomHelp
|
||||||
|
|||||||
@@ -4,11 +4,13 @@ module Dodge.Creature.State.Data
|
|||||||
where
|
where
|
||||||
import Geometry
|
import Geometry
|
||||||
import Dodge.Data.DamageType
|
import Dodge.Data.DamageType
|
||||||
|
import Dodge.Creature.Impulse.Data
|
||||||
|
import Dodge.Creature.Stance.Data
|
||||||
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
|
||||||
data CreatureState = CrSt
|
data CreatureState = CrSt
|
||||||
{ _goals :: [[Goal]]
|
{ _goals :: [[Impulse]]
|
||||||
, _stance :: Stance
|
, _stance :: Stance
|
||||||
, _faction :: Faction
|
, _faction :: Faction
|
||||||
, _crDamage :: [DamageType]
|
, _crDamage :: [DamageType]
|
||||||
@@ -27,72 +29,7 @@ data CrSpState
|
|||||||
= Barrel { _piercedPoints :: [Point2]}
|
= Barrel { _piercedPoints :: [Point2]}
|
||||||
| GenCr
|
| GenCr
|
||||||
deriving (Eq,Show,Ord)
|
deriving (Eq,Show,Ord)
|
||||||
data Goal
|
|
||||||
= MoveTo Point2
|
|
||||||
| MoveToFor Point2 Int
|
|
||||||
| MoveFire Point2 Point2
|
|
||||||
| PathTo Point2
|
|
||||||
| PathAlong [Point2]
|
|
||||||
| SubPathTo Point2 Int Point2
|
|
||||||
| Wait
|
|
||||||
| WaitFor Int
|
|
||||||
| WaitForID Int Int
|
|
||||||
| FireAt Point2
|
|
||||||
| FireAtID Int Point2
|
|
||||||
| Fire
|
|
||||||
| Reload
|
|
||||||
| IncreaseAlert Int
|
|
||||||
| Guard Point2 Point2
|
|
||||||
| Search Int
|
|
||||||
| SearchNear Point2
|
|
||||||
| AimAt Point2 Int
|
|
||||||
| InitGuard
|
|
||||||
| Init
|
|
||||||
| MeleeAttack Int
|
|
||||||
| InitTrackYou
|
|
||||||
| TrackYou
|
|
||||||
| Track Int
|
|
||||||
| TrackFor Int Int
|
|
||||||
| TurnByFor Float Int
|
|
||||||
| TurnTo Point2
|
|
||||||
| TurnToward Point2
|
|
||||||
| TurnTowardAngle Float
|
|
||||||
| StrafeLeftAround Int Point2
|
|
||||||
| StrafeRightAround Int Point2
|
|
||||||
| StrafeLeftFor Int
|
|
||||||
| StrafeRightFor Int
|
|
||||||
| StrafeLeftForSpeed Int Float
|
|
||||||
| StrafeRightForSpeed Int Float
|
|
||||||
| StrafeLeftFire
|
|
||||||
| StrafeRightFire
|
|
||||||
| MoveForwardFor Int
|
|
||||||
| MoveForwardFire
|
|
||||||
| MoveBackwardFor Int
|
|
||||||
| MoveByFor Point2 Int
|
|
||||||
| MoveBackwardFire
|
|
||||||
| GoalID Int Goal
|
|
||||||
| AtRange Float
|
|
||||||
| AtRanges Float Float
|
|
||||||
| RepeatAction Int Goal
|
|
||||||
| MakeJudgement
|
|
||||||
| SetPosture Posture
|
|
||||||
deriving (Eq,Show)
|
|
||||||
data Stance = Stance
|
|
||||||
{_carriage :: Carriage
|
|
||||||
,_posture :: Posture
|
|
||||||
}
|
|
||||||
deriving (Eq,Show)
|
|
||||||
data Carriage
|
|
||||||
= Walking { _stepCycle :: Int, _stepToAdd :: Int }
|
|
||||||
| Standing
|
|
||||||
| Floating
|
|
||||||
| Flying
|
|
||||||
| Boosting Point2
|
|
||||||
deriving (Eq,Show)
|
|
||||||
data Posture = Aiming | AtEase
|
|
||||||
deriving (Eq,Show)
|
|
||||||
data Mind = ZombieMind | HumanMind
|
|
||||||
deriving (Eq,Show)
|
|
||||||
data Faction
|
data Faction
|
||||||
= GenericFaction Int
|
= GenericFaction Int
|
||||||
| ZombieFaction
|
| ZombieFaction
|
||||||
@@ -104,6 +41,4 @@ data Faction
|
|||||||
|
|
||||||
makeLenses ''CreatureState
|
makeLenses ''CreatureState
|
||||||
makeLenses ''CrSpState
|
makeLenses ''CrSpState
|
||||||
makeLenses ''Goal
|
makeLenses ''Impulse
|
||||||
makeLenses ''Carriage
|
|
||||||
makeLenses ''Posture
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import Dodge.Data
|
|||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Creature.Action
|
import Dodge.Creature.Action
|
||||||
import Dodge.Creature.State
|
import Dodge.Creature.State
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
|
import Dodge.Creature.Stance.Data
|
||||||
import Dodge.Update.UsingInput
|
import Dodge.Update.UsingInput
|
||||||
import Dodge.Config.KeyConfig
|
import Dodge.Config.KeyConfig
|
||||||
import Dodge.Item.Attachment.Data
|
import Dodge.Item.Attachment.Data
|
||||||
|
|||||||
+4
-33
@@ -10,16 +10,14 @@ module Dodge.Data
|
|||||||
( module Dodge.Data
|
( module Dodge.Data
|
||||||
, module Dodge.Data.DamageType
|
, module Dodge.Data.DamageType
|
||||||
, module Dodge.Data.SoundOrigin
|
, module Dodge.Data.SoundOrigin
|
||||||
, module Dodge.Creature.Data
|
|
||||||
, module Dodge.Creature.State.Data
|
|
||||||
, Point2 (..)
|
, Point2 (..)
|
||||||
, Sound (..)
|
, Sound (..)
|
||||||
, soundTime
|
, soundTime
|
||||||
)
|
) where
|
||||||
where
|
|
||||||
import Dodge.Picture.Layer.Data
|
import Dodge.Picture.Layer.Data
|
||||||
import Dodge.Creature.Data
|
import Dodge.Creature.Data
|
||||||
import Dodge.Creature.State.Data
|
import Dodge.Creature.State.Data
|
||||||
|
import Dodge.Creature.Stance.Data
|
||||||
import Dodge.Data.Menu
|
import Dodge.Data.Menu
|
||||||
import Dodge.Data.SoundOrigin
|
import Dodge.Data.SoundOrigin
|
||||||
import Dodge.Data.DamageType
|
import Dodge.Data.DamageType
|
||||||
@@ -46,7 +44,6 @@ import SDL (Scancode, MouseButton)
|
|||||||
import qualified SDL.Mixer as Mix
|
import qualified SDL.Mixer as Mix
|
||||||
import Graphics.Rendering.OpenGL (PrimitiveMode (..),GLfloat,Program,VertexArrayObject,BufferObject)
|
import Graphics.Rendering.OpenGL (PrimitiveMode (..),GLfloat,Program,VertexArrayObject,BufferObject)
|
||||||
import Codec.Picture (Image,PixelRGBA8)
|
import Codec.Picture (Image,PixelRGBA8)
|
||||||
|
|
||||||
data World = World
|
data World = World
|
||||||
{ _keys :: !(S.Set Scancode)
|
{ _keys :: !(S.Set Scancode)
|
||||||
, _mouseButtons :: !(S.Set MouseButton)
|
, _mouseButtons :: !(S.Set MouseButton)
|
||||||
@@ -103,14 +100,11 @@ data World = World
|
|||||||
, _sideEffects :: [PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)]
|
, _sideEffects :: [PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)]
|
||||||
, _doneSideEffects :: [PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)]
|
, _doneSideEffects :: [PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)]
|
||||||
}
|
}
|
||||||
|
|
||||||
data Corpse = Corpse
|
data Corpse = Corpse
|
||||||
{ _cpPos :: Point2
|
{ _cpPos :: Point2
|
||||||
, _cpPict :: Picture
|
, _cpPict :: Picture
|
||||||
, _cpRes :: Creature
|
, _cpRes :: Creature
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data Cloud = Cloud
|
data Cloud = Cloud
|
||||||
{ _clID :: Int
|
{ _clID :: Int
|
||||||
, _clPos :: Point2
|
, _clPos :: Point2
|
||||||
@@ -120,7 +114,6 @@ data Cloud = Cloud
|
|||||||
, _clTimer :: Int
|
, _clTimer :: Int
|
||||||
, _clEffect :: Cloud -> World -> World
|
, _clEffect :: Cloud -> World -> World
|
||||||
}
|
}
|
||||||
|
|
||||||
data LightSource = LS
|
data LightSource = LS
|
||||||
{ _lsID :: !Int
|
{ _lsID :: !Int
|
||||||
, _lsPos :: !Point2
|
, _lsPos :: !Point2
|
||||||
@@ -128,14 +121,12 @@ data LightSource = LS
|
|||||||
, _lsRad :: !Float
|
, _lsRad :: !Float
|
||||||
, _lsIntensity :: !Float
|
, _lsIntensity :: !Float
|
||||||
}
|
}
|
||||||
|
|
||||||
data TempLightSource = TLS
|
data TempLightSource = TLS
|
||||||
{ _tlsPos :: !Point2
|
{ _tlsPos :: !Point2
|
||||||
, _tlsRad :: !Float
|
, _tlsRad :: !Float
|
||||||
, _tlsIntensity :: !Float
|
, _tlsIntensity :: !Float
|
||||||
, _tlsUpdate :: World -> TempLightSource -> (World, Maybe TempLightSource)
|
, _tlsUpdate :: World -> TempLightSource -> (World, Maybe TempLightSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
data Creature = Creature
|
data Creature = Creature
|
||||||
{ _crPos :: Point2
|
{ _crPos :: Point2
|
||||||
, _crOldPos :: Point2
|
, _crOldPos :: Point2
|
||||||
@@ -158,12 +149,10 @@ data Creature = Creature
|
|||||||
, _crCorpse :: Picture
|
, _crCorpse :: Picture
|
||||||
, _crApplyDamage :: [DamageType] -> Creature -> (World -> World,Creature)
|
, _crApplyDamage :: [DamageType] -> Creature -> (World -> World,Creature)
|
||||||
}
|
}
|
||||||
|
|
||||||
data WorldState
|
data WorldState
|
||||||
= DoorNumOpen Int
|
= DoorNumOpen Int
|
||||||
| CrNumAlive Int
|
| CrNumAlive Int
|
||||||
deriving (Eq,Ord)
|
deriving (Eq,Ord)
|
||||||
|
|
||||||
data Button = Button
|
data Button = Button
|
||||||
{ _btPict :: Picture
|
{ _btPict :: Picture
|
||||||
, _btPos :: Point2
|
, _btPos :: Point2
|
||||||
@@ -173,10 +162,8 @@ data Button = Button
|
|||||||
, _btText :: String
|
, _btText :: String
|
||||||
, _btState :: ButtonState
|
, _btState :: ButtonState
|
||||||
}
|
}
|
||||||
|
|
||||||
data ButtonState = BtOn | BtOff | BtNoLabel
|
data ButtonState = BtOn | BtOff | BtNoLabel
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
data PressPlate = PressPlate
|
data PressPlate = PressPlate
|
||||||
{ _ppPict :: Picture
|
{ _ppPict :: Picture
|
||||||
, _ppPos :: Point2
|
, _ppPos :: Point2
|
||||||
@@ -185,13 +172,10 @@ data PressPlate = PressPlate
|
|||||||
, _ppID :: Int
|
, _ppID :: Int
|
||||||
, _ppText :: String
|
, _ppText :: String
|
||||||
}
|
}
|
||||||
|
|
||||||
data FloorItem = FlIt { _flIt :: Item , _flItPos :: Point2 , _flItRot :: Float, _flItID :: Int}
|
data FloorItem = FlIt { _flIt :: Item , _flItPos :: Point2 , _flItRot :: Float, _flItID :: Int}
|
||||||
|
|
||||||
data ItemPos
|
data ItemPos
|
||||||
= InInv { _itCrId :: Int , _itInvId :: Int }
|
= InInv { _itCrId :: Int , _itInvId :: Int }
|
||||||
| OnFloor { _itFlID :: Int }
|
| OnFloor { _itFlID :: Int }
|
||||||
|
|
||||||
data Item
|
data Item
|
||||||
= Weapon
|
= Weapon
|
||||||
{ _itName :: String
|
{ _itName :: String
|
||||||
@@ -287,7 +271,6 @@ data Item
|
|||||||
, _itScrollDown :: Int -> World -> World
|
, _itScrollDown :: Int -> World -> World
|
||||||
}
|
}
|
||||||
| NoItem
|
| NoItem
|
||||||
|
|
||||||
data ItEffect = NoItEffect
|
data ItEffect = NoItEffect
|
||||||
| ItInvEffect
|
| ItInvEffect
|
||||||
{_itInvEffect :: Creature -> Int -> World -> World
|
{_itInvEffect :: Creature -> Int -> World -> World
|
||||||
@@ -306,15 +289,12 @@ data ItZoom = ItZoom
|
|||||||
,_itZoomMin :: Float
|
,_itZoomMin :: Float
|
||||||
,_itZoomFac :: Float
|
,_itZoomFac :: Float
|
||||||
}
|
}
|
||||||
|
|
||||||
data IntID a = IntID Int a
|
data IntID a = IntID Int a
|
||||||
|
|
||||||
data HammerPosition
|
data HammerPosition
|
||||||
= HammerDown
|
= HammerDown
|
||||||
| HammerReleased
|
| HammerReleased
|
||||||
| HammerUp
|
| HammerUp
|
||||||
| NoHammer
|
| NoHammer
|
||||||
|
|
||||||
data ItemIdentity
|
data ItemIdentity
|
||||||
= Pistol
|
= Pistol
|
||||||
| SpreadGun
|
| SpreadGun
|
||||||
@@ -346,11 +326,8 @@ data ItemIdentity
|
|||||||
| LightningGun
|
| LightningGun
|
||||||
| PoisonSprayer
|
| PoisonSprayer
|
||||||
deriving (Eq,Show,Ord,Enum)
|
deriving (Eq,Show,Ord,Enum)
|
||||||
|
{- Objects without ids.
|
||||||
{-
|
Update themselves, perhaps with side effects. -}
|
||||||
Objects without ids.
|
|
||||||
Update themselves, perhaps with side effects.
|
|
||||||
-}
|
|
||||||
data Particle
|
data Particle
|
||||||
= Particle
|
= Particle
|
||||||
{ _ptDraw :: Particle -> Picture
|
{ _ptDraw :: Particle -> Picture
|
||||||
@@ -389,10 +366,8 @@ data Particle
|
|||||||
, _btMaxTime' :: Int
|
, _btMaxTime' :: Int
|
||||||
, _btTimer' :: Int
|
, _btTimer' :: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
type HitEffect = Particle -> [(Point2, (Either3 Creature Wall ForceField))] -> World
|
type HitEffect = Particle -> [(Point2, (Either3 Creature Wall ForceField))] -> World
|
||||||
-> (World,Maybe Particle)
|
-> (World,Maybe Particle)
|
||||||
|
|
||||||
data Projectile
|
data Projectile
|
||||||
= Projectile
|
= Projectile
|
||||||
{ _pjPos :: Point2
|
{ _pjPos :: Point2
|
||||||
@@ -411,9 +386,7 @@ data Projectile
|
|||||||
, _pjUpdate :: World -> World
|
, _pjUpdate :: World -> World
|
||||||
, _pjPayload :: Point2-> World -> World
|
, _pjPayload :: Point2-> World -> World
|
||||||
}
|
}
|
||||||
|
|
||||||
data Either3 a b c = E3x1 a | E3x2 b | E3x3 c
|
data Either3 a b c = E3x1 a | E3x2 b | E3x3 c
|
||||||
|
|
||||||
data Wall
|
data Wall
|
||||||
= Wall
|
= Wall
|
||||||
{ _wlLine :: (Point2,Point2)
|
{ _wlLine :: (Point2,Point2)
|
||||||
@@ -454,7 +427,6 @@ data Wall
|
|||||||
, _blDegrades :: [Int]
|
, _blDegrades :: [Int]
|
||||||
, _blShadows :: [Int]
|
, _blShadows :: [Int]
|
||||||
}
|
}
|
||||||
|
|
||||||
data ForceField = FF
|
data ForceField = FF
|
||||||
{ _ffLine :: [Point2] , _ffID :: Int
|
{ _ffLine :: [Point2] , _ffID :: Int
|
||||||
, _ffColor :: Color
|
, _ffColor :: Color
|
||||||
@@ -468,7 +440,6 @@ makeLenses ''Cloud
|
|||||||
makeLenses ''Creature
|
makeLenses ''Creature
|
||||||
makeLenses ''LightSource
|
makeLenses ''LightSource
|
||||||
makeLenses ''TempLightSource
|
makeLenses ''TempLightSource
|
||||||
makeLenses ''Stance
|
|
||||||
makeLenses ''Item
|
makeLenses ''Item
|
||||||
makeLenses ''ItemPos
|
makeLenses ''ItemPos
|
||||||
makeLenses ''ItEffect
|
makeLenses ''ItEffect
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ data Creature = Creature
|
|||||||
}
|
}
|
||||||
|
|
||||||
data CreatureState = CrSt
|
data CreatureState = CrSt
|
||||||
{ _goals :: [[Goal]]
|
{ _goals :: [[Impulse]]
|
||||||
, _stance :: Stance
|
, _stance :: Stance
|
||||||
, _faction :: Faction
|
, _faction :: Faction
|
||||||
, _crDamage :: [DamageType]
|
, _crDamage :: [DamageType]
|
||||||
@@ -157,7 +157,7 @@ data CrSpState
|
|||||||
= Barrel { _piercedPoints :: [Point2]}
|
= Barrel { _piercedPoints :: [Point2]}
|
||||||
| GenCr
|
| GenCr
|
||||||
deriving (Eq,Show,Ord)
|
deriving (Eq,Show,Ord)
|
||||||
data Goal
|
data Impulse
|
||||||
= MoveTo Point2
|
= MoveTo Point2
|
||||||
| MoveToFor Point2 Int
|
| MoveToFor Point2 Int
|
||||||
| MoveFire Point2 Point2
|
| MoveFire Point2 Point2
|
||||||
@@ -200,10 +200,10 @@ data Goal
|
|||||||
| MoveBackwardFor Int
|
| MoveBackwardFor Int
|
||||||
| MoveByFor Point2 Int
|
| MoveByFor Point2 Int
|
||||||
| MoveBackwardFire
|
| MoveBackwardFire
|
||||||
| GoalID Int Goal
|
| ImpulseID Int Impulse
|
||||||
| AtRange Float
|
| AtRange Float
|
||||||
| AtRanges Float Float
|
| AtRanges Float Float
|
||||||
| RepeatAction Int Goal
|
| RepeatAction Int Impulse
|
||||||
| MakeJudgement
|
| MakeJudgement
|
||||||
| SetPosture Posture
|
| SetPosture Posture
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
@@ -652,7 +652,7 @@ makeLenses ''Cloud
|
|||||||
makeLenses ''Creature
|
makeLenses ''Creature
|
||||||
makeLenses ''CreatureState
|
makeLenses ''CreatureState
|
||||||
makeLenses ''CrSpState
|
makeLenses ''CrSpState
|
||||||
makeLenses ''Goal
|
makeLenses ''Impulse
|
||||||
makeLenses ''LightSource
|
makeLenses ''LightSource
|
||||||
makeLenses ''TempLightSource
|
makeLenses ''TempLightSource
|
||||||
makeLenses ''Stance
|
makeLenses ''Stance
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ This module contains prototypical data structures.
|
|||||||
module Dodge.Default where
|
module Dodge.Default where
|
||||||
import Dodge.Item.Weapon.ExtraEffect
|
import Dodge.Item.Weapon.ExtraEffect
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.Creature.Stance.Data
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.Data.Menu
|
import Dodge.Data.Menu
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import Geometry
|
|||||||
import Picture
|
import Picture
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Room
|
import Dodge.Room
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.Room.Procedural
|
import Dodge.Room.Procedural
|
||||||
import Dodge.Room.RoadBlock
|
import Dodge.Room.RoadBlock
|
||||||
import Dodge.Room.Data
|
import Dodge.Room.Data
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import Dodge.WorldEvent
|
|||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
import Dodge.RandomHelp
|
import Dodge.RandomHelp
|
||||||
import Dodge.WorldEvent.Shockwave
|
import Dodge.WorldEvent.Shockwave
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.Creature.Property
|
import Dodge.Creature.Property
|
||||||
import Geometry
|
import Geometry
|
||||||
import Picture
|
import Picture
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import Dodge.WorldEvent.SpawnParticle
|
|||||||
import Dodge.WorldEvent.ThingsHit
|
import Dodge.WorldEvent.ThingsHit
|
||||||
import Dodge.WorldEvent.HelperParticle
|
import Dodge.WorldEvent.HelperParticle
|
||||||
import Dodge.WorldEvent.Flash
|
import Dodge.WorldEvent.Flash
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Geometry
|
import Geometry
|
||||||
import Picture
|
import Picture
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Creation of doors that open when creatures approach them.
|
|||||||
module Dodge.LevelGen.AutoDoor
|
module Dodge.LevelGen.AutoDoor
|
||||||
where
|
where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
import Dodge.Creature.Property
|
import Dodge.Creature.Property
|
||||||
|
|||||||
+4
-4
@@ -147,14 +147,14 @@ makePathBetweenPs' a b w = fmap (mapMaybe (lab g)) $ makePathBetween' a b w
|
|||||||
where g = _pathGraph w
|
where g = _pathGraph w
|
||||||
|
|
||||||
|
|
||||||
pointTowardsGoal :: Point2 -> Point2 -> World -> Maybe Point2
|
pointTowardsImpulse :: Point2 -> Point2 -> World -> Maybe Point2
|
||||||
pointTowardsGoal a b w = join $ fmap (listToMaybe . filter (flip (isWalkable a) w))
|
pointTowardsImpulse a b w = join $ fmap (listToMaybe . filter (flip (isWalkable a) w))
|
||||||
-- $ pathBetween a b w
|
-- $ pathBetween a b w
|
||||||
$ makePathBetweenPs a b w
|
$ makePathBetweenPs a b w
|
||||||
--
|
--
|
||||||
|
|
||||||
pointTowardsGoal' :: Point2 -> Point2 -> World -> Either String Point2
|
pointTowardsImpulse' :: Point2 -> Point2 -> World -> Either String Point2
|
||||||
pointTowardsGoal' a b w = join $ fmap (maybeToEither "NOSEEPATH" . listToMaybe . filter (flip (isWalkable a) w))
|
pointTowardsImpulse' a b w = join $ fmap (maybeToEither "NOSEEPATH" . listToMaybe . filter (flip (isWalkable a) w))
|
||||||
$ makePathBetweenPs' b a w
|
$ makePathBetweenPs' b a w
|
||||||
|
|
||||||
maybeToEither :: a -> Maybe b -> Either a b
|
maybeToEither :: a -> Maybe b -> Either a b
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import Dodge.Room.Link
|
|||||||
import Dodge.Room.Corridor
|
import Dodge.Room.Corridor
|
||||||
import Dodge.LevelGen.Data
|
import Dodge.LevelGen.Data
|
||||||
import Dodge.Creature
|
import Dodge.Creature
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.RandomHelp
|
import Dodge.RandomHelp
|
||||||
import Dodge.Layout.Tree.Polymorphic
|
import Dodge.Layout.Tree.Polymorphic
|
||||||
import Geometry
|
import Geometry
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ module Dodge.Room.NoNeedWeapon
|
|||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Creature
|
import Dodge.Creature
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.Creature.Inanimate
|
import Dodge.Creature.Inanimate
|
||||||
import Dodge.Room.Data
|
import Dodge.Room.Data
|
||||||
import Dodge.Room.Procedural
|
import Dodge.Room.Procedural
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
module Dodge.WallCreatureCollisions where
|
module Dodge.WallCreatureCollisions where
|
||||||
-- imports {{{
|
-- imports {{{
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Geometry
|
import Geometry
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import Dodge.WorldEvent.Explosion
|
|||||||
import Dodge.WorldEvent.SpawnParticle
|
import Dodge.WorldEvent.SpawnParticle
|
||||||
import Dodge.WorldEvent.Shockwave
|
import Dodge.WorldEvent.Shockwave
|
||||||
import Dodge.LightSources
|
import Dodge.LightSources
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
module Dodge.WorldEvent.HitEffect
|
module Dodge.WorldEvent.HitEffect
|
||||||
where
|
where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
|
|
||||||
import Geometry
|
import Geometry
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ module Dodge.WorldEvent.Shockwave
|
|||||||
)
|
)
|
||||||
where
|
where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Picture.Layer
|
import Dodge.Picture.Layer
|
||||||
import Geometry
|
import Geometry
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ Creation of particles in the world.
|
|||||||
module Dodge.WorldEvent.SpawnParticle
|
module Dodge.WorldEvent.SpawnParticle
|
||||||
where
|
where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.Creature.State.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Picture
|
import Dodge.Picture
|
||||||
import Dodge.Picture.Layer
|
import Dodge.Picture.Layer
|
||||||
|
|||||||
Reference in New Issue
Block a user