diff --git a/include/aoapplication.h b/include/aoapplication.h index e4a5b7f..f499faf 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -79,6 +79,7 @@ public: bool casing_alerts_enabled = false; bool modcall_reason_enabled = false; bool looping_sfx_support_enabled = false; + bool additive_enabled = false; ///////////////loading info/////////////////// diff --git a/include/aocharmovie.h b/include/aocharmovie.h index ec7b952..adfa7b8 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -46,6 +46,9 @@ public: QStringList network_strings; + QString m_char; + QString m_emote; + private: AOApplication *ao_app; @@ -62,9 +65,6 @@ private: QString last_path; QImageReader *m_reader = new QImageReader(); - QString m_char; - QString m_emote; - QElapsedTimer actual_time; //it will forever be a mystery who thought this time_mod system would ever be a good idea with precision-based emotes diff --git a/include/courtroom.h b/include/courtroom.h index 304dd64..9b3c057 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -315,6 +315,9 @@ private: bool rainbow_appended = 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. int log_maximum_blocks = 0; @@ -339,7 +342,7 @@ private: //the amount of time non-animated witness testimony/cross-examination images stay onscreen for in ms const int wtce_stay_time = 1500; - static const int chatmessage_size = 28; + static const int chatmessage_size = 29; QString m_chatmessage[chatmessage_size]; bool chatmessage_is_empty = false; @@ -484,6 +487,7 @@ private: QCheckBox *ui_pre; QCheckBox *ui_flip; + QCheckBox *ui_additive; QCheckBox *ui_guard; QCheckBox *ui_casing; @@ -601,7 +605,7 @@ private slots: void on_emote_dropdown_changed(int p_index); void on_pos_dropdown_changed(int p_index); - void on_evidence_name_edited(); + void on_evidence_name_edited(QString text); void on_evidence_image_name_edited(); void on_evidence_image_button_clicked(); void on_evidence_clicked(int p_id); @@ -653,6 +657,7 @@ private slots: void on_pre_clicked(); void on_flip_clicked(); + void on_additive_clicked(); void on_guard_clicked(); void on_showname_enable_clicked(); diff --git a/include/datatypes.h b/include/datatypes.h index 1b76f72..54e5c74 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -105,7 +105,8 @@ enum CHAT_MESSAGE SCREENSHAKE, FRAME_SCREENSHAKE, FRAME_REALIZATION, - FRAME_SFX + FRAME_SFX, + ADDITIVE }; enum COLOR diff --git a/src/courtroom.cpp b/src/courtroom.cpp index d56719f..59d37d3 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -197,6 +197,10 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_guard->setText(tr("Guard")); ui_guard->hide(); + ui_additive = new QCheckBox(this); + ui_additive->setText(tr("Additive")); + ui_additive->hide(); + ui_casing = new QCheckBox(this); ui_casing->setChecked(ao_app->get_casing_enabled()); ui_casing->setText(tr("Casing")); @@ -331,6 +335,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); + connect(ui_additive, SIGNAL(clicked()), this, SLOT(on_additive_clicked())); connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked())); connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked())); @@ -619,6 +624,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); set_size_and_pos(ui_flip, "flip"); + set_size_and_pos(ui_additive, "additive"); + set_size_and_pos(ui_guard, "guard"); set_size_and_pos(ui_casing, "casing"); @@ -741,7 +748,7 @@ void Courtroom::set_font(QWidget *widget, QString p_identifier) QString font_name = ao_app->get_font_name(p_identifier + "_font", design_file); QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - bool bold = static_cast(ao_app->get_font_size(p_identifier + "_bold", design_file)); // is the font bold or not? + bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? this->set_qfont(widget, QFont(font_name, f_weight), f_color, bold); } @@ -954,6 +961,11 @@ void Courtroom::enter_courtroom(int p_cid) else ui_flip->hide(); + if (ao_app->additive_enabled) + ui_additive->show(); + else + ui_additive->hide(); + if (ao_app->casing_alerts_enabled) ui_casing->show(); else @@ -1319,13 +1331,13 @@ void Courtroom::on_chat_return_pressed() qDebug() << f_effect << "packet" << packet; packet_contents.append(packet); } - - //"roar|thing=thong^(b)roar^(a)roar^" - -// packet_contents.append(frame_screenshake); -// packet_contents.append(frame_realization); -// packet_contents.append(frame_sfx); } + + if (ao_app->additive_enabled) + { + packet_contents.append(ui_additive->isChecked() ? "1" : "0"); + } + ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } @@ -1388,6 +1400,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; + is_additive = false; if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() && m_chatmessage[CHAR_ID].toInt() == m_cid) { ui_ic_chat_message->clear(); @@ -1403,6 +1416,10 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_realization->set_image("realization.png"); ui_screenshake->set_image("screenshake.png"); ui_evidence_present->set_image("present_disabled.png"); + + + if (ao_app->additive_enabled && ui_vp_player_char->m_char == m_chatmessage[CHAR_NAME]) + is_additive = m_chatmessage[ADDITIVE].toInt() == 1; } chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false); @@ -1493,7 +1510,7 @@ void Courtroom::handle_chatmessage_2() ui_vp_showname->setText(m_chatmessage[SHOWNAME]); } - ui_vp_message->clear(); + ui_vp_message->hide(); ui_vp_chatbox->hide(); QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); @@ -1510,7 +1527,7 @@ void Courtroom::handle_chatmessage_2() int f_weight = ao_app->get_font_size("message", design_file); QString font_name = ao_app->get_font_name("message_font", design_file); QColor f_color = ao_app->get_color("message_color", design_file); - bool bold = static_cast(ao_app->get_font_size("message_bold", design_file)); // is the font bold or not? + bool bold = ao_app->get_font_size("message_bold", design_file) == 1; // is the font bold or not? QString chatfont = ao_app->get_chat_font(m_chatmessage[CHAR_NAME]); if (chatfont != "") @@ -2177,7 +2194,6 @@ void Courtroom::start_chat_ticking() this->do_screenshake(); } - ui_vp_message->clear(); set_text_color(); rainbow_counter = 0; @@ -2196,6 +2212,12 @@ void Courtroom::start_chat_ticking() } ui_vp_chatbox->show(); + ui_vp_message->show(); + + if (!is_additive) + { + ui_vp_message->clear(); + } tick_pos = 0; blip_pos = 0; @@ -3667,6 +3689,11 @@ void Courtroom::on_flip_clicked() ui_ic_chat_message->setFocus(); } +void Courtroom::on_additive_clicked() +{ + ui_ic_chat_message->setFocus(); +} + void Courtroom::on_guard_clicked() { ui_ic_chat_message->setFocus(); diff --git a/src/lobby.cpp b/src/lobby.cpp index 951ff9a..758f0fb 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -213,13 +213,13 @@ void Lobby::set_font(QWidget *widget, QString p_identifier) QString class_name = widget->metaObject()->className(); QString font_name = ao_app->get_font_name("font_" + p_identifier, design_file); QFont font(font_name, f_weight); - bool use = static_cast(ao_app->get_font_size("use_custom_fonts", design_file)); + bool use = ao_app->get_font_size("use_custom_fonts", design_file) == 1; if(use) { widget->setFont(font); QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - bool bold = static_cast(ao_app->get_font_size(p_identifier + "_bold", design_file)); // is the font bold or not? - bool center = static_cast(ao_app->get_font_size(p_identifier + "_center", design_file)); // should it be centered? + bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? + bool center = ao_app->get_font_size(p_identifier + "_center", design_file) == 1; // should it be centered? QString is_bold = ""; if(bold) is_bold = "bold"; QString is_center = ""; diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 72840f7..ff43f27 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -150,6 +150,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) casing_alerts_enabled = false; modcall_reason_enabled = false; looping_sfx_support_enabled = false; + additive_enabled = false; //workaround for tsuserver4 if (f_contents.at(0) == "NOENCRYPT") @@ -212,6 +213,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) modcall_reason_enabled = true; if (f_packet.contains("looping_sfx",Qt::CaseInsensitive)) looping_sfx_support_enabled = true; + if (f_packet.contains("additive",Qt::CaseInsensitive)) + additive_enabled = true; } else if (header == "PN") {