From 9dbb1d5112d0e44d182b1a81dd46acf4f060b5cb Mon Sep 17 00:00:00 2001 From: lambdcalculus Date: Wed, 10 May 2023 17:12:08 -0300 Subject: [PATCH 1/4] ignore deskmod when zoom speaking --- src/courtroom.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 1d9b5a251..46d611f5b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3544,6 +3544,10 @@ void Courtroom::start_chat_ticking() break; } + if (m_chatmessage[EMOTE_MOD].toInt() == ZOOM) { + ui_vp_desk->hide(); + } + if (m_chatmessage[EFFECTS] != "") { QStringList fx_list = m_chatmessage[EFFECTS].split("|"); QString fx = fx_list[0]; From da0b65cebbf5238d49bbbdcc50c39132fa9d8132 Mon Sep 17 00:00:00 2001 From: lambdcalculus Date: Thu, 11 May 2023 19:19:14 -0300 Subject: [PATCH 2/4] clean up deskmod a bit * adds an enum for deskmods * deprecates the "chat" deskmood * modifies set_scene since it never rly used the deskmod argument meaningfully --- include/courtroom.h | 2 +- include/datatypes.h | 11 +++++++ src/courtroom.cpp | 79 +++++++++++++++++++-------------------------- 3 files changed, 45 insertions(+), 47 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 6107a7f66..65ef75af7 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -191,7 +191,7 @@ class Courtroom : public QMainWindow { void set_pair_list(); // sets desk and bg based on pos in chatmessage - void set_scene(QString f_desk_mod, QString f_side); + void set_scene(bool show_desk, QString f_side); // sets ui_vp_player_char according to SELF_OFFSET, only a function bc it's used with desk_mod 4 and 5 void set_self_offset(const QString& p_list); diff --git a/include/datatypes.h b/include/datatypes.h index 682d68a59..3a82efffe 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -120,6 +120,17 @@ enum EMOTE_MOD_TYPE { PREANIM_ZOOM = 6, }; +enum DESK_MOD_TYPE { + DESK_HIDE = 0, + DESK_SHOW, + DESK_EMOTE_ONLY, + DESK_PRE_ONLY, + DESK_EMOTE_ONLY_EX, + DESK_PRE_ONLY_EX, + //"EX" for "expanded" + //dumb, i know, but throw the first stone if you have a better idea +}; + enum MUSIC_EFFECT { FADE_IN = 1, FADE_OUT = 2, SYNC_POS = 4 }; #endif // DATATYPES_H diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 46d611f5b..889e17916 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1379,9 +1379,7 @@ void Courtroom::set_background(QString p_background, bool display) QString f_side = current_side; if (current_side == "") f_side = ao_app->get_char_side(current_char); - set_scene( - QString::number(ao_app->get_desk_mod(current_char, current_emote)), - f_side); + set_scene(true, f_side); } } @@ -1838,22 +1836,21 @@ void Courtroom::on_chat_return_pressed() else f_side = current_side; - QString f_desk_mod = "chat"; + int f_desk_mod = DESK_SHOW; if (ao_app->desk_mod_supported) { - f_desk_mod = - QString::number(ao_app->get_desk_mod(current_char, current_emote)); + f_desk_mod = ao_app->get_desk_mod(current_char, current_emote); if (!ao_app->expanded_desk_mods_supported) { - if (f_desk_mod == "2" || f_desk_mod == "4") - f_desk_mod = "0"; - else if (f_desk_mod == "3" || f_desk_mod == "5") - f_desk_mod = "1"; + if (f_desk_mod % 2 == 0) //deskmods 2 and 4 only show desk on preanim + f_desk_mod = DESK_HIDE; + else + f_desk_mod = DESK_SHOW; } - if (f_desk_mod == "-1") - f_desk_mod = "chat"; + if (f_desk_mod == -1) + f_desk_mod = DESK_SHOW; } - packet_contents.append(f_desk_mod); + packet_contents.append(QString::number(f_desk_mod)); 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); @@ -2471,8 +2468,6 @@ void Courtroom::display_character() else { ui_vp_sticker->stop(); } - // Initialize the correct pos (called SIDE here for some reason) with DESK_MOD to determine if we should hide the desk or not. - set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); // Arrange the netstrings of the frame SFX for the character to know about if (!m_chatmessage[FRAME_SFX].isEmpty() && @@ -3475,20 +3470,20 @@ void Courtroom::play_preanim(bool immediate) ui_vp_player_char->set_play_once(true); ui_vp_player_char->load_image(f_preanim, f_char, preanim_duration, true); - switch(m_chatmessage[DESK_MOD].toInt()) { - case 4: + switch (m_chatmessage[DESK_MOD].toInt()) { + case DESK_EMOTE_ONLY_EX: ui_vp_sideplayer_char->hide(); ui_vp_player_char->move_and_center(0, 0); [[fallthrough]]; - case 2: - set_scene("0", m_chatmessage[SIDE]); - break; - case 5: - case 3: - set_scene("1", m_chatmessage[SIDE]); + case DESK_EMOTE_ONLY: + case DESK_HIDE: + set_scene(false, m_chatmessage[SIDE]); break; - default: - set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); + + case DESK_PRE_ONLY_EX: + case DESK_PRE_ONLY: + case DESK_SHOW: + set_scene(true, m_chatmessage[SIDE]); break; } @@ -3526,28 +3521,24 @@ void Courtroom::start_chat_ticking() // handle expanded desk mods switch(m_chatmessage[DESK_MOD].toInt()) { - case 4: + case DESK_EMOTE_ONLY_EX: set_self_offset(m_chatmessage[SELF_OFFSET]); [[fallthrough]]; - case 2: - set_scene("1", m_chatmessage[SIDE]); + case DESK_EMOTE_ONLY: + case DESK_SHOW: + set_scene(true, m_chatmessage[SIDE]); break; - case 5: + + case DESK_PRE_ONLY_EX: ui_vp_sideplayer_char->hide(); ui_vp_player_char->move_and_center(0, 0); [[fallthrough]]; - case 3: - set_scene("0", m_chatmessage[SIDE]); - break; - default: - set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); + case DESK_PRE_ONLY: + case DESK_HIDE: + set_scene(false, m_chatmessage[SIDE]); break; } - if (m_chatmessage[EMOTE_MOD].toInt() == ZOOM) { - ui_vp_desk->hide(); - } - if (m_chatmessage[EFFECTS] != "") { QStringList fx_list = m_chatmessage[EFFECTS].split("|"); QString fx = fx_list[0]; @@ -3916,19 +3907,15 @@ void Courtroom::play_sfx() ao_app->get_sfx_looping(current_char, current_emote) == "1"); } -void Courtroom::set_scene(const QString f_desk_mod, const QString f_side) +void Courtroom::set_scene(bool show_desk, const QString f_side) { ui_vp_background->load_image(ao_app->get_pos_path(f_side)); ui_vp_desk->load_image(ao_app->get_pos_path(f_side, true)); - if (f_desk_mod == "0" || - (f_desk_mod != "1" && - (f_side == "jud" || f_side == "hld" || f_side == "hlp"))) { - ui_vp_desk->hide(); - } - else { + if (show_desk) ui_vp_desk->show(); - } + else + ui_vp_desk->hide(); } void Courtroom::set_self_offset(const QString& p_list) { From ba110c700b9148d8844351340ae29cf3a5707e18 Mon Sep 17 00:00:00 2001 From: lambdcalculus Date: Thu, 11 May 2023 19:54:13 -0300 Subject: [PATCH 3/4] actually use the enums i made lol --- src/courtroom.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 889e17916..21908dbc5 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1841,9 +1841,9 @@ void Courtroom::on_chat_return_pressed() if (ao_app->desk_mod_supported) { f_desk_mod = ao_app->get_desk_mod(current_char, current_emote); if (!ao_app->expanded_desk_mods_supported) { - if (f_desk_mod % 2 == 0) //deskmods 2 and 4 only show desk on preanim - f_desk_mod = DESK_HIDE; - else + if (f_desk_mod == DESK_PRE_ONLY_EX || f_desk_mod == DESK_PRE_ONLY) + f_desk_mod = DESK_HIDE;/ + else if (f_desk_mod == DESK_EMOTE_ONLY_EX || f_desk_mod == DESK_EMOTE_ONLY) f_desk_mod = DESK_SHOW; } if (f_desk_mod == -1) From 86b7e3f8373d66500ce2b003ef8cc37f39b5dd6b Mon Sep 17 00:00:00 2001 From: lambdcalculus Date: Thu, 11 May 2023 19:55:39 -0300 Subject: [PATCH 4/4] fix typo --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 21908dbc5..65c5e1a30 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1842,7 +1842,7 @@ void Courtroom::on_chat_return_pressed() f_desk_mod = ao_app->get_desk_mod(current_char, current_emote); if (!ao_app->expanded_desk_mods_supported) { if (f_desk_mod == DESK_PRE_ONLY_EX || f_desk_mod == DESK_PRE_ONLY) - f_desk_mod = DESK_HIDE;/ + f_desk_mod = DESK_HIDE; else if (f_desk_mod == DESK_EMOTE_ONLY_EX || f_desk_mod == DESK_EMOTE_ONLY) f_desk_mod = DESK_SHOW; }