228 lines
5.9 KiB
Haskell
228 lines
5.9 KiB
Haskell
module Dodge.Default.World where
|
|
|
|
import NewInt
|
|
import Control.Lens
|
|
import Data.Graph.Inductive.Graph hiding ((&))
|
|
import qualified Data.Map as M
|
|
import Dodge.Data.SelectionList
|
|
import Dodge.Data.World
|
|
import Geometry.Data
|
|
import Geometry.Polygon
|
|
import qualified IntMapHelp as IM
|
|
import System.Random
|
|
|
|
defaultInput :: Input
|
|
defaultInput =
|
|
Input
|
|
{ _clickPos = mempty
|
|
, _clickWorldPos = mempty
|
|
, _heldPos = mempty
|
|
, _heldWorldPos = mempty
|
|
, _textInput = mempty
|
|
, _pressedKeys = mempty
|
|
, _mouseButtons = mempty
|
|
, _mousePos = V2 0 0
|
|
, _mouseMoving = False
|
|
, _scrollAmount = 0
|
|
, _smoothScrollAmount = 0
|
|
, _scrollTestFloat = 1
|
|
, _scrollTestInt = 0
|
|
}
|
|
|
|
defaultWorld :: World
|
|
defaultWorld =
|
|
World
|
|
{ _cWorld = defaultCWorld
|
|
, _wCam = defaultCWCam
|
|
, _pastWorlds = mempty
|
|
, _timeFlow = NormalTimeFlow
|
|
, _input = defaultInput
|
|
, _toPlaySounds = M.empty
|
|
, _playingSounds = M.empty
|
|
, _randGen = mkStdGen 2
|
|
, _testFloat = 0
|
|
, _rbOptions = NoRightButtonOptions
|
|
, _hud = defaultHUD
|
|
, _worldEventFlags = mempty
|
|
, _crZoning = mempty
|
|
, _clZoning = mempty
|
|
, _wlZoning = mempty
|
|
, _pnZoning = mempty
|
|
, _peZoning = mempty
|
|
, _gsZoning = mempty --Zoning IM.empty clZoneSize (zonePos _guPos)
|
|
}
|
|
|
|
defaultCWGen :: CWGen
|
|
defaultCWGen =
|
|
CWGen
|
|
{ _cwgParams = GenParams M.empty
|
|
, _cwgSeed = 0
|
|
, _cwgWorldBounds = defaultBounds
|
|
, _cwgGameRooms = []
|
|
, _cwgRoomClipping = []
|
|
}
|
|
|
|
defaultCWCam :: Camera
|
|
defaultCWCam =
|
|
Camera
|
|
{ _camCenter = V2 0 0
|
|
, _camRot = 0
|
|
, _camZoom = 1
|
|
, _camDefaultZoom = 1
|
|
, _camViewFrom = V2 0 0
|
|
, _camViewDistance = 1000
|
|
, _camItemZoom = 1
|
|
, _camBoundBox = square 100
|
|
, _camBoundDist = (100, -100, 100, -100)
|
|
, _camControl = CamInGame {_cigType = CamOnPlayer}
|
|
}
|
|
|
|
defaultCWorld :: CWorld
|
|
defaultCWorld =
|
|
CWorld
|
|
{ _lWorld = defaultLWorld
|
|
, _cwGen = defaultCWGen
|
|
, _cClock = 0
|
|
, _seenWalls = mempty
|
|
, _pathGraph = Data.Graph.Inductive.Graph.empty
|
|
, _cwTiles = mempty
|
|
, _numberFloorVerxs = 0
|
|
}
|
|
|
|
defaultLWorld :: LWorld
|
|
defaultLWorld =
|
|
LWorld
|
|
{ _magnets = IM.empty
|
|
, _modifications = IM.empty
|
|
, _creatures = IM.empty
|
|
, _creatureGroups = IM.empty
|
|
, _clouds = mempty
|
|
, _gusts = IM.empty
|
|
, _itemLocations = IM.empty
|
|
, _props = IM.empty
|
|
, _projectiles = IM.empty
|
|
, _instantBullets = []
|
|
, _bullets = []
|
|
, _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
|
|
, _floorItems = NIntMap IM.empty
|
|
, _worldEvents = []
|
|
, _delayedEvents = []
|
|
, _pressPlates = IM.empty
|
|
, _buttons = IM.empty
|
|
, _corpses = IM.empty
|
|
, _decorations = IM.empty
|
|
, _lightSources = IM.empty
|
|
, _tempLightSources = []
|
|
, _seenLocations =
|
|
IM.fromList
|
|
[ (0, (WdYouPos, "CURRENT POSITION"))
|
|
, (1, (WdP2Const (V2 0 0), "START POSITION"))
|
|
]
|
|
, _selLocation = 0
|
|
, _foregroundShapes = mempty
|
|
, _distortions = []
|
|
, _lClock = 0
|
|
, _lTestString = []
|
|
, _lTestInt = 0
|
|
}
|
|
|
|
defaultHUD :: HUD
|
|
defaultHUD =
|
|
HUD
|
|
{ _hudElement = defaultDisplayInventory
|
|
, _carteCenter = V2 0 0
|
|
, _carteZoom = 0.5
|
|
, _carteRot = 0
|
|
, _closeObjects = []
|
|
}
|
|
|
|
defaultDisplayInventory :: HUDElement
|
|
defaultDisplayInventory =
|
|
DisplayInventory
|
|
{ _subInventory = NoSubInventory
|
|
, _diSections = defaultInvSections
|
|
}
|
|
|
|
defaultSSSExtra :: SSSExtra
|
|
defaultSSSExtra =
|
|
SSSExtra
|
|
{ _sssFilters = IM.fromList [(-1, mempty), (2, mempty)]
|
|
, _sssSelPos = Nothing
|
|
}
|
|
|
|
defaultInvSections :: SelectionSections ()
|
|
defaultInvSections =
|
|
SelectionSections
|
|
{ _sssSections =
|
|
IM.fromDistinctAscList $
|
|
zip
|
|
[-1 ..]
|
|
[ defaultFiltSection
|
|
, defaultInvSection
|
|
, defaultYouSection
|
|
, defaultFiltSection & ssIndent .~ 2
|
|
& ssDescriptor .~ "NEARBY"
|
|
, defaultCOSection
|
|
]
|
|
, _sssExtra = defaultSSSExtra
|
|
}
|
|
|
|
defaultSS :: SelectionSection a
|
|
defaultSS =
|
|
SelectionSection
|
|
{ _ssItems = mempty
|
|
, _ssCursor = Nothing
|
|
, _ssMinSize = 10
|
|
, _ssOffset = 0
|
|
, _ssShownItems = []
|
|
, _ssIndent = 0
|
|
, _ssDescriptor = ""
|
|
}
|
|
|
|
defaultCOSection :: SelectionSection ()
|
|
defaultCOSection =
|
|
defaultSS
|
|
& ssIndent .~ 2
|
|
& ssDescriptor .~ "CLOSE OBJECTS"
|
|
|
|
defaultFiltSection :: SelectionSection a
|
|
defaultFiltSection =
|
|
defaultSS
|
|
& ssIndent .~ 0
|
|
& ssDescriptor .~ "INV"
|
|
& ssMinSize .~ 0
|
|
|
|
defaultInvSection :: SelectionSection ()
|
|
defaultInvSection =
|
|
defaultSS
|
|
& ssDescriptor .~ "INVENTORY ITEMS"
|
|
|
|
defaultYouSection :: SelectionSection ()
|
|
defaultYouSection =
|
|
defaultSS
|
|
& ssIndent .~ 2
|
|
& ssMinSize .~ 1
|
|
& ssDescriptor .~ "YOUR STATUS"
|