mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Dialogue::WriteText improvements
- Only have a long delay between symbols if the current character is std::ispunct() and the NEXT character is std::isspace
- Add native color code support
- Requires string concatenation to actually use it, though, which I don't know how to do in ACS
This commit is contained in:
parent
753c6f414d
commit
8326a2d588
1 changed files with 14 additions and 4 deletions
|
|
@ -157,9 +157,20 @@ void Dialogue::WriteText(void)
|
||||||
|
|
||||||
while (textTimer <= 0 && !textDest.empty())
|
while (textTimer <= 0 && !textDest.empty())
|
||||||
{
|
{
|
||||||
char c = textDest.back();
|
char c = textDest.back(), nextc = '\n';
|
||||||
text.push_back(c);
|
text.push_back(c);
|
||||||
|
|
||||||
|
textDest.pop_back();
|
||||||
|
|
||||||
|
if (c & 0x80)
|
||||||
|
{
|
||||||
|
// Color code support
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!textDest.empty())
|
||||||
|
nextc = textDest.back();
|
||||||
|
|
||||||
if (voicePlayed == false
|
if (voicePlayed == false
|
||||||
&& std::isprint(c)
|
&& std::isprint(c)
|
||||||
&& c != ' ')
|
&& c != ' ')
|
||||||
|
|
@ -174,7 +185,8 @@ void Dialogue::WriteText(void)
|
||||||
voicePlayed = true;
|
voicePlayed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '.' || c == ',' || c == ';' || c == '!' || c == '?')
|
if (std::ispunct(c)
|
||||||
|
&& std::isspace(nextc))
|
||||||
{
|
{
|
||||||
// slow down for punctuation
|
// slow down for punctuation
|
||||||
textTimer += kTextPunctPause;
|
textTimer += kTextPunctPause;
|
||||||
|
|
@ -183,8 +195,6 @@ void Dialogue::WriteText(void)
|
||||||
{
|
{
|
||||||
textTimer += FRACUNIT;
|
textTimer += FRACUNIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
textDest.pop_back();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
textDone = (textTimer <= 0 && textDest.empty());
|
textDone = (textTimer <= 0 && textDest.empty());
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue