aboutsummaryrefslogtreecommitdiff
path: root/src/courtroom.cpp
diff options
context:
space:
mode:
authorin1tiate <32779090+in1tiate@users.noreply.github.com>2021-01-09 09:17:12 -0600
committerGitHub <noreply@github.com>2021-01-09 18:17:12 +0300
commit15c3d607c616a6171118cfdd4967e35489c99312 (patch)
tree5e0d351d861644f8fe15a8a2666b11ab19e9824e /src/courtroom.cpp
parent7bac3c9514f2c5b01d0c49f60849d897993765db (diff)
Log objections IC, overhaul custom objections context menu, add more configuration options per-character (#356)
* initial commit * The Quick-Fix is a secondary weapon for the Medic. It is a prototype Medi Gun with a group of three gauges on one side, a (cosmetic) ÜberCharge gauge on the other side, and what appears to be a blender for a body. The main gun is coupled with a medicinal reactor backpack with glowing portions that replaces Medic's default backpack. * fixed settings dialog * slightly less stupid custom objection default Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com> Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
Diffstat (limited to 'src/courtroom.cpp')
-rw-r--r--src/courtroom.cpp94
1 files changed, 73 insertions, 21 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 9b549419..b8aa0bd8 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("<b>" + filter_ic_text(p_text, true, -1, 0) + "</b>");
+ 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);
}