aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/courtroom.cpp54
1 files changed, 31 insertions, 23 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index cc35a7bd..b76a4a63 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1538,7 +1538,7 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message,
void Courtroom::on_chat_return_pressed()
{
- if (ui_ic_chat_message->text() == "" || is_muted)
+ if (is_muted)
return;
if ((anim_state < 3 || text_state < 2) && objection_state == 0)
@@ -1863,31 +1863,35 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
reset_ui();
}
- // Let the server handle actually checking if they're allowed to do this.
- is_additive = m_chatmessage[ADDITIVE].toInt() == 1;
-
QString f_charname = "";
if (f_char_id >= 0)
f_charname = ao_app->get_showname(char_list.at(f_char_id).name);
- chatlogpiece *temp =
- new chatlogpiece(f_charname, f_displayname, m_chatmessage[MESSAGE], false,
- m_chatmessage[TEXT_COLOR].toInt());
- ic_chatlog_history.append(*temp);
- if (ao_app->get_auto_logging_enabled())
- ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true);
+ if (m_chatmessage[MESSAGE].trimmed().isEmpty()) // User-created blankpost
+ {
+ m_chatmessage[MESSAGE] = ""; // Turn it into true blankpost
+ }
+
+ if (!m_chatmessage[MESSAGE].isEmpty() || ic_chatlog_history.isEmpty() || ic_chatlog_history.last().get_message() != "")
+ {
+ chatlogpiece log_entry(f_charname, f_displayname, m_chatmessage[MESSAGE], false,
+ m_chatmessage[TEXT_COLOR].toInt());
+ ic_chatlog_history.append(log_entry);
+ if (ao_app->get_auto_logging_enabled())
+ ao_app->append_to_file(log_entry.get_full(), ao_app->log_filename, true);
- while (ic_chatlog_history.size() > log_maximum_blocks &&
- log_maximum_blocks > 0) {
- ic_chatlog_history.removeFirst();
+ while (ic_chatlog_history.size() > log_maximum_blocks &&
+ log_maximum_blocks > 0) {
+ ic_chatlog_history.removeFirst();
+ }
+
+ append_ic_text(m_chatmessage[MESSAGE], f_displayname, "",
+ m_chatmessage[TEXT_COLOR].toInt());
}
QString f_char = m_chatmessage[CHAR_NAME];
QString f_custom_theme = ao_app->get_char_shouts(f_char);
- append_ic_text(m_chatmessage[MESSAGE], f_displayname, "",
- m_chatmessage[TEXT_COLOR].toInt());
-
// if an objection is used
if (objection_mod <= 4 && objection_mod >= 1) {
switch (objection_mod) {
@@ -2763,16 +2767,25 @@ void Courtroom::start_chat_ticking()
this->do_flash();
sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME]));
}
- if (chatmessage_is_empty) {
+ int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); // text meme bonanza
+ if ((emote_mod == 0 || emote_mod == 5) && m_chatmessage[SCREENSHAKE] == "1") {
+ this->do_screenshake();
+ }
+ if (m_chatmessage[MESSAGE].isEmpty()) {
// since the message is empty, it's technically done ticking
text_state = 2;
+ if (m_chatmessage[ADDITIVE] == "1") {
+ // Cool behavior
+ ui_vp_chatbox->show();
+ ui_vp_message->show();
+ }
return;
}
ui_vp_chatbox->show();
ui_vp_message->show();
- if (!is_additive) {
+ if (m_chatmessage[ADDITIVE] != "1") {
ui_vp_message->clear();
real_tick_pos = 0;
additive_previous = "";
@@ -2789,11 +2802,6 @@ void Courtroom::start_chat_ticking()
blip_player->set_blips(f_gender);
- int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); // text meme bonanza
- if ((emote_mod == 0 || emote_mod == 5) && m_chatmessage[SCREENSHAKE] == "1") {
- this->do_screenshake();
- }
-
// means text is currently ticking
text_state = 1;
}