From 3f8d81a3f73c0bef1fcf1e3ea7675751868320f9 Mon Sep 17 00:00:00 2001 From: Lernos Date: Sun, 5 Jun 2022 14:58:26 +0300 Subject: [PATCH 01/15] split get_blips into two functions Because otherwise it would always return only what was read from char.ini, and we want it to be able to read our custom QLineEdit too, right? --- src/text_file_functions.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index b5bd69685..050543ee4 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -603,7 +603,7 @@ QString AOApplication::get_char_side(QString p_char) return f_result; } -QString AOApplication::get_blips(QString p_char) +QString AOApplication::get_blipname(QString p_char) { QString f_result = read_char_ini(p_char, "blips", "Options"); @@ -612,14 +612,17 @@ QString AOApplication::get_blips(QString p_char) if (f_result == "") f_result = "male"; } + return f_result; +} +QString AOApplication::get_blips(QString p_blipname) +{ + if (!file_exists(get_sfx_suffix(get_sounds_path(p_blipname)))) { + if (file_exists(get_sfx_suffix(get_sounds_path("../blips/" + p_blipname)))) + return "../blips/" + p_blipname; // Return the cool kids variant - if (!file_exists(get_sfx_suffix(get_sounds_path(f_result)))) { - if (file_exists(get_sfx_suffix(get_sounds_path("../blips/" + f_result)))) - return "../blips/" + f_result; // Return the cool kids variant - - return "sfx-blip" + f_result; // Return legacy variant + return "sfx-blip" + p_blipname; // Return legacy variant } - return f_result; + return p_blipname; } QString AOApplication::get_emote_property(QString p_char, QString p_emote, From 71ff2fc0ed7bd5bd6a97e042eaaa7f5bd7a60278 Mon Sep 17 00:00:00 2001 From: Lernos Date: Sun, 5 Jun 2022 15:01:15 +0300 Subject: [PATCH 02/15] include new function, rewrite description --- include/aoapplication.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 4809c3fcb..16931578c 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -467,8 +467,11 @@ class AOApplication : public QApplication { // Returns the desk modifier for p_char's p_emote int get_desk_mod(QString p_char, int p_emote); - // Returns p_char's blips (previously called their "gender") - QString get_blips(QString p_char); + // Returns p_char's blipname by reading char.ini for blips (previously called "gender") + QString get_blipname(QString p_char); + + // Returns p_blipname's sound(path) to play in the client + QString get_blips(QString p_blipname); // Get a property of a given emote, or get it from "options" if emote doesn't have it QString get_emote_property(QString p_char, QString p_emote, QString p_property); From 1b4e0b121cfc337faf37d7cd9326fd7cc99b1b89 Mon Sep 17 00:00:00 2001 From: Lernos Date: Sun, 5 Jun 2022 15:04:58 +0300 Subject: [PATCH 03/15] check for custom blips support in packet --- src/packet_distribution.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index e03261390..168fa84ed 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -53,6 +53,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) additive_enabled = false; effects_enabled = false; y_offset_enabled = false; + custom_blips_enabled = false; QString f_hdid; f_hdid = get_hdid(); @@ -103,6 +104,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) effects_enabled = false; expanded_desk_mods_enabled = false; auth_packet_enabled = false; + custom_blips_enabled = false; if (f_packet.contains("yellowtext", Qt::CaseInsensitive)) yellow_text_enabled = true; if (f_packet.contains("prezoom", Qt::CaseInsensitive)) @@ -135,6 +137,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) expanded_desk_mods_enabled = true; if (f_packet.contains("auth_packet", Qt::CaseInsensitive)) auth_packet_enabled = true; + if (f_packet.contains("custom_blips", Qt::CaseInsensitive)) + custom_blips_enabled = true; } else if (header == "PN") { if (f_contents.size() < 2) From 00348879346a1564b1233093308faffe92331d49 Mon Sep 17 00:00:00 2001 From: Lernos Date: Sun, 5 Jun 2022 15:05:38 +0300 Subject: [PATCH 04/15] add custom blips enabled bool --- include/aoapplication.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/aoapplication.h b/include/aoapplication.h index 16931578c..708dd3209 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -104,6 +104,7 @@ class AOApplication : public QApplication { bool y_offset_enabled = false; bool expanded_desk_mods_enabled = false; bool auth_packet_enabled = false; + bool custom_blips_enabled = false; ///////////////loading info/////////////////// From 30cec4ba8bcbcd818d91043a71cd60d9c4f073c5 Mon Sep 17 00:00:00 2001 From: Lernos Date: Sun, 5 Jun 2022 15:07:01 +0300 Subject: [PATCH 05/15] increase MS_MAXIMUM, add custom blips QLineEdit --- include/courtroom.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/courtroom.h b/include/courtroom.h index 13c639a87..b263423b2 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -477,7 +477,7 @@ class Courtroom : public QMainWindow { // Minumum and maximum number of parameters in the MS packet static const int MS_MINIMUM = 15; - static const int MS_MAXIMUM = 30; + static const int MS_MAXIMUM = 31; QString m_chatmessage[MS_MAXIMUM]; QString previous_ic_message = ""; @@ -673,6 +673,7 @@ class Courtroom : public QMainWindow { QLineEdit *ui_ic_chat_message; AOLineEditFilter *ui_ic_chat_message_filter; QLineEdit *ui_ic_chat_name; + QLineEdit *ui_custom_blips; QLineEdit *ui_ooc_chat_message; QLineEdit *ui_ooc_chat_name; From ff3464a23ae45ec8053580619b571232ea62536c Mon Sep 17 00:00:00 2001 From: Lernos Date: Sun, 5 Jun 2022 15:08:21 +0300 Subject: [PATCH 06/15] add BLIPNAME to chat message --- include/datatypes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/datatypes.h b/include/datatypes.h index 2f03d39f0..5ae55af43 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -98,7 +98,8 @@ enum CHAT_MESSAGE { FRAME_REALIZATION, FRAME_SFX, ADDITIVE, - EFFECTS + EFFECTS, + BLIPNAME, }; enum EMOTE_MOD { From a2af3891969f17466775a89b8b2937b1fffb92f1 Mon Sep 17 00:00:00 2001 From: Lernos Date: Sun, 5 Jun 2022 15:23:50 +0300 Subject: [PATCH 07/15] introducing custom blips --- src/courtroom.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 1c0437891..980f9306b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -177,6 +177,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ic_chat_name->setPlaceholderText(tr("Showname")); ui_ic_chat_name->setText(p_ao_app->get_default_showname()); ui_ic_chat_name->setObjectName("ui_ic_chat_name"); + + ui_custom_blips = new QLineEdit(this); + ui_custom_blips->setFrame(false); + ui_custom_blips->setPlaceholderText(tr("Blips")); + ui_custom_blips->setObjectName("ui_custom_blips"); ui_ic_chat_message = new QLineEdit(this); ui_ic_chat_message->setFrame(false); @@ -649,6 +654,15 @@ void Courtroom::set_widgets() ui_ic_chat_name->hide(); ui_ic_chat_name->setEnabled(false); } + + if (ao_app->custom_blips_enabled) { + ui_custom_blips->show(); + ui_custom_blips->setEnabled(true); + } + else { + ui_custom_blips->hide(); + ui_custom_blips->setEnabled(false); + } if (ao_app->casing_alerts_enabled) { ui_announce_casing->show(); @@ -818,6 +832,7 @@ void Courtroom::set_widgets() } set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message"); set_size_and_pos(ui_ic_chat_name, "ao2_ic_chat_name"); + set_size_and_pos(ui_custom_blips, "ao2_custom_blips"); ui_vp_chatbox->set_image("chatblank"); ui_vp_chatbox->hide(); @@ -1558,9 +1573,12 @@ void Courtroom::update_character(int p_cid) if (m_cid != -1) { ui_ic_chat_name->setPlaceholderText(char_list.at(m_cid).name); + QString f_blipname = ao_app->get_blipname(f_char); + ui_custom_blips->setPlaceholderText(f_blipname); } else { ui_ic_chat_name->setPlaceholderText("Spectator"); + ui_custom_blips->setPlaceholderText("None"); } ui_char_select_background->hide(); ui_ic_chat_message->setEnabled(m_cid != -1); @@ -2083,6 +2101,10 @@ void Courtroom::on_chat_return_pressed() } } + if (ao_app->custom_blips_enabled) { + if (ui_custom_blips->text().isEmpty()) { packet_contents.append(ui_custom_blips->placeholderText()); } + else { packet_contents.append(ui_custom_blips->text()); } + } ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } @@ -3476,7 +3498,9 @@ void Courtroom::start_chat_ticking() if (last_misc != current_misc || char_color_rgb_list.size() < max_colors) gen_char_rgb_list(current_misc); - QString f_blips = ao_app->get_blips(m_chatmessage[CHAR_NAME]); + QString f_blips = ao_app->get_blipname(m_chatmessage[CHAR_NAME]); + f_blips = ao_app->get_blips(f_blips); + if (ao_app->custom_blips_enabled && !ui_custom_blips->text().isEmpty()) {f_blips = ao_app->get_blips(m_chatmessage[BLIPNAME]);} blip_player->set_blips(f_blips); // means text is currently ticking From 8e129ceb78bbae3c6bbe352d55bb900ae3ac5951 Mon Sep 17 00:00:00 2001 From: Lernos Date: Sun, 5 Jun 2022 15:54:34 +0300 Subject: [PATCH 08/15] introducing custom blips I said --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 980f9306b..569d9b778 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3500,7 +3500,7 @@ void Courtroom::start_chat_ticking() QString f_blips = ao_app->get_blipname(m_chatmessage[CHAR_NAME]); f_blips = ao_app->get_blips(f_blips); - if (ao_app->custom_blips_enabled && !ui_custom_blips->text().isEmpty()) {f_blips = ao_app->get_blips(m_chatmessage[BLIPNAME]);} + if (ao_app->custom_blips_enabled && !m_chatmessage[BLIPNAME].isEmpty()) {f_blips = ao_app->get_blips(m_chatmessage[BLIPNAME]);} blip_player->set_blips(f_blips); // means text is currently ticking From f22cb535296bf3f59907e4078a1ae7a171675afd Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sat, 3 Sep 2022 01:17:24 +0200 Subject: [PATCH 09/15] unfold if --- src/courtroom.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index d740fc8ee..5a354908d 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2140,8 +2140,12 @@ void Courtroom::on_chat_return_pressed() } if (ao_app->custom_blips_enabled) { - if (ui_custom_blips->text().isEmpty()) { packet_contents.append(ui_custom_blips->placeholderText()); } - else { packet_contents.append(ui_custom_blips->text()); } + if (ui_custom_blips->text().isEmpty()) { + packet_contents.append(ui_custom_blips->placeholderText()); + } + else { + packet_contents.append(ui_custom_blips->text()); + } } ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } From 579f54a55e1be90a3c29d89f4cf992278624d0fa Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sat, 3 Sep 2022 01:17:57 +0200 Subject: [PATCH 10/15] unfold other if --- src/courtroom.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 5a354908d..f19e92c3c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3689,7 +3689,9 @@ void Courtroom::start_chat_ticking() QString f_blips = ao_app->get_blipname(m_chatmessage[CHAR_NAME]); f_blips = ao_app->get_blips(f_blips); - if (ao_app->custom_blips_enabled && !m_chatmessage[BLIPNAME].isEmpty()) {f_blips = ao_app->get_blips(m_chatmessage[BLIPNAME]);} + if (ao_app->custom_blips_enabled && !m_chatmessage[BLIPNAME].isEmpty()) { + f_blips = ao_app->get_blips(m_chatmessage[BLIPNAME]); + } blip_player->set_blips(f_blips); // means text is currently ticking From 2f44a0a7135119bd8d9ad6fc066a1a7dafd6ee0b Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Wed, 8 May 2024 23:53:04 -0500 Subject: [PATCH 11/15] retool custom blips code, add ini parser --- include/aoapplication.h | 40 ++++++++++----------- src/courtroom.cpp | 38 ++++---------------- src/packet_distribution.cpp | 69 ++++++++++++++++++------------------- src/text_file_functions.cpp | 50 +++++++++++++++++++++++++-- 4 files changed, 108 insertions(+), 89 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index f7dfdc05a..ffb77ee20 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -89,23 +89,23 @@ class AOApplication : public QApplication { /////////////////server metadata////////////////// - bool yellow_text_enabled = false; - bool prezoom_enabled = false; - bool flipping_enabled = false; - bool custom_objection_enabled = false; - bool desk_mod_enabled = false; - bool evidence_enabled = false; - bool cccc_ic_support_enabled = false; - bool arup_enabled = false; - bool casing_alerts_enabled = false; - bool modcall_reason_enabled = false; - bool looping_sfx_support_enabled = false; - bool additive_enabled = false; - bool effects_enabled = false; - bool y_offset_enabled = false; - bool expanded_desk_mods_enabled = false; - bool auth_packet_enabled = false; - bool custom_blips_enabled = false; + bool yellow_text_supported = false; + bool prezoom_supported = false; + bool flipping_supported = false; + bool custom_objection_supported = false; + bool desk_mod_supported = false; + bool evidence_supported = false; + bool cccc_ic_supported = false; + bool arup_supported = false; + bool casing_alerts_supported = false; + bool modcall_reason_supported = false; + bool looping_sfx_supported = false; + bool additive_supported = false; + bool effects_supported = false; + bool y_offset_supported = false; + bool expanded_desk_mods_supported = false; + bool auth_packet_supported = false; + bool custom_blips_supported = false; ///////////////loading info/////////////////// @@ -261,7 +261,7 @@ class AOApplication : public QApplication { QString get_char_side(QString p_char); // Returns the showname from the ini of p_char - QString get_showname(QString p_char); + QString get_showname(QString p_char, int current_emote = 1); // Returns the category of this character QString get_category(QString p_char); @@ -338,8 +338,8 @@ class AOApplication : public QApplication { int get_desk_mod(QString p_char, int p_emote); // Returns p_char's blipname by reading char.ini for blips (previously called "gender") - QString get_blipname(QString p_char); - + QString get_blipname(QString p_char, int p_emote = -1); + // Returns p_blipname's sound(path) to play in the client QString get_blips(QString p_blipname); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 240c096fb..c360d6b5e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -180,11 +180,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ic_chat_name->setPlaceholderText(tr("Showname")); ui_ic_chat_name->setText(Options::getInstance().shownameOnJoin()); ui_ic_chat_name->setObjectName("ui_ic_chat_name"); - - ui_custom_blips = new QLineEdit(this); - ui_custom_blips->setFrame(false); - ui_custom_blips->setPlaceholderText(tr("Blips")); - ui_custom_blips->setObjectName("ui_custom_blips"); ui_ic_chat_message = new QLineEdit(this); ui_ic_chat_message->setFrame(false); @@ -684,15 +679,6 @@ void Courtroom::set_widgets() ui_ic_chat_name->hide(); ui_ic_chat_name->setEnabled(false); } - - if (ao_app->custom_blips_enabled) { - ui_custom_blips->show(); - ui_custom_blips->setEnabled(true); - } - else { - ui_custom_blips->hide(); - ui_custom_blips->setEnabled(false); - } // We also show the non-server-dependent client additions. // Once again, if the theme can't display it, set_move_and_pos will catch @@ -837,7 +823,6 @@ void Courtroom::set_widgets() } set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message"); set_size_and_pos(ui_ic_chat_name, "ao2_ic_chat_name"); - set_size_and_pos(ui_custom_blips, "ao2_custom_blips"); initialize_chatbox(); @@ -1589,12 +1574,9 @@ void Courtroom::update_character(int p_cid, QString char_name, bool reset_emote) if (m_cid != -1) { ui_ic_chat_name->setPlaceholderText(char_list.at(m_cid).name); - QString f_blipname = ao_app->get_blipname(f_char); - ui_custom_blips->setPlaceholderText(f_blipname); } else { ui_ic_chat_name->setPlaceholderText("Spectator"); - ui_custom_blips->setPlaceholderText("None"); } ui_char_select_background->hide(); ui_ic_chat_message->setEnabled(m_cid != -1); @@ -1611,7 +1593,7 @@ void Courtroom::enter_courtroom() else ui_flip->hide(); - if (ao_app->additive_text_supported) + if (ao_app->additive_supported) ui_additive->show(); else ui_additive->hide(); @@ -2037,13 +2019,12 @@ void Courtroom::on_chat_return_pressed() // If the server we're on supports CCCC stuff, we should use it! if (ao_app->cccc_ic_supported) { - // If there is a showname entered, use that -- else, just send an empty - // packet-part. + // If there is a showname entered, use that -- else, just send whatever the ini calls for. if (!ui_ic_chat_name->text().isEmpty()) { packet_contents.append(ui_ic_chat_name->text()); } else { - packet_contents.append(""); + packet_contents.append(ao_app->get_showname(current_char, current_emote)); } // Similarly, we send over whom we're paired with, unless we have chosen @@ -2106,7 +2087,7 @@ void Courtroom::on_chat_return_pressed() } } - if (ao_app->additive_text_supported) { + if (ao_app->additive_supported) { packet_contents.append(ui_additive->isChecked() ? "1" : "0"); } if (ao_app->effects_supported) { @@ -2129,14 +2110,7 @@ void Courtroom::on_chat_return_pressed() } } - if (ao_app->custom_blips_enabled) { - if (ui_custom_blips->text().isEmpty()) { - packet_contents.append(ui_custom_blips->placeholderText()); - } - else { - packet_contents.append(ui_custom_blips->text()); - } - } + packet_contents.append(ao_app->get_blipname(current_char, current_emote)); ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } @@ -3686,7 +3660,7 @@ void Courtroom::start_chat_ticking() QString f_blips = ao_app->get_blipname(m_chatmessage[CHAR_NAME]); f_blips = ao_app->get_blips(f_blips); - if (ao_app->custom_blips_enabled && !m_chatmessage[BLIPNAME].isEmpty()) { + if (ao_app->custom_blips_supported && !m_chatmessage[BLIPNAME].isEmpty()) { f_blips = ao_app->get_blips(m_chatmessage[BLIPNAME]); } blip_player->set_blips(f_blips); diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 3c31cb480..e5a17d27f 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -42,21 +42,21 @@ void AOApplication::server_packet_received(AOPacket *p_packet) goto end; // default(legacy) values - yellow_text_enabled = false; - prezoom_enabled = false; - flipping_enabled = false; - custom_objection_enabled = false; - desk_mod_enabled = false; - evidence_enabled = false; - cccc_ic_support_enabled = false; - arup_enabled = false; - casing_alerts_enabled = false; - modcall_reason_enabled = false; - looping_sfx_support_enabled = false; - additive_enabled = false; - effects_enabled = false; - y_offset_enabled = false; - custom_blips_enabled = false; + yellow_text_supported = false; + prezoom_supported = false; + flipping_supported = false; + custom_objection_supported = false; + desk_mod_supported = false; + evidence_supported = false; + cccc_ic_supported = false; + arup_supported = false; + casing_alerts_supported = false; + modcall_reason_supported = false; + looping_sfx_supported = false; + additive_supported = false; + effects_supported = false; + y_offset_supported = false; + custom_blips_supported = false; QString f_hdid; f_hdid = get_hdid(); @@ -91,22 +91,22 @@ void AOApplication::server_packet_received(AOPacket *p_packet) f_contents.at(1), "0"); } else if (header == "FL") { - yellow_text_enabled = false; - prezoom_enabled = false; - flipping_enabled = false; - custom_objection_enabled = false; - desk_mod_enabled = false; - evidence_enabled = false; - cccc_ic_support_enabled = false; - arup_enabled = false; - casing_alerts_enabled = false; - modcall_reason_enabled = false; - looping_sfx_support_enabled = false; - additive_enabled = false; - effects_enabled = false; - expanded_desk_mods_enabled = false; - auth_packet_enabled = false; - custom_blips_enabled = false; + yellow_text_supported = false; + prezoom_supported = false; + flipping_supported = false; + custom_objection_supported = false; + desk_mod_supported = false; + evidence_supported = false; + cccc_ic_supported = false; + arup_supported = false; + casing_alerts_supported = false; + modcall_reason_supported = false; + looping_sfx_supported = false; + additive_supported = false; + effects_supported = false; + expanded_desk_mods_supported = false; + auth_packet_supported = false; + custom_blips_supported = false; log_to_demo = false; if (f_packet.contains("yellowtext", Qt::CaseInsensitive)) @@ -132,7 +132,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) if (f_packet.contains("looping_sfx", Qt::CaseInsensitive)) looping_sfx_supported = true; if (f_packet.contains("additive", Qt::CaseInsensitive)) - additive_text_supported = true; + additive_supported = true; if (f_packet.contains("effects", Qt::CaseInsensitive)) effects_supported = true; if (f_packet.contains("y_offset", Qt::CaseInsensitive)) @@ -140,10 +140,9 @@ void AOApplication::server_packet_received(AOPacket *p_packet) if (f_packet.contains("expanded_desk_mods", Qt::CaseInsensitive)) expanded_desk_mods_supported = true; if (f_packet.contains("auth_packet", Qt::CaseInsensitive)) - auth_packet_enabled = true; + auth_packet_supported = true; if (f_packet.contains("custom_blips", Qt::CaseInsensitive)) - custom_blips_enabled = true; - + custom_blips_supported = true; } else if (header == "PN") { if (!lobby_constructed || f_contents.size() < 2) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index a31a036d6..bb922c22c 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -442,11 +442,34 @@ QStringList AOApplication::read_ini_tags(VPath p_path, QString target_tag) return r_values; } -QString AOApplication::get_showname(QString p_char) +QString AOApplication::get_showname(QString p_char, int current_emote) { QString f_result = read_char_ini(p_char, "showname", "Options"); QString f_needed = read_char_ini(p_char, "needs_showname", "Options"); + if (current_emote != -1) { // activate epic look for override mode + for (int i = 2; i < 6; i++) { + QString override_key = "Options" + QString::number(i); + QStringList override_list = + read_char_ini(p_char, "emotes", override_key).split(","); + qDebug() << "override list" << override_key << override_list; + if (override_list.isEmpty()) { + continue; // not here + } + else if (override_list.contains(QString::number(current_emote + 1))) { + QString temp_f_result = read_char_ini(p_char, "showname", override_key); + if (temp_f_result != "") { + f_result = temp_f_result; + break; // we got it + } + break; // override found but no showname + } + else { + continue; // not here + } + } + } + if (f_needed.startsWith("false")) return ""; if (f_result == "") @@ -463,15 +486,38 @@ QString AOApplication::get_char_side(QString p_char) return f_result; } -QString AOApplication::get_blipname(QString p_char) +QString AOApplication::get_blipname(QString p_char, int current_emote) { QString f_result = read_char_ini(p_char, "blips", "Options"); + if (current_emote != -1) { // activate epic look for override mode + for (int i = 2; i < 6; i++) { + QString override_key = "Options" + QString::number(i); + QStringList override_list = + read_char_ini(p_char, "emotes", override_key).split(","); + qDebug() << "override list" << override_key << override_list; + if (override_list.isEmpty()) { + continue; // not here + } + else if (override_list.contains(QString::number(current_emote + 1))) { + QString temp_f_result = read_char_ini(p_char, "blips", override_key); + if (temp_f_result != "") { + f_result = temp_f_result; + break; // we got it + } + break; // override found but no blips + } + else { + continue; // not here + } + } + } if (f_result == "") { f_result = read_char_ini(p_char, "gender", "Options"); // not very PC, FanatSors if (f_result == "") f_result = "male"; } + qDebug() << f_result; return f_result; } QString AOApplication::get_blips(QString p_blipname) From 4a2de0644c6da0a9d9d44f23a54332d7c1b80a24 Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Fri, 10 May 2024 07:03:21 -0500 Subject: [PATCH 12/15] remove extraneous debug calls --- src/text_file_functions.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index bb922c22c..5fd8dbbff 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -452,7 +452,6 @@ QString AOApplication::get_showname(QString p_char, int current_emote) QString override_key = "Options" + QString::number(i); QStringList override_list = read_char_ini(p_char, "emotes", override_key).split(","); - qDebug() << "override list" << override_key << override_list; if (override_list.isEmpty()) { continue; // not here } @@ -494,7 +493,6 @@ QString AOApplication::get_blipname(QString p_char, int current_emote) QString override_key = "Options" + QString::number(i); QStringList override_list = read_char_ini(p_char, "emotes", override_key).split(","); - qDebug() << "override list" << override_key << override_list; if (override_list.isEmpty()) { continue; // not here } @@ -517,7 +515,6 @@ QString AOApplication::get_blipname(QString p_char, int current_emote) if (f_result == "") f_result = "male"; } - qDebug() << f_result; return f_result; } QString AOApplication::get_blips(QString p_blipname) From a97168b2094736485f966bb090f18ed3b6a78921 Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Fri, 10 May 2024 12:01:57 -0500 Subject: [PATCH 13/15] fix incorrect default value on get_showname --- include/aoapplication.h | 2 +- src/text_file_functions.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index ffb77ee20..43ed559ee 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -261,7 +261,7 @@ class AOApplication : public QApplication { QString get_char_side(QString p_char); // Returns the showname from the ini of p_char - QString get_showname(QString p_char, int current_emote = 1); + QString get_showname(QString p_char, int p_emote = -1); // Returns the category of this character QString get_category(QString p_char); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 5fd8dbbff..d9421c95a 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -442,7 +442,7 @@ QStringList AOApplication::read_ini_tags(VPath p_path, QString target_tag) return r_values; } -QString AOApplication::get_showname(QString p_char, int current_emote) +QString AOApplication::get_showname(QString p_char, int p_emote) { QString f_result = read_char_ini(p_char, "showname", "Options"); QString f_needed = read_char_ini(p_char, "needs_showname", "Options"); From 8cb5fd4f903c2c06832a09756f198f33921d0451 Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Fri, 10 May 2024 12:37:41 -0500 Subject: [PATCH 14/15] restructure ini format --- src/text_file_functions.cpp | 61 +++++++++++++------------------------ 1 file changed, 21 insertions(+), 40 deletions(-) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index d9421c95a..416f38ec1 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -447,24 +447,14 @@ QString AOApplication::get_showname(QString p_char, int p_emote) QString f_result = read_char_ini(p_char, "showname", "Options"); QString f_needed = read_char_ini(p_char, "needs_showname", "Options"); - if (current_emote != -1) { // activate epic look for override mode - for (int i = 2; i < 6; i++) { - QString override_key = "Options" + QString::number(i); - QStringList override_list = - read_char_ini(p_char, "emotes", override_key).split(","); - if (override_list.isEmpty()) { - continue; // not here - } - else if (override_list.contains(QString::number(current_emote + 1))) { - QString temp_f_result = read_char_ini(p_char, "showname", override_key); - if (temp_f_result != "") { - f_result = temp_f_result; - break; // we got it - } - break; // override found but no showname - } - else { - continue; // not here + if (p_emote != -1) { + int override_idx = + read_char_ini(p_char, QString::number(p_emote), "OptionsN").toInt(); + if (override_idx > 0) { + QString temp_f_result = read_char_ini( + p_char, "blips", "Options" + QString::number(override_idx)); + if (!temp_f_result.isEmpty()) { + f_result = temp_f_result; } } } @@ -485,35 +475,26 @@ QString AOApplication::get_char_side(QString p_char) return f_result; } -QString AOApplication::get_blipname(QString p_char, int current_emote) +QString AOApplication::get_blipname(QString p_char, int p_emote) { QString f_result = read_char_ini(p_char, "blips", "Options"); - if (current_emote != -1) { // activate epic look for override mode - for (int i = 2; i < 6; i++) { - QString override_key = "Options" + QString::number(i); - QStringList override_list = - read_char_ini(p_char, "emotes", override_key).split(","); - if (override_list.isEmpty()) { - continue; // not here - } - else if (override_list.contains(QString::number(current_emote + 1))) { - QString temp_f_result = read_char_ini(p_char, "blips", override_key); - if (temp_f_result != "") { - f_result = temp_f_result; - break; // we got it - } - break; // override found but no blips - } - else { - continue; // not here + + if (p_emote != -1) { + int override_idx = + read_char_ini(p_char, QString::number(p_emote), "OptionsN").toInt(); + if (override_idx > 0) { + QString temp_f_result = read_char_ini( + p_char, "blips", "Options" + QString::number(override_idx)); + if (!temp_f_result.isEmpty()) { + f_result = temp_f_result; } } } if (f_result == "") { - f_result = read_char_ini(p_char, "gender", "Options"); // not very PC, FanatSors - if (f_result == "") - f_result = "male"; + f_result = + read_char_ini(p_char, "gender", "Options"); // not very PC, FanatSors + if (f_result == "") f_result = "male"; } return f_result; } From db370ae22fde764decdecc9e29cdd63cc4e937d3 Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Sat, 11 May 2024 03:10:06 -0500 Subject: [PATCH 15/15] fix parser again --- src/text_file_functions.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 416f38ec1..7c5bbde01 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -449,10 +449,10 @@ QString AOApplication::get_showname(QString p_char, int p_emote) if (p_emote != -1) { int override_idx = - read_char_ini(p_char, QString::number(p_emote), "OptionsN").toInt(); + read_char_ini(p_char, QString::number(p_emote + 1), "OptionsN").toInt(); if (override_idx > 0) { - QString temp_f_result = read_char_ini( - p_char, "blips", "Options" + QString::number(override_idx)); + QString override_key = "Options" + QString::number(override_idx); + QString temp_f_result = read_char_ini(p_char, "showname", override_key); if (!temp_f_result.isEmpty()) { f_result = temp_f_result; } @@ -481,10 +481,10 @@ QString AOApplication::get_blipname(QString p_char, int p_emote) if (p_emote != -1) { int override_idx = - read_char_ini(p_char, QString::number(p_emote), "OptionsN").toInt(); + read_char_ini(p_char, QString::number(p_emote + 1), "OptionsN").toInt(); if (override_idx > 0) { - QString temp_f_result = read_char_ini( - p_char, "blips", "Options" + QString::number(override_idx)); + QString override_key = "Options" + QString::number(override_idx); + QString temp_f_result = read_char_ini(p_char, "blips", override_key); if (!temp_f_result.isEmpty()) { f_result = temp_f_result; }