ScriptDataChunk struct
#include <Jazz2/Formats/LevelFile.h>
Chunk with the data of a level for its script.
What a level of JJ2+ keeps for its script beyond the level itself, in sections:
- Section::
Texts — the texts of the level as the original game had them. They're kept with their formatting converted, which drops the characters that formatting uses, such as |, a script reads them as they were (jjHelpStrings), and some split them by those characters.u16length and the bytes of each text in order, a text after the last one is empty. - Section::
Recolors — the sprites the level recolors, platforms, poles and the like, which its script does when it sets up: for each of them u8its slot in the list of the sprites the editor of the level can recolor andu8the new palette index of each of the 256 indices (RecolorRecordSize).
The payload is the sections in any order, each u8 Section, varuint size and its bytes. A section of a kind this version doesn't know is skipped. The converter writes the chunk for a level with a script, and it's kept when the level is exported.
Public types
-
enum class Section : std::
uint8_t { Texts = 1, Recolors } - Kind of a section.
Public static variables
-
static std::
uint32_t Tag constexpr - Tag of the chunk.
-
static std::
size_t RecolorRecordSize constexpr - Size of one recolored sprite of Section::
Recolors.
Public static functions
-
static auto ReadSection(ArrayView<const std::
uint8_t> data, Section section) -> ArrayView<const std:: uint8_t> - Returns the bytes of a section of the payload, empty if there's none or the payload is damaged.
-
static void WriteSection(SmallVectorImpl<std::
uint8_t>& data, Section section, ArrayView<const std:: uint8_t> bytes) - Appends a section to the payload, nothing if
bytesis empty. -
static auto ReadText(ArrayView<const std::
uint8_t> texts, std:: int32_t index) -> StringView - Reads the text at the given index from Section::
Texts, empty if there's none. -
static void WriteTexts(ArrayView<const StringView> texts,
SmallVectorImpl<std::
uint8_t>& data) - Writes all texts in order as Section::
Texts, nothing if all are empty.
Constructors, destructors, conversion operators
- ScriptDataChunk() deleted
Enum documentation
enum class Jazz2:: Formats:: ScriptDataChunk:: Section : std:: uint8_t
Kind of a section.
| Enumerators | |
|---|---|
| Texts |
Texts of the level as the original game had them |
| Recolors |
Recolored sprites |