From 3b3507df60673079482372b4da08eeabf9317a20 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 19:37:44 +0300 Subject: [PATCH] Fix compilation error Allow realization flashes to be animated images by making them AOMovies Eploit the newly added 'duration' system for realization AOMovie (cherry picked from commit bb98f79083648243216f665852a7d2326af11be0) --- include/courtroom.h | 10 +--------- src/courtroom.cpp | 18 +++--------------- src/text_file_functions.cpp | 2 +- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index e053e23..fe870b4 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -306,9 +306,6 @@ private: //delay before sfx plays QTimer *sfx_delay_timer; - //keeps track of how long realization is visible(it's just a white square and should be visible less than a second) - QTimer *realization_timer; - //every time point in char.inis times this equals the final time const int time_mod = 40; @@ -394,7 +391,7 @@ private: AOImage *ui_vp_chatbox; QLabel *ui_vp_showname; QTextEdit *ui_vp_message; - AOImage *ui_vp_realization; + AOMovie *ui_vp_realization; AOMovie *ui_vp_testimony; AOMovie *ui_vp_wtce; AOMovie *ui_vp_objection; @@ -538,11 +535,6 @@ public slots: void objection_done(); void preanim_done(); - void realization_done(); - - void show_testimony(); - void hide_testimony(); - void mod_called(QString p_ip); void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c82f6f2..5ae71f8 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -55,9 +55,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() sfx_delay_timer = new QTimer(this); sfx_delay_timer->setSingleShot(true); - realization_timer = new QTimer(this); - realization_timer->setSingleShot(true); - music_player = new AOMusicPlayer(this, ao_app); music_player->set_volume(0); @@ -97,7 +94,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_testimony = new AOMovie(this, ao_app); ui_vp_testimony->set_play_once(false); - ui_vp_realization = new AOImage(this, ao_app); + ui_vp_realization = new AOMovie(this, ao_app); ui_vp_wtce = new AOMovie(this, ao_app); ui_vp_objection = new AOMovie(this, ao_app); @@ -273,8 +270,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(chat_tick_timer, SIGNAL(timeout()), this, SLOT(chat_tick())); - connect(realization_timer, SIGNAL(timeout()), this, SLOT(realization_done())); - connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked())); connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); @@ -487,9 +482,7 @@ void Courtroom::set_widgets() ui_vp_testimony->combo_resize(ui_viewport->width(), ui_viewport->height()); ui_vp_realization->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_realization->resize(ui_viewport->width(), ui_viewport->height()); - ui_vp_realization->set_image("realizationflash.png"); - ui_vp_realization->hide(); + ui_vp_realization->combo_resize(ui_viewport->width(), ui_viewport->height()); ui_vp_wtce->move(ui_viewport->x(), ui_viewport->y()); ui_vp_wtce->combo_resize(ui_viewport->width(), ui_viewport->height()); @@ -1972,10 +1965,6 @@ void Courtroom::preanim_done() handle_chatmessage_3(); } -void Courtroom::realization_done() -{ - ui_vp_realization->hide(); -} void Courtroom::start_chat_ticking() { @@ -1985,8 +1974,7 @@ void Courtroom::start_chat_ticking() if (m_chatmessage[REALIZATION] == "1") { - realization_timer->start(60); - ui_vp_realization->show(); + ui_vp_realization->play("realizationflash", "", "", 60); sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 5a34ac8..8f6ee23 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -592,7 +592,7 @@ QString AOApplication::get_custom_realization(QString p_char) if (f_result == "") return get_sfx("realization"); - else return f_result; + else return get_sfx_suffix(f_result); } bool AOApplication::get_blank_blip()