From 5b6d58bd020978f4632cb2dcb2db620213175645 Mon Sep 17 00:00:00 2001 From: cents Date: Mon, 20 Apr 2020 07:49:47 -0700 Subject: [PATCH] Added additional customization options. I didn't format anything tho that is at the end --- include/aoapplication.h | 4 +++- include/aooptionsdialog.h | 5 +++-- include/courtroom.h | 7 ++++--- src/aooptionsdialog.cpp | 27 +++++++++++++++++---------- src/courtroom.cpp | 11 ++++++++--- src/text_file_functions.cpp | 17 +++++++++++------ 6 files changed, 46 insertions(+), 25 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index a07bf74..5646dde 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -188,8 +188,10 @@ public: int get_max_log_size(); // Gets the punctuation delay modifier - int get_pundelay(); + bool get_pundelay(); + //Gets whether slower text speed is enabled + bool get_slower_blips(); // Returns whether the log should go upwards (new behaviour) // or downwards (vanilla behaviour). bool get_log_goes_downwards(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 8580c34..9a1429a 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -52,8 +52,9 @@ private: QLabel *ui_length_lbl; QSpinBox *ui_length_spinbox; QLabel *ui_pun_delay; - QSpinBox *ui_pun_delay_spinbox; - QFrame *ui_log_names_divider; + QCheckBox *ui_pun_delay_cb; + QLabel *ui_slower_blips_lb; + QCheckBox *ui_slower_blips_cb; QLineEdit *ui_username_textbox; QLabel *ui_username_lbl; QLabel *ui_showname_lbl; diff --git a/include/courtroom.h b/include/courtroom.h index 8b4b443..396c4d7 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -288,7 +288,8 @@ private: bool message_is_centered = false; int current_display_speed = 3; - int message_display_speed[7] = {30, 40, 50, 60, 75, 100, 120}; + int message_display_speed_slow[7] = {30, 40, 50, 60, 75, 100, 120}; + int message_display_speed[7] = {10, 20, 30, 40, 50, 60, 75}; // This is for checking if the character should start talking again // when an inline blue text ends. @@ -388,8 +389,8 @@ private: const QString punctuation_chars = ".,?!:;"; // amount by which we multiply the delay when we parse punctuation chars - int punctuation_modifier = 2; - + int punctuation_modifier = 0; + bool slower_blips = false; // character id, which index of the char_list the player is int m_cid = -1; // cid and this may differ in cases of ini-editing diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index e9b38fa..e2f433d 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -189,16 +189,23 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_net_divider->setFrameShadow(QFrame::Sunken); ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_net_divider); + ui_slower_blips_lb = new QLabel(ui_form_layout_widget); + ui_slower_blips_lb->setText(tr("Slower text speed:")); + ui_slower_blips_lb->setToolTip(tr("Set the text speed to be the same as the AA games.")); + ui_slower_blips_cb = new QCheckBox(ui_form_layout_widget); + ui_slower_blips_cb->setChecked(p_ao_app->get_pundelay()); + ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_slower_blips_cb); + ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_slower_blips_lb); + ui_pun_delay = new QLabel(ui_form_layout_widget); - ui_pun_delay->setText(tr("Punctation Delay:")); + ui_pun_delay->setText(tr("Blip delay on punctuations:")); ui_pun_delay->setToolTip(tr("Punctation delay modifier." - " Set it to 1 for no additional delay.")); - ui_pun_delay_spinbox = new QSpinBox(ui_form_layout_widget); - ui_pun_delay_spinbox->setMinimum(1); - ui_pun_delay_spinbox->setMaximum(3); - ui_pun_delay_spinbox->setValue(p_ao_app->get_pundelay()); - ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_pun_delay_spinbox); - ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_pun_delay); + " Enable it for the blips to slow down on punctuations.")); + ui_pun_delay_cb = new QCheckBox(ui_form_layout_widget); + ui_pun_delay_cb->setChecked(p_ao_app->get_pundelay()); + ui_gameplay_form->setWidget(11, QFormLayout::FieldRole, ui_pun_delay_cb); + ui_gameplay_form->setWidget(11, QFormLayout::LabelRole, ui_pun_delay); + // Here we start the callwords tab. ui_callwords_tab = new QWidget(); @@ -655,8 +662,8 @@ void AOOptionsDialog::save_pressed() configini->setValue("discord", ui_discord_cb->isChecked()); configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked()); configini->setValue("language", ui_language_combobox->currentText().left(2)); - configini->setValue("punctuation_delay", ui_pun_delay_spinbox->value()); - configini->setValue("keep_evidence", ui_keepevi_cb->isChecked()); + configini->setValue("punctuation_delay", ui_pun_delay_cb->isChecked()); + configini->setValue("slower_blips", ui_slower_blips_cb->isChecked()); QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c0fb24b..0cacffc 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1761,7 +1761,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_vp_objection->stop(); // ui_vp_player_char->stop(); chat_tick_timer->stop(); - if (keep_evidence_display) + if (!keep_evidence_display) ui_vp_evidence_display->reset(); chatmessage_is_empty = @@ -2769,7 +2769,10 @@ void Courtroom::start_chat_ticking() // 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]); + if (slower_blips) + chat_tick_timer->start(message_display_speed_slow[current_display_speed]); + else + chat_tick_timer->start(message_display_speed[current_display_speed]); QString f_char = m_chatmessage[CHAR_NAME]; QString f_gender = ao_app->get_gender(f_char); @@ -2793,6 +2796,8 @@ void Courtroom::chat_tick() // Due to our new text speed system, we always need to stop the timer now. chat_tick_timer->stop(); int msg_delay = message_display_speed[current_display_speed]; + if (slower_blips) + msg_delay = message_display_speed_slow[current_display_speed]; // Stops blips from playing when we have a formatting option. bool formatting_char = false; @@ -2829,7 +2834,7 @@ void Courtroom::chat_tick() f_character = f_character.toHtmlEscaped(); if (punctuation_chars.contains(f_character)) { - msg_delay *= punctuation_modifier; + msg_delay *= punctuation_modifier + 1; // Since we are handling a boolean, if its true its double (1 + 1) or false (1 + 0). // ui_vp_message->insertPlainText(f_character); } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 29c5c42..779765d 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -46,13 +46,18 @@ int AOApplication::get_max_log_size() return result; } -int AOApplication::get_pundelay() +bool AOApplication::get_slower_blips() { - int result = configini->value("punctuation_delay", 2).toInt(); - if (result < 1 || result > 3) { - result = 2; - } - return result; + QString result = + configini->value("slower_blips", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_pundelay() +{ + QString result = + configini->value("punctuation_delay", "false").value(); + return result.startsWith("true"); } bool AOApplication::get_log_goes_downwards()