From b9df908113209511624e690317fa5b3998b9f7db Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Sun, 26 May 2024 13:30:23 -0500 Subject: [PATCH 1/2] fix pair layer not being hidden correctly --- src/courtroom.cpp | 49 +++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 7ea7d28..e79d3d5 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2974,7 +2974,7 @@ void Courtroom::do_screenshake() void Courtroom::do_transition(QString p_desk_mod, QString oldPosId, QString newPosId) { - if (m_chatmessage[EMOTE] != "") + if (m_chatmessage[EMOTE].isEmpty()) { display_character(); } @@ -3000,7 +3000,7 @@ void Courtroom::do_transition(QString p_desk_mod, QString oldPosId, QString newP int duration = ao_app->get_pos_transition_duration(t_old_pos, t_new_pos); // conditions to stop slide - if (oldPosId == newPosId || old_pos_pair.first != new_pos_pair.first || !new_pos_pair.second.isValid() || !Options::getInstance().slidesEnabled() || m_chatmessage[SLIDE] != "1" || duration == -1 || m_chatmessage[EMOTE_MOD].toInt() == ZOOM || m_chatmessage[EMOTE_MOD].toInt() == PREANIM_ZOOM) + if (m_chatmessage[EMOTE].isEmpty() || oldPosId == newPosId || old_pos_pair.first != new_pos_pair.first || !new_pos_pair.second.isValid() || !Options::getInstance().slidesEnabled() || m_chatmessage[SLIDE] != "1" || duration == -1 || m_chatmessage[EMOTE_MOD].toInt() == ZOOM || m_chatmessage[EMOTE_MOD].toInt() == PREANIM_ZOOM) { #ifdef DEBUG_TRANSITION qDebug() << "skipping transition - not applicable"; @@ -3064,6 +3064,27 @@ void Courtroom::do_transition(QString p_desk_mod, QString oldPosId, QString newP QStringList pair_data = data.split("^"); return (pair_data.size() > 1) ? (pair_data.at(1).toInt() == 1) : false; }; + + ui_vp_dummy_char->loadCharacterEmote(m_previous_chatmessage[CHAR_NAME], m_previous_chatmessage[EMOTE], kal::CharacterAnimationLayer::IdleEmote); + ui_vp_dummy_char->setFlipped(m_previous_chatmessage[FLIP].toInt() == 1); + calculate_offset_and_setup_layer(ui_vp_dummy_char, scaled_old_pos, m_previous_chatmessage[SELF_OFFSET]); + + if (is_pairing(m_previous_chatmessage)) + { + qDebug() << "last message WAS paired"; + ui_vp_sidedummy_char->loadCharacterEmote(m_previous_chatmessage[OTHER_NAME], m_previous_chatmessage[OTHER_EMOTE], kal::CharacterAnimationLayer::IdleEmote); + ui_vp_sidedummy_char->setFlipped(m_previous_chatmessage[OTHER_FLIP].toInt() == 1); + calculate_offset_and_setup_layer(ui_vp_sidedummy_char, scaled_old_pos, m_previous_chatmessage[OTHER_OFFSET]); + if (is_pair_under(m_previous_chatmessage[OTHER_CHARID])) + { + ui_vp_dummy_char->stackUnder(ui_vp_sidedummy_char); + } + else + { + ui_vp_sidedummy_char->stackUnder(ui_vp_dummy_char); + } + } + if (is_pairing(m_chatmessage)) { ui_vp_sideplayer_char->loadCharacterEmote(m_chatmessage[OTHER_NAME], m_chatmessage[OTHER_EMOTE], kal::CharacterAnimationLayer::IdleEmote); @@ -3077,24 +3098,10 @@ void Courtroom::do_transition(QString p_desk_mod, QString oldPosId, QString newP ui_vp_sideplayer_char->stackUnder(ui_vp_player_char); } } - - ui_vp_dummy_char->loadCharacterEmote(m_previous_chatmessage[CHAR_NAME], m_previous_chatmessage[EMOTE], kal::CharacterAnimationLayer::IdleEmote); - ui_vp_dummy_char->setFlipped(m_previous_chatmessage[FLIP].toInt() == 1); - calculate_offset_and_setup_layer(ui_vp_dummy_char, scaled_old_pos, m_previous_chatmessage[SELF_OFFSET]); - - if (is_pairing(m_previous_chatmessage)) + else { - ui_vp_sidedummy_char->loadCharacterEmote(m_previous_chatmessage[OTHER_NAME], m_previous_chatmessage[OTHER_EMOTE], kal::CharacterAnimationLayer::IdleEmote); - ui_vp_sidedummy_char->setFlipped(m_previous_chatmessage[OTHER_FLIP].toInt() == 1); - calculate_offset_and_setup_layer(ui_vp_sidedummy_char, scaled_old_pos, m_previous_chatmessage[OTHER_OFFSET]); - if (is_pair_under(m_previous_chatmessage[OTHER_CHARID])) - { - ui_vp_dummy_char->stackUnder(ui_vp_sidedummy_char); - } - else - { - ui_vp_sidedummy_char->stackUnder(ui_vp_dummy_char); - } + ui_vp_sideplayer_char->setVisible(false); + ui_vp_sideplayer_char->hide(); } transition_animation_group->start(); @@ -3117,6 +3124,10 @@ void Courtroom::post_transition_cleanup() ui_vp_dummy_char->hide(); ui_vp_sidedummy_char->hide(); + // reset the god damn pair character + ui_vp_sideplayer_char->hide(); + ui_vp_sideplayer_char->move(0, 0); + set_scene(m_chatmessage[DESK_MOD].toInt(), m_chatmessage[SIDE]); // Move the character on the viewport according to the offsets From f09ff7fc519bac1731ae8820640e61601ac0b0e0 Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Sun, 26 May 2024 13:39:14 -0500 Subject: [PATCH 2/2] fix first-person / narrator mode --- src/courtroom.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index e79d3d5..ce4b982 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2910,8 +2910,15 @@ void Courtroom::handle_ic_message() { // Update the chatbox information initialize_chatbox(); - - do_transition(m_chatmessage[DESK_MOD], last_side, m_chatmessage[SIDE]); + if (m_chatmessage[EMOTE] != "") + { + do_transition(m_chatmessage[DESK_MOD], last_side, m_chatmessage[SIDE]); + } + else + { + play_sfx(); + start_chat_ticking(); + } // if we have instant objections disabled, and queue is not empty, check if next message after this is an objection. if (!Options::getInstance().objectionSkipQueueEnabled() && chatmessage_queue.size() > 0) @@ -2974,10 +2981,7 @@ void Courtroom::do_screenshake() void Courtroom::do_transition(QString p_desk_mod, QString oldPosId, QString newPosId) { - if (m_chatmessage[EMOTE].isEmpty()) - { - display_character(); - } + display_character(); const QStringList legacy_pos = {"def", "wit", "pro"}; QString t_old_pos = oldPosId; @@ -3000,7 +3004,7 @@ void Courtroom::do_transition(QString p_desk_mod, QString oldPosId, QString newP int duration = ao_app->get_pos_transition_duration(t_old_pos, t_new_pos); // conditions to stop slide - if (m_chatmessage[EMOTE].isEmpty() || oldPosId == newPosId || old_pos_pair.first != new_pos_pair.first || !new_pos_pair.second.isValid() || !Options::getInstance().slidesEnabled() || m_chatmessage[SLIDE] != "1" || duration == -1 || m_chatmessage[EMOTE_MOD].toInt() == ZOOM || m_chatmessage[EMOTE_MOD].toInt() == PREANIM_ZOOM) + if (oldPosId == newPosId || old_pos_pair.first != new_pos_pair.first || !new_pos_pair.second.isValid() || !Options::getInstance().slidesEnabled() || m_chatmessage[SLIDE] != "1" || duration == -1 || m_chatmessage[EMOTE_MOD].toInt() == ZOOM || m_chatmessage[EMOTE_MOD].toInt() == PREANIM_ZOOM) { #ifdef DEBUG_TRANSITION qDebug() << "skipping transition - not applicable";