LambdaHack-0.11.0.1: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Server.DungeonGen.Place

Contents

- Internal operations

Description

Generation of places from place kinds.

Synopsis

- data Place = Place {
  - qkind :: ContentId PlaceKind
  - qarea :: Area
  - qmap :: TileMapEM
  - qfence :: TileMapEM
  }
- type TileMapEM = EnumMap Point (ContentId TileKind)
- buildPlace :: COps -> CaveKind -> Bool -> ContentId TileKind -> ContentId TileKind -> AbsDepth -> AbsDepth -> Word32 -> Area -> Maybe Area -> Freqs PlaceKind -> Rnd Place
- isChancePos :: Int -> Int -> Word32 -> Point -> Bool
- buildFenceRnd :: COps -> GroupName TileKind -> GroupName TileKind -> GroupName TileKind -> GroupName TileKind -> Area -> Rnd TileMapEM
- placeCheck :: Area -> PlaceKind -> Bool
- interiorArea :: PlaceKind -> Area -> Maybe Area
- pover :: COps -> EnumMap Char (GroupName TileKind) -> Rnd (EnumMap Char (Maybe (Int, Int, ContentId TileKind), ContentId TileKind))
- buildFence :: COps -> CaveKind -> Bool -> ContentId TileKind -> ContentId TileKind -> Bool -> Fence -> Area -> Rnd TileMapEM
- buildFenceMap :: ContentId TileKind -> ContentId TileKind -> Area -> TileMapEM
- tilePlace :: Area -> PlaceKind -> Rnd (EnumMap Point Char)

# Documentation

data Place Source #

The parameters of a place. All are immutable and rolled and fixed at the time when a place is generated.

Constructors

Place |

Fields

- qkind :: ContentId PlaceKind
- qarea :: Area
- qmap :: TileMapEM
- qfence :: TileMapEM

#### Instances

Instances details

Show Place Source # |
Instance details Defined in Game.LambdaHack.Server.DungeonGen.Place Methods showsPrec :: Int -> Place -> ShowS Source # show :: Place -> String Source # showList :: [Place] -> ShowS Source #

type TileMapEM = EnumMap Point (ContentId TileKind) Source #

The map of tile kinds in a place (and generally anywhere in a cave). The map is sparse. The default tile that eventually fills the empty spaces is specified in the cave kind specification with `cdefTile`.

buildPlace Source #

Arguments

:: COps | the game content
-> CaveKind | current cave kind
-> Bool | whether the cave is dark
-> ContentId TileKind | dark fence tile, if fence hollow
-> ContentId TileKind | lit fence tile, if fence hollow
-> AbsDepth | current level depth
-> AbsDepth | absolute depth
-> Word32 | secret tile seed
-> Area | whole area of the place, fence included
-> Maybe Area | whole inner area of the grid cell
-> Freqs PlaceKind | optional fixed place freq
-> Rnd Place |

Given a few parameters, roll and construct a `Place` datastructure and fill a cave section acccording to it.

isChancePos :: Int -> Int -> Word32 -> Point -> Bool Source #

buildFenceRnd :: COps -> GroupName TileKind -> GroupName TileKind -> GroupName TileKind -> GroupName TileKind -> Area -> Rnd TileMapEM Source #

Construct a fence around an area, with the given tile group.

# Internal operations

placeCheck Source #

Arguments

:: Area | the area to fill
-> PlaceKind | the kind of place to construct
-> Bool |

For `CAlternate` tiling, require the place be comprised of an even number of whole corners, with exactly one square overlap between consecutive coners and no trimming. For other tiling methods, check that the area is large enough for tiling the corner twice in each direction, with a possible one row/column overlap.

interiorArea :: PlaceKind -> Area -> Maybe Area Source #

Calculate interior room area according to fence type, based on the total area for the room and it's fence. This is used for checking if the room fits in the area, for digging up the place and the fence and for deciding if the room is dark or lit later in the dungeon generation process.

pover :: COps -> EnumMap Char (GroupName TileKind) -> Rnd (EnumMap Char (Maybe (Int, Int, ContentId TileKind), ContentId TileKind)) Source #

buildFence :: COps -> CaveKind -> Bool -> ContentId TileKind -> ContentId TileKind -> Bool -> Fence -> Area -> Rnd TileMapEM Source #

Construct a fence around a place.

buildFenceMap :: ContentId TileKind -> ContentId TileKind -> Area -> TileMapEM Source #

Construct a fence around an area, with the given tile kind. Corners have a different kind, e.g., to avoid putting doors there.

tilePlace Source #

Arguments

:: Area | the area to fill
-> PlaceKind | the place kind to construct
-> Rnd (EnumMap Point Char) |

Create a place by tiling patterns.