Jazz2::Editor::TileShapes class

Shapes of the collision masks of the tiles of a tile set.

A tile whose mask is solid below a straight line across all of it, and empty above it, is a piece of ground — flat, or a slope of any steepness the line has. Its surface is known by how deep the line is at the left and the right edge of the tile. Each such tile is also known flipped horizontally, as a slope the other way.

Public types

struct Surface
Tile of ground with a straight surface.
struct LevelTiles
Tiles a level stores in itself, an extra tile set embedded in it.

Public functions

void Build(StringView tileSet, const Formats::TileSetData& data, const TerrainRules* rules = nullptr, const LevelDocument* document = nullptr, ArrayView<const LevelTiles> levelTiles = {})
Analyzes the masks of the default tile set of a level, unless they're analyzed already.
auto GetTileSet() const -> StringView
Returns the tile set analyzed.
auto GetRevision() const -> std::uint32_t
Returns a number that changes whenever the shapes do.
auto GetSurfaces() const -> const SmallVector<Surface, 0>&
Returns all tiles of ground with a straight surface.
auto GetCeilings() const -> const SmallVector<Surface, 0>&
Returns all tiles of ceiling, solid above a straight line, the depths are of the line from the top.

Function documentation

void Jazz2::Editor::TileShapes::Build(StringView tileSet, const Formats::TileSetData& data, const TerrainRules* rules = nullptr, const LevelDocument* document = nullptr, ArrayView<const LevelTiles> levelTiles = {})

Analyzes the masks of the default tile set of a level, unless they're analyzed already.

The slope tags of rules go before what the masks tell, a tile left out isn't ground, a tagged one has the surface it's tagged with. With document, the masks the level overrides are those analyzed, and the tiles of levelTiles are pieces of ground too. Any change of these is analyzed again.

const SmallVector<Surface, 0>& Jazz2::Editor::TileShapes::GetCeilings() const

Returns all tiles of ceiling, solid above a straight line, the depths are of the line from the top.

Pieces of ground flipped upside down are among them too, a little worse than tiles made for it.