diff --git a/include/aoapplication.h b/include/aoapplication.h
index 790b445..3465202 100644
--- a/include/aoapplication.h
+++ b/include/aoapplication.h
@@ -220,6 +220,9 @@ public:
// Returns whether the log should have a timestamp.
bool get_log_timestamp();
+ // Returns whether to log IC actions.
+ bool get_log_ic_actions();
+
// Returns the username the user may have set in config.ini.
QString get_default_username();
diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h
index fe99626..2e2d7b8 100644
--- a/include/aooptionsdialog.h
+++ b/include/aooptionsdialog.h
@@ -52,6 +52,8 @@ private:
QSpinBox *ui_log_margin_spinbox;
QLabel *ui_log_timestamp_lbl;
QCheckBox *ui_log_timestamp_cb;
+ QLabel *ui_log_ic_actions_lbl;
+ QCheckBox *ui_log_ic_actions_cb;
QFrame *ui_log_names_divider;
QLineEdit *ui_username_textbox;
QLabel *ui_username_lbl;
diff --git a/include/courtroom.h b/include/courtroom.h
index 6a00bdc..a35d830 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -332,6 +332,9 @@ private:
// True, if the log should display the message like name
text instead of name: text
bool log_newline = false;
+ // True, if the log should include RP actions like interjections, showing evidence, etc.
+ bool log_ic_actions = true;
+
// Margin in pixels between log entries for the IC log.
int log_margin = 0;
@@ -398,6 +401,11 @@ private:
int objection_state = 0;
QString objection_custom = "";
+ struct CustomObjection {
+ QString name;
+ QString filename;
+ };
+ QList custom_objections_list;
int realization_state = 0;
int screenshake_state = 0;
int text_color = 0;
diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp
index 075e2d0..314e982 100644
--- a/src/aooptionsdialog.cpp
+++ b/src/aooptionsdialog.cpp
@@ -163,6 +163,19 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_timestamp_cb);
+ row += 1;
+ ui_log_ic_actions_lbl = new QLabel(ui_form_layout_widget);
+ ui_log_ic_actions_lbl->setText(tr("Log IC actions:"));
+ ui_log_ic_actions_lbl->setToolTip(
+ tr("If ticked, log will show IC actions such as shouting and presenting evidence."));
+
+ ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_log_ic_actions_lbl);
+
+ ui_log_ic_actions_cb = new QCheckBox(ui_form_layout_widget);
+ ui_log_ic_actions_cb->setChecked(p_ao_app->get_log_ic_actions());
+
+ ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_ic_actions_cb);
+
row += 1;
ui_log_names_divider = new QFrame(ui_form_layout_widget);
ui_log_names_divider->setFrameShape(QFrame::HLine);
@@ -765,6 +778,7 @@ void AOOptionsDialog::save_pressed()
configini->setValue("log_newline", ui_log_newline_cb->isChecked());
configini->setValue("log_margin", ui_log_margin_spinbox->value());
configini->setValue("log_timestamp", ui_log_timestamp_cb->isChecked());
+ configini->setValue("log_ic_actions", ui_log_ic_actions_cb->isChecked());
configini->setValue("default_username", ui_username_textbox->text());
configini->setValue("show_custom_shownames", ui_showname_cb->isChecked());
configini->setValue("master", ui_ms_textbox->text());
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 9b54941..b8aa0bd 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1300,10 +1300,16 @@ void Courtroom::update_character(int p_cid)
if (ao_app->custom_objection_enabled) // if setting is enabled
{
custom_obj_menu->clear();
+ custom_objections_list.clear();
if (file_exists(ao_app->get_image_suffix(
ao_app->get_character_path(current_char, "custom")))) {
ui_custom_objection->show();
- QAction *action = custom_obj_menu->addAction("Default");
+ QString custom_name = ao_app->read_char_ini(f_char, "custom_name", "Shouts");
+ QAction *action;
+ if (custom_name != "")
+ action = custom_obj_menu->addAction(custom_name);
+ else
+ action = custom_obj_menu->addAction("Default");
custom_obj_menu->setDefaultAction(action);
objection_custom = "";
}
@@ -1318,11 +1324,23 @@ void Courtroom::update_character(int p_cid)
<< "*.webp",
QDir::Files);
for (const QString &filename : custom_obj) {
- QAction *action = custom_obj_menu->addAction(filename);
+ CustomObjection custom_objection;
+ custom_objection.filename = filename;
+ QString custom_name = ao_app->read_char_ini(f_char, filename.split(".")[0] + "_name", "Shouts");
+ QAction *action;
+ if (custom_name != "") {
+ custom_objection.name = custom_name;
+ action = custom_obj_menu->addAction(custom_name);
+ }
+ else {
+ custom_objection.name = filename.split(".")[0];
+ action = custom_obj_menu->addAction(filename.split(".")[0]);
+ }
if (custom_obj_menu->defaultAction() == nullptr) {
custom_obj_menu->setDefaultAction(action);
- objection_custom = action->text();
+ objection_custom = custom_objection.filename;
}
+ custom_objections_list.append(custom_objection);
}
}
}
@@ -1881,34 +1899,36 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
{
m_chatmessage[MESSAGE] = ""; // Turn it into true blankpost
}
-
- if (prev_char_id != f_char_id || !m_chatmessage[MESSAGE].isEmpty() ||
- ic_chatlog_history.isEmpty() || ic_chatlog_history.last().get_message() != "") {
- log_ic_text(f_charname, f_displayname, m_chatmessage[MESSAGE], "",
- m_chatmessage[TEXT_COLOR].toInt());
- append_ic_text(m_chatmessage[MESSAGE], f_displayname, "",
- m_chatmessage[TEXT_COLOR].toInt());
- }
-
+
QString f_char = m_chatmessage[CHAR_NAME];
QString f_custom_theme = ao_app->get_char_shouts(f_char);
// if an objection is used
if (objection_mod <= 4 && objection_mod >= 1) {
+ QString shout_message;
switch (objection_mod) {
case 1:
ui_vp_objection->play("holdit_bubble", f_char, f_custom_theme, 724);
objection_player->play("holdit", f_char, f_custom_theme);
+ shout_message = ao_app->read_char_ini(f_char, "holdit_message", "Shouts");
+ if (shout_message == "")
+ shout_message = tr("HOLD IT!");
break;
case 2:
ui_vp_objection->play("objection_bubble", f_char, f_custom_theme, 724);
objection_player->play("objection", f_char, f_custom_theme);
+ shout_message = ao_app->read_char_ini(f_char, "objection_message", "Shouts");
+ if (shout_message == "")
+ shout_message = tr("OBJECTION!");
if (ao_app->objection_stop_music())
music_player->stop();
break;
case 3:
ui_vp_objection->play("takethat_bubble", f_char, f_custom_theme, 724);
objection_player->play("takethat", f_char, f_custom_theme);
+ shout_message = ao_app->read_char_ini(f_char, "takethat_message", "Shouts");
+ if (shout_message == "")
+ shout_message = tr("TAKE THAT!");
break;
// case 4 is AO2 only
case 4:
@@ -1918,19 +1938,36 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
objection_player->play("custom_objections/" +
custom_objection.split('.')[0],
f_char, f_custom_theme);
+ shout_message = ao_app->read_char_ini(f_char, custom_objection.split('.')[0] + "_message", "Shouts");
+ if (shout_message == "")
+ shout_message = custom_objection.split('.')[0];
}
else {
ui_vp_objection->play("custom", f_char, f_custom_theme,
shout_stay_time);
objection_player->play("custom", f_char, f_custom_theme);
+ shout_message = ao_app->read_char_ini(f_char, "custom_message", "Shouts");
+ if (shout_message == "")
+ shout_message = tr("CUSTOM OBJECTION!");
}
m_chatmessage[EMOTE_MOD] = 1;
break;
}
+ log_ic_text(f_char, f_displayname, shout_message,
+ tr("shouts"),2);
+ append_ic_text(shout_message, f_displayname, tr("shouts"));
sfx_player->clear(); // Objection played! Cut all sfx.
}
else
handle_chatmessage_2();
+
+ if (!m_chatmessage[MESSAGE].isEmpty() || ic_chatlog_history.isEmpty() ||
+ ic_chatlog_history.last().get_message() != "") {
+ log_ic_text(f_charname, f_displayname, m_chatmessage[MESSAGE], "",
+ m_chatmessage[TEXT_COLOR].toInt());
+ append_ic_text(m_chatmessage[MESSAGE], f_displayname, "",
+ m_chatmessage[TEXT_COLOR].toInt());
+ }
}
void Courtroom::objection_done() { handle_chatmessage_2(); }
@@ -2294,11 +2331,12 @@ void Courtroom::handle_chatmessage_3()
f_side == "jud" || f_side == "jur");
ui_vp_evidence_display->show_evidence(f_image, is_left_side,
ui_sfx_slider->value());
-
- log_ic_text(m_chatmessage[CHAR_NAME], m_chatmessage[SHOWNAME], f_evi_name,
- tr("has presented evidence"),
- m_chatmessage[TEXT_COLOR].toInt());
- append_ic_text(f_evi_name, f_showname, tr("has presented evidence"));
+ if (log_ic_actions) {
+ log_ic_text(m_chatmessage[CHAR_NAME], m_chatmessage[SHOWNAME], f_evi_name,
+ tr("has presented evidence"),
+ m_chatmessage[TEXT_COLOR].toInt());
+ append_ic_text(f_evi_name, f_showname, tr("has presented evidence"));
+ }
evidence_presented = true; // we're done presenting evidence, and we
// don't want to do it twice
}
@@ -2657,8 +2695,16 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action,
if (p_action == tr("has stopped the music")) {
ui_ic_chatlog->textCursor().insertText(" " + p_action + ".", normal);
}
+ // Make shout text bold
+ else if (p_action == tr("shouts") && log_ic_actions) {
+ ui_ic_chatlog->textCursor().insertText(" " + p_action + " ", normal);
+ if (log_colors)
+ ui_ic_chatlog->textCursor().insertHtml("" + filter_ic_text(p_text, true, -1, 0) + "");
+ else
+ ui_ic_chatlog->textCursor().insertText(" " + p_text, italics);
+ }
// If action not blank:
- else if (p_action != "") {
+ else if (p_action != "" && log_ic_actions) {
// Format the action in normal
ui_ic_chatlog->textCursor().insertText(" " + p_action, normal);
if (log_newline)
@@ -4424,10 +4470,16 @@ void Courtroom::show_custom_objection_menu(const QPoint &pos)
ui_take_that->set_image("takethat");
ui_hold_it->set_image("holdit");
ui_custom_objection->set_image("custom_selected");
- if (selecteditem->text() == "Default")
+ if (selecteditem->text() == ao_app->read_char_ini(current_char, "custom_name", "Shouts") || selecteditem->text() == "Default")
objection_custom = "";
- else
- objection_custom = selecteditem->text();
+ else {
+ foreach (CustomObjection custom_objection, custom_objections_list) {
+ if (custom_objection.name == selecteditem->text()) {
+ objection_custom = custom_objection.filename;
+ break;
+ }
+ }
+ }
objection_state = 4;
custom_obj_menu->setDefaultAction(selecteditem);
}
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp
index 00eaa00..eb0976a 100644
--- a/src/text_file_functions.cpp
+++ b/src/text_file_functions.cpp
@@ -73,6 +73,13 @@ bool AOApplication::get_log_timestamp()
return result.startsWith("true");
}
+bool AOApplication::get_log_ic_actions()
+{
+ QString result =
+ configini->value("log_ic_actions", "true").value();
+ return result.startsWith("true");
+}
+
bool AOApplication::get_showname_enabled_by_default()
{
QString result =