Few more bugs fixed

This commit is contained in:
2023-07-12 22:47:19 -07:00
parent 116670fcd0
commit 264bf550ea
4 changed files with 99 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<vnscene name="SceneInitial" extend="scenes/SceneMonologue"> <vnscene name="SceneInitial" extend="scenes/SceneMonologue">
<events> <events>
<scene-change scene="vnscenes/ScenePrologue0" /> <scene-change scene="vnscenes/ScenePrologue1" />
</events> </events>
</vnscene> </vnscene>

View File

@ -5,5 +5,73 @@
<text> <text>
<string lang="en">I wake.</string> <string lang="en">I wake.</string>
</text> </text>
<text>
<string lang="en">I gasp. I close my eyes - I'm fine, I'm <font style="italics">fine</font>. I'm still here. Breathing.</string>
</text>
<text>
<string lang="en">That bucket was a dream. My death was a dream. I'm not dead.</string>
</text>
<text>
<string lang="en">
(Am I?)
(...)
(Aren't I?)
</string>
</text>
<text>
<string lang="en">Of course I'm not.</string>
</text>
<text>
<string lang="en">I exhale. My feet fall to the edges of my bed. Slowly, I raise myself to stand.</string>
</text>
<text>
<string lang="en">My fingers tremble by the edges of my leg: I curl my hand in. My nails catch on my skin.</string>
</text>
<text>
<string lang="en">They're sharp, pastel pink. Done for Prom Day today.</string>
</text>
<text>
<string lang="en">The dream didn't happen. How could it have? Prom Day hasn't happened yet.</string>
</text>
<text>
<string lang="en">
I'm fine.
(Didn't it happen?)
(It felt so...)
<font size="26" style="italics">(Real.)</font>
</string>
</text>
<!--
(Am I?)
(...)
(Aren't I?)
Of course I'm not.
I exhale. My feet fall to the edges of my bed. Slowly, I raise myself to stand.
My fingers tremble by the edges of my leg: I curl my hand in. My nails catch on my skin. They're sharp, pastel pink. Done for Prom Day today.
The dream didn't happen. How could it have? Prom Day hasn't happened yet.
I'm fine.
(Didn't it happen?)
(It felt so...)
(Real.)
I tidy the bedsheets. Pull the corners over the bed's edges, fluff up the pillows, pat away the sweat and the residue of a scream: my parents want it pretty.
It wasn't real. I only had a visceral dream, sunken into my brain as an anchor to a sea, as a stone angel's crumbling visage, as a bird's descent off Devil Cradle's cliffs. That wasn't real.
No, of course not.
My calendar says May 29th. I've got to prepare for Prom.
After all, if there is anything I will be, it is Prom Queen.
I've been chasing this moment since the beginning of time. Today is the finale.
And I am nothing if not ready.
-->
</events> </events>
</vnscene> </vnscene>

View File

@ -148,3 +148,21 @@ static inline std::string stringReplaceAll(
} }
return newString; return newString;
} }
/**
* Joins a vector of strings into a single string, using a delimiter.
*
* @param strings Vector of strings to join.
* @param delim Delimiter to join the strings with.
*/
static inline std::string stringJoin(
const std::vector<std::string> &strings,
const std::string &delim
) {
std::string result;
for(size_t i = 0; i < strings.size(); i++) {
if(i > 0) result += delim;
result += strings[i];
}
return result;
}

View File

@ -22,8 +22,19 @@ int32_t VNTextParser::onParse(
struct VNText *out, struct VNText *out,
std::string *error std::string *error
) { ) {
std::string innerXml = node->innerXml;
// Split by newlines, then trim each line.
std::vector<std::string> lines = stringSplit(innerXml, "\n");
std::vector<std::string> finalLines;
for(auto it = lines.begin(); it != lines.end(); ++it) {
auto newLine = stringTrim(*it);
if(newLine.length() > 0) finalLines.push_back(newLine);
}
std::string finalXml = stringJoin(finalLines, "\n");
out->language = values["lang"]; out->language = values["lang"];
out->text = stringParser(node->innerXml, error); out->text = stringParser(finalXml, error);
return error->length() == 0 ? 0 : -1; return error->length() == 0 ? 0 : -1;
} }