Text speed modifier.

- 7 different speeds.
- `{` turns the speed down.
- `}` turns the speed up!
This commit is contained in:
Cerapter 2018-07-26 23:51:47 +02:00
parent a8205986a4
commit 3295e5a78e
2 changed files with 46 additions and 3 deletions

View File

@ -1214,6 +1214,16 @@ void Courtroom::append_ic_text(QString p_text, QString p_name)
p_text.remove(trick_check_pos,1);
}
// Text speed modifier.
else if (f_character == "{" and !ic_next_is_not_special)
{
p_text.remove(trick_check_pos,1);
}
else if (f_character == "}" and !ic_next_is_not_special)
{
p_text.remove(trick_check_pos,1);
}
// Orange inline colourisation.
else if (f_character == "|" and !ic_next_is_not_special)
{
@ -1398,7 +1408,10 @@ void Courtroom::start_chat_ticking()
tick_pos = 0;
blip_pos = 0;
chat_tick_timer->start(chat_tick_interval);
// At the start of every new message, we set the text speed to the default.
current_display_speed = 3;
chat_tick_timer->start(message_display_speed[current_display_speed]);
QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]);
@ -1415,10 +1428,12 @@ void Courtroom::chat_tick()
QString f_message = m_chatmessage[MESSAGE];
// Due to our new text speed system, we always need to stop the timer now.
chat_tick_timer->stop();
if (tick_pos >= f_message.size())
{
text_state = 2;
chat_tick_timer->stop();
anim_state = 3;
ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]);
}
@ -1464,6 +1479,17 @@ void Courtroom::chat_tick()
next_character_is_not_special = true;
}
// Text speed modifier.
else if (f_character == "{" and !next_character_is_not_special)
{
// ++, because it INCREASES delay!
current_display_speed++;
}
else if (f_character == "}" and !next_character_is_not_special)
{
current_display_speed--;
}
// Orange inline colourisation.
else if (f_character == "|" and !next_character_is_not_special)
{
@ -1594,6 +1620,20 @@ void Courtroom::chat_tick()
}
++tick_pos;
// Restart the timer, but according to the newly set speeds, if there were any.
// Keep the speed at bay.
if (current_display_speed < 0)
{
current_display_speed = 0;
}
if (current_display_speed > 6)
{
current_display_speed = 6;
}
chat_tick_timer->start(message_display_speed[current_display_speed]);
}
}

View File

@ -170,6 +170,9 @@ private:
bool message_is_centered = false;
int current_display_speed = 3;
int message_display_speed[7] = {30, 40, 50, 60, 75, 100, 120};
QVector<char_type> char_list;
QVector<evi_type> evidence_list;
QVector<QString> music_list;
@ -181,7 +184,7 @@ private:
//determines how fast messages tick onto screen
QTimer *chat_tick_timer;
int chat_tick_interval = 60;
//int chat_tick_interval = 60;
//which tick position(character in chat message) we are at
int tick_pos = 0;
//used to determine how often blips sound