Make Violet's button dialogue work in cutscene test

This was easier than I expected - just add an optional buttons="1"
attribute to cutscenes.xml. It's treated like the speaker attribute -
it's only there as context for the translator, and for the cutscene
test.
This commit is contained in:
Dav999-v
2023-03-22 21:30:42 +01:00
committed by Misa Elizabeth Kai
parent bc156137d8
commit 65d9d9a0d8
15 changed files with 30 additions and 16 deletions

View File

@@ -289,6 +289,9 @@ static void sync_lang_file(const std::string& langcode)
subElem->DeleteAttribute("pad_right");
subElem->DeleteAttribute("padtowidth");
bool buttons = subElem->BoolAttribute("buttons", false);
subElem->DeleteAttribute("buttons"); // we want this at the end...
if (format->text != NULL)
subElem->SetAttribute("translation", format->text);
if (format->tt)
@@ -310,6 +313,8 @@ static void sync_lang_file(const std::string& langcode)
}
if (format->padtowidth != 0)
subElem->SetAttribute("padtowidth", format->padtowidth);
if (buttons)
subElem->SetAttribute("buttons", 1);
}
}
@@ -546,7 +551,8 @@ bool populate_cutscene_test(const char* script_id)
script.add_test_line(
speaker,
eng,
subElem->UnsignedAttribute("case", 1)
subElem->UnsignedAttribute("case", 1),
subElem->BoolAttribute("buttons", false)
);
}
}

View File

@@ -3608,8 +3608,12 @@ void scriptclass::loadalts(const std::string& processed, const std::string& raw)
}
}
void scriptclass::add_test_line(const std::string& speaker, const std::string& english, char textcase)
{
void scriptclass::add_test_line(
const std::string& speaker,
const std::string& english,
const char textcase,
const bool textbuttons
) {
if (speaker == "gray")
{
add("squeak(terminal)");
@@ -3622,6 +3626,10 @@ void scriptclass::add_test_line(const std::string& speaker, const std::string& e
add("text("+speaker+",0,0,1)");
add(english);
add("position(center)");
if (textbuttons)
{
add("textbuttons()");
}
add("speak_active");
}

View File

@@ -68,7 +68,7 @@ public:
bool loadcustom(const std::string& t);
void loadalts(const std::string& processed, const std::string& raw);
void add_test_line(const std::string& speaker, const std::string& english, char textcase);
void add_test_line(const std::string& speaker, const std::string& english, char textcase, bool textbuttons);
void loadtest(const std::string& name);
void inline add(const std::string& t)