Fix expanded_desk_mods (2-5) being nonfunctional (#451)
Also fix backgrounds appearing off to the left if they are less wide than the viewport. i am in agony Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
This commit is contained in:
parent
8162783e8b
commit
e6ced65922
@ -73,6 +73,9 @@ public:
|
|||||||
// Move the label itself around
|
// Move the label itself around
|
||||||
void move(int ax, int ay);
|
void move(int ax, int ay);
|
||||||
|
|
||||||
|
// Move the label and center it
|
||||||
|
void move_and_center(int ax, int ay);
|
||||||
|
|
||||||
// This is somewhat pointless now as there's no "QMovie" object to resize, aka
|
// This is somewhat pointless now as there's no "QMovie" object to resize, aka
|
||||||
// no "combo" to speak of
|
// no "combo" to speak of
|
||||||
void combo_resize(int w, int h);
|
void combo_resize(int w, int h);
|
||||||
@ -132,6 +135,8 @@ protected:
|
|||||||
|
|
||||||
// Set the movie's frame to provided pixmap
|
// Set the movie's frame to provided pixmap
|
||||||
void set_frame(QPixmap f_pixmap);
|
void set_frame(QPixmap f_pixmap);
|
||||||
|
// Center the QLabel in the viewport based on the dimensions of f_pixmap
|
||||||
|
void center_pixmap(QPixmap f_pixmap);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done();
|
void done();
|
||||||
|
@ -89,6 +89,10 @@ QPixmap AOLayer::get_pixmap(QImage image)
|
|||||||
void AOLayer::set_frame(QPixmap f_pixmap)
|
void AOLayer::set_frame(QPixmap f_pixmap)
|
||||||
{
|
{
|
||||||
this->setPixmap(f_pixmap);
|
this->setPixmap(f_pixmap);
|
||||||
|
this->center_pixmap(f_pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AOLayer::center_pixmap(QPixmap f_pixmap) {
|
||||||
QLabel::move(
|
QLabel::move(
|
||||||
x + (f_w - f_pixmap.width()) / 2,
|
x + (f_w - f_pixmap.width()) / 2,
|
||||||
y + (f_h - f_pixmap.height())); // Always center horizontally, always put
|
y + (f_h - f_pixmap.height())); // Always center horizontally, always put
|
||||||
@ -118,6 +122,16 @@ void AOLayer::move(int ax, int ay)
|
|||||||
QLabel::move(x, y);
|
QLabel::move(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOLayer::move_and_center(int ax, int ay)
|
||||||
|
{
|
||||||
|
x = ax;
|
||||||
|
y = ay;
|
||||||
|
if (movie_frames.isEmpty()) // safeguard
|
||||||
|
QLabel::move(x,y);
|
||||||
|
else
|
||||||
|
center_pixmap(movie_frames[0]); // just use the first frame since dimensions are all that matter
|
||||||
|
}
|
||||||
|
|
||||||
void BackgroundLayer::load_image(QString p_filename)
|
void BackgroundLayer::load_image(QString p_filename)
|
||||||
{
|
{
|
||||||
play_once = false;
|
play_once = false;
|
||||||
|
@ -532,21 +532,21 @@ void Courtroom::set_widgets()
|
|||||||
// them.
|
// them.
|
||||||
ui_settings->show();
|
ui_settings->show();
|
||||||
|
|
||||||
ui_vp_background->move(0, 0);
|
ui_vp_background->move_and_center(0, 0);
|
||||||
ui_vp_background->combo_resize(ui_viewport->width(), ui_viewport->height());
|
ui_vp_background->combo_resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
ui_vp_speedlines->move(0, 0);
|
ui_vp_speedlines->move_and_center(0, 0);
|
||||||
ui_vp_speedlines->combo_resize(ui_viewport->width(), ui_viewport->height());
|
ui_vp_speedlines->combo_resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
ui_vp_player_char->move(0, 0);
|
ui_vp_player_char->move_and_center(0, 0);
|
||||||
ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height());
|
ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
ui_vp_sideplayer_char->move(0, 0);
|
ui_vp_sideplayer_char->move_and_center(0, 0);
|
||||||
ui_vp_sideplayer_char->combo_resize(ui_viewport->width(),
|
ui_vp_sideplayer_char->combo_resize(ui_viewport->width(),
|
||||||
ui_viewport->height());
|
ui_viewport->height());
|
||||||
|
|
||||||
// the AO2 desk element
|
// the AO2 desk element
|
||||||
ui_vp_desk->move(0, 0);
|
ui_vp_desk->move_and_center(0, 0);
|
||||||
ui_vp_desk->combo_resize(ui_viewport->width(), ui_viewport->height());
|
ui_vp_desk->combo_resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
ui_vp_evidence_display->move(0, 0);
|
ui_vp_evidence_display->move(0, 0);
|
||||||
@ -570,16 +570,16 @@ void Courtroom::set_widgets()
|
|||||||
// thing, which is to parent these to ui_viewport. instead, AOLayer handles
|
// thing, which is to parent these to ui_viewport. instead, AOLayer handles
|
||||||
// masking so we don't overlap parts of the UI, and they become free floating
|
// masking so we don't overlap parts of the UI, and they become free floating
|
||||||
// widgets.
|
// widgets.
|
||||||
ui_vp_testimony->move(ui_viewport->x(), ui_viewport->y());
|
ui_vp_testimony->move_and_center(ui_viewport->x(), ui_viewport->y());
|
||||||
ui_vp_testimony->combo_resize(ui_viewport->width(), ui_viewport->height());
|
ui_vp_testimony->combo_resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
ui_vp_effect->move(ui_viewport->x(), ui_viewport->y());
|
ui_vp_effect->move_and_center(ui_viewport->x(), ui_viewport->y());
|
||||||
ui_vp_effect->combo_resize(ui_viewport->width(), ui_viewport->height());
|
ui_vp_effect->combo_resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
ui_vp_wtce->move(ui_viewport->x(), ui_viewport->y());
|
ui_vp_wtce->move_and_center(ui_viewport->x(), ui_viewport->y());
|
||||||
ui_vp_wtce->combo_resize(ui_viewport->width(), ui_viewport->height());
|
ui_vp_wtce->combo_resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
ui_vp_objection->move(ui_viewport->x(), ui_viewport->y());
|
ui_vp_objection->move_and_center(ui_viewport->x(), ui_viewport->y());
|
||||||
ui_vp_objection->combo_resize(ui_viewport->width(), ui_viewport->height());
|
ui_vp_objection->combo_resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
log_maximum_blocks = ao_app->get_max_log_size();
|
log_maximum_blocks = ao_app->get_max_log_size();
|
||||||
@ -2277,24 +2277,7 @@ void Courtroom::display_character()
|
|||||||
// Hide the face sticker
|
// Hide the face sticker
|
||||||
ui_vp_sticker->stop();
|
ui_vp_sticker->stop();
|
||||||
// Initialize the correct pos (called SIDE here for some reason) with DESK_MOD to determine if we should hide the desk or not.
|
// Initialize the correct pos (called SIDE here for some reason) with DESK_MOD to determine if we should hide the desk or not.
|
||||||
switch(m_chatmessage[DESK_MOD].toInt()) {
|
|
||||||
case 4:
|
|
||||||
set_self_offset(m_chatmessage[SELF_OFFSET]);
|
|
||||||
[[fallthrough]];
|
|
||||||
case 2:
|
|
||||||
set_scene("1", m_chatmessage[SIDE]);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
ui_vp_sideplayer_char->hide();
|
|
||||||
ui_vp_player_char->move(0, 0);
|
|
||||||
[[fallthrough]];
|
|
||||||
case 3:
|
|
||||||
set_scene("0", m_chatmessage[SIDE]);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]);
|
set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arrange the netstrings of the frame SFX for the character to know about
|
// Arrange the netstrings of the frame SFX for the character to know about
|
||||||
if (!m_chatmessage[FRAME_SFX].isEmpty() &&
|
if (!m_chatmessage[FRAME_SFX].isEmpty() &&
|
||||||
@ -2313,16 +2296,8 @@ void Courtroom::display_character()
|
|||||||
ui_vp_player_char->set_flipped(true);
|
ui_vp_player_char->set_flipped(true);
|
||||||
else
|
else
|
||||||
ui_vp_player_char->set_flipped(false);
|
ui_vp_player_char->set_flipped(false);
|
||||||
|
|
||||||
// Parse the character X offset
|
|
||||||
QStringList offsets = m_chatmessage[SELF_OFFSET].split("&");
|
|
||||||
int offset_x = offsets[0].toInt();
|
|
||||||
// Y offset is 0 by default unless we find that the server sent us the Y position as well
|
|
||||||
int offset_y = 0;
|
|
||||||
if (offsets.length() > 1)
|
|
||||||
offset_y = offsets[1].toInt();
|
|
||||||
// Move the character on the viewport according to the offsets
|
// Move the character on the viewport according to the offsets
|
||||||
ui_vp_player_char->move(ui_viewport->width() * offset_x / 100, ui_viewport->height() * offset_y / 100);
|
set_self_offset(m_chatmessage[SELF_OFFSET]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::display_pair_character(QString other_charid, QString other_offset)
|
void Courtroom::display_pair_character(QString other_charid, QString other_offset)
|
||||||
@ -3189,6 +3164,23 @@ void Courtroom::play_preanim(bool immediate)
|
|||||||
ui_vp_player_char->set_play_once(true);
|
ui_vp_player_char->set_play_once(true);
|
||||||
ui_vp_player_char->load_image(f_preanim, f_char, preanim_duration, true);
|
ui_vp_player_char->load_image(f_preanim, f_char, preanim_duration, true);
|
||||||
|
|
||||||
|
switch(m_chatmessage[DESK_MOD].toInt()) {
|
||||||
|
case 4:
|
||||||
|
ui_vp_sideplayer_char->hide();
|
||||||
|
ui_vp_player_char->move_and_center(0, 0);
|
||||||
|
[[fallthrough]];
|
||||||
|
case 2:
|
||||||
|
set_scene("0", m_chatmessage[SIDE]);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
case 3:
|
||||||
|
set_scene("1", m_chatmessage[SIDE]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (immediate)
|
if (immediate)
|
||||||
anim_state = 4;
|
anim_state = 4;
|
||||||
else
|
else
|
||||||
@ -3204,6 +3196,24 @@ void Courtroom::play_preanim(bool immediate)
|
|||||||
void Courtroom::preanim_done()
|
void Courtroom::preanim_done()
|
||||||
{
|
{
|
||||||
anim_state = 1;
|
anim_state = 1;
|
||||||
|
switch(m_chatmessage[DESK_MOD].toInt()) {
|
||||||
|
case 4:
|
||||||
|
set_self_offset(m_chatmessage[SELF_OFFSET]);
|
||||||
|
[[fallthrough]];
|
||||||
|
case 2:
|
||||||
|
set_scene("1", m_chatmessage[SIDE]);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
ui_vp_sideplayer_char->hide();
|
||||||
|
ui_vp_player_char->move_and_center(0, 0);
|
||||||
|
[[fallthrough]];
|
||||||
|
case 3:
|
||||||
|
set_scene("0", m_chatmessage[SIDE]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
qDebug() << "preanim over, anim_state set to 1";
|
qDebug() << "preanim over, anim_state set to 1";
|
||||||
handle_ic_speaking();
|
handle_ic_speaking();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user