Make discord toggleable, OOC name option, default bg fix

This commit is contained in:
gameboyprinter 2018-07-05 12:21:32 -05:00
parent e761805cd1
commit bed0b55e70
10 changed files with 35 additions and 31 deletions

View File

@ -40,6 +40,7 @@ void AOApplication::construct_lobby()
int y = (screenGeometry.height()-w_lobby->height()) / 2; int y = (screenGeometry.height()-w_lobby->height()) / 2;
w_lobby->move(x, y); w_lobby->move(x, y);
if(is_discord_enabled())
discord->state_lobby(); discord->state_lobby();
w_lobby->show(); w_lobby->show();

View File

@ -114,6 +114,9 @@ public:
//Reads the theme from config.ini and loads it into the current_theme variable //Reads the theme from config.ini and loads it into the current_theme variable
QString read_theme(); QString read_theme();
//Returns the value of ooc_name in config.ini
QString get_ooc_name();
//Returns the blip rate from config.ini //Returns the blip rate from config.ini
int read_blip_rate(); int read_blip_rate();
@ -129,6 +132,9 @@ public:
//Returns the value of default_blip in config.ini //Returns the value of default_blip in config.ini
int get_default_blip(); 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 //Returns the list of words in callwords.ini
QStringList get_call_words(); QStringList get_call_words();

View File

@ -14,7 +14,7 @@ void AOBlipPlayer::set_blips(QString p_sfx)
{ {
QString f_path = ao_app->get_sounds_path() + p_sfx.toLower(); 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]); BASS_StreamFree(m_stream_list[n_stream]);
@ -28,7 +28,7 @@ void AOBlipPlayer::blip_tick()
{ {
int f_cycle = m_cycle++; int f_cycle = m_cycle++;
if (m_cycle == 5) if (m_cycle == BLIP_COUNT)
m_cycle = 0; m_cycle = 0;
HSTREAM f_stream = m_stream_list[f_cycle]; 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; 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); BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
} }

View File

@ -6,6 +6,8 @@
#include <QWidget> #include <QWidget>
const int BLIP_COUNT = 5;
class AOBlipPlayer class AOBlipPlayer
{ {
public: public:
@ -22,7 +24,7 @@ private:
AOApplication *ao_app; AOApplication *ao_app;
int m_volume; int m_volume;
HSTREAM m_stream_list[5]; HSTREAM m_stream_list[BLIP_COUNT];
}; };
#endif // AOBLIPPLAYER_H #endif // AOBLIPPLAYER_H

View File

@ -109,6 +109,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_ooc_chat_name = new QLineEdit(this); ui_ooc_chat_name = new QLineEdit(this);
ui_ooc_chat_name->setFrame(false); ui_ooc_chat_name->setFrame(false);
ui_ooc_chat_name->setPlaceholderText("Name"); 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 = new QLineEdit(this);
//ui_area_password->setFrame(false); //ui_area_password->setFrame(false);
@ -663,12 +664,14 @@ void Courtroom::enter_courtroom(int p_cid)
if (m_cid == -1) if (m_cid == -1)
{ {
if(ao_app->is_discord_enabled())
ao_app->discord->state_spectate(); ao_app->discord->state_spectate();
f_char = ""; f_char = "";
} }
else else
{ {
f_char = ao_app->get_char_name(char_list.at(m_cid).name); f_char = ao_app->get_char_name(char_list.at(m_cid).name);
if(ao_app->is_discord_enabled())
ao_app->discord->state_character(f_char.toStdString()); ao_app->discord->state_character(f_char.toStdString());
} }

View File

@ -250,7 +250,7 @@ private:
//whether the ooc chat is server or master chat, true is server //whether the ooc chat is server or master chat, true is server
bool server_ooc = true; bool server_ooc = true;
QString current_background = "gs4"; QString current_background = "default";
AOMusicPlayer *music_player; AOMusicPlayer *music_player;
AOSfxPlayer *sfx_player; AOSfxPlayer *sfx_player;

View File

@ -29,6 +29,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
ui_chatbox->setOpenExternalLinks(true); ui_chatbox->setOpenExternalLinks(true);
ui_chatname = new QLineEdit(this); ui_chatname = new QLineEdit(this);
ui_chatname->setPlaceholderText("Name"); ui_chatname->setPlaceholderText("Name");
ui_chatname->setText(ao_app->get_ooc_name());
ui_chatmessage = new QLineEdit(this); ui_chatmessage = new QLineEdit(this);
ui_loading_background = new AOImage(this, ao_app); ui_loading_background = new AOImage(this, ao_app);
ui_loading_text = new QTextEdit(ui_loading_background); ui_loading_text = new QTextEdit(ui_loading_background);

View File

@ -264,6 +264,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256); QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256);
hash.addData(server_address.toUtf8()); hash.addData(server_address.toUtf8());
if(is_discord_enabled())
discord->state_server(server_name.toStdString(), hash.result().toBase64().toStdString()); discord->state_server(server_name.toStdString(), hash.result().toBase64().toStdString());
} }
else if (header == "CI") else if (header == "CI")

View File

@ -29,21 +29,6 @@ QString AOApplication::get_base_path()
#endif #endif
} }
return base_path; 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() QString AOApplication::get_data_path()
@ -96,7 +81,7 @@ QString AOApplication::get_background_path()
QString AOApplication::get_default_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() QString AOApplication::get_evidence_path()
@ -118,5 +103,5 @@ QString Courtroom::get_background_path()
QString Courtroom::get_default_background_path() QString Courtroom::get_default_background_path()
{ {
return ao_app->get_base_path() + "background/gs4/"; return ao_app->get_base_path() + "background/default/";
} }

View File

@ -52,6 +52,11 @@ QString AOApplication::read_theme()
return result; return result;
} }
QString AOApplication::get_ooc_name()
{
return read_config("ooc_name");
}
int AOApplication::read_blip_rate() int AOApplication::read_blip_rate()
{ {
QString result = read_config("blip_rate"); QString result = read_config("blip_rate");
@ -571,8 +576,8 @@ bool AOApplication::get_blank_blip()
return f_result.startsWith("true"); return f_result.startsWith("true");
} }
bool AOApplication::is_discord_enabled()
{
QString f_result = read_config("discord");
return f_result.startsWith("true");
}