Merge pull request #438 from AttorneyOnline/feature/textspeed
Text crawl setting
This commit is contained in:
commit
6de2105f2f
@ -229,6 +229,9 @@ public:
|
|||||||
// Current wait time between messages for the queue system
|
// Current wait time between messages for the queue system
|
||||||
int stay_time();
|
int stay_time();
|
||||||
|
|
||||||
|
// Returns the letter display speed during text crawl in in-character messages
|
||||||
|
int get_text_crawl();
|
||||||
|
|
||||||
// Returns Minimum amount of time (in miliseconds) that must pass before the next Enter key press will send your IC message. (new behaviour)
|
// Returns Minimum amount of time (in miliseconds) that must pass before the next Enter key press will send your IC message. (new behaviour)
|
||||||
int get_chat_ratelimit();
|
int get_chat_ratelimit();
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ private:
|
|||||||
QCheckBox *ui_desync_logs_cb;
|
QCheckBox *ui_desync_logs_cb;
|
||||||
QLabel *ui_instant_objection_lbl;
|
QLabel *ui_instant_objection_lbl;
|
||||||
QCheckBox *ui_instant_objection_cb;
|
QCheckBox *ui_instant_objection_cb;
|
||||||
|
QLabel *ui_text_crawl_lbl;
|
||||||
|
QSpinBox *ui_text_crawl_spinbox;
|
||||||
QLabel *ui_chat_ratelimit_lbl;
|
QLabel *ui_chat_ratelimit_lbl;
|
||||||
QSpinBox *ui_chat_ratelimit_spinbox;
|
QSpinBox *ui_chat_ratelimit_spinbox;
|
||||||
QLabel *ui_log_ic_actions_lbl;
|
QLabel *ui_log_ic_actions_lbl;
|
||||||
|
@ -336,7 +336,8 @@ private:
|
|||||||
bool message_is_centered = false;
|
bool message_is_centered = false;
|
||||||
|
|
||||||
int current_display_speed = 3;
|
int current_display_speed = 3;
|
||||||
int message_display_speed[7] = {5, 10, 25, 40, 50, 70, 90};
|
int text_crawl = 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.
|
// The character ID of the character this user wants to appear alongside with.
|
||||||
int other_charid = -1;
|
int other_charid = -1;
|
||||||
|
@ -220,6 +220,21 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
|
|
||||||
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_instant_objection_cb);
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_instant_objection_cb);
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
ui_text_crawl_lbl = new QLabel(ui_form_layout_widget);
|
||||||
|
ui_text_crawl_lbl->setText(tr("Text crawl:"));
|
||||||
|
ui_text_crawl_lbl->setToolTip(tr(
|
||||||
|
"Amount of time (in miliseconds) spent on each letter when the in-character text is being displayed."));
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_text_crawl_lbl);
|
||||||
|
|
||||||
|
ui_text_crawl_spinbox = new QSpinBox(ui_form_layout_widget);
|
||||||
|
ui_text_crawl_spinbox->setSuffix(" ms");
|
||||||
|
ui_text_crawl_spinbox->setMaximum(500);
|
||||||
|
ui_text_crawl_spinbox->setValue(p_ao_app->get_text_crawl());
|
||||||
|
|
||||||
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_text_crawl_spinbox);
|
||||||
|
|
||||||
row += 1;
|
row += 1;
|
||||||
ui_chat_ratelimit_lbl = new QLabel(ui_form_layout_widget);
|
ui_chat_ratelimit_lbl = new QLabel(ui_form_layout_widget);
|
||||||
ui_chat_ratelimit_lbl->setText(tr("Chat Rate Limit:"));
|
ui_chat_ratelimit_lbl->setText(tr("Chat Rate Limit:"));
|
||||||
@ -234,6 +249,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
ui_chat_ratelimit_spinbox->setValue(p_ao_app->get_chat_ratelimit());
|
ui_chat_ratelimit_spinbox->setValue(p_ao_app->get_chat_ratelimit());
|
||||||
|
|
||||||
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_chat_ratelimit_spinbox);
|
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_chat_ratelimit_spinbox);
|
||||||
|
|
||||||
row += 1;
|
row += 1;
|
||||||
ui_log_names_divider = new QFrame(ui_form_layout_widget);
|
ui_log_names_divider = new QFrame(ui_form_layout_widget);
|
||||||
ui_log_names_divider->setFrameShape(QFrame::HLine);
|
ui_log_names_divider->setFrameShape(QFrame::HLine);
|
||||||
@ -840,6 +856,7 @@ void AOOptionsDialog::save_pressed()
|
|||||||
configini->setValue("desync_logs", ui_desync_logs_cb->isChecked());
|
configini->setValue("desync_logs", ui_desync_logs_cb->isChecked());
|
||||||
configini->setValue("stay_time", ui_stay_time_spinbox->value());
|
configini->setValue("stay_time", ui_stay_time_spinbox->value());
|
||||||
configini->setValue("instant_objection", ui_instant_objection_cb->isChecked());
|
configini->setValue("instant_objection", ui_instant_objection_cb->isChecked());
|
||||||
|
configini->setValue("text_crawl", ui_text_crawl_spinbox->value());
|
||||||
configini->setValue("chat_ratelimit", ui_chat_ratelimit_spinbox->value());
|
configini->setValue("chat_ratelimit", ui_chat_ratelimit_spinbox->value());
|
||||||
configini->setValue("default_username", ui_username_textbox->text());
|
configini->setValue("default_username", ui_username_textbox->text());
|
||||||
configini->setValue("show_custom_shownames", ui_showname_cb->isChecked());
|
configini->setValue("show_custom_shownames", ui_showname_cb->isChecked());
|
||||||
|
@ -467,9 +467,6 @@ void Courtroom::set_pair_list()
|
|||||||
|
|
||||||
void Courtroom::set_widgets()
|
void Courtroom::set_widgets()
|
||||||
{
|
{
|
||||||
blip_rate = ao_app->read_blip_rate();
|
|
||||||
blank_blip = ao_app->get_blank_blip();
|
|
||||||
|
|
||||||
QString filename = "courtroom_design.ini";
|
QString filename = "courtroom_design.ini";
|
||||||
|
|
||||||
pos_size_type f_courtroom =
|
pos_size_type f_courtroom =
|
||||||
@ -3231,6 +3228,9 @@ void Courtroom::start_chat_ticking()
|
|||||||
|
|
||||||
tick_pos = 0;
|
tick_pos = 0;
|
||||||
blip_ticker = 0;
|
blip_ticker = 0;
|
||||||
|
text_crawl = ao_app->get_text_crawl();
|
||||||
|
blip_rate = ao_app->read_blip_rate();
|
||||||
|
blank_blip = ao_app->get_blank_blip();
|
||||||
|
|
||||||
// At the start of every new message, we set the text speed to the default.
|
// At the start of every new message, we set the text speed to the default.
|
||||||
current_display_speed = 3;
|
current_display_speed = 3;
|
||||||
@ -3415,7 +3415,8 @@ void Courtroom::chat_tick()
|
|||||||
else if (current_display_speed > 6)
|
else if (current_display_speed > 6)
|
||||||
current_display_speed = 6;
|
current_display_speed = 6;
|
||||||
|
|
||||||
if ((message_display_speed[current_display_speed] <= 0 &&
|
int msg_delay = text_crawl * message_display_mult[current_display_speed];
|
||||||
|
if ((msg_delay <= 0 &&
|
||||||
tick_pos < f_message.size() - 1) ||
|
tick_pos < f_message.size() - 1) ||
|
||||||
formatting_char) {
|
formatting_char) {
|
||||||
chat_tick_timer->start(0); // Don't bother rendering anything out as we're
|
chat_tick_timer->start(0); // Don't bother rendering anything out as we're
|
||||||
@ -3426,7 +3427,6 @@ void Courtroom::chat_tick()
|
|||||||
// scrollbar convenience
|
// scrollbar convenience
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int msg_delay = message_display_speed[current_display_speed];
|
|
||||||
// Do the colors, gradual showing, etc. in here
|
// Do the colors, gradual showing, etc. in here
|
||||||
QString f_message_filtered = filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt());
|
QString f_message_filtered = filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt());
|
||||||
for (int c = 0; c < max_colors; ++c) {
|
for (int c = 0; c < max_colors; ++c) {
|
||||||
@ -3459,7 +3459,7 @@ void Courtroom::chat_tick()
|
|||||||
// And if it's faster than that:
|
// And if it's faster than that:
|
||||||
// 40/10 = 4
|
// 40/10 = 4
|
||||||
b_rate =
|
b_rate =
|
||||||
qMax(b_rate, qRound(static_cast<float>(message_display_speed[3]) /
|
qMax(b_rate, qRound(static_cast<float>(text_crawl) /
|
||||||
msg_delay));
|
msg_delay));
|
||||||
}
|
}
|
||||||
if (blip_ticker % b_rate == 0) {
|
if (blip_ticker % b_rate == 0) {
|
||||||
@ -3478,9 +3478,10 @@ void Courtroom::chat_tick()
|
|||||||
|
|
||||||
// Punctuation delayer, only kicks in on speed ticks less than }}
|
// Punctuation delayer, only kicks in on speed ticks less than }}
|
||||||
if (current_display_speed > 1 && punctuation_chars.contains(f_character)) {
|
if (current_display_speed > 1 && punctuation_chars.contains(f_character)) {
|
||||||
// Making the user have to wait any longer than 150ms per letter is
|
// Making the user have to wait any longer than 1.5 of the slowest speed
|
||||||
// downright unreasonable
|
// is downright unreasonable
|
||||||
msg_delay = qMin(150, msg_delay * punctuation_modifier);
|
int max_delay = text_crawl * message_display_mult[6] * 1.5;
|
||||||
|
msg_delay = qMin(max_delay, msg_delay * punctuation_modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this color is talking
|
// If this color is talking
|
||||||
|
@ -52,6 +52,12 @@ int AOApplication::stay_time()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AOApplication::get_text_crawl()
|
||||||
|
{
|
||||||
|
int result = configini->value("text_crawl", 40).toInt();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
int AOApplication::get_chat_ratelimit()
|
int AOApplication::get_chat_ratelimit()
|
||||||
{
|
{
|
||||||
int result = configini->value("chat_ratelimit", 300).toInt();
|
int result = configini->value("chat_ratelimit", 300).toInt();
|
||||||
|
Loading…
Reference in New Issue
Block a user