Skip to content

Commit 71bac54

Browse files
committed
added call word function and fixed an evidence-related crash
1 parent 256e07e commit 71bac54

5 files changed

+50
-11
lines changed

Diff for: Attorney_Online_remake.pro

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RC_ICONS = logo.ico
1313
TARGET = Attorney_Online_remake
1414
TEMPLATE = app
1515

16-
VERSION = 2.4.1.0
16+
VERSION = 2.4.2.0
1717

1818
SOURCES += main.cpp\
1919
lobby.cpp \

Diff for: aoapplication.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,15 @@ class AOApplication : public QApplication
108108
int get_default_music();
109109
int get_default_sfx();
110110
int get_default_blip();
111+
QStringList get_call_words();
111112
void write_to_serverlist_txt(QString p_line);
112113
QVector<server_type> read_serverlist_txt();
113114
QString read_design_ini(QString p_identifier, QString p_design_path);
114115
QPoint get_button_spacing(QString p_identifier, QString p_file);
115116
pos_size_type get_element_dimensions(QString p_identifier, QString p_file);
116117
int get_font_size(QString p_identifier, QString p_file);
117118
QColor get_color(QString p_identifier, QString p_file);
118-
QString get_sfx(QString p_identifier, QString p_file);
119+
QString get_sfx(QString p_identifier);
119120
QString read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag);
120121
QString get_char_side(QString p_char);
121122
QString get_showname(QString p_char);
@@ -138,7 +139,7 @@ class AOApplication : public QApplication
138139
private:
139140
const int RELEASE = 2;
140141
const int MAJOR_VERSION = 4;
141-
const int MINOR_VERSION = 1;
142+
const int MINOR_VERSION = 2;
142143

143144
QString user_theme = "default";
144145

Diff for: aoevidencedisplay.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid
6565
this->setMovie(evidence_movie);
6666

6767
evidence_movie->start();
68-
sfx_player->play(ao_app->get_sfx("evidence_present", "courtroom_sounds.ini"));
68+
sfx_player->play(ao_app->get_sfx("evidence_present"));
6969
}
7070

7171
void AOEvidenceDisplay::frame_change(int p_frame)

Diff for: courtroom.cpp

+18-4
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,21 @@ void Courtroom::handle_chatmessage_3()
11121112
{
11131113
realization_timer->start(60);
11141114
ui_vp_realization->show();
1115-
sfx_player->play(ao_app->get_sfx("realization", "courtroom_sounds.ini"));
1115+
sfx_player->play(ao_app->get_sfx("realization"));
1116+
}
1117+
1118+
QString f_message = m_chatmessage[MESSAGE];
1119+
QStringList call_words = ao_app->get_call_words();
1120+
1121+
for (QString word : call_words)
1122+
{
1123+
if (f_message.contains(word, Qt::CaseInsensitive))
1124+
{
1125+
modcall_player->play(ao_app->get_sfx("word_call"));
1126+
ao_app->alert(this);
1127+
1128+
break;
1129+
}
11161130
}
11171131

11181132
}
@@ -1508,15 +1522,15 @@ void Courtroom::handle_wtce(QString p_wtce)
15081522
//witness testimony
15091523
if (p_wtce == "testimony1")
15101524
{
1511-
sfx_player->play(ao_app->get_sfx("witness_testimony", sfx_file));
1525+
sfx_player->play(ao_app->get_sfx("witness_testimony"));
15121526
ui_vp_wtce->play("witnesstestimony");
15131527
testimony_in_progress = true;
15141528
show_testimony();
15151529
}
15161530
//cross examination
15171531
else if (p_wtce == "testimony2")
15181532
{
1519-
sfx_player->play(ao_app->get_sfx("cross_examination", sfx_file));
1533+
sfx_player->play(ao_app->get_sfx("cross_examination"));
15201534
ui_vp_wtce->play("crossexamination");
15211535
testimony_in_progress = false;
15221536
}
@@ -1544,7 +1558,7 @@ void Courtroom::mod_called(QString p_ip)
15441558
ui_server_chatlog->append(p_ip);
15451559
if (ui_guard->isChecked())
15461560
{
1547-
modcall_player->play("sfx-gallery.wav");
1561+
modcall_player->play(ao_app->get_sfx("mod_call"));
15481562
ao_app->alert(this);
15491563
}
15501564
}

Diff for: text_file_functions.cpp

+27-3
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,28 @@ int AOApplication::get_default_blip()
9090
else return f_result.toInt();
9191
}
9292

93+
QStringList AOApplication::get_call_words()
94+
{
95+
QStringList return_value;
96+
97+
QFile callwords_ini;
98+
99+
callwords_ini.setFileName(get_base_path() + "callwords.ini");
100+
101+
if (!callwords_ini.open(QIODevice::ReadOnly))
102+
return return_value;
103+
104+
QTextStream in(&callwords_ini);
105+
106+
while (!in.atEnd())
107+
{
108+
QString line = in.readLine();
109+
return_value.append(line);
110+
}
111+
112+
return return_value;
113+
}
114+
93115
void AOApplication::write_to_serverlist_txt(QString p_line)
94116
{
95117
QFile serverlist_txt;
@@ -292,10 +314,10 @@ QColor AOApplication::get_color(QString p_identifier, QString p_file)
292314
return return_color;
293315
}
294316

295-
QString AOApplication::get_sfx(QString p_identifier, QString p_file)
317+
QString AOApplication::get_sfx(QString p_identifier)
296318
{
297-
QString design_ini_path = get_theme_path() + p_file;
298-
QString default_path = get_default_theme_path() + p_file;
319+
QString design_ini_path = get_theme_path() + "courtroom_sounds.ini";
320+
QString default_path = get_default_theme_path() + "courtroom_sounds.ini";
299321
QString f_result = read_design_ini(p_identifier, design_ini_path);
300322

301323
QString return_sfx = "";
@@ -552,3 +574,5 @@ bool AOApplication::get_blank_blip()
552574

553575

554576

577+
578+

0 commit comments

Comments
 (0)