From e76a83ddfe8f6fe16ee7e2a91d3ac30e89f80345 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 18:28:08 +0300 Subject: Allow AOMovie to have timers that take priority over the animated image frame count Set it up so feeding the timer value when playing the AOMovie would use the timer but only in cases where a non-animated image is used Update shouts and wtce to pass the 'duration' argument which will be used if the image used is non-animated. Otherwise, prioritize the animated image duration. --- src/courtroom.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index a1714163..14409780 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1350,20 +1350,20 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) switch (objection_mod) { case 1: - ui_vp_objection->play("holdit", f_char, f_custom_theme); + ui_vp_objection->play("holdit", f_char, f_custom_theme, 724); objection_player->play("holdit.wav", f_char, f_custom_theme); break; case 2: - ui_vp_objection->play("objection", f_char, f_custom_theme); + ui_vp_objection->play("objection", f_char, f_custom_theme, 724); objection_player->play("objection.wav", f_char, f_custom_theme); break; case 3: - ui_vp_objection->play("takethat", f_char, f_custom_theme); + ui_vp_objection->play("takethat", f_char, f_custom_theme, 724); objection_player->play("takethat.wav", f_char, f_custom_theme); break; //case 4 is AO2 only case 4: - ui_vp_objection->play("custom", f_char, f_custom_theme); + ui_vp_objection->play("custom", f_char, f_custom_theme, 724); objection_player->play("custom.wav", f_char, f_custom_theme); break; default: @@ -2574,7 +2574,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) if (p_wtce == "testimony1") { sfx_player->play(ao_app->get_sfx("witness_testimony")); - ui_vp_wtce->play("witnesstestimony"); + ui_vp_wtce->play("witnesstestimony", "", "", 1500); testimony_in_progress = true; show_testimony(); } @@ -2582,7 +2582,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) else if (p_wtce == "testimony2") { sfx_player->play(ao_app->get_sfx("cross_examination")); - ui_vp_wtce->play("crossexamination"); + ui_vp_wtce->play("crossexamination", "", "", 1500); testimony_in_progress = false; } else if (p_wtce == "judgeruling") @@ -2590,12 +2590,12 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) if (variant == 0) { sfx_player->play(ao_app->get_sfx("not_guilty")); - ui_vp_wtce->play("notguilty"); + ui_vp_wtce->play("notguilty", "", "", 3000); testimony_in_progress = false; } else if (variant == 1) { sfx_player->play(ao_app->get_sfx("guilty")); - ui_vp_wtce->play("guilty"); + ui_vp_wtce->play("guilty", "", "", 3000); testimony_in_progress = false; } } -- cgit From 5a31516a36e0f13211db807a48214f11ccef827d Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 19:03:42 +0300 Subject: Remove unecessary hard-coded timers for the witness testimony .png Make the witness testimony use AOMovie instead of AOImage Remove pointless "testimony_in_progress" variable CONTROVERSIAL: Make the witness testimony indicator be position-ignorant so as to reduce the amount of hardcoding and allow broader usage of the witness testimony system (For example, Danganronpa investigation indicator, etc.) - This should not affect how the testimony indicator is received currently, as witness testimony usually requires the entire rest of the court to shut up until the cross-examination either way. (cherry picked from commit 932f430b683dffb0b965c32cd2247e2b6361dd0e) --- src/courtroom.cpp | 54 +++++++++--------------------------------------------- 1 file changed, 9 insertions(+), 45 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 14409780..c82f6f2e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -58,12 +58,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() realization_timer = new QTimer(this); realization_timer->setSingleShot(true); - testimony_show_timer = new QTimer(this); - testimony_show_timer->setSingleShot(true); - - testimony_hide_timer = new QTimer(this); - testimony_hide_timer->setSingleShot(true); - music_player = new AOMusicPlayer(this, ao_app); music_player->set_volume(0); @@ -101,7 +95,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); ui_vp_message->setReadOnly(true); - ui_vp_testimony = new AOImage(this, ao_app); + 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_wtce = new AOMovie(this, ao_app); ui_vp_objection = new AOMovie(this, ao_app); @@ -280,9 +275,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(realization_timer, SIGNAL(timeout()), this, SLOT(realization_done())); - connect(testimony_show_timer, SIGNAL(timeout()), this, SLOT(hide_testimony())); - connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony())); - connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked())); connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); @@ -492,9 +484,7 @@ void Courtroom::set_widgets() "color: white"); ui_vp_testimony->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_testimony->resize(ui_viewport->width(), ui_viewport->height()); - ui_vp_testimony->set_image("testimony.png"); - ui_vp_testimony->hide(); + 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()); @@ -824,8 +814,7 @@ void Courtroom::done_received() void Courtroom::set_background(QString p_background) { - testimony_in_progress = false; - + ui_vp_testimony->stop(); current_background = p_background; is_ao2_bg = file_exists(ao_app->get_background_path("defensedesk.png")) && @@ -933,7 +922,7 @@ void Courtroom::enter_courtroom(int p_cid) objection_player->set_volume(ui_sfx_slider->value()); blip_player->set_volume(ui_blip_slider->value()); - testimony_in_progress = false; + ui_vp_testimony->stop(); set_widgets(); @@ -2335,27 +2324,6 @@ void Courtroom::chat_tick() } } - -void Courtroom::show_testimony() -{ - if (!testimony_in_progress || m_chatmessage[SIDE] != "wit") - return; - - ui_vp_testimony->show(); - - testimony_show_timer->start(testimony_show_time); -} - -void Courtroom::hide_testimony() -{ - ui_vp_testimony->hide(); - - if (!testimony_in_progress) - return; - - testimony_hide_timer->start(testimony_hide_time); -} - void Courtroom::play_sfx() { QString sfx_name = m_chatmessage[SFX_NAME]; @@ -2368,9 +2336,6 @@ void Courtroom::play_sfx() void Courtroom::set_scene() { - if (testimony_in_progress) - show_testimony(); - //witness is default if pos is invalid QString f_background = "witnessempty"; QString f_desk_image = "stand"; @@ -2575,15 +2540,14 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) { sfx_player->play(ao_app->get_sfx("witness_testimony")); ui_vp_wtce->play("witnesstestimony", "", "", 1500); - testimony_in_progress = true; - show_testimony(); + ui_vp_testimony->play("testimony"); } //cross examination else if (p_wtce == "testimony2") { sfx_player->play(ao_app->get_sfx("cross_examination")); ui_vp_wtce->play("crossexamination", "", "", 1500); - testimony_in_progress = false; + ui_vp_testimony->stop(); } else if (p_wtce == "judgeruling") { @@ -2591,12 +2555,12 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) { sfx_player->play(ao_app->get_sfx("not_guilty")); ui_vp_wtce->play("notguilty", "", "", 3000); - testimony_in_progress = false; + ui_vp_testimony->stop(); } else if (variant == 1) { sfx_player->play(ao_app->get_sfx("guilty")); ui_vp_wtce->play("guilty", "", "", 3000); - testimony_in_progress = false; + ui_vp_testimony->stop(); } } } -- cgit From 3b3507df60673079482372b4da08eeabf9317a20 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 19:37:44 +0300 Subject: 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) --- src/courtroom.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/courtroom.cpp') diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c82f6f2e..5ae71f8e 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])); } -- cgit