From de6d325334756e72a9d8706f64c34b7b687523e9 Mon Sep 17 00:00:00 2001 From: argoneus Date: Tue, 31 Jul 2018 18:03:41 +0200 Subject: [PATCH 01/20] added modcall reason --- courtroom.cpp | 18 +++++++++++++++++- courtroom.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/courtroom.cpp b/courtroom.cpp index bc0b0ad..ec5a07c 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2018,9 +2018,25 @@ void Courtroom::on_spectator_clicked() void Courtroom::on_call_mod_clicked() { - ao_app->send_server_packet(new AOPacket("ZZ#%")); + auto box = new QInputDialog(); + box->setLabelText("Enter a reason:"); + auto code = box->exec(); + + if (code != QDialog::Accepted) + return; + + auto text = box->textValue(); + if (text.isEmpty()) + text = "N/A"; + + QStringList mod_reason; + mod_reason.append(text); + + ao_app->send_server_packet(new AOPacket("ZZ", mod_reason)); ui_ic_chat_message->setFocus(); + + delete box; } void Courtroom::on_pre_clicked() diff --git a/courtroom.h b/courtroom.h index 2cc099c..728502b 100644 --- a/courtroom.h +++ b/courtroom.h @@ -43,6 +43,7 @@ #include #include #include +#include class AOApplication; From 83d30e6920d0584d316d4ff12766ab9fe159b01d Mon Sep 17 00:00:00 2001 From: argoneus Date: Tue, 31 Jul 2018 18:08:02 +0200 Subject: [PATCH 02/20] fixed memory leak --- courtroom.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/courtroom.cpp b/courtroom.cpp index ec5a07c..d625699 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2022,8 +2022,10 @@ void Courtroom::on_call_mod_clicked() box->setLabelText("Enter a reason:"); auto code = box->exec(); - if (code != QDialog::Accepted) + if (code != QDialog::Accepted) { + delete box; return; + } auto text = box->textValue(); if (text.isEmpty()) From 01e933f6bb3fda5ac86beff0be2a4f8ff21064e0 Mon Sep 17 00:00:00 2001 From: argoneus Date: Fri, 3 Aug 2018 12:01:50 +0200 Subject: [PATCH 03/20] added modcall_reason as a FL feature --- aoapplication.h | 1 + courtroom.cpp | 36 ++++++++++++++++++++---------------- packet_distribution.cpp | 2 ++ 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/aoapplication.h b/aoapplication.h index f69a0ea..0f14a0c 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -56,6 +56,7 @@ public: bool improved_loading_enabled = false; bool desk_mod_enabled = false; bool evidence_enabled = false; + bool modcall_reason_enabled = false; ///////////////loading info/////////////////// diff --git a/courtroom.cpp b/courtroom.cpp index d625699..880d124 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2018,27 +2018,31 @@ void Courtroom::on_spectator_clicked() void Courtroom::on_call_mod_clicked() { - auto box = new QInputDialog(); - box->setLabelText("Enter a reason:"); - auto code = box->exec(); + if (ao_app->modcall_reason_enabled) { + auto box = new QInputDialog(); + box->setLabelText("Enter a reason:"); + auto code = box->exec(); + + if (code != QDialog::Accepted) { + delete box; + return; + } + + auto text = box->textValue(); + if (text.isEmpty()) + text = "N/A"; - if (code != QDialog::Accepted) { delete box; - return; + + QStringList mod_reason; + mod_reason.append(text); + + ao_app->send_server_packet(new AOPacket("ZZ", mod_reason)); + } else { + ao_app->send_server_packet(new AOPacket("ZZ")); } - auto text = box->textValue(); - if (text.isEmpty()) - text = "N/A"; - - QStringList mod_reason; - mod_reason.append(text); - - ao_app->send_server_packet(new AOPacket("ZZ", mod_reason)); - ui_ic_chat_message->setFocus(); - - delete box; } void Courtroom::on_pre_clicked() diff --git a/packet_distribution.cpp b/packet_distribution.cpp index 4299518..6f29b2e 100644 --- a/packet_distribution.cpp +++ b/packet_distribution.cpp @@ -195,6 +195,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) desk_mod_enabled = true; if (f_packet.contains("evidence",Qt::CaseInsensitive)) evidence_enabled = true; + if (f_packet.contains("modcall_reason",Qt::CaseInsensitive)) + modcall_reason_enabled = true; } else if (header == "PN") { From 64f0e254cc03d4afcda7cbe5c9ace81852a3a792 Mon Sep 17 00:00:00 2001 From: argoneus Date: Fri, 3 Aug 2018 13:27:12 +0200 Subject: [PATCH 04/20] bumped version to 2.5.0 --- aoapplication.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aoapplication.h b/aoapplication.h index 0f14a0c..b432a73 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -225,8 +225,8 @@ public: private: const int RELEASE = 2; - const int MAJOR_VERSION = 4; - const int MINOR_VERSION = 10; + const int MAJOR_VERSION = 5; + const int MINOR_VERSION = 0; QString current_theme = "default"; From c6251362adbee37f27e0f9ade3cc2b9a3b09e7e9 Mon Sep 17 00:00:00 2001 From: argoneus Date: Fri, 3 Aug 2018 14:58:44 +0200 Subject: [PATCH 05/20] changed Attorney Online 2 to Attorney Online Vidya --- lobby.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lobby.cpp b/lobby.cpp index c0dbf0c..9761cc0 100644 --- a/lobby.cpp +++ b/lobby.cpp @@ -12,7 +12,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() { ao_app = p_ao_app; - this->setWindowTitle("Attorney Online 2"); + this->setWindowTitle("Attorney Online Vidya (AO2)"); ui_background = new AOImage(this, ao_app); ui_public_servers = new AOButton(this, ao_app); From 806a022a93882eeebed734e2b2941de3b6f5a021 Mon Sep 17 00:00:00 2001 From: argoneus Date: Fri, 3 Aug 2018 15:23:13 +0200 Subject: [PATCH 06/20] added #% for consistency --- courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/courtroom.cpp b/courtroom.cpp index 880d124..f6935ba 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2039,7 +2039,7 @@ void Courtroom::on_call_mod_clicked() ao_app->send_server_packet(new AOPacket("ZZ", mod_reason)); } else { - ao_app->send_server_packet(new AOPacket("ZZ")); + ao_app->send_server_packet(new AOPacket("ZZ#%")); } ui_ic_chat_message->setFocus(); From 3fc478bc4f5ec8e0b32c8a93ef1637f9549f600b Mon Sep 17 00:00:00 2001 From: argoneus Date: Mon, 6 Aug 2018 00:43:57 +0200 Subject: [PATCH 07/20] refactored modcall reason, added check for empty text --- courtroom.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/courtroom.cpp b/courtroom.cpp index f6935ba..b3c3ba2 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -2019,21 +2019,26 @@ void Courtroom::on_spectator_clicked() void Courtroom::on_call_mod_clicked() { if (ao_app->modcall_reason_enabled) { - auto box = new QInputDialog(); - box->setLabelText("Enter a reason:"); - auto code = box->exec(); + QMessageBox errorBox; + QInputDialog input; - if (code != QDialog::Accepted) { - delete box; + input.setWindowFlags(Qt::WindowSystemMenuHint); + input.setLabelText("Reason:"); + input.setWindowTitle("Call Moderator"); + auto code = input.exec(); + + if (code != QDialog::Accepted) + return; + + QString text = input.textValue(); + if (text.isEmpty()) { + errorBox.critical(nullptr, "Error", "You must provide a reason."); + return; + } else if (text.length() > 256) { + errorBox.critical(nullptr, "Error", "The message is too long."); return; } - auto text = box->textValue(); - if (text.isEmpty()) - text = "N/A"; - - delete box; - QStringList mod_reason; mod_reason.append(text); From 25a45f2e87088c4f27f43d01735570a196e8fc2a Mon Sep 17 00:00:00 2001 From: argoneus Date: Mon, 6 Aug 2018 18:32:39 +0200 Subject: [PATCH 08/20] fixed blank lines in IC log --- courtroom.cpp | 53 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/courtroom.cpp b/courtroom.cpp index b3c3ba2..352a3da 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1139,29 +1139,48 @@ void Courtroom::handle_chatmessage_3() void Courtroom::append_ic_text(QString p_text, QString p_name) { + // a bit of a silly hack, should use QListWidget for IC in the first place though + static bool isEmpty = true; + QTextCharFormat bold; QTextCharFormat normal; bold.setFontWeight(QFont::Bold); normal.setFontWeight(QFont::Normal); const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); - + + QTextCursor::MoveOperation move_op; int scrollbar_limit; - - if(ao_app->ic_scroll_down_enabled()) { + + if (ao_app->ic_scroll_down_enabled()) { scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->maximum(); - ui_ic_chatlog->moveCursor(QTextCursor::End); + move_op = QTextCursor::End; } else { scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->minimum(); - ui_ic_chatlog->moveCursor(QTextCursor::Start); + move_op = QTextCursor::Start; } - + const bool is_fully_scrolled = old_scrollbar_value == scrollbar_limit; - ui_ic_chatlog->textCursor().insertText(p_name, bold); - ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); - + ui_ic_chatlog->moveCursor(move_op); + + if (ao_app->ic_scroll_down_enabled()) { + if (!isEmpty) + ui_ic_chatlog->textCursor().insertText("\n", normal); + else + isEmpty = false; + ui_ic_chatlog->textCursor().insertText(p_name, bold); + ui_ic_chatlog->textCursor().insertText(p_text, normal); + } else { + ui_ic_chatlog->textCursor().insertText(p_name, bold); + ui_ic_chatlog->textCursor().insertText(p_text, normal); + if (!isEmpty) + ui_ic_chatlog->textCursor().insertText("\n", normal); + else + isEmpty = false; + } + if (old_cursor.hasSelection() || !is_fully_scrolled) { // The user has selected text or scrolled away from the top: maintain position. @@ -1171,14 +1190,14 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) else { // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. - if(ao_app->ic_scroll_down_enabled()) { - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); - } - else { - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); - } + ui_ic_chatlog->moveCursor(move_op); + + // update the value to the new maximum/minimum + if (ao_app->ic_scroll_down_enabled()) + scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->maximum(); + else + scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->minimum(); + ui_ic_chatlog->verticalScrollBar()->setValue(scrollbar_limit); } } From 357da55626f0533531d3b3dc48c95c802563b9af Mon Sep 17 00:00:00 2001 From: argoneus Date: Mon, 6 Aug 2018 18:38:12 +0200 Subject: [PATCH 09/20] bumped version to 2.5.1 --- Attorney_Online_remake.pro | 2 +- aoapplication.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro index 32a76e2..46d65ff 100644 --- a/Attorney_Online_remake.pro +++ b/Attorney_Online_remake.pro @@ -13,7 +13,7 @@ RC_ICONS = logo.ico TARGET = Attorney_Online_remake TEMPLATE = app -VERSION = 2.4.10.0 +VERSION = 2.5.1.0 SOURCES += main.cpp\ lobby.cpp \ diff --git a/aoapplication.h b/aoapplication.h index b432a73..5396874 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -226,7 +226,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 5; - const int MINOR_VERSION = 0; + const int MINOR_VERSION = 1; QString current_theme = "default"; From 0fab6785e63ce1baa2447a4d6eb08b0db1893112 Mon Sep 17 00:00:00 2001 From: Iamgoofball Date: Sun, 14 Oct 2018 17:38:54 -0700 Subject: [PATCH 10/20] fixes opus courtesy of longbyte1 --- courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/courtroom.cpp b/courtroom.cpp index 352a3da..43e977b 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -6,7 +6,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() //initializing sound device BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL); - BASS_PluginLoad("bassopus.dll", BASS_UNICODE); + BASS_PluginLoad(L"bassopus.dll", BASS_UNICODE); keepalive_timer = new QTimer(this); keepalive_timer->start(60000); From af19ee5688882c83e751b6f79a8dca5bba0cbac6 Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Mon, 15 Oct 2018 23:18:20 -0700 Subject: [PATCH 11/20] build fix --- Attorney_Online_remake.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro index 46d65ff..24ecf7d 100644 --- a/Attorney_Online_remake.pro +++ b/Attorney_Online_remake.pro @@ -88,7 +88,7 @@ HEADERS += lobby.h \ # in the same way as BASS. Discord RPC uses CMake, which does not play nicely with # QMake, so this step must be manual. unix:LIBS += -L$$PWD -lbass -ldiscord-rpc -win32:LIBS += -L$$PWD "$$PWD/bass.dll" -ldiscord-rpc #"$$PWD/discord-rpc.dll" +win32:LIBS += -L$$PWD "$$PWD/bass.dll" -L$$PWD "$$PWD/discord-rpc.dll" android:LIBS += -L$$PWD\android\libs\armeabi-v7a\ -lbass CONFIG += c++11 From 4858904d11bc9b350cf461d8455cf369b89477da Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Mon, 15 Oct 2018 23:56:19 -0700 Subject: [PATCH 12/20] forgot to bump the version number --- aoapplication.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aoapplication.h b/aoapplication.h index 5396874..e3544fe 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -226,7 +226,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 5; - const int MINOR_VERSION = 1; + const int MINOR_VERSION = 2; QString current_theme = "default"; From d1347b2243c1595557d7b89d40eb88a68a94375b Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Tue, 16 Oct 2018 01:22:07 -0700 Subject: [PATCH 13/20] Opus on SFX --- aoapplication.h | 3 +++ courtroom.cpp | 9 +++++---- text_file_functions.cpp | 22 +++++++++++++++++++++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/aoapplication.h b/aoapplication.h index e3544fe..b9d3fd1 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -169,6 +169,9 @@ public: //Returns the sfx with p_identifier from sounds.ini in the current theme path QString get_sfx(QString p_identifier); + //Figure out if we can opus this or if we should fall back to wav + QString get_sfx_suffix(QString sound_to_check); + //Returns the value of p_search_line within target_tag and terminator_tag QString read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag); diff --git a/courtroom.cpp b/courtroom.cpp index 43e977b..1ccae30 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1377,7 +1377,7 @@ void Courtroom::play_sfx() if (sfx_name == "1") return; - sfx_player->play(sfx_name + ".wav"); + sfx_player->play(ao_app->get_sfx_suffix(sfx_name)); } void Courtroom::set_scene() @@ -1488,12 +1488,13 @@ void Courtroom::set_text_color() ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: yellow"); break; - default: - qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR]; + case WHITE: ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white"); - + break; + default: + qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR]; } } diff --git a/text_file_functions.cpp b/text_file_functions.cpp index 1aebc35..5b057a4 100644 --- a/text_file_functions.cpp +++ b/text_file_functions.cpp @@ -340,6 +340,26 @@ QString AOApplication::get_sfx(QString p_identifier) return return_sfx; } +QString AOApplication::get_sfx_suffix(QString sound_to_check) +{ + QString wav_check = get_sounds_path() + sound_to_check + ".wav"; + QString mp3_check = get_sounds_path() + sound_to_check + ".mp3"; + QString opus_check = get_sounds_path() + sound_to_check + ".opus"; + if(file_exists(opus_check)) + { + return sound_to_check + ".opus"; + } + if(file_exists(mp3_check)) + { + return sound_to_check + ".mp3"; + } + if(file_exists(wav_check)) + { + return sound_to_check + ".wav"; + } + return sound_to_check + ".wav"; +} + //returns whatever is to the right of "search_line =" within target_tag and terminator_tag, trimmed //returns the empty string if the search line couldnt be found QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag) @@ -586,4 +606,4 @@ bool AOApplication::ic_scroll_down_enabled() { QString f_result = read_config("ic_scroll_down"); return f_result.startsWith("true"); -} \ No newline at end of file +} From b56421365ab75173facef74cdaf8d77d51df6d0f Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Wed, 17 Oct 2018 08:11:52 -0700 Subject: [PATCH 14/20] APNG Support --- Attorney_Online_remake.pro | 4 ++-- aoapplication.h | 3 +++ aocharmovie.cpp | 8 +++++++- courtroom.cpp | 6 +++--- main.cpp | 6 +++--- text_file_functions.cpp | 16 ++++++++++++++++ 6 files changed, 34 insertions(+), 9 deletions(-) diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro index 24ecf7d..cf8b47d 100644 --- a/Attorney_Online_remake.pro +++ b/Attorney_Online_remake.pro @@ -5,7 +5,7 @@ #------------------------------------------------- QT += core gui multimedia network - +QTPLUGIN += qapng greaterThan(QT_MAJOR_VERSION, 4): QT += widgets RC_ICONS = logo.ico @@ -88,7 +88,7 @@ HEADERS += lobby.h \ # in the same way as BASS. Discord RPC uses CMake, which does not play nicely with # QMake, so this step must be manual. unix:LIBS += -L$$PWD -lbass -ldiscord-rpc -win32:LIBS += -L$$PWD "$$PWD/bass.dll" -L$$PWD "$$PWD/discord-rpc.dll" +win32:LIBS += -L$$PWD "$$PWD/bass.dll" -L$$PWD "$$PWD/discord-rpc.dll" -lpng -lqapng -lz android:LIBS += -L$$PWD\android\libs\armeabi-v7a\ -lbass CONFIG += c++11 diff --git a/aoapplication.h b/aoapplication.h index b9d3fd1..29988c0 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -172,6 +172,9 @@ public: //Figure out if we can opus this or if we should fall back to wav QString get_sfx_suffix(QString sound_to_check); + // Can we use APNG for this? If not, fall back to a gif. + QString get_image_suffix(QString path_to_check); + //Returns the value of p_search_line within target_tag and terminator_tag QString read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag); diff --git a/aocharmovie.cpp b/aocharmovie.cpp index b591c22..786cab2 100644 --- a/aocharmovie.cpp +++ b/aocharmovie.cpp @@ -3,6 +3,8 @@ #include "misc_functions.h" #include "file_functions.h" #include "aoapplication.h" +#include "debug_functions.h" +#include AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) { @@ -21,11 +23,14 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { QString original_path = ao_app->get_character_path(p_char) + emote_prefix + p_emote.toLower() + ".gif"; QString alt_path = ao_app->get_character_path(p_char) + p_emote.toLower() + ".png"; + QString apng_path = ao_app->get_character_path(p_char) + emote_prefix + p_emote.toLower() + ".apng"; QString placeholder_path = ao_app->get_theme_path() + "placeholder.gif"; QString placeholder_default_path = ao_app->get_default_theme_path() + "placeholder.gif"; QString gif_path; - if (file_exists(original_path)) + if (file_exists(apng_path)) + gif_path = apng_path; + else if (file_exists(original_path)) gif_path = original_path; else if (file_exists(alt_path)) gif_path = alt_path; @@ -148,6 +153,7 @@ void AOCharMovie::combo_resize(int w, int h) void AOCharMovie::frame_change(int n_frame) { + if (movie_frames.size() > n_frame) { QPixmap f_pixmap = QPixmap::fromImage(movie_frames.at(n_frame)); diff --git a/courtroom.cpp b/courtroom.cpp index 1ccae30..fdb5e8c 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1219,13 +1219,13 @@ void Courtroom::play_preanim() preanim_duration = ao2_duration; sfx_delay_timer->start(sfx_delay); - - if (!file_exists(ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif") || + QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char) + f_preanim.toLower()); + if (!file_exists(anim_to_find) || preanim_duration < 0) { anim_state = 1; preanim_done(); - qDebug() << "could not find " + ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif"; + qDebug() << "could not find " + anim_to_find; return; } diff --git a/main.cpp b/main.cpp index 5696e2e..cf51b0a 100644 --- a/main.cpp +++ b/main.cpp @@ -5,9 +5,9 @@ #include "networkmanager.h" #include "lobby.h" #include "courtroom.h" - +#include #include - +Q_IMPORT_PLUGIN(ApngImagePlugin); int main(int argc, char *argv[]) { #if QT_VERSION > QT_VERSION_CHECK(5, 6, 0) @@ -16,10 +16,10 @@ int main(int argc, char *argv[]) // packages up to Qt 5.6, so this is conditional. AOApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif + AOApplication main_app(argc, argv); main_app.construct_lobby(); main_app.net_manager->connect_to_master(); main_app.w_lobby->show(); - return main_app.exec(); } diff --git a/text_file_functions.cpp b/text_file_functions.cpp index 5b057a4..a6ad4f7 100644 --- a/text_file_functions.cpp +++ b/text_file_functions.cpp @@ -360,6 +360,22 @@ QString AOApplication::get_sfx_suffix(QString sound_to_check) return sound_to_check + ".wav"; } +QString AOApplication::get_image_suffix(QString path_to_check) +{ + QString apng_check = path_to_check + ".apng"; + QString gif_check = path_to_check + ".gif"; + if(file_exists(apng_check)) + { + return path_to_check + ".apng"; + } + if(file_exists(gif_check)) + { + return path_to_check + ".gif"; + } + return path_to_check + ".gif"; +} + + //returns whatever is to the right of "search_line =" within target_tag and terminator_tag, trimmed //returns the empty string if the search line couldnt be found QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag) From ad27e0043313824787737889512e539bd3ff32b9 Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Wed, 17 Oct 2018 08:27:17 -0700 Subject: [PATCH 15/20] version to 2.6.0 --- aoapplication.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aoapplication.h b/aoapplication.h index 29988c0..b9a3b0a 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -231,8 +231,8 @@ public: private: const int RELEASE = 2; - const int MAJOR_VERSION = 5; - const int MINOR_VERSION = 2; + const int MAJOR_VERSION = 6; + const int MINOR_VERSION = 0; QString current_theme = "default"; From 5325083b6f564cf8521ff2602fbbf653849b17ce Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Wed, 17 Oct 2018 09:44:15 -0700 Subject: [PATCH 16/20] fixes (TM) --- aomovie.cpp | 4 ++-- courtroom.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aomovie.cpp b/aomovie.cpp index 90c3701..cc33ff7 100644 --- a/aomovie.cpp +++ b/aomovie.cpp @@ -28,9 +28,9 @@ void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme) QString custom_path; if (p_gif == "custom") - custom_path = ao_app->get_character_path(p_char) + p_gif + ".gif"; + custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char) + p_gif); else - custom_path = ao_app->get_character_path(p_char) + p_gif + "_bubble.gif"; + custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char) + p_gif + "_bubble"); QString custom_theme_path = ao_app->get_base_path() + "themes/" + p_custom_theme + "/" + p_gif + ".gif"; QString theme_path = ao_app->get_theme_path() + p_gif + ".gif"; diff --git a/courtroom.cpp b/courtroom.cpp index fdb5e8c..bdcb7dd 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -703,7 +703,7 @@ void Courtroom::enter_courtroom(int p_cid) QString char_path = ao_app->get_character_path(current_char); if (ao_app->custom_objection_enabled && - file_exists(char_path + "custom.gif") && + (file_exists(char_path + "custom.gif") || file_exists(char_path + "custom.apng")) && file_exists(char_path + "custom.wav")) ui_custom_objection->show(); else From 462ece38c7bfb57305b77ec34561aa914b5bdc92 Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Wed, 17 Oct 2018 15:16:47 -0700 Subject: [PATCH 17/20] fixes --- aocharmovie.cpp | 2 -- text_file_functions.cpp | 10 ---------- 2 files changed, 12 deletions(-) diff --git a/aocharmovie.cpp b/aocharmovie.cpp index 786cab2..661a649 100644 --- a/aocharmovie.cpp +++ b/aocharmovie.cpp @@ -3,8 +3,6 @@ #include "misc_functions.h" #include "file_functions.h" #include "aoapplication.h" -#include "debug_functions.h" -#include AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) { diff --git a/text_file_functions.cpp b/text_file_functions.cpp index a6ad4f7..c37857c 100644 --- a/text_file_functions.cpp +++ b/text_file_functions.cpp @@ -342,7 +342,6 @@ QString AOApplication::get_sfx(QString p_identifier) QString AOApplication::get_sfx_suffix(QString sound_to_check) { - QString wav_check = get_sounds_path() + sound_to_check + ".wav"; QString mp3_check = get_sounds_path() + sound_to_check + ".mp3"; QString opus_check = get_sounds_path() + sound_to_check + ".opus"; if(file_exists(opus_check)) @@ -353,25 +352,16 @@ QString AOApplication::get_sfx_suffix(QString sound_to_check) { return sound_to_check + ".mp3"; } - if(file_exists(wav_check)) - { - return sound_to_check + ".wav"; - } return sound_to_check + ".wav"; } QString AOApplication::get_image_suffix(QString path_to_check) { QString apng_check = path_to_check + ".apng"; - QString gif_check = path_to_check + ".gif"; if(file_exists(apng_check)) { return path_to_check + ".apng"; } - if(file_exists(gif_check)) - { - return path_to_check + ".gif"; - } return path_to_check + ".gif"; } From 2ba3e86a1d617b2b3096f62f35e451b140604ffe Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Wed, 17 Oct 2018 17:19:52 -0700 Subject: [PATCH 18/20] Adds reason support for kicks and bans to the client. --- packet_distribution.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/packet_distribution.cpp b/packet_distribution.cpp index 6f29b2e..cb48651 100644 --- a/packet_distribution.cpp +++ b/packet_distribution.cpp @@ -539,25 +539,23 @@ void AOApplication::server_packet_received(AOPacket *p_packet) } else if (header == "KK") { - if (courtroom_constructed && f_contents.size() > 0) + if (courtroom_constructed && f_contents.size() >= 1) { - int f_cid = w_courtroom->get_cid(); - int remote_cid = f_contents.at(0).toInt(); - - if (f_cid != remote_cid && remote_cid != -1) - goto end; - - call_notice("You have been kicked."); + call_notice("You have been kicked from the server.\nReason: " + f_contents.at(0)); + construct_lobby(); + destruct_courtroom(); + } + } + else if (header == "KB") + { + if (courtroom_constructed && f_contents.size() >= 1) + { + call_notice("You have been banned from the server.\nReason: " + f_contents.at(0)); construct_lobby(); destruct_courtroom(); } } - else if (header == "KB") - { - if (courtroom_constructed && f_contents.size() > 0) - w_courtroom->set_ban(f_contents.at(0).toInt()); - } else if (header == "BD") { call_notice("You are banned on this server."); From 021d89c065e1d813bc78e8f7ab25b7092dd65182 Mon Sep 17 00:00:00 2001 From: argoneus Date: Sun, 4 Nov 2018 19:37:04 +0100 Subject: [PATCH 19/20] fixed project file to use qapng and discord rpc correctly --- Attorney_Online_remake.pro | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro index cf8b47d..6308dbd 100644 --- a/Attorney_Online_remake.pro +++ b/Attorney_Online_remake.pro @@ -5,7 +5,6 @@ #------------------------------------------------- QT += core gui multimedia network -QTPLUGIN += qapng greaterThan(QT_MAJOR_VERSION, 4): QT += widgets RC_ICONS = logo.ico @@ -88,7 +87,7 @@ HEADERS += lobby.h \ # in the same way as BASS. Discord RPC uses CMake, which does not play nicely with # QMake, so this step must be manual. unix:LIBS += -L$$PWD -lbass -ldiscord-rpc -win32:LIBS += -L$$PWD "$$PWD/bass.dll" -L$$PWD "$$PWD/discord-rpc.dll" -lpng -lqapng -lz +win32:LIBS += -L$$PWD "$$PWD/bass.dll" -ldiscord-rpc -L$$PWD android:LIBS += -L$$PWD\android\libs\armeabi-v7a\ -lbass CONFIG += c++11 From 64aad2506906a9ec7d693a7f2c1dacb22060186d Mon Sep 17 00:00:00 2001 From: argoneus Date: Sun, 4 Nov 2018 19:53:28 +0100 Subject: [PATCH 20/20] removed redundant linker argument --- Attorney_Online_remake.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro index 6308dbd..1b36f61 100644 --- a/Attorney_Online_remake.pro +++ b/Attorney_Online_remake.pro @@ -87,7 +87,7 @@ HEADERS += lobby.h \ # in the same way as BASS. Discord RPC uses CMake, which does not play nicely with # QMake, so this step must be manual. unix:LIBS += -L$$PWD -lbass -ldiscord-rpc -win32:LIBS += -L$$PWD "$$PWD/bass.dll" -ldiscord-rpc -L$$PWD +win32:LIBS += -L$$PWD "$$PWD/bass.dll" -ldiscord-rpc android:LIBS += -L$$PWD\android\libs\armeabi-v7a\ -lbass CONFIG += c++11