Add support for narrator chat (??!!) which does not affect the state of IC in any way, rather the only thing it affects is the IC chat box. INSANELY useful for GMs to play sound effects, talk over the situation, etc. without causing the IC viewport to reset.

Stress-tested with preanims, non-interrupting preanims, idle chat, talking chat, evidence presenting
This commit is contained in:
Crystalwarrior 2021-04-20 02:38:42 +03:00
parent e36ac916a9
commit 1edb5d9ae1

View File

@ -2231,6 +2231,7 @@ bool Courtroom::handle_objection()
sfx_player->clear(); // Objection played! Cut all sfx.
return true;
}
if (m_chatmessage[EMOTE] != "")
display_character();
return false;
}
@ -2389,6 +2390,9 @@ void Courtroom::handle_ic_message()
// Update the chatbox information
initialize_chatbox();
int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
bool immediate = m_chatmessage[IMMEDIATE].toInt() == 1;
if (m_chatmessage[EMOTE] != "") {
// Display our own character
display_character();
@ -2397,14 +2401,20 @@ void Courtroom::handle_ic_message()
ui_vp_sideplayer_char->move(0, 0);
// If the emote_mod is not zooming
int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
if (emote_mod != 5 && emote_mod != 6) {
// Display the pair character
display_pair_character(m_chatmessage[OTHER_CHARID], m_chatmessage[OTHER_OFFSET]);
}
// Parse the emote_mod part of the chat message
handle_emote_mod(m_chatmessage[EMOTE_MOD].toInt(), m_chatmessage[IMMEDIATE].toInt() == 1);
handle_emote_mod(emote_mod, immediate);
}
else
{
start_chat_ticking();
if (emote_mod == 1 || emote_mod == 2 || emote_mod == 6 || immediate)
play_sfx();
}
// if we have instant objections disabled, and queue is not empty, check if next message after this is an objection.
if (!ao_app->is_instant_objection_enabled() && chatmessage_queue.size() > 0)
@ -3300,6 +3310,8 @@ void Courtroom::chat_tick()
if (tick_pos >= f_message.size()) {
text_state = 2;
// Check if we're a narrator msg
if (m_chatmessage[EMOTE] != "") {
if (anim_state < 3) {
QStringList c_paths = {
ao_app->get_image_suffix(ao_app->get_character_path(m_chatmessage[CHAR_NAME], "(c)" + m_chatmessage[EMOTE])),
@ -3320,6 +3332,9 @@ void Courtroom::chat_tick()
ui_vp_player_char->load_image(filename, m_chatmessage[CHAR_NAME], 0,
false);
}
}
else // We're a narrator msg
anim_state = 3;
QString f_char;
QString f_custom_theme;
if (ao_app->is_customchat_enabled()) {
@ -3520,6 +3535,7 @@ void Courtroom::chat_tick()
msg_delay = qMin(max_delay, msg_delay * punctuation_modifier);
}
if (m_chatmessage[EMOTE] != "") {
// If this color is talking
if (color_is_talking && anim_state != 2 &&
anim_state <
@ -3543,6 +3559,7 @@ void Courtroom::chat_tick()
false);
anim_state = 3;
}
}
// Continue ticking
chat_tick_timer->start(msg_delay);
}