Redesign the text display speed delay to be more modular by introducing a "base display speed" variable
This commit is contained in:
parent
e3f11ebed3
commit
b040449f7f
@ -336,7 +336,8 @@ private:
|
||||
bool message_is_centered = false;
|
||||
|
||||
int current_display_speed = 3;
|
||||
int message_display_speed[7] = {5, 10, 25, 40, 50, 70, 90};
|
||||
int base_display_speed = 40;
|
||||
double message_display_mult[7] = {0.125, 0.25, 0.65, 1, 1.25, 1.75, 2.25};
|
||||
|
||||
// The character ID of the character this user wants to appear alongside with.
|
||||
int other_charid = -1;
|
||||
|
@ -3415,7 +3415,8 @@ void Courtroom::chat_tick()
|
||||
else if (current_display_speed > 6)
|
||||
current_display_speed = 6;
|
||||
|
||||
if ((message_display_speed[current_display_speed] <= 0 &&
|
||||
int msg_delay = base_display_speed * message_display_mult[current_display_speed];
|
||||
if ((msg_delay <= 0 &&
|
||||
tick_pos < f_message.size() - 1) ||
|
||||
formatting_char) {
|
||||
chat_tick_timer->start(0); // Don't bother rendering anything out as we're
|
||||
@ -3459,7 +3460,7 @@ void Courtroom::chat_tick()
|
||||
// And if it's faster than that:
|
||||
// 40/10 = 4
|
||||
b_rate =
|
||||
qMax(b_rate, qRound(static_cast<float>(message_display_speed[3]) /
|
||||
qMax(b_rate, qRound(static_cast<float>(base_display_speed) /
|
||||
msg_delay));
|
||||
}
|
||||
if (blip_ticker % b_rate == 0) {
|
||||
@ -3478,9 +3479,10 @@ void Courtroom::chat_tick()
|
||||
|
||||
// Punctuation delayer, only kicks in on speed ticks less than }}
|
||||
if (current_display_speed > 1 && punctuation_chars.contains(f_character)) {
|
||||
// Making the user have to wait any longer than 150ms per letter is
|
||||
// downright unreasonable
|
||||
msg_delay = qMin(150, msg_delay * punctuation_modifier);
|
||||
// Making the user have to wait any longer than 1.5 of the slowest speed
|
||||
// is downright unreasonable
|
||||
int max_delay = base_display_speed * message_display_mult[6] * 1.5;
|
||||
msg_delay = qMin(max_delay, msg_delay * punctuation_modifier);
|
||||
}
|
||||
|
||||
// If this color is talking
|
||||
|
Loading…
Reference in New Issue
Block a user