mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 13:01:56 +00:00
Typewriter::WriteText: If dialogue ends with a hyphen, cut down the time to textDone massively
This commit is contained in:
parent
7fba9321d1
commit
f5566ff8c4
1 changed files with 10 additions and 4 deletions
|
|
@ -64,15 +64,17 @@ void Dialogue::Typewriter::WriteText(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool voicePlayed = false;
|
bool voicePlayed = false;
|
||||||
|
bool empty = textDest.empty();
|
||||||
|
|
||||||
textTimer -= textSpeed;
|
textTimer -= textSpeed;
|
||||||
|
|
||||||
while (textTimer <= 0 && !textDest.empty())
|
while (textTimer <= 0 && !empty)
|
||||||
{
|
{
|
||||||
char c = textDest.back(), nextc = '\n';
|
char c = textDest.back(), nextc = '\n';
|
||||||
text.push_back(c);
|
text.push_back(c);
|
||||||
|
|
||||||
textDest.pop_back();
|
textDest.pop_back();
|
||||||
|
empty = textDest.empty();
|
||||||
|
|
||||||
if (c & 0x80)
|
if (c & 0x80)
|
||||||
{
|
{
|
||||||
|
|
@ -83,7 +85,7 @@ void Dialogue::Typewriter::WriteText(void)
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
textLines++;
|
textLines++;
|
||||||
|
|
||||||
if (!textDest.empty())
|
if (!empty)
|
||||||
nextc = textDest.back();
|
nextc = textDest.back();
|
||||||
|
|
||||||
if (voicePlayed == false
|
if (voicePlayed == false
|
||||||
|
|
@ -100,7 +102,11 @@ void Dialogue::Typewriter::WriteText(void)
|
||||||
voicePlayed = true;
|
voicePlayed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::ispunct(c)
|
if (c == '-' && empty)
|
||||||
|
{
|
||||||
|
textTimer += textSpeed;
|
||||||
|
}
|
||||||
|
else if (std::ispunct(c)
|
||||||
&& std::isspace(nextc))
|
&& std::isspace(nextc))
|
||||||
{
|
{
|
||||||
// slow down for punctuation
|
// slow down for punctuation
|
||||||
|
|
@ -112,7 +118,7 @@ void Dialogue::Typewriter::WriteText(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
textDone = (textTimer <= 0 && textDest.empty());
|
textDone = (textTimer <= 0 && empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialogue::Typewriter::CompleteText(void)
|
void Dialogue::Typewriter::CompleteText(void)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue