Improved blankposting (#256)
* Consolidate blankposting into singular log entries of "no message" instead of spamming the logs repeatedly when someone decides to keep switching emotes
Return proper blankpost checking to 2.8.5 (chatmessage_is_empty bool makes sure the chatbox doesn't appear - branch broke that behavior by never setting it)
More robust blankpost checking, meaning that passing a competely empty "" string will also count as a blankpost
Fix screenshake not working with blankposting by moving it before the chatmessage_is_empty check in start_chack_ticking() stage of the message parsing
* Allow user to send blankposts without even having to input a single spacebar, but only if last m_chatmessage CID matches ours.
* Reviews are cool and good👌
allow sending no-text chat message to server without weird cid checks (let the server validate if they want to do STR_OR_EMPTY or just STR) - doesn't break existing behavior and lets servers introduce the new one if they want to
Treat all blank/whitespace messages as blankposting and not just single-whitespace.
Remove chatmessage_is_empty bool because why the fuck would you even need it if you have m_chatmessage[MESSAGE] already
Simplify chatlogpiece log entry to not be a *temp pointer by suggestion
* another useless bool destroyed
Make "additive" have a very awesome emergent behavior with blankposting - keep showing the chatbox+message while only changing the emotes. Works with preanims too!
This commit is contained in:
parent
3c13a686a0
commit
475a572c3b
@ -315,9 +315,6 @@ private:
|
|||||||
bool rainbow_appended = false;
|
bool rainbow_appended = false;
|
||||||
bool blank_blip = false;
|
bool blank_blip = false;
|
||||||
|
|
||||||
// Whether or not is this message additive to the previous one
|
|
||||||
bool is_additive = false;
|
|
||||||
|
|
||||||
// Used for getting the current maximum blocks allowed in the IC chatlog.
|
// Used for getting the current maximum blocks allowed in the IC chatlog.
|
||||||
int log_maximum_blocks = 0;
|
int log_maximum_blocks = 0;
|
||||||
|
|
||||||
@ -355,7 +352,6 @@ private:
|
|||||||
static const int MS_MINIMUM = 15;
|
static const int MS_MINIMUM = 15;
|
||||||
static const int MS_MAXIMUM = 30;
|
static const int MS_MAXIMUM = 30;
|
||||||
QString m_chatmessage[MS_MAXIMUM];
|
QString m_chatmessage[MS_MAXIMUM];
|
||||||
bool chatmessage_is_empty = false;
|
|
||||||
|
|
||||||
QString previous_ic_message = "";
|
QString previous_ic_message = "";
|
||||||
QString additive_previous = "";
|
QString additive_previous = "";
|
||||||
|
@ -1538,7 +1538,7 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message,
|
|||||||
|
|
||||||
void Courtroom::on_chat_return_pressed()
|
void Courtroom::on_chat_return_pressed()
|
||||||
{
|
{
|
||||||
if (ui_ic_chat_message->text() == "" || is_muted)
|
if (is_muted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((anim_state < 3 || text_state < 2) && objection_state == 0)
|
if ((anim_state < 3 || text_state < 2) && objection_state == 0)
|
||||||
@ -1863,31 +1863,35 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
|
|||||||
reset_ui();
|
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 = "";
|
QString f_charname = "";
|
||||||
if (f_char_id >= 0)
|
if (f_char_id >= 0)
|
||||||
f_charname = ao_app->get_showname(char_list.at(f_char_id).name);
|
f_charname = ao_app->get_showname(char_list.at(f_char_id).name);
|
||||||
|
|
||||||
chatlogpiece *temp =
|
if (m_chatmessage[MESSAGE].trimmed().isEmpty()) // User-created blankpost
|
||||||
new chatlogpiece(f_charname, f_displayname, m_chatmessage[MESSAGE], false,
|
{
|
||||||
m_chatmessage[TEXT_COLOR].toInt());
|
m_chatmessage[MESSAGE] = ""; // Turn it into true blankpost
|
||||||
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);
|
|
||||||
|
|
||||||
while (ic_chatlog_history.size() > log_maximum_blocks &&
|
if (!m_chatmessage[MESSAGE].isEmpty() || ic_chatlog_history.isEmpty() || ic_chatlog_history.last().get_message() != "")
|
||||||
log_maximum_blocks > 0) {
|
{
|
||||||
ic_chatlog_history.removeFirst();
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
append_ic_text(m_chatmessage[MESSAGE], f_displayname, "",
|
||||||
|
m_chatmessage[TEXT_COLOR].toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString f_char = m_chatmessage[CHAR_NAME];
|
QString f_char = m_chatmessage[CHAR_NAME];
|
||||||
QString f_custom_theme = ao_app->get_char_shouts(f_char);
|
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 an objection is used
|
||||||
if (objection_mod <= 4 && objection_mod >= 1) {
|
if (objection_mod <= 4 && objection_mod >= 1) {
|
||||||
switch (objection_mod) {
|
switch (objection_mod) {
|
||||||
@ -2763,16 +2767,25 @@ void Courtroom::start_chat_ticking()
|
|||||||
this->do_flash();
|
this->do_flash();
|
||||||
sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME]));
|
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
|
// since the message is empty, it's technically done ticking
|
||||||
text_state = 2;
|
text_state = 2;
|
||||||
|
if (m_chatmessage[ADDITIVE] == "1") {
|
||||||
|
// Cool behavior
|
||||||
|
ui_vp_chatbox->show();
|
||||||
|
ui_vp_message->show();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_vp_chatbox->show();
|
ui_vp_chatbox->show();
|
||||||
ui_vp_message->show();
|
ui_vp_message->show();
|
||||||
|
|
||||||
if (!is_additive) {
|
if (m_chatmessage[ADDITIVE] != "1") {
|
||||||
ui_vp_message->clear();
|
ui_vp_message->clear();
|
||||||
real_tick_pos = 0;
|
real_tick_pos = 0;
|
||||||
additive_previous = "";
|
additive_previous = "";
|
||||||
@ -2789,11 +2802,6 @@ void Courtroom::start_chat_ticking()
|
|||||||
|
|
||||||
blip_player->set_blips(f_gender);
|
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
|
// means text is currently ticking
|
||||||
text_state = 1;
|
text_state = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user