LevelFile struct
#include <Jazz2/Formats/LevelFile.h>
Layout of the game's own level format.
A level is converted once from the original .j2l (see Compatibility::
The header starts with the same signature and type/version fields every other file the game writes uses. Only CurrentVersion is read — a level of another version is refused rather than misread, and the converted levels in the cache are rebuilt whenever the version changes (see Compatibility::JJ2Anims::CacheVersion).
Public static variables
-
static std::
uint64_t Signature constexpr - Signature shared by all files the game writes.
-
static std::
uint16_t CurrentVersion constexpr - Version this build writes, and the only one it reads.
-
static std::
int32_t EventParamsSize constexpr - Size of the parameters of an event.
-
static std::
int32_t ColorsPerPalette constexpr - Number of colors in a palette.
-
static std::
int32_t TileSize constexpr - Size of a tile in pixels.
-
static std::
int32_t MaxLayerSize constexpr - Largest width and height of a layer in tiles, as large as 3.9.0 lets the editor make a layer.
-
static std::
int64_t MaxLayerTiles constexpr - Largest number of tiles of a single layer.
-
static std::
int64_t MaxTotalLayerTiles constexpr - Largest number of tiles of all layers together.
-
static std::
uint32_t MaxOffGridEvents constexpr - Largest number of off-grid events, each of them takes a tile of the event map of its own.
-
static std::
uint32_t MaxTileOverrides constexpr - Largest number of overridden tile diffuses, and of overridden tile masks.
-
static std::
uint32_t MaxBlobSize constexpr - Largest size of an embedded tile set or of the payload of a chunk in bytes.
-
static std::
int64_t MaxBodySize constexpr - Largest size of the decompressed body in bytes.
-
static std::
uint32_t PreviewChunk constexpr - Small image of the level shown in the list of custom levels, kept when the level is exported.
Public static functions
- static auto ReadHeader(Stream& s, LevelHeader& header) -> bool
- Reads the uncompressed header of a level.
-
static auto MakeChunkTag(char a,
char b,
char c,
char d) -> std::
uint32_t constexpr - Makes a chunk tag from its four characters.
-
static auto IsEditorOnlyChunk(std::
uint32_t tag) -> bool constexpr - Returns
trueif a chunk tag marks editor-only data, which is dropped when a level is exported. -
static auto IsCriticalChunk(std::
uint32_t tag) -> bool constexpr - Returns
trueif a chunk tag marks data the level can't be played without. - static auto IsSafeTileSetPath(StringView path) -> bool
- Returns
trueif a tile set path of a level is safe to look up inTilesets/.
Function documentation
static bool Jazz2:: Formats:: LevelFile:: ReadHeader(Stream& s,
LevelHeader& header)
Reads the uncompressed header of a level.
Leaves the stream at the start of the deflated body. Returns false if the stream doesn't hold a level of CurrentVersion.
static bool Jazz2:: Formats:: LevelFile:: IsCriticalChunk(std:: uint32_t tag) constexpr
Returns true if a chunk tag marks data the level can't be played without.
The first letter uppercase and the second lowercase, such as Gscr. A reader that doesn't know such a chunk refuses the level. Editor-only chunks and the preview (PRVW) are never critical.
static bool Jazz2:: Formats:: LevelFile:: IsSafeTileSetPath(StringView path)
Returns true if a tile set path of a level is safe to look up in Tilesets/.
A path may have directories, but it must stay relative and must not go up from where it starts. A part of it must not end with a dot or a space, nor be a name of a device of Windows, which would resolve to something else there.
Variable documentation
static std:: uint32_t Jazz2:: Formats:: LevelFile:: PreviewChunk constexpr
Small image of the level shown in the list of custom levels, kept when the level is exported.
u16 width and height, then the pixels row by row as opaque RGBA in the image content of the game's files (see Compatibility::