LayerPropertiesChunk struct
#include <Jazz2/Formats/LevelFile.h>
Chunk with what the records of the layers have no room for.
The name of a layer, the number it had in the original game, how the sprite layer is drawn, the parameters and the texture of its own of a textured layer, and how a layer is blended over what is behind it. The level editor shows the names, and scripts find layers by them; a script of JJ2+ refers to the eight layers of a level of the original game by their numbers, 1 to 8 from the front (jjLayers[n]), whatever order they are drawn in — the converter keeps all eight of them, even an empty one, and gives them their numbers here. Without a number, scripts count the layers from the sprite layer, which is layer 4. The record of the sprite layer ends after its size, so its renderer type and its color are here, and only those that keep its tiles where they are take effect (see Tiles::
The payload is varuint count × (varuint index of the layer in file order, varuint size of its fields, then the fields), each field u8 Field, varuint size and its value:
- Field::
Name — the UTF-8 bytes of the name, at most MaxNameLength - Field::
OriginalNumber — u81 to OriginalLayerCount, another one is taken as 0 - Field::
SpriteLook — u8renderer type and the 4 bytes of the color, which mean what LayerRecord::RendererType and LayerRecord:: Color of any other layer do, only of the sprite layer - Field::
Textured — f32TexturedLayerParams::FadeX, f32TexturedLayerParams::FadeY, u8TexturedLayerParams::Fade, u8TexturedLayerParams::Flags, f32TexturedLayerParams::InnerSpeedX, f32TexturedLayerParams::InnerSpeedY, f32TexturedLayerParams::InnerAutoSpeedX, f32TexturedLayerParams::InnerAutoSpeedY and u8TexturedLayerParams::Mapping - Field::
Texture — TextureSize × TextureSize palette indices row by row - Field::
Blend — u8LayerRecord::Blend and u8LayerRecord::BlendParam
A field of a kind this version doesn't know is skipped, and so are the bytes a newer version adds after a value; a field shorter than its value is ignored. A layer without a field has its default, a layer without an entry all of them.
Public types
- struct Entry
- Properties of one layer.
-
enum class Field : std::
uint8_t { Name = 1, OriginalNumber, SpriteLook, Textured, Texture, Blend } - Kind of a field of an entry.
Public static variables
-
static std::
uint32_t Tag constexpr - Tag of the chunk.
-
static std::
int32_t TextureSize constexpr - Width and height of a texture of its own in pixels, as the textures of JJ2+ and of 8×8 tiles.
-
static std::
size_t MaxNameLength constexpr - Largest length of a name in bytes, a longer one is cut short at a whole character.
-
static std::
uint8_t OriginalLayerCount constexpr - Number of the layers of a level of the original game.
Public static functions
-
static auto Read(ArrayView<const std::
uint8_t> data, SmallVectorImpl<Entry>& layers) -> bool - Reads the payload, returns
falseif it's damaged andlayersis left empty then. -
static void Write(ArrayView<const Entry> layers,
SmallVectorImpl<std::
uint8_t>& data) - Writes the payload of the layers that have any property other than its default, nothing if there are none.
Constructors, destructors, conversion operators
- LayerPropertiesChunk() deleted
Enum documentation
enum class Jazz2:: Formats:: LayerPropertiesChunk:: Field : std:: uint8_t
Kind of a field of an entry.
| Enumerators | |
|---|---|
| Name |
Name of the layer |
| OriginalNumber |
Number of the layer in the original game |
| SpriteLook |
Renderer type and color of the sprite layer |
| Textured |
Parameters of a textured layer, see TexturedLayerParams |
| Texture |
Texture of its own of a textured layer |
| Blend |
How the layer is blended over what is behind it |
Function documentation
static void Jazz2:: Formats:: LayerPropertiesChunk:: Write(ArrayView<const Entry> layers,
SmallVectorImpl<std:: uint8_t>& data)
Writes the payload of the layers that have any property other than its default, nothing if there are none.
A texture of another size than TextureSize × TextureSize isn't written, a parameter that isn't finite is written as its default.