Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15105 additions and 13343 deletions
+126 -119
View File
@@ -1,133 +1,140 @@
module Dodge.Default.World where
import Dodge.Data.Hammer
import Dodge.Data
import Geometry.Data
import Geometry.Polygon
import System.Random
import qualified IntMapHelp as IM
import MaybeHelp
import Data.Graph.Inductive.Graph hiding ((&))
import qualified Data.Map as M
import qualified Data.Set as S
import Data.Graph.Inductive.Graph hiding ((&))
import Dodge.Data.World
import Geometry.Data
import Geometry.Polygon
import qualified IntMapHelp as IM
import System.Random
--import Data.Graph.Inductive.NodeMap
defaultWorld :: World
defaultWorld = World
{ _cWorld = defaultCWorld
, _toPlaySounds = M.empty
, _playingSounds = M.empty
, _randGen = mkStdGen 2
, _keys = S.empty
, _mouseButtons = mempty
, _mousePos = V2 0 0
, _hammers = defaultWorldHammers
, _testFloat = 0
, _lLine = (0,0)
, _rLine = (0,0)
, _lSelect = 0
, _rSelect = 0
, _backspaceTimer = 0
, _timeFlow = NormalTimeFlow
, _rbOptions = NoRightButtonOptions
}
defaultWorld =
World
{ _cWorld = defaultCWorld
, _toPlaySounds = M.empty
, _playingSounds = M.empty
, _randGen = mkStdGen 2
, _keys = S.empty
, _mouseButtons = mempty
, _mousePos = V2 0 0
, _hammers = defaultWorldHammers
, _testFloat = 0
, _lLine = (0, 0)
, _rLine = (0, 0)
, _lSelect = 0
, _rSelect = 0
, _backspaceTimer = 0
, _timeFlow = NormalTimeFlow
, _rbOptions = NoRightButtonOptions
}
defaultCWorld :: CWorld
defaultCWorld = CWorld
{ _cameraCenter = V2 0 0
, _cameraRot = 0
, _cameraZoom = 1
, _magnets = IM.empty
, _itemZoom = 1
, _defaultZoom = 1
, _cameraViewFrom = V2 0 0
, _viewDistance = 1000
, _modifications = IM.empty
, _creatures = IM.empty
, _crZoning = mempty --Zoning IM.empty crZoneSize zoneOfCreature
, _creatureGroups = IM.empty
, _clouds = mempty
, _clZoning = mempty
, _gusts = IM.empty
, _gsZoning = mempty --Zoning IM.empty clZoneSize (zonePos _guPos)
, _itemLocations = IM.empty
, _props = IM.empty
, _projectiles = IM.empty
, _instantBullets = []
, _bullets = []
-- , _instantParticles = []
-- , _particles = []
, _flames = []
, _radarSweeps = []
, _sparks = []
, _posEvents = []
, _energyBalls = []
, _radarBlips = []
, _flares = []
, _newBeams = WorldBeams [] [] [] []
, _beams = WorldBeams [] [] [] []
, _teslaArcs = []
, _shockwaves = []
, _lasers = []
, _lasersToDraw = []
, _tractorBeams = mempty
, _linearShockwaves = mempty
, _walls = IM.empty
, _wallDamages = IM.empty
, _blocks = IM.empty
, _machines = IM.empty
, _terminals = IM.empty
, _doors = IM.empty
, _coordinates = IM.empty
, _triggers = IM.empty
, _wlZoning = IM.empty --Zoning IM.empty wlZoneSize zoneOfWall
, _floorItems = IM.empty
, _floorTiles = []
, _yourID = 0
, _worldEvents = []
, _delayedEvents = []
, _pressPlates = IM.empty
, _buttons = IM.empty
, _corpses = IM.empty
, _decorations = IM.empty
--, _savedWorlds = M.empty
-- , _menuLayers = []
, _clickMousePos = V2 0 0
, _pathGraph = Data.Graph.Inductive.Graph.empty
-- , _pathGraphP = mempty
, _pnZoning = mempty
, _peZoning = mempty
, _hud = HUD
{ _hudElement = DisplayInventory NoSubInventory
, _carteCenter = V2 0 0
, _carteZoom = 0.5
, _carteRot = 0
defaultCWorld =
CWorld
{ _cameraCenter = V2 0 0
, _cameraRot = 0
, _cameraZoom = 1
, _magnets = IM.empty
, _itemZoom = 1
, _defaultZoom = 1
, _cameraViewFrom = V2 0 0
, _viewDistance = 1000
, _modifications = IM.empty
, _creatures = IM.empty
, _crZoning = mempty --Zoning IM.empty crZoneSize zoneOfCreature
, _creatureGroups = IM.empty
, _clouds = mempty
, _clZoning = mempty
, _gusts = IM.empty
, _gsZoning = mempty --Zoning IM.empty clZoneSize (zonePos _guPos)
, _itemLocations = IM.empty
, _props = IM.empty
, _projectiles = IM.empty
, _instantBullets = []
, _bullets = []
, -- , _instantParticles = []
-- , _particles = []
_flames = []
, _radarSweeps = []
, _sparks = []
, _posEvents = []
, _energyBalls = []
, _radarBlips = []
, _flares = []
, _newBeams = WorldBeams [] [] [] []
, _beams = WorldBeams [] [] [] []
, _teslaArcs = []
, _shockwaves = []
, _lasers = []
, _lasersToDraw = []
, _tractorBeams = mempty
, _linearShockwaves = mempty
, _walls = IM.empty
, _wallDamages = IM.empty
, _blocks = IM.empty
, _machines = IM.empty
, _terminals = IM.empty
, _doors = IM.empty
, _coordinates = IM.empty
, _triggers = IM.empty
, _wlZoning = IM.empty --Zoning IM.empty wlZoneSize zoneOfWall
, _floorItems = IM.empty
, _floorTiles = []
, _yourID = 0
, _worldEvents = []
, _delayedEvents = []
, _pressPlates = IM.empty
, _buttons = IM.empty
, _corpses = IM.empty
, _decorations = IM.empty
, --, _savedWorlds = M.empty
-- , _menuLayers = []
_clickMousePos = V2 0 0
, _pathGraph = Data.Graph.Inductive.Graph.empty
, -- , _pathGraphP = mempty
_pnZoning = mempty
, _peZoning = mempty
, _hud =
HUD
{ _hudElement = DisplayInventory NoSubInventory
, _carteCenter = V2 0 0
, _carteZoom = 0.5
, _carteRot = 0
}
, _lightSources = IM.empty
, _tempLightSources = []
, _closeObjects = []
, _seenLocations =
IM.fromList
[ (0, (WdYouPos, "CURRENT POSITION"))
, (1, (WdP2Const (V2 0 0), "START POSITION"))
]
, _selLocation = 0
, _foregroundShapes = mempty
, _distortions = []
, _gameRooms = []
, _roomClipping = []
, _worldClock = 0
, _worldBounds = defaultBounds
, _maybeWorld = Nothing'
, _rewindWorlds = []
, _genParams = GenParams M.empty
, -- , _genPlacements = IM.empty
-- , _genRooms = IM.empty
_deathDelay = Nothing
, _boundBox = square 100
, _boundDist = (100, -100, 100, -100)
}
, _lightSources = IM.empty
, _tempLightSources = []
, _closeObjects = []
, _seenLocations = IM.fromList
[(0, (WdYouPos, "CURRENT POSITION"))
,(1, (WdP2Const (V2 0 0) , "START POSITION"))
]
, _selLocation = 0
, _foregroundShapes = mempty
, _distortions = []
, _gameRooms = []
, _roomClipping = []
, _worldClock = 0
, _worldBounds = defaultBounds
, _maybeWorld = Nothing'
, _rewindWorlds = []
, _genParams = GenParams M.empty
-- , _genPlacements = IM.empty
-- , _genRooms = IM.empty
, _deathDelay = Nothing
, _boundBox = square 100
, _boundDist = (100,-100,100,-100)
}
defaultWorldHammers :: M.Map WorldHammer HammerPosition
defaultWorldHammers = M.fromSet (const HammerUp) $ S.fromList [minBound.. maxBound]
defaultWorldHammers = M.fromSet (const HammerUp) $ S.fromList [minBound .. maxBound]
--youLight :: TempLightSource
--youLight = TLS
--youLight = TLS
-- { _tlsParam = LSParam
-- {_lsPos = V3 0 0 0
-- ,_lsRad = 300