LevelTextsChunk struct
#include <Jazz2/Formats/LevelTextsChunk.h>
Chunk with the texts of a level translated to other languages.
The level texts are written in one language, this chunk holds their translations, so the game can show the texts in the language it's in (see LevelHandler::
The payload is u8 version (1), varuint number of languages, then for each a varuint size of its record and the record: str8 language, varuint number of texts, and for each varuint number of the text, varuint length and the UTF-8 bytes. A newer version may add fields at the end of a record, a reader skips those it doesn't know.
Public static variables
-
static std::
uint32_t Tag constexpr - Tag of the chunk.
-
static std::
uint8_t Version constexpr - Version this build writes.
-
static std::
uint32_t MaxLanguages constexpr - Most languages a level can have.
-
static std::
uint32_t MaxTexts constexpr - Most texts a level can have, as an event refers to one by a byte.
-
static std::
uint32_t MaxTextLength constexpr - Longest translated text in bytes.
Public static functions
-
static auto Read(ArrayView<const std::
uint8_t> data, SmallVectorImpl<LocalizedLevelTexts>& languages) -> bool - Reads the payload, returns
falseif it's damaged, what was read until then is kept. -
static void Write(ArrayView<const LocalizedLevelTexts> languages,
SmallVectorImpl<std::
uint8_t>& data) - Writes the payload, nothing for no languages, a language without any translated text is left out.
- static auto Find(ArrayView<const LocalizedLevelTexts> languages, StringView language) -> const LocalizedLevelTexts*
- Finds the texts of a language.
Constructors, destructors, conversion operators
- LevelTextsChunk() deleted
Function documentation
static const LocalizedLevelTexts* Jazz2:: Formats:: LevelTextsChunk:: Find(ArrayView<const LocalizedLevelTexts> languages,
StringView language)
Finds the texts of a language.
Looks for the language itself, then for the language without its region (pt for pt-br). Returns nullptr if neither is there.