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 932f430b68)
This commit is contained in:
Crystalwarrior 2019-09-12 19:03:42 +03:00
parent e76a83ddfe
commit 5a31516a36
2 changed files with 10 additions and 59 deletions

View File

@ -309,11 +309,6 @@ private:
//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;
//times how long the blinking testimony should be shown(green one in the corner)
QTimer *testimony_show_timer;
//times how long the blinking testimony should be hidden
QTimer *testimony_hide_timer;
//every time point in char.inis times this equals the final time
const int time_mod = 40;
@ -323,14 +318,6 @@ private:
QString previous_ic_message = "";
bool testimony_in_progress = false;
//in milliseconds
const int testimony_show_time = 1500;
//in milliseconds
const int testimony_hide_time = 500;
//char id, muted or not
QMap<int, bool> mute_map;
@ -407,8 +394,8 @@ private:
AOImage *ui_vp_chatbox;
QLabel *ui_vp_showname;
QTextEdit *ui_vp_message;
AOImage *ui_vp_testimony;
AOImage *ui_vp_realization;
AOMovie *ui_vp_testimony;
AOMovie *ui_vp_wtce;
AOMovie *ui_vp_objection;

View File

@ -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();
}
}
}