diff --git a/aoapplication.cpp b/aoapplication.cpp index 12e540c..54ec180 100644 --- a/aoapplication.cpp +++ b/aoapplication.cpp @@ -40,7 +40,8 @@ void AOApplication::construct_lobby() int y = (screenGeometry.height()-w_lobby->height()) / 2; w_lobby->move(x, y); - discord->state_lobby(); + if(is_discord_enabled()) + discord->state_lobby(); w_lobby->show(); } diff --git a/aoapplication.h b/aoapplication.h index 2a5c436..f7cdb00 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -114,6 +114,9 @@ public: //Reads the theme from config.ini and loads it into the current_theme variable QString read_theme(); + //Returns the value of ooc_name in config.ini + QString get_ooc_name(); + //Returns the blip rate from config.ini int read_blip_rate(); @@ -129,6 +132,9 @@ public: //Returns the value of default_blip in config.ini int get_default_blip(); + //Returns true if discord is enabled in config.ini and false otherwise + bool is_discord_enabled(); + //Returns the list of words in callwords.ini QStringList get_call_words(); diff --git a/aoblipplayer.cpp b/aoblipplayer.cpp index f212453..63f0494 100644 --- a/aoblipplayer.cpp +++ b/aoblipplayer.cpp @@ -14,7 +14,7 @@ void AOBlipPlayer::set_blips(QString p_sfx) { QString f_path = ao_app->get_sounds_path() + p_sfx.toLower(); - for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) + for (int n_stream = 0 ; n_stream < BLIP_COUNT ; ++n_stream) { BASS_StreamFree(m_stream_list[n_stream]); @@ -28,7 +28,7 @@ void AOBlipPlayer::blip_tick() { int f_cycle = m_cycle++; - if (m_cycle == 5) + if (m_cycle == BLIP_COUNT) m_cycle = 0; HSTREAM f_stream = m_stream_list[f_cycle]; @@ -42,7 +42,7 @@ void AOBlipPlayer::set_volume(int p_value) float volume = p_value / 100.0f; - for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) + for (int n_stream = 0 ; n_stream < BLIP_COUNT ; ++n_stream) { BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); } diff --git a/aoblipplayer.h b/aoblipplayer.h index 430f702..6e3ce1c 100644 --- a/aoblipplayer.h +++ b/aoblipplayer.h @@ -6,6 +6,8 @@ #include +const int BLIP_COUNT = 5; + class AOBlipPlayer { public: @@ -22,7 +24,7 @@ private: AOApplication *ao_app; int m_volume; - HSTREAM m_stream_list[5]; + HSTREAM m_stream_list[BLIP_COUNT]; }; #endif // AOBLIPPLAYER_H diff --git a/courtroom.cpp b/courtroom.cpp index ca94f43..8ddb6ed 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -109,6 +109,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ooc_chat_name = new QLineEdit(this); ui_ooc_chat_name->setFrame(false); ui_ooc_chat_name->setPlaceholderText("Name"); + ui_ooc_chat_name->setText(ao_app->get_ooc_name()); //ui_area_password = new QLineEdit(this); //ui_area_password->setFrame(false); @@ -663,13 +664,15 @@ void Courtroom::enter_courtroom(int p_cid) if (m_cid == -1) { - ao_app->discord->state_spectate(); + if(ao_app->is_discord_enabled()) + ao_app->discord->state_spectate(); f_char = ""; } else { f_char = ao_app->get_char_name(char_list.at(m_cid).name); - ao_app->discord->state_character(f_char.toStdString()); + if(ao_app->is_discord_enabled()) + ao_app->discord->state_character(f_char.toStdString()); } current_char = f_char; diff --git a/courtroom.h b/courtroom.h index 85554a0..e4a4f16 100644 --- a/courtroom.h +++ b/courtroom.h @@ -250,7 +250,7 @@ private: //whether the ooc chat is server or master chat, true is server bool server_ooc = true; - QString current_background = "gs4"; + QString current_background = "default"; AOMusicPlayer *music_player; AOSfxPlayer *sfx_player; diff --git a/lobby.cpp b/lobby.cpp index 13ef550..c0dbf0c 100644 --- a/lobby.cpp +++ b/lobby.cpp @@ -29,6 +29,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() ui_chatbox->setOpenExternalLinks(true); ui_chatname = new QLineEdit(this); ui_chatname->setPlaceholderText("Name"); + ui_chatname->setText(ao_app->get_ooc_name()); ui_chatmessage = new QLineEdit(this); ui_loading_background = new AOImage(this, ao_app); ui_loading_text = new QTextEdit(ui_loading_background); diff --git a/packet_distribution.cpp b/packet_distribution.cpp index 3908ffa..4299518 100644 --- a/packet_distribution.cpp +++ b/packet_distribution.cpp @@ -264,7 +264,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256); hash.addData(server_address.toUtf8()); - discord->state_server(server_name.toStdString(), hash.result().toBase64().toStdString()); + if(is_discord_enabled()) + discord->state_server(server_name.toStdString(), hash.result().toBase64().toStdString()); } else if (header == "CI") { diff --git a/path_functions.cpp b/path_functions.cpp index 6e772db..820c05a 100644 --- a/path_functions.cpp +++ b/path_functions.cpp @@ -29,21 +29,6 @@ QString AOApplication::get_base_path() #endif } return base_path; - /* -#ifdef OMNI_DEBUG - return "/media/omnitroid/Data/winshare/AO/client/base/"; -#elif OMNI_DEBUG2 - return "/home/omnitroid/winshare/AO/client/base/"; -#elif defined(OMNI_WIN_DEBUG) - return "E:/AO/client/base/"; -#elif defined(OMNI_WIN_DEBUG2) - return "F:/winshare/AO/client/base/"; -#elif defined(ANDROID) - return "/storage/extSdCard/AO2/"; -#else - return QDir::currentPath() + "/base/"; -#endif -*/ } QString AOApplication::get_data_path() @@ -96,7 +81,7 @@ QString AOApplication::get_background_path() QString AOApplication::get_default_background_path() { - return get_base_path() + "background/gs4/"; + return get_base_path() + "background/default/"; } QString AOApplication::get_evidence_path() @@ -118,5 +103,5 @@ QString Courtroom::get_background_path() QString Courtroom::get_default_background_path() { - return ao_app->get_base_path() + "background/gs4/"; + return ao_app->get_base_path() + "background/default/"; } diff --git a/text_file_functions.cpp b/text_file_functions.cpp index 90b10f5..2263fa1 100644 --- a/text_file_functions.cpp +++ b/text_file_functions.cpp @@ -52,6 +52,11 @@ QString AOApplication::read_theme() return result; } +QString AOApplication::get_ooc_name() +{ + return read_config("ooc_name"); +} + int AOApplication::read_blip_rate() { QString result = read_config("blip_rate"); @@ -571,8 +576,8 @@ bool AOApplication::get_blank_blip() return f_result.startsWith("true"); } - - - - - +bool AOApplication::is_discord_enabled() +{ + QString f_result = read_config("discord"); + return f_result.startsWith("true"); +} \ No newline at end of file