added call word function and fixed an evidence-related crash

This commit is contained in:
OmniTroid 2017-05-30 22:06:06 +02:00
parent 256e07e237
commit 71bac5414e
5 changed files with 50 additions and 11 deletions

View File

@ -13,7 +13,7 @@ RC_ICONS = logo.ico
TARGET = Attorney_Online_remake
TEMPLATE = app
VERSION = 2.4.1.0
VERSION = 2.4.2.0
SOURCES += main.cpp\
lobby.cpp \

View File

@ -108,6 +108,7 @@ public:
int get_default_music();
int get_default_sfx();
int get_default_blip();
QStringList get_call_words();
void write_to_serverlist_txt(QString p_line);
QVector<server_type> read_serverlist_txt();
QString read_design_ini(QString p_identifier, QString p_design_path);
@ -115,7 +116,7 @@ public:
pos_size_type get_element_dimensions(QString p_identifier, QString p_file);
int get_font_size(QString p_identifier, QString p_file);
QColor get_color(QString p_identifier, QString p_file);
QString get_sfx(QString p_identifier, QString p_file);
QString get_sfx(QString p_identifier);
QString read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag);
QString get_char_side(QString p_char);
QString get_showname(QString p_char);
@ -138,7 +139,7 @@ public:
private:
const int RELEASE = 2;
const int MAJOR_VERSION = 4;
const int MINOR_VERSION = 1;
const int MINOR_VERSION = 2;
QString user_theme = "default";

View File

@ -65,7 +65,7 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid
this->setMovie(evidence_movie);
evidence_movie->start();
sfx_player->play(ao_app->get_sfx("evidence_present", "courtroom_sounds.ini"));
sfx_player->play(ao_app->get_sfx("evidence_present"));
}
void AOEvidenceDisplay::frame_change(int p_frame)

View File

@ -1112,7 +1112,21 @@ void Courtroom::handle_chatmessage_3()
{
realization_timer->start(60);
ui_vp_realization->show();
sfx_player->play(ao_app->get_sfx("realization", "courtroom_sounds.ini"));
sfx_player->play(ao_app->get_sfx("realization"));
}
QString f_message = m_chatmessage[MESSAGE];
QStringList call_words = ao_app->get_call_words();
for (QString word : call_words)
{
if (f_message.contains(word, Qt::CaseInsensitive))
{
modcall_player->play(ao_app->get_sfx("word_call"));
ao_app->alert(this);
break;
}
}
}
@ -1508,7 +1522,7 @@ void Courtroom::handle_wtce(QString p_wtce)
//witness testimony
if (p_wtce == "testimony1")
{
sfx_player->play(ao_app->get_sfx("witness_testimony", sfx_file));
sfx_player->play(ao_app->get_sfx("witness_testimony"));
ui_vp_wtce->play("witnesstestimony");
testimony_in_progress = true;
show_testimony();
@ -1516,7 +1530,7 @@ void Courtroom::handle_wtce(QString p_wtce)
//cross examination
else if (p_wtce == "testimony2")
{
sfx_player->play(ao_app->get_sfx("cross_examination", sfx_file));
sfx_player->play(ao_app->get_sfx("cross_examination"));
ui_vp_wtce->play("crossexamination");
testimony_in_progress = false;
}
@ -1544,7 +1558,7 @@ void Courtroom::mod_called(QString p_ip)
ui_server_chatlog->append(p_ip);
if (ui_guard->isChecked())
{
modcall_player->play("sfx-gallery.wav");
modcall_player->play(ao_app->get_sfx("mod_call"));
ao_app->alert(this);
}
}

View File

@ -90,6 +90,28 @@ int AOApplication::get_default_blip()
else return f_result.toInt();
}
QStringList AOApplication::get_call_words()
{
QStringList return_value;
QFile callwords_ini;
callwords_ini.setFileName(get_base_path() + "callwords.ini");
if (!callwords_ini.open(QIODevice::ReadOnly))
return return_value;
QTextStream in(&callwords_ini);
while (!in.atEnd())
{
QString line = in.readLine();
return_value.append(line);
}
return return_value;
}
void AOApplication::write_to_serverlist_txt(QString p_line)
{
QFile serverlist_txt;
@ -292,10 +314,10 @@ QColor AOApplication::get_color(QString p_identifier, QString p_file)
return return_color;
}
QString AOApplication::get_sfx(QString p_identifier, QString p_file)
QString AOApplication::get_sfx(QString p_identifier)
{
QString design_ini_path = get_theme_path() + p_file;
QString default_path = get_default_theme_path() + p_file;
QString design_ini_path = get_theme_path() + "courtroom_sounds.ini";
QString default_path = get_default_theme_path() + "courtroom_sounds.ini";
QString f_result = read_design_ini(p_identifier, design_ini_path);
QString return_sfx = "";
@ -552,3 +574,5 @@ bool AOApplication::get_blank_blip()