Skip to content

Commit be017b7

Browse files
committed
fixed all known bugs + improved preanims(probably)
1 parent f7db8fa commit be017b7

9 files changed

Lines changed: 66 additions & 25 deletions

Attorney_Online_remake.pro

Lines changed: 1 addition & 1 deletion
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.1.3.0
16+
VERSION = 2.1.4.0
1717

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

aoapplication.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class AOApplication : public QApplication
103103
QString get_showname(QString p_char);
104104
QString get_chat(QString p_char);
105105
int get_preanim_duration(QString p_char, QString p_emote);
106+
int get_ao2_preanim_duration(QString p_char, QString p_emote);
106107
int get_text_delay(QString p_char, QString p_emote);
107108
QString get_char_name(QString p_char);
108109
int get_emote_number(QString p_char);
@@ -117,7 +118,7 @@ class AOApplication : public QApplication
117118
private:
118119
const int RELEASE = 2;
119120
const int MAJOR_VERSION = 1;
120-
const int MINOR_VERSION = 3;
121+
const int MINOR_VERSION = 4;
121122

122123
QString user_theme = "default";
123124

aoblipplayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
1212

1313
void AOBlipPlayer::set_blips(QString p_sfx)
1414
{
15-
QString f_path = ao_app->get_sounds_path() + p_sfx;
15+
QString f_path = ao_app->get_sounds_path() + p_sfx.toLower();
1616

1717
for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
1818
{

aocharmovie.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_
1919
this->setMovie(m_movie);
2020

2121
connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
22-
connect(preanim_timer, SIGNAL(timeout()), this, SLOT(preanim_done()));
22+
connect(m_movie, SIGNAL(finished()), this, SLOT(movie_done()));
23+
connect(preanim_timer, SIGNAL(timeout()), this, SLOT(timer_done()));
2324
}
2425

2526
void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
@@ -63,8 +64,15 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
6364

6465
void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
6566
{
67+
if (duration == 0)
68+
play_once = true;
69+
70+
else
71+
{
72+
play_once = false;
73+
preanim_timer->start(duration);
74+
}
6675
play(p_char, p_emote, "");
67-
preanim_timer->start(duration);
6876
}
6977

7078
void AOCharMovie::play_talking(QString p_char, QString p_emote)
@@ -95,9 +103,15 @@ void AOCharMovie::frame_change(int n_frame)
95103
{
96104
if (m_flipped && flipped_movie.size() > n_frame)
97105
this->setPixmap(QPixmap::fromImage(flipped_movie.at(n_frame)));
106+
107+
if (m_movie->frameCount() - 1 == n_frame && play_once)
108+
{
109+
delay(m_movie->nextFrameDelay());
110+
done();
111+
}
98112
}
99113

100-
void AOCharMovie::preanim_done()
114+
void AOCharMovie::timer_done()
101115
{
102116
done();
103117
}

aocharmovie.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ class AOCharMovie : public QLabel
3434

3535
bool m_flipped = false;
3636

37+
bool play_once = true;
38+
3739
signals:
3840
void done();
3941

4042
private slots:
4143
void frame_change(int n_frame);
42-
void preanim_done();
44+
void timer_done();
4345
};
4446

4547
#endif // AOCHARMOVIE_H

aoimage.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,8 @@ void AOImage::set_scaled_image(QString p_image)
5050

5151
QPixmap f_pixmap(final_image_path);
5252

53-
this->setPixmap(f_pixmap.scaled(this->width(), this->height()));
53+
qDebug() << "aoimage width" << this->width();
54+
qDebug() << "aoimage height" << this->height();
55+
56+
this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
5457
}

courtroom.cpp

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
4343
music_player->set_volume(0);
4444
sfx_player = new AOSfxPlayer(this, ao_app);
4545
sfx_player->set_volume(0);
46+
objection_player = new AOSfxPlayer(this, ao_app);
47+
sfx_player->set_volume(0);
4648
blip_player = new AOBlipPlayer(this, ao_app);
4749
blip_player->set_volume(0);
4850

@@ -57,17 +59,18 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
5759
ui_vp_player_char = new AOCharMovie(ui_viewport, ao_app);
5860
ui_vp_desk = new AOScene(ui_viewport, ao_app);
5961
ui_vp_legacy_desk = new AOScene(ui_viewport, ao_app);
60-
ui_vp_chatbox = new AOImage(ui_viewport, ao_app);
62+
ui_vp_testimony = new AOImage(ui_viewport, ao_app);
63+
ui_vp_realization = new AOImage(this, ao_app);
64+
ui_vp_wtce = new AOMovie(ui_viewport, ao_app);
65+
ui_vp_objection = new AOMovie(ui_viewport, ao_app);
66+
67+
ui_vp_chatbox = new AOImage(this, ao_app);
6168
ui_vp_showname = new QLabel(ui_vp_chatbox);
6269
ui_vp_message = new QPlainTextEdit(ui_vp_chatbox);
6370
ui_vp_message->setFrameStyle(QFrame::NoFrame);
6471
ui_vp_message->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
6572
ui_vp_message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
6673
ui_vp_message->setReadOnly(true);
67-
ui_vp_testimony = new AOImage(ui_viewport, ao_app);
68-
ui_vp_realization = new AOImage(this, ao_app);
69-
ui_vp_wtce = new AOMovie(ui_viewport, ao_app);
70-
ui_vp_objection = new AOMovie(ui_viewport, ao_app);
7174

7275
ui_ic_chatlog = new QPlainTextEdit(this);
7376
ui_ic_chatlog->setReadOnly(true);
@@ -378,6 +381,7 @@ void Courtroom::set_widgets()
378381
"color: white;");
379382

380383
set_size_and_pos(ui_vp_message, "message");
384+
ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction);
381385
#if (defined (_WIN32) || defined (_WIN64))
382386
ui_vp_message->setFont(pt_10);
383387
#else
@@ -408,14 +412,14 @@ void Courtroom::set_widgets()
408412
#else
409413
ui_ic_chatlog->setFont(pt_9);
410414
#endif
411-
ui_ic_chatlog->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
412-
"color: white;");
415+
ui_ic_chatlog->setStyleSheet("QPlainTextEdit{ background-color: rgba(0, 0, 0, 0);"
416+
"color: white; }");
413417

414418
set_size_and_pos(ui_ms_chatlog, "ms_chatlog");
415-
ui_ms_chatlog->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
419+
ui_ms_chatlog->setStyleSheet("QPlainTextEdit{ background-color: rgba(0, 0, 0, 0); }");
416420

417421
set_size_and_pos(ui_server_chatlog, "server_chatlog");
418-
ui_server_chatlog->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
422+
ui_server_chatlog->setStyleSheet("QPlainTextEdit{ background-color: rgba(0, 0, 0, 0); }");
419423

420424
set_size_and_pos(ui_mute_list, "mute_list");
421425
ui_mute_list->hide();
@@ -601,6 +605,7 @@ void Courtroom::done_received()
601605

602606
music_player->set_volume(0);
603607
sfx_player->set_volume(0);
608+
objection_player->set_volume(0);
604609
blip_player->set_volume(0);
605610

606611
set_char_select_page();
@@ -747,6 +752,7 @@ void Courtroom::enter_courtroom(int p_cid)
747752

748753
music_player->set_volume(ui_music_slider->value());
749754
sfx_player->set_volume(ui_sfx_slider->value());
755+
objection_player->set_volume(ui_sfx_slider->value());
750756
blip_player->set_volume(ui_blip_slider->value());
751757

752758
testimony_in_progress = false;
@@ -954,7 +960,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
954960
if (mute_map.value(m_chatmessage[CHAR_NAME]))
955961
return;
956962

957-
QString f_showname = ao_app->get_showname(m_chatmessage[CHAR_NAME]);
963+
QString f_showname = ao_app->get_showname(char_list.at(m_chatmessage[CHAR_ID].toInt()).name);
958964

959965
QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n';
960966

@@ -992,20 +998,20 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
992998
{
993999
case 1:
9941000
ui_vp_objection->play("holdit");
995-
sfx_player->play("holdit.wav", m_chatmessage[CHAR_NAME]);
1001+
objection_player->play("holdit.wav", m_chatmessage[CHAR_NAME]);
9961002
break;
9971003
case 2:
9981004
ui_vp_objection->play("objection");
999-
sfx_player->play("objection.wav", m_chatmessage[CHAR_NAME]);
1005+
objection_player->play("objection.wav", m_chatmessage[CHAR_NAME]);
10001006
break;
10011007
case 3:
10021008
ui_vp_objection->play("takethat");
1003-
sfx_player->play("takethat.wav", m_chatmessage[CHAR_NAME]);
1009+
objection_player->play("takethat.wav", m_chatmessage[CHAR_NAME]);
10041010
break;
10051011
//case 4 is AO2 only
10061012
case 4:
10071013
ui_vp_objection->play("custom", m_chatmessage[CHAR_NAME]);
1008-
sfx_player->play("custom.wav", m_chatmessage[CHAR_NAME]);
1014+
objection_player->play("custom.wav", m_chatmessage[CHAR_NAME]);
10091015
break;
10101016
default:
10111017
qDebug() << "W: Logic error in objection switch statement!";
@@ -1030,7 +1036,7 @@ void Courtroom::handle_chatmessage_2()
10301036
ui_vp_speedlines->stop();
10311037
ui_vp_player_char->stop();
10321038

1033-
QString f_showname = ao_app->get_showname(m_chatmessage[CHAR_NAME]);
1039+
QString f_showname = ao_app->get_showname(char_list.at(m_chatmessage[CHAR_ID].toInt()).name);
10341040

10351041
ui_vp_showname->setText(f_showname);
10361042

@@ -1157,14 +1163,15 @@ void Courtroom::play_preanim()
11571163
QString f_char = m_chatmessage[CHAR_NAME];
11581164
QString f_preanim = m_chatmessage[PRE_EMOTE];
11591165

1160-
if (!file_exists(ao_app->get_character_path(f_char) + ".gif"))
1166+
if (!file_exists(ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif"))
11611167
{
11621168
preanim_done();
1169+
qDebug() << "could not find " + ao_app->get_character_path(f_char) + f_preanim + ".gif";
11631170
return;
11641171
}
11651172

11661173
//all time values in char.inis are multiplied by a constant(time_mod) to get the actual time
1167-
int preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim) * time_mod;
1174+
int preanim_duration = ao_app->get_ao2_preanim_duration(f_char, f_preanim) * time_mod;
11681175
int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod;
11691176
int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * time_mod;
11701177

@@ -1720,6 +1727,7 @@ void Courtroom::on_music_slider_moved(int p_value)
17201727
void Courtroom::on_sfx_slider_moved(int p_value)
17211728
{
17221729
sfx_player->set_volume(p_value);
1730+
objection_player->set_volume(p_value);
17231731
ui_ic_chat_message->setFocus();
17241732
}
17251733

@@ -1753,6 +1761,7 @@ void Courtroom::on_change_character_clicked()
17531761
{
17541762
music_player->set_volume(0);
17551763
sfx_player->set_volume(0);
1764+
sfx_player->set_volume(0);
17561765
blip_player->set_volume(0);
17571766

17581767
ui_char_select_background->show();
@@ -1862,4 +1871,6 @@ Courtroom::~Courtroom()
18621871
{
18631872
delete music_player;
18641873
delete sfx_player;
1874+
delete objection_player;
1875+
delete blip_player;
18651876
}

courtroom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ class Courtroom : public QMainWindow
190190

191191
AOMusicPlayer *music_player;
192192
AOSfxPlayer *sfx_player;
193+
AOSfxPlayer *objection_player;
193194
AOBlipPlayer *blip_player;
194195

195196
AOSfxPlayer *modcall_player;

text_file_functions.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ int AOApplication::get_preanim_duration(QString p_char, QString p_emote)
247247
else return f_result.toInt();
248248
}
249249

250+
int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote)
251+
{
252+
QString f_result = read_char_ini(p_char, "%" + p_emote, "[Time]", "[Emotions]");
253+
254+
if (f_result == "")
255+
return 0;
256+
else return f_result.toInt();
257+
}
258+
250259
int AOApplication::get_emote_number(QString p_char)
251260
{
252261
QString f_result = read_char_ini(p_char, "number", "[Emotions]", "[SoundN]");

0 commit comments

Comments
 (0)