diff --git a/aocharbutton.cpp b/aocharbutton.cpp index d6edf80..b32be01 100644 --- a/aocharbutton.cpp +++ b/aocharbutton.cpp @@ -54,6 +54,7 @@ void AOCharButton::set_image(QString p_character) { QString image_path = ao_app->get_character_path(p_character) + "char_icon.png"; QString legacy_path = ao_app->get_demothings_path() + p_character.toLower() + "_char_icon.png"; + QString alt_path = ao_app->get_demothings_path() + p_character.toLower() + "_off.png"; this->setText(""); diff --git a/aocharmovie.cpp b/aocharmovie.cpp index 7198523..40953e5 100644 --- a/aocharmovie.cpp +++ b/aocharmovie.cpp @@ -25,12 +25,15 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ 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 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)) gif_path = original_path; + else if (file_exists(alt_path)) + gif_path = alt_path; else if (file_exists(placeholder_path)) gif_path = placeholder_path; else diff --git a/aomovie.cpp b/aomovie.cpp index 9e1b64e..2e7194a 100644 --- a/aomovie.cpp +++ b/aomovie.cpp @@ -27,6 +27,7 @@ void AOMovie::play(QString p_gif, QString p_char) QString gif_path; QString custom_path = ao_app->get_character_path(p_char) + p_gif + ".gif"; + QString alt_path = ao_app->get_character_path(p_char) + p_gif + ".png"; QString theme_path = ao_app->get_theme_path() + p_gif + ".gif"; QString default_theme_path = ao_app->get_default_theme_path() + p_gif + ".gif"; QString placeholder_path = ao_app->get_theme_path() + "placeholder.gif"; @@ -34,6 +35,8 @@ void AOMovie::play(QString p_gif, QString p_char) if (file_exists(custom_path)) gif_path = custom_path; + else if (file_exists(alt_path)) + gif_path = alt_path; else if (file_exists(theme_path)) gif_path = theme_path; else if (file_exists(default_theme_path)) diff --git a/file_functions.cpp b/file_functions.cpp index a191d67..bc9185f 100644 --- a/file_functions.cpp +++ b/file_functions.cpp @@ -1,4 +1,5 @@ #include +#include #include "file_functions.h" @@ -8,3 +9,10 @@ bool file_exists(QString file_path) return check_file.exists() && check_file.isFile(); } + +bool dir_exists(QString dir_path) +{ + QDir check_dir(dir_path); + + return check_dir.exists(); +} diff --git a/file_functions.h b/file_functions.h index 5ecf14a..81a90ed 100644 --- a/file_functions.h +++ b/file_functions.h @@ -4,5 +4,6 @@ #include bool file_exists(QString file_path); +bool dir_exists(QString file_path); #endif // FILE_FUNCTIONS_H diff --git a/packet_distribution.cpp b/packet_distribution.cpp index 8740f05..80a6b0e 100644 --- a/packet_distribution.cpp +++ b/packet_distribution.cpp @@ -165,23 +165,6 @@ void AOApplication::server_packet_received(AOPacket *p_packet) server_minor = version_list.at(2).toInt(); } } - - if (server_software == "v1312.150") - { - encryption_needed = false; - custom_objection_enabled = true; - } - else if (server_software == "tsuserver3") - { - if (server_release >= 3) - { - yellow_text_enabled = true; - flipping_enabled = true; - custom_objection_enabled = true; - improved_loading_enabled = true; - } - } - send_server_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%")); } else if (header == "CT") @@ -192,6 +175,19 @@ void AOApplication::server_packet_received(AOPacket *p_packet) if (courtroom_constructed) w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1)); } + else if (header == "FL") + { + if (f_packet.contains("yellowtext",Qt::CaseInsensitive)) + yellow_text_enabled = true; + if (f_packet.contains("flipping",Qt::CaseInsensitive)) + flipping_enabled = true; + if (f_packet.contains("customobjections",Qt::CaseInsensitive)) + custom_objection_enabled = true; + if (f_packet.contains("fastloading",Qt::CaseInsensitive)) + improved_loading_enabled = true; + if (f_packet.contains("noencryption",Qt::CaseInsensitive)) + encryption_needed = false; + } else if (header == "PN") { if (f_contents.size() < 2) diff --git a/path_functions.cpp b/path_functions.cpp index 7f0b83c..47fab06 100644 --- a/path_functions.cpp +++ b/path_functions.cpp @@ -1,6 +1,6 @@ #include "aoapplication.h" #include "courtroom.h" - +#include "file_functions.h" #include #include @@ -16,7 +16,16 @@ QString AOApplication::get_base_path() #elif defined(ANDROID) return "/storage/extSdCard/AO2/"; #else - return (QDir::currentPath() + "/base/"); + QString default_path = "/base/"; + QString alt_path = "/data/"; + + if (dir_exists(default_path)) + return QDir::currentPath() + default_path; + else if (dir_exists(alt_path)) + return QDir::currentPath() + alt_path; + else + return QDir::currentPath() + default_path; + #endif } @@ -37,7 +46,14 @@ QString AOApplication::get_character_path(QString p_character) QString AOApplication::get_demothings_path() { - return get_base_path() + "misc/demothings/"; + QString default_path = "misc/demothings/"; + QString alt_path = "misc/RosterImages"; + if (dir_exists(default_path)) + return get_base_path() + default_path; + else if (dir_exists(alt_path)) + return get_base_path() + alt_path; + else + return get_base_path() + default_path; } QString AOApplication::get_sounds_path() {