Merge pull request #469 from AttorneyOnline/fix/bg-update

Fix testimony indicator not reappearing, fix objections prematurely adjusting chatbox positioning, and fix background not resizing properly when switching themes
This commit is contained in:
oldmud0 2021-02-14 21:54:55 -06:00 committed by GitHub
commit 005ecca9d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 15 deletions

View File

@ -64,6 +64,9 @@ public:
// Stop the movie, clearing the image
void stop();
// Stop the movie and clear all vectors
void kill();
// Set the m_flipped variable to true/false
void set_flipped(bool p_flipped) { m_flipped = p_flipped; }

View File

@ -493,6 +493,16 @@ void AOLayer::freeze()
preanim_timer->stop();
}
void AOLayer::kill()
{
// used for when we want to ensure a file is loaded anew
this->stop();
this->clear();
movie_frames.clear();
movie_delays.clear();
last_path = "";
}
void CharLayer::movie_ticker()
{
AOLayer::movie_ticker();

View File

@ -1299,6 +1299,8 @@ void Courtroom::set_background(QString p_background, bool display)
ui_vp_objection->stop();
chat_tick_timer->stop();
ui_vp_evidence_display->reset();
ui_vp_background->kill();
ui_vp_desk->kill();
set_scene(
QString::number(ao_app->get_desk_mod(current_char, current_emote)),
current_side);
@ -2197,17 +2199,7 @@ bool Courtroom::handle_objection()
objection_mod = m_chatmessage[OBJECTION_MOD].toInt();
}
if (is_ao2_bg) {
set_size_and_pos(ui_vp_chatbox, "ao2_chatbox", m_chatmessage[CHAR_NAME]);
}
else {
set_size_and_pos(ui_vp_chatbox, "chatbox", m_chatmessage[CHAR_NAME]);
}
set_size_and_pos(ui_vp_showname, "showname", m_chatmessage[CHAR_NAME]);
set_size_and_pos(ui_vp_message, "message", m_chatmessage[CHAR_NAME]);
ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(),
ui_vp_message->y() + ui_vp_chatbox->y());
ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction);
// if an objection is used
if (objection_mod <= 4 && objection_mod >= 1) {
@ -2555,6 +2547,18 @@ void Courtroom::initialize_chatbox()
ui_vp_showname->setText(m_chatmessage[SHOWNAME]);
}
if (is_ao2_bg) {
set_size_and_pos(ui_vp_chatbox, "ao2_chatbox", m_chatmessage[CHAR_NAME]);
}
else {
set_size_and_pos(ui_vp_chatbox, "chatbox", m_chatmessage[CHAR_NAME]);
}
set_size_and_pos(ui_vp_showname, "showname", m_chatmessage[CHAR_NAME]);
set_size_and_pos(ui_vp_message, "message", m_chatmessage[CHAR_NAME]);
ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(),
ui_vp_message->y() + ui_vp_chatbox->y());
ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction);
QString customchar;
if (ao_app->is_customchat_enabled())
customchar = m_chatmessage[CHAR_NAME];
@ -3799,7 +3803,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
if (p_wtce == "testimony1") {
// End testimony indicator
if (variant == 1) {
ui_vp_testimony->stop();
ui_vp_testimony->kill();
return;
}
sfx_name = ao_app->get_court_sfx("witnesstestimony", bg_misc);
@ -3810,7 +3814,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
else if (p_wtce == "testimony2") {
sfx_name = ao_app->get_court_sfx("crossexamination", bg_misc);
filename = "crossexamination";
ui_vp_testimony->stop();
ui_vp_testimony->kill();
}
else {
ui_vp_wtce->set_static_duration(verdict_static_time);
@ -3820,12 +3824,12 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
if (variant == 0) {
sfx_name = ao_app->get_court_sfx("notguilty", bg_misc);
filename = "notguilty";
ui_vp_testimony->stop();
ui_vp_testimony->kill();
}
else if (variant == 1) {
sfx_name = ao_app->get_court_sfx("guilty", bg_misc);
filename = "guilty";
ui_vp_testimony->stop();
ui_vp_testimony->kill();
}
}
// Completely custom WTCE