Jazz2::Formats::LayerRecord struct

Description of a layer.

Everything after Height is stored only for layers other than the sprite one, which is always placed with its defaults — how it's drawn is stored apart from the record, see LayerPropertiesChunk. The speed models and the renderer type are kept as raw values, so a level saved again keeps even values this version of the game doesn't know.

Public static variables

static std::uint16_t RepeatX constexpr
The layer repeats horizontally.
static std::uint16_t RepeatY constexpr
The layer repeats vertically.
static std::uint16_t UseInherentOffset constexpr
The layer uses the inherent offset of the original game.
static std::uint16_t Visible constexpr
The layer is visible.

Public variables

LayerKind Kind
Kind of the layer.
std::uint16_t Flags
Combination of RepeatX, RepeatY, UseInherentOffset and Visible.
std::int32_t Width
Width in tiles.
std::int32_t Height
Height in tiles.
std::uint8_t SpeedModels
Speed model (see Tiles::LayerSpeedModel), horizontal in the low nibble, vertical in the high one.
float OffsetX
Horizontal offset.
float OffsetY
Vertical offset.
float SpeedX
Horizontal speed.
float SpeedY
Vertical speed.
float AutoSpeedX
Horizontal auto speed.
float AutoSpeedY
Vertical auto speed, see AutoSpeedX.
std::int16_t Depth
Depth, the layer is in front of the sprites if below 50.
std::uint8_t RendererType
Renderer type (see Tiles::LayerRendererType).
std::uint8_t Color
Color whose meaning depends on the renderer type.
TexturedLayerParams Textured
Parameters of a tunnel, a wave, a cylinder or a reflection that Color has no room for.
std::uint8_t OriginalNumber
Number of the layer in the original game, 1 to 8 from the front, or 0 for a layer of another origin.
std::uint8_t Blend
How the layer is blended over what is behind it (see Tiles::LayerBlend).
std::uint8_t BlendParam
Parameter of Blend, the opacity or the palette entry of the key (see Tiles::LayerDescription::BlendParam).

Variable documentation

static std::uint16_t Jazz2::Formats::LayerRecord::UseInherentOffset constexpr

The layer uses the inherent offset of the original game.

limitVisibleRegion of JJ2+ — the layer is moved down by half of how much taller the view is than 200 pixels. Since 4.0.0 only a layer that doesn't repeat vertically and whose vertical speed model is Tiles::LayerSpeedModel::Default is moved, as in JJ2+; 3.9.0 moves any layer that has the flag.

std::uint8_t Jazz2::Formats::LayerRecord::SpeedModels

Speed model (see Tiles::LayerSpeedModel), horizontal in the low nibble, vertical in the high one.

Tiles::LayerSpeedModel::FromStart (4) is written since 4.0.0. 3.9.0 places a layer of a value it doesn't know as one of Tiles::LayerSpeedModel::Default, and so a layer of that model too, and places a layer of Tiles::LayerSpeedModel::FitLevel and Tiles::LayerSpeedModel::SpeedMultipliers differently, by the center of the view and the size of the level instead of the range the view moves in.

float Jazz2::Formats::LayerRecord::AutoSpeedX

Horizontal auto speed.

In pixels each of 60 frames a second, the original game and JJ2+ take theirs each of 70 ticks a second (see Tiles::LayerDescription::FromOriginalAutoSpeed()). With Tiles::LayerSpeedModel::SpeedMultipliers, the multiplier of the size of the view at the end of the level instead.

std::uint8_t Jazz2::Formats::LayerRecord::Color

Color whose meaning depends on the renderer type.

For a tinted layer, red is a palette index. For a palette-shifted layer, red is the shift and alpha the opacity; green and blue are written as 255, so a reader that doesn't know the renderer (it draws an ordinary layer modulated by the color) only lowers the red of the tiles. For a sky or a tunnel, red, green and blue are the color it fades into and non-zero alpha shows stars, for a cylinder the same without the stars. For a wave, red and green are the wavelengths of its horizontal and vertical waves (0 for none), blue its speed as a signed byte, and alpha is 0. For a reflection, red is the opacity of its tint, green the distance of its plane, blue its distortion and non-zero alpha blurs it.

TexturedLayerParams Jazz2::Formats::LayerRecord::Textured

Parameters of a tunnel, a wave, a cylinder or a reflection that Color has no room for.

Not stored in the record itself but in LayerPropertiesChunk, the reader of the record leaves the defaults.

std::uint8_t Jazz2::Formats::LayerRecord::OriginalNumber

Number of the layer in the original game, 1 to 8 from the front, or 0 for a layer of another origin.

Not stored in the record itself but in LayerPropertiesChunk, the reader of the record sets 0.

std::uint8_t Jazz2::Formats::LayerRecord::Blend

How the layer is blended over what is behind it (see Tiles::LayerBlend).

Not stored in the record itself but in LayerPropertiesChunk, as BlendParam.