Jazz2::Editor::DocumentLayer struct

A layer of a level being edited.

Public static variables

static std::uint8_t EditorHidden constexpr
The editor hides the layer, the level itself isn't changed by it.
static std::uint8_t EditorLocked constexpr
The editor doesn't let the layer be changed.

Public functions

auto IsSpriteLayer() const -> bool
Returns true if it's the sprite layer.
auto GetWidth() const -> std::int32_t
Returns the width in tiles.
auto GetHeight() const -> std::int32_t
Returns the height in tiles.
auto Contains(std::int32_t x, std::int32_t y) const -> bool
Returns true if a position is inside of the layer.
auto GetTile(std::int32_t x, std::int32_t y) const -> const TileRef&
Returns the tile at a position, which has to be inside of the layer.
auto GetTile(std::int32_t x, std::int32_t y) -> TileRef&
Returns the tile at a position, which has to be inside of the layer.

Public variables

Formats::LayerRecord Record
Description of the layer as the file stores it, including its size.
String Name
Name of the layer, may be empty.
SmallVector<TileRef, 0> Tiles
Tiles of the layer, row by row.
SmallVector<std::uint8_t, 0> Texture
Texture of its own of a textured layer, taken instead of the 8×8 tiles at its top left, or empty.
std::uint8_t EditorFlags
Combination of EditorHidden and EditorLocked, saved with the level but not part of it.
std::uint8_t EditorOpacity
How opaque the editor shows the layer, 255 fully, saved with the level but not part of it.
std::uint32_t Id
Identity of the layer while the editor runs, it's not saved.

Variable documentation

Formats::LayerRecord Jazz2::Editor::DocumentLayer::Record

Description of the layer as the file stores it, including its size.

The renderer type and the color of the sprite layer are stored apart from its record, in Formats::LayerPropertiesChunk, they're kept here as those of any other layer. So is everything else of the record the chunk stores (Formats::LayerRecord::Textured, Formats::LayerRecord::OriginalNumber, Formats::LayerRecord::Blend).

SmallVector<std::uint8_t, 0> Jazz2::Editor::DocumentLayer::Texture

Texture of its own of a textured layer, taken instead of the 8×8 tiles at its top left, or empty.

Palette indices row by row, stored with the properties of the layer in Formats::LayerPropertiesChunk (see Formats::LayerPropertiesChunk::Entry::Texture), such as a texture of JJ2+ a converted level has.

std::uint32_t Jazz2::Editor::DocumentLayer::Id

Identity of the layer while the editor runs, it's not saved.

A layer keeps it however it moves, so the editor state of a layer that is still there is kept when a snapshot of the layers is restored (see DocumentSnapshot). The snapshots kept in a recovery copy give their layers new ones when they're read (see LayerIdRemap).