Skip to content

Commit 5ac95ad

Browse files
Make "stop music on objection" work in tandem with the server by calling "music_stop()" instead of only working on the client-side
1 parent 7579457 commit 5ac95ad

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

include/courtroom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ private slots:
822822
void music_random();
823823
void music_list_expand_all();
824824
void music_list_collapse_all();
825-
void music_stop();
825+
void music_stop(bool no_effects = false);
826826
void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column);
827827

828828
void select_emote(int p_id);

src/aooptionsdialog.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
704704
ui_objectmusic_lbl = new QLabel(ui_audio_widget);
705705
ui_objectmusic_lbl->setText(tr("Kill Music On Objection:"));
706706
ui_objectmusic_lbl->setToolTip(
707-
tr("If true, AO2 will stop the music for you when you or someone else "
708-
"does 'Objection!'."));
707+
tr("If true, AO2 will ask the server to stop music when you use 'Objection!' "));
709708

710709
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_objectmusic_lbl);
711710

src/courtroom.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,10 @@ void Courtroom::on_chat_return_pressed()
17471747
else
17481748
f_obj_state = QString::number(objection_state);
17491749

1750+
// We're doing an Objection (custom objections not yet supported)
1751+
if (objection_state == 2 && ao_app->objection_stop_music())
1752+
music_stop(true);
1753+
17501754
packet_contents.append(f_obj_state);
17511755

17521756
if (is_presenting_evidence)
@@ -2166,8 +2170,6 @@ bool Courtroom::handle_objection()
21662170
filename = "objection_bubble";
21672171
objection_player->play("objection", m_chatmessage[CHAR_NAME],
21682172
ao_app->get_chat(m_chatmessage[CHAR_NAME]));
2169-
if (ao_app->objection_stop_music())
2170-
music_player->stop();
21712173
break;
21722174
case 3:
21732175
filename = "takethat_bubble";
@@ -4777,7 +4779,7 @@ void Courtroom::music_list_collapse_all()
47774779
ui_music_list->setCurrentItem(current);
47784780
}
47794781

4780-
void Courtroom::music_stop()
4782+
void Courtroom::music_stop(bool no_effects)
47814783
{
47824784
if (is_muted)
47834785
return;
@@ -4802,8 +4804,12 @@ void Courtroom::music_stop()
48024804
if ((!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) ||
48034805
ao_app->effects_enabled)
48044806
packet_contents.append(ui_ic_chat_name->text());
4805-
if (ao_app->effects_enabled)
4806-
packet_contents.append(QString::number(music_flags));
4807+
if (ao_app->effects_enabled) {
4808+
if (no_effects)
4809+
packet_contents.append("0");
4810+
else
4811+
packet_contents.append(QString::number(music_flags));
4812+
}
48074813
ao_app->send_server_packet(new AOPacket("MC", packet_contents), false);
48084814
}
48094815

0 commit comments

Comments
 (0)