Jazz2::Formats::LevelPreview::RecordSource class

A level in the form its file stores it, with its tile sets in memory.

The tiles are found the way the game finds them — the tile IDs count the tiles of the tile sets in their order, an animated tile shows its first frame, and an overridden diffuse replaces the pixels of a tile. The tiles of a tile set that isn't there show nothing.

Base classes

class ISource
Layers of a level and the pixels of their tiles, as the preview takes them.

Public types

struct Layer
Layer with its tiles.
struct TileSet
Tile set the tiles of the level are taken from, see ExtraTileSetRecord.

Public functions

auto GetLayerCount() -> std::int32_t override
Returns the number of layers.
auto GetLayer(std::int32_t index) -> const LayerRecord& override
Returns the description of a layer as the level stores it, its kind, flags, size, renderer and color.
auto GetTilePixels(std::int32_t layer, std::int32_t x, std::int32_t y, TilePixels& result) -> bool override
Finds the pixels of a tile of a layer, the first frame of an animated one, returns false for an empty or unknown one.
void CollectTiles(nCine::Vector2f start, Function<void(std::int32_t, std::int32_t)>&& visit)
Reports the tiles of the tile sets the preview around start takes.

Public variables

ArrayView<const Layer> Layers
Layers in the order of the file.
ArrayView<const TileSet> TileSets
Tile sets in the order their tiles are numbered, the default one first.
std::int32_t AnimatedTilesOffset
Tile ID of the first animated tile.
ArrayView<const AnimatedTileRecord> AnimatedTiles
Animated tiles.
ArrayView<const TileDiffuseOverride> DiffuseOverrides
Overridden tile diffuse.

Function documentation

void Jazz2::Formats::LevelPreview::RecordSource::CollectTiles(nCine::Vector2f start, Function<void(std::int32_t, std::int32_t)>&& visit)

Reports the tiles of the tile sets the preview around start takes.

Calls visit with the index of a tile set in TileSets and the index of a tile in it, for every tile Make() reads pixels of, possibly more than once, so the tile sets can be loaded only in part before. Doesn't need TileSet::Data.