Jazz2::Compatibility::JJ2Strings class

Parses original .j2s localization files.

Reads an original localization file containing the shared and per-level text strings, recodes them from the original encoding, and writes the converted localization to the target path. Level names can be remapped through the supplied conversion callback.

Public types

struct LevelEntry
Texts for specific level.

Public static functions

static auto RecodeString(StringView text, bool stripFormatting = false, bool escaped = false) -> String
Recodes a string from the original encoding, optionally stripping formatting or escaping it.
static auto RecodeScriptString(StringView text, bool asMessage = false, bool newLines = false) -> String
Recodes a string a level script draws from the original encoding, as jjCANVAS::drawString() of JJ2+ draws it.

Constructors, destructors, conversion operators

JJ2Strings()
Creates a new instance.
JJ2Strings(StringView name)
Creates a new instance with the specified name.

Public functions

auto Open(StringView path) -> bool
Opens and parses the specified localization file.
void Convert(StringView targetPath, Function<JJ2Level::LevelToken(StringView)>&& levelTokenConversion)
Converts the localization and writes the result to the specified target path.

Public variables

String Name
Name of the localization.
SmallVector<String, 0> CommonTexts
Texts shared across all levels.
SmallVector<LevelEntry, 0> LevelTexts
Per-level texts.

Function documentation

static String Jazz2::Compatibility::JJ2Strings::RecodeScriptString(StringView text, bool asMessage = false, bool newLines = false)

Recodes a string a level script draws from the original encoding, as jjCANVAS::drawString() of JJ2+ draws it.

Unlike in the texts of levels, every | switches to the next color, # isn't drawn, and ~ and @ are drawn as they are - \n is a new line only with newLines (STRING::SPECIALSIGN), a space otherwise. With asMessage, as jjAlert() and jjConsole() show it, the text starts in the first color instead of the default one and # is drawn too.