aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrystalwarrior <varsash@gmail.com>2021-02-24 16:02:07 +0300
committerCrystalwarrior <varsash@gmail.com>2021-02-24 16:02:07 +0300
commit5ac95ada564f11419441eca32907aef7ec16dd90 (patch)
tree80dbe9db5a99cd2ef7141d6da6b8f880a2f62c0f
parent7579457e897cba6d358bd65dba1ee05e1db87c06 (diff)
Make "stop music on objection" work in tandem with the server by calling "music_stop()" instead of only working on the client-side
-rw-r--r--include/courtroom.h2
-rw-r--r--src/aooptionsdialog.cpp3
-rw-r--r--src/courtroom.cpp16
3 files changed, 13 insertions, 8 deletions
diff --git a/include/courtroom.h b/include/courtroom.h
index 2e007d27..6a64deb2 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -822,7 +822,7 @@ private slots:
void music_random();
void music_list_expand_all();
void music_list_collapse_all();
- void music_stop();
+ void music_stop(bool no_effects = false);
void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column);
void select_emote(int p_id);
diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp
index 5817d96e..9ca0865f 100644
--- a/src/aooptionsdialog.cpp
+++ b/src/aooptionsdialog.cpp
@@ -704,8 +704,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
ui_objectmusic_lbl = new QLabel(ui_audio_widget);
ui_objectmusic_lbl->setText(tr("Kill Music On Objection:"));
ui_objectmusic_lbl->setToolTip(
- tr("If true, AO2 will stop the music for you when you or someone else "
- "does 'Objection!'."));
+ tr("If true, AO2 will ask the server to stop music when you use 'Objection!' "));
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_objectmusic_lbl);
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 4782e393..c8d8320f 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1747,6 +1747,10 @@ void Courtroom::on_chat_return_pressed()
else
f_obj_state = QString::number(objection_state);
+ // We're doing an Objection (custom objections not yet supported)
+ if (objection_state == 2 && ao_app->objection_stop_music())
+ music_stop(true);
+
packet_contents.append(f_obj_state);
if (is_presenting_evidence)
@@ -2166,8 +2170,6 @@ bool Courtroom::handle_objection()
filename = "objection_bubble";
objection_player->play("objection", m_chatmessage[CHAR_NAME],
ao_app->get_chat(m_chatmessage[CHAR_NAME]));
- if (ao_app->objection_stop_music())
- music_player->stop();
break;
case 3:
filename = "takethat_bubble";
@@ -4777,7 +4779,7 @@ void Courtroom::music_list_collapse_all()
ui_music_list->setCurrentItem(current);
}
-void Courtroom::music_stop()
+void Courtroom::music_stop(bool no_effects)
{
if (is_muted)
return;
@@ -4802,8 +4804,12 @@ void Courtroom::music_stop()
if ((!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) ||
ao_app->effects_enabled)
packet_contents.append(ui_ic_chat_name->text());
- if (ao_app->effects_enabled)
- packet_contents.append(QString::number(music_flags));
+ if (ao_app->effects_enabled) {
+ if (no_effects)
+ packet_contents.append("0");
+ else
+ packet_contents.append(QString::number(music_flags));
+ }
ao_app->send_server_packet(new AOPacket("MC", packet_contents), false);
}