aboutsummaryrefslogtreecommitdiff
path: root/src/courtroom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/courtroom.cpp')
-rw-r--r--src/courtroom.cpp45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 614d97a1..d6a1acf3 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1886,18 +1886,11 @@ void Courtroom::on_chat_return_pressed()
packet_contents.append(f_desk_mod);
- packet_contents.append(ao_app->get_pre_emote(current_char, current_emote));
-
- packet_contents.append(current_char);
-
- packet_contents.append(ao_app->get_emote(current_char, current_emote));
-
- packet_contents.append(ui_ic_chat_message->text());
-
- packet_contents.append(f_side);
-
+ QString f_pre = ao_app->get_pre_emote(current_char, current_emote);
int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote);
QString f_sfx = "1";
+ int f_sfx_delay = get_char_sfx_delay();
+
// EMOTE MOD OVERRIDES:
// Emote_mod 2 is only used by objection check later, having it in the char.ini does nothing
if (f_emote_mod == 2) {
@@ -1944,13 +1937,33 @@ void Courtroom::on_chat_return_pressed()
// Custom sfx override via sound list dropdown.
if (!custom_sfx.isEmpty() || ui_sfx_dropdown->currentIndex() != 0) {
f_sfx = get_char_sfx();
+ // We have a custom sfx but we're on idle emotes.
+ // Turn them into pre so the sound plays if client setting sfx_on_idle is enabled.
+ if (ao_app->get_sfx_on_idle() && (f_emote_mod == IDLE || f_emote_mod == ZOOM)) {
+ // We turn idle into preanim, but make it not send a pre animation
+ f_pre = "";
+ // Set sfx delay to 0 so the sfx plays immediately
+ f_sfx_delay = 0;
+ // Set the emote mod to preanim so the sound plays
+ f_emote_mod = f_emote_mod == IDLE ? PREANIM : PREANIM_ZOOM;
+ }
}
+ packet_contents.append(f_pre);
+
+ packet_contents.append(current_char);
+
+ packet_contents.append(ao_app->get_emote(current_char, current_emote));
+
+ packet_contents.append(ui_ic_chat_message->text());
+
+ packet_contents.append(f_side);
+
packet_contents.append(f_sfx);
packet_contents.append(QString::number(f_emote_mod));
packet_contents.append(QString::number(m_cid));
- packet_contents.append(QString::number(get_char_sfx_delay()));
+ packet_contents.append(QString::number(f_sfx_delay));
QString f_obj_state;
@@ -2118,12 +2131,16 @@ void Courtroom::reset_ui()
ui_screenshake->set_image("screenshake");
ui_evidence_present->set_image("present");
- if (!ao_app->is_stickysounds_enabled()) {
+ // If sticky sounds is disabled and we either have SFX on Idle enabled, or our Preanim checkbox is checked
+ if (!ao_app->is_stickysounds_enabled() && (ao_app->get_sfx_on_idle() || ui_pre->isChecked())) {
+ // Reset the SFX Dropdown to "Default"
ui_sfx_dropdown->setCurrentIndex(0);
ui_sfx_remove->hide();
custom_sfx = "";
}
+ // If sticky preanims is disabled
if (!ao_app->is_stickypres_enabled())
+ // Turn off our Preanim checkbox
ui_pre->setChecked(false);
}
@@ -2555,7 +2572,7 @@ void Courtroom::handle_emote_mod(int emote_mod, bool p_immediate)
switch (emote_mod) {
case PREANIM:
case PREANIM_ZOOM:
- // Emotes 1, 2 and 6 all play preanim that makes the chatbox wait for it to finish.
+ // play preanim that makes the chatbox wait for it to finish.
play_preanim(false);
break;
case IDLE:
@@ -2563,8 +2580,6 @@ void Courtroom::handle_emote_mod(int emote_mod, bool p_immediate)
// If immediate is not ticked on...
if (!p_immediate)
{
- // Play the sound effect if one was sent to us
- play_sfx();
// Skip preanim.
handle_ic_speaking();
}