Apply all world side effects using list

This commit is contained in:
2021-04-09 00:47:41 +02:00
parent feec924d5d
commit c42c5069ea
16 changed files with 106 additions and 82 deletions
+6 -42
View File
@@ -10,27 +10,26 @@ module Dodge.Data
)
where
import Dodge.Data.Menu
import Dodge.Config.Data
import Dodge.LoadConfig.KeyConfig
import Preload.Data
import Picture.Data
import Geometry.Data
import Sound.Data
import Control.Lens
import Control.Monad.State
import System.Random
import Data.Graph.Inductive
import Data.Int (Int16)
import qualified Data.Set as S
import qualified Data.IntMap.Strict as IM
import qualified Data.Map as M
import qualified SDL.Mixer as Mix
import qualified Data.DList as DL
import SDL (Scancode, MouseButton)
import qualified SDL.Mixer as Mix
import Graphics.Rendering.OpenGL (PrimitiveMode (..),GLfloat,Program,VertexArrayObject,BufferObject)
import Codec.Picture (Image,PixelRGBA8)
import qualified Data.DList as DL
import Dodge.Config.Data
import Dodge.LoadConfig.KeyConfig
import Data.Int (Int16)
data World = World
{ _keys :: !(S.Set Scancode)
@@ -85,7 +84,6 @@ data World = World
, _varMovementStrafeSpeedModifier :: Float
, _debugMode :: Bool
, _config :: Configuration
, _configNeedsUpdate :: Bool
, _sideEffects :: [PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)]
, _doneSideEffects :: [PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)]
}
@@ -526,8 +524,6 @@ data DamageType
data Either3 a b c = E3x1 a | E3x2 b | E3x3 c
data WLID = WLID { _wlIDx :: Int, _wlIDy :: Int, _wlIDid :: Int}
data Wall
= Wall
{ _wlLine :: [Point2] , _wlID :: Int
@@ -596,36 +592,6 @@ data SoundOrigin = InventorySound
| GlassBreakSound Int
deriving (Eq,Ord,Show)
type Poly = [Point2]
data PSType = PutCrit Creature
| PutLS LightSource Picture
| PutButton Button
| PutFlIt FloorItem
| PutPressPlate PressPlate
| PutAutoDoor Point2 Point2
| PutBlock [Int] Color [Point2]
| PutLineBlock Wall Float Float Point2 Point2
| PutTriggerDoor Color (World -> Bool) Point2 Point2
| PutBtDoor Color Point2 Float Point2 Point2
| PutSwitchDoor Color Point2 Float Point2 Point2
| RandPS (State StdGen PSType)
| PutNothing
| CollectivePS
{ _collectiveID :: Int
, _collectiveNum :: Int
, _collectiveFunction :: [Int] -> State StdGen [PSType]
}
| LabelPS { _psLabel :: Int, _ps :: PSType}
| PutWindow { _pwPoly :: [Point2] , _pwColor :: Color
}
data PlacementSpot = PS
{ _psPos :: Point2
, _psRot :: Float
, _psType :: PSType
}
data SubNode a = SN a | InLink | OutLink
makeLenses ''World
makeLenses ''Cloud
@@ -651,8 +617,6 @@ makeLenses ''ForceField
makeLenses ''FFState
makeLenses ''PressPlate
makeLenses ''Button
makeLenses ''PSType
makeLenses ''PlacementSpot
numColor :: Int -> Color
numColor 0 = (1,0,0,1)