aboutsummaryrefslogtreecommitdiff
path: root/src/courtroom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/courtroom.cpp')
-rw-r--r--src/courtroom.cpp84
1 files changed, 64 insertions, 20 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index e20abea9..603b2230 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1870,30 +1870,72 @@ void Courtroom::on_chat_return_pressed()
packet_contents.append(f_side);
- packet_contents.append(get_char_sfx());
-
int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote);
+ QString f_sfx = "1";
+// 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) {
+ f_emote_mod = PREANIM;
+ }
+ // No clue what emote_mod 3 is even supposed to be.
+ if (f_emote_mod == 3) {
+ f_emote_mod = IDLE;
+ }
+ // Emote_mod 4 seems to be a legacy bugfix that just refers it to emote_mod 5 which is zoom emote
+ if (f_emote_mod == 4) {
+ f_emote_mod = ZOOM;
+ }
+ // If we have "pre" on, and immediate is not checked
+ if (ui_pre->isChecked() && !ui_immediate->isChecked()) {
+ // Turn idle into preanim
+ if (f_emote_mod == IDLE) {
+ f_emote_mod = PREANIM;
+ }
+ // Turn zoom into preanim zoom
+ else if (f_emote_mod == ZOOM && ao_app->prezoom_enabled) {
+ f_emote_mod = PREANIM_ZOOM;
+ }
+ // Play the sfx
+ f_sfx = get_char_sfx();
+ }
+ // If we have "pre" off, or immediate is checked
+ else {
+ // Turn preanim into idle
+ if (f_emote_mod == PREANIM) {
+ f_emote_mod = IDLE;
+ }
+ // Turn preanim zoom into zoom
+ else if (f_emote_mod == PREANIM_ZOOM) {
+ f_emote_mod = ZOOM;
+ }
- // needed or else legacy won't understand what we're saying
- if (objection_state > 0 && ui_pre->isChecked()) {
- if (f_emote_mod == 4 || f_emote_mod == 5)
- f_emote_mod = 6;
- else
- f_emote_mod = 2;
+ // Play the sfx if pre is checked
+ if (ui_pre->isChecked()) {
+ f_sfx = get_char_sfx();
+ }
}
- else if (ui_pre->isChecked() && !ui_immediate->isChecked()) {
- if (f_emote_mod == 0)
- f_emote_mod = 1;
- else if (f_emote_mod == 5 && ao_app->prezoom_enabled)
- f_emote_mod = 6;
+
+// TODO: deprecate this garbage. See https://github.com/AttorneyOnline/AO2-Client/issues/692
+ // If our objection is enabled
+ if (objection_state > 0) {
+ // Turn preanim zoom emote mod into non-pre
+ if (f_emote_mod == ZOOM) {
+ f_emote_mod = PREANIM_ZOOM;
+ }
+ // Turn it into preanim objection emote mod
+ else {
+ f_emote_mod = 2;
+ }
+ // Play the sfx
+ f_sfx = get_char_sfx();
}
- else {
- if (f_emote_mod == 1)
- f_emote_mod = 0;
- else if (f_emote_mod == 4)
- f_emote_mod = 5;
+
+ // Custom sfx override via sound list dropdown.
+ if (!custom_sfx.isEmpty() || ui_sfx_dropdown->currentIndex() != 0) {
+ f_sfx = get_char_sfx();
}
+ packet_contents.append(f_sfx);
packet_contents.append(QString::number(f_emote_mod));
packet_contents.append(QString::number(m_cid));
@@ -2059,7 +2101,7 @@ void Courtroom::reset_ui()
ui_screenshake->set_image("screenshake");
ui_evidence_present->set_image("present");
- if (ui_pre->isChecked() && !ao_app->is_stickysounds_enabled()) {
+ if (!ao_app->is_stickysounds_enabled()) {
ui_sfx_dropdown->setCurrentIndex(0);
ui_sfx_remove->hide();
custom_sfx = "";
@@ -2504,6 +2546,7 @@ void Courtroom::handle_emote_mod(int emote_mod, bool p_immediate)
// If immediate is not ticked on...
if (!p_immediate)
{
+ play_sfx();
// Skip preanim.
handle_ic_speaking();
}
@@ -4637,8 +4680,9 @@ QString Courtroom::get_char_sfx()
if (!custom_sfx.isEmpty())
return custom_sfx;
int index = ui_sfx_dropdown->currentIndex();
- if (index == 0) // Default
+ if (index == 0) { // Default
return ao_app->get_sfx_name(current_char, current_emote);
+ }
if (index == 1) // Nothing
return "1";
QString sfx = sound_list[index-2].split("=")[0].trimmed();