aboutsummaryrefslogtreecommitdiff
path: root/src/courtroom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/courtroom.cpp')
-rw-r--r--src/courtroom.cpp531
1 files changed, 250 insertions, 281 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index b5f62f5a..bf49fdc1 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1,6 +1,11 @@
#include "courtroom.h"
+
#include "options.h"
+#include <QtConcurrent/QtConcurrent>
+
+// #define DEBUG_TRANSITION
+
Courtroom::Courtroom(AOApplication *p_ao_app)
: QMainWindow()
{
@@ -45,30 +50,29 @@ Courtroom::Courtroom(AOApplication *p_ao_app)
ui_viewport = new QWidget(this);
ui_viewport->setObjectName("ui_viewport");
- ui_vp_background = new BackgroundLayer(ao_app, ui_viewport);
+ ui_vp_background = new kal::BackgroundAnimationLayer(ao_app, ui_viewport);
ui_vp_background->setObjectName("ui_vp_background");
- ui_vp_background->masked = false;
- ui_vp_speedlines = new SplashLayer(ao_app, ui_viewport);
+ ui_vp_speedlines = new kal::SplashAnimationLayer(ao_app, ui_viewport);
ui_vp_speedlines->setObjectName("ui_vp_speedlines");
- ui_vp_speedlines->stretch = true;
- ui_vp_player_char = new CharLayer(ao_app, ui_viewport);
+ ui_vp_speedlines->setStretchToFit(true);
+ ui_vp_player_char = new kal::CharacterAnimationLayer(ao_app, ui_viewport);
ui_vp_player_char->setObjectName("ui_vp_player_char");
- ui_vp_player_char->masked = false;
- ui_vp_sideplayer_char = new CharLayer(ao_app, ui_viewport);
+ ui_vp_sideplayer_char = new kal::CharacterAnimationLayer(ao_app, ui_viewport);
ui_vp_sideplayer_char->setObjectName("ui_vp_sideplayer_char");
- ui_vp_sideplayer_char->masked = false;
ui_vp_sideplayer_char->hide();
- ui_vp_dummy_char = new CharLayer(ao_app, ui_viewport);
- ui_vp_dummy_char->masked = false;
+ ui_vp_dummy_char = new kal::CharacterAnimationLayer(ao_app, ui_viewport);
+ ui_vp_dummy_char->setObjectName("ui_vp_dummy_char");
+ ui_vp_dummy_char->setResetCacheWhenStopped(true);
ui_vp_dummy_char->hide();
- ui_vp_sidedummy_char = new CharLayer(ao_app, ui_viewport);
- ui_vp_sidedummy_char->masked = false;
+ ui_vp_sidedummy_char = new kal::CharacterAnimationLayer(ao_app, ui_viewport);
+ ui_vp_sidedummy_char->setObjectName("ui_vp_sidedummy_char");
+ ui_vp_sidedummy_char->setResetCacheWhenStopped(true);
ui_vp_sidedummy_char->hide();
- ui_vp_desk = new BackgroundLayer(ao_app, ui_viewport);
+ ui_vp_char_list = QList{ui_vp_player_char, ui_vp_sideplayer_char, ui_vp_dummy_char, ui_vp_sidedummy_char};
+ ui_vp_desk = new kal::BackgroundAnimationLayer(ao_app, ui_viewport);
ui_vp_desk->setObjectName("ui_vp_desk");
- ui_vp_desk->masked = false;
- ui_vp_effect = new EffectLayer(ao_app, this);
+ ui_vp_effect = new kal::EffectAnimationLayer(ao_app, this);
ui_vp_effect->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_vp_effect->setObjectName("ui_vp_effect");
@@ -78,18 +82,14 @@ Courtroom::Courtroom(AOApplication *p_ao_app)
ui_vp_chatbox = new AOImage(ao_app, this);
ui_vp_chatbox->setObjectName("ui_vp_chatbox");
- ui_vp_sticker = new StickerLayer(ao_app, this);
- ui_vp_sticker->set_play_once(false);
- ui_vp_sticker->set_cull_image(false);
+ ui_vp_sticker = new kal::StickerAnimationLayer(ao_app, this);
ui_vp_sticker->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_vp_sticker->setObjectName("ui_vp_sticker");
ui_vp_showname = new AOChatboxLabel(ui_vp_chatbox);
ui_vp_showname->setObjectName("ui_vp_showname");
ui_vp_showname->setAlignment(Qt::AlignLeft);
- ui_vp_chat_arrow = new InterfaceLayer(ao_app, this);
- ui_vp_chat_arrow->set_play_once(false);
- ui_vp_chat_arrow->set_cull_image(false);
+ ui_vp_chat_arrow = new kal::InterfaceAnimationLayer(ao_app, this);
ui_vp_chat_arrow->setObjectName("ui_vp_chat_arrow");
ui_vp_message = new QTextEdit(this);
@@ -99,20 +99,15 @@ Courtroom::Courtroom(AOApplication *p_ao_app)
ui_vp_message->setReadOnly(true);
ui_vp_message->setObjectName("ui_vp_message");
- ui_vp_testimony = new SplashLayer(ao_app, this);
- ui_vp_testimony->set_play_once(false);
+ ui_vp_testimony = new kal::SplashAnimationLayer(ao_app, this);
ui_vp_testimony->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_vp_testimony->setObjectName("ui_vp_testimony");
- ui_vp_wtce = new SplashLayer(ao_app, this);
- ui_vp_wtce->set_play_once(true);
- ui_vp_wtce->continuous = false;
- ui_vp_wtce->force_continuous = true;
+ ui_vp_wtce = new kal::SplashAnimationLayer(ao_app, this);
ui_vp_wtce->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_vp_wtce->setObjectName("ui_vp_wtce");
- ui_vp_objection = new SplashLayer(ao_app, this);
- ui_vp_objection->set_play_once(true);
- ui_vp_objection->continuous = false;
- ui_vp_objection->force_continuous = true;
+ ui_vp_wtce->setPlayOnce(true);
+ ui_vp_objection = new kal::SplashAnimationLayer(ao_app, this);
+ ui_vp_objection->setPlayOnce(true);
ui_vp_objection->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_vp_objection->setObjectName("ui_vp_objection");
@@ -159,10 +154,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app)
ui_music_list->setUniformRowHeights(true);
ui_music_list->setObjectName("ui_music_list");
- ui_music_display = new InterfaceLayer(ao_app, this);
- ui_music_display->set_play_once(false);
- ui_music_display->set_cull_image(false);
- ui_music_display->transform_mode = Qt::SmoothTransformation;
+ ui_music_display = new kal::InterfaceAnimationLayer(ao_app, this);
+ ui_music_display->setTransformationMode(Qt::SmoothTransformation);
ui_music_display->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_music_display->setObjectName("ui_music_display");
@@ -419,11 +412,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app)
connect(keepalive_timer, &QTimer::timeout, this, &Courtroom::ping_server);
- connect(ui_vp_objection, &SplashLayer::done, this, &Courtroom::objection_done);
- connect(ui_vp_player_char, &CharLayer::done, this, &Courtroom::preanim_done);
- connect(ui_vp_player_char, &CharLayer::shake, this, &Courtroom::do_screenshake);
- connect(ui_vp_player_char, &CharLayer::flash, this, &Courtroom::do_flash);
- connect(ui_vp_player_char, &CharLayer::play_sfx, this, &Courtroom::play_char_sfx);
+ connect(ui_vp_objection, &kal::SplashAnimationLayer::finishedPlayback, this, &Courtroom::objection_done);
+ connect(ui_vp_player_char, &kal::CharacterAnimationLayer::finishedPreOrPostEmotePlayback, this, &Courtroom::preanim_done);
+ connect(ui_vp_player_char, &kal::CharacterAnimationLayer::shakeEffect, this, &Courtroom::do_screenshake);
+ connect(ui_vp_player_char, &kal::CharacterAnimationLayer::flashEffect, this, &Courtroom::do_flash);
+ connect(ui_vp_player_char, &kal::CharacterAnimationLayer::soundEffect, this, &Courtroom::play_char_sfx);
connect(text_delay_timer, &QTimer::timeout, this, &Courtroom::start_chat_ticking);
@@ -521,7 +514,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app)
connect(ui_vp_evidence_display, &AOEvidenceDisplay::show_evidence_details, this, &Courtroom::show_evidence);
- connect(transition_animation_group, &QParallelAnimationGroup::finished, this, &Courtroom::on_transition_finish);
+ connect(transition_animation_group, &QParallelAnimationGroup::finished, this, &Courtroom::post_transition_cleanup);
set_widgets();
@@ -763,29 +756,29 @@ void Courtroom::set_widgets()
ui_settings->show();
// make the BG's reload
- ui_vp_background->kill();
- ui_vp_desk->kill();
+ ui_vp_background->restartPlayback();
+ ui_vp_desk->restartPlayback();
- ui_vp_background->move_and_center(0, 0);
- ui_vp_background->combo_resize(ui_viewport->width(), ui_viewport->height());
+ ui_vp_background->move(0, 0);
+ ui_vp_background->resize(ui_viewport->width(), ui_viewport->height());
- ui_vp_speedlines->move_and_center(0, 0);
- ui_vp_speedlines->combo_resize(ui_viewport->width(), ui_viewport->height());
+ ui_vp_speedlines->move(0, 0);
+ ui_vp_speedlines->resize(ui_viewport->width(), ui_viewport->height());
- 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->move(0, 0);
+ ui_vp_player_char->resize(ui_viewport->width(), ui_viewport->height());
- ui_vp_sideplayer_char->move_and_center(0, 0);
- ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), ui_viewport->height());
+ ui_vp_sideplayer_char->move(0, 0);
+ ui_vp_sideplayer_char->resize(ui_viewport->width(), ui_viewport->height());
- ui_vp_dummy_char->move_and_center(0, 0);
- ui_vp_dummy_char->combo_resize(ui_viewport->width(), ui_viewport->height());
- ui_vp_sidedummy_char->move_and_center(0, 0);
- ui_vp_sidedummy_char->combo_resize(ui_viewport->width(), ui_viewport->height());
+ ui_vp_dummy_char->move(0, 0);
+ ui_vp_dummy_char->resize(ui_viewport->width(), ui_viewport->height());
+ ui_vp_sidedummy_char->move(0, 0);
+ ui_vp_sidedummy_char->resize(ui_viewport->width(), ui_viewport->height());
// the AO2 desk element
- ui_vp_desk->move_and_center(0, 0);
- ui_vp_desk->combo_resize(ui_viewport->width(), ui_viewport->height());
+ ui_vp_desk->move(0, 0);
+ ui_vp_desk->resize(ui_viewport->width(), ui_viewport->height());
ui_vp_evidence_display->move(0, 0);
ui_vp_evidence_display->combo_resize(ui_viewport->width(), ui_viewport->height());
@@ -794,17 +787,17 @@ void Courtroom::set_widgets()
// 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
// widgets.
- 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->move(ui_viewport->x(), ui_viewport->y());
+ ui_vp_testimony->resize(ui_viewport->width(), ui_viewport->height());
- 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->move(ui_viewport->x(), ui_viewport->y());
+ ui_vp_effect->resize(ui_viewport->width(), ui_viewport->height());
- 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->move(ui_viewport->x(), ui_viewport->y());
+ ui_vp_wtce->resize(ui_viewport->width(), ui_viewport->height());
- 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->move(ui_viewport->x(), ui_viewport->y());
+ ui_vp_objection->resize(ui_viewport->width(), ui_viewport->height());
log_maximum_blocks = Options::getInstance().maxLogSize();
@@ -888,9 +881,9 @@ void Courtroom::set_widgets()
else
{
ui_music_display->move(design_ini_result.x, design_ini_result.y);
- ui_music_display->combo_resize(design_ini_result.width, design_ini_result.height);
+ ui_music_display->resize(design_ini_result.width, design_ini_result.height);
}
- ui_music_display->load_image("music_display", "");
+ ui_music_display->loadAndPlayAnimation("music_display", "");
for (int i = 0; i < max_clocks; i++)
{
@@ -902,7 +895,7 @@ void Courtroom::set_widgets()
initialize_chatbox();
ui_vp_sticker->move(ui_viewport->x(), ui_viewport->y());
- ui_vp_sticker->combo_resize(ui_viewport->width(), ui_viewport->height());
+ ui_vp_sticker->resize(ui_viewport->width(), ui_viewport->height());
ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height());
ui_muted->setImage("muted");
@@ -1390,7 +1383,7 @@ void Courtroom::done_received()
void Courtroom::set_background(QString p_background, bool display)
{
- ui_vp_testimony->stop();
+ ui_vp_testimony->stopPlayback();
current_background = p_background;
// welcome to hardcode central may I take your order of regularly scheduled
@@ -1440,21 +1433,20 @@ void Courtroom::set_background(QString p_background, bool display)
if (display)
{
ui_vp_speedlines->hide();
- ui_vp_player_char->stop();
-
- ui_vp_sideplayer_char->stop();
- ui_vp_effect->stop();
+ ui_vp_player_char->stopPlayback();
+ ui_vp_sideplayer_char->stopPlayback();
+ ui_vp_effect->stopPlayback();
ui_vp_message->hide();
ui_vp_chatbox->setVisible(chatbox_always_show);
// Show it if chatbox always shows
if (Options::getInstance().characterStickerEnabled() && chatbox_always_show)
{
- ui_vp_sticker->load_image(m_chatmessage[CHAR_NAME]);
+ ui_vp_sticker->loadAndPlayAnimation(m_chatmessage[CHAR_NAME]);
}
// Hide the face sticker
else
{
- ui_vp_sticker->stop();
+ ui_vp_sticker->stopPlayback();
}
// Stop the chat arrow from animating
ui_vp_chat_arrow->hide();
@@ -1465,7 +1457,7 @@ void Courtroom::set_background(QString p_background, bool display)
text_state = 2;
anim_state = 3;
- ui_vp_objection->stop();
+ ui_vp_objection->stopPlayback();
chat_tick_timer->stop();
ui_vp_evidence_display->reset();
QString f_side = current_side;
@@ -1730,7 +1722,7 @@ void Courtroom::enter_courtroom()
// Update the audio sliders
update_audio_volume();
- ui_vp_testimony->stop();
+ ui_vp_testimony->stopPlayback();
// ui_server_chatlog->setHtml(ui_server_chatlog->toHtml());
}
@@ -1894,6 +1886,9 @@ void Courtroom::list_areas()
void Courtroom::debug_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
+#ifdef QT_DEBUG
+ return;
+#endif
Q_UNUSED(context);
const QMap<QtMsgType, QString> colors = {{QtDebugMsg, "debug"}, {QtInfoMsg, "info"}, {QtWarningMsg, "warn"}, {QtCriticalMsg, "critical"}, {QtFatalMsg, "fatal"}};
const QString color_id = QString("debug_log_%1_color").arg(colors.value(type, "info"));
@@ -2312,8 +2307,9 @@ void Courtroom::on_chat_return_pressed()
if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::CUSTOM_BLIPS))
{
packet_contents.append(ao_app->get_blipname(current_char, current_emote));
+
+ packet_contents.append(ui_slide_enable->isChecked() ? "1" : "0"); // just let the server figure out what to do with this
}
- packet_contents.append(ui_slide_enable->isChecked() ? "1" : "0"); // just let the server figure out what to do with this
ao_app->send_server_packet(AOPacket("MS", packet_contents));
}
@@ -2473,6 +2469,8 @@ void Courtroom::unpack_chatmessage(QStringList p_contents)
{
for (int n_string = 0; n_string < MS_MAXIMUM; ++n_string)
{
+ m_previous_chatmessage[n_string] = m_chatmessage[n_string];
+
// Note that we have added stuff that vanilla clients and servers simply
// won't send. So now, we have to check if the thing we want even exists
// amongst the packet's content. We also have to check if the server even
@@ -2502,7 +2500,7 @@ void Courtroom::unpack_chatmessage(QStringList p_contents)
text_state = 0;
anim_state = 0;
evidence_presented = false;
- ui_vp_objection->stop();
+ ui_vp_objection->stopPlayback();
chat_tick_timer->stop();
ui_vp_evidence_display->reset();
// This chat msg is not objection so we're not waiting on the objection animation to finish to display the character.
@@ -2699,8 +2697,7 @@ bool Courtroom::handle_objection()
ui_vp_message->setVisible(chatbox_always_show);
ui_vp_chat_arrow->setVisible(chatbox_always_show);
ui_vp_showname->setVisible(chatbox_always_show);
- ui_vp_objection->set_static_duration(shout_static_time);
- ui_vp_objection->set_max_duration(shout_max_time);
+ ui_vp_objection->setMaximumDurationPerFrame(shout_max_time);
QString filename;
switch (objection_mod)
{
@@ -2731,9 +2728,9 @@ bool Courtroom::handle_objection()
break;
m_chatmessage[EMOTE_MOD] = QChar(PREANIM);
}
- ui_vp_objection->load_image(filename, m_chatmessage[CHAR_NAME], ao_app->get_chat(m_chatmessage[CHAR_NAME]));
+ ui_vp_objection->loadAndPlayAnimation(filename, m_chatmessage[CHAR_NAME], ao_app->get_chat(m_chatmessage[CHAR_NAME]));
sfx_player->stopAll(); // Objection played! Cut all sfx.
- ui_vp_player_char->set_play_once(true);
+ ui_vp_player_char->setPlayOnce(true);
return true;
}
if (m_chatmessage[EMOTE] != "")
@@ -2747,8 +2744,8 @@ void Courtroom::display_character()
{
// Stop all previously playing animations, effects etc.
ui_vp_speedlines->hide();
- ui_vp_player_char->stop();
- ui_vp_effect->stop();
+ ui_vp_player_char->stopPlayback();
+ ui_vp_effect->stopPlayback();
// Clear all looping sfx to prevent obnoxiousness
sfx_player->stopAllLoopingStream();
// Hide the message and chatbox and handle the emotes
@@ -2757,12 +2754,12 @@ void Courtroom::display_character()
// Show it if chatbox always shows
if (Options::getInstance().characterStickerEnabled() && chatbox_always_show)
{
- ui_vp_sticker->load_image(m_chatmessage[CHAR_NAME]);
+ ui_vp_sticker->loadAndPlayAnimation(m_chatmessage[CHAR_NAME]);
}
// Hide the face sticker
else
{
- ui_vp_sticker->stop();
+ ui_vp_sticker->stopPlayback();
}
// Arrange the netstrings of the frame SFX for the character to know about
@@ -2770,15 +2767,15 @@ void Courtroom::display_character()
{
// ORDER IS IMPORTANT!!
QStringList netstrings = {m_chatmessage[FRAME_SCREENSHAKE], m_chatmessage[FRAME_REALIZATION], m_chatmessage[FRAME_SFX]};
- ui_vp_player_char->set_network_string(netstrings);
+ ui_vp_player_char->setFrameEffects(netstrings);
}
else
{
- ui_vp_player_char->set_network_string(QStringList());
+ ui_vp_player_char->setFrameEffects(QStringList());
}
// Determine if we should flip the character or not
- ui_vp_player_char->set_flipped(m_chatmessage[FLIP].toInt() == 1);
+ ui_vp_player_char->setFlipped(m_chatmessage[FLIP].toInt() == 1);
}
void Courtroom::display_pair_character(QString other_charid, QString other_offset)
@@ -2833,20 +2830,22 @@ void Courtroom::display_pair_character(QString other_charid, QString other_offse
break;
}
}
+
+ // Play the other pair character's idle animation
+ ui_vp_sideplayer_char->loadCharacterEmote(m_chatmessage[OTHER_NAME], m_chatmessage[OTHER_EMOTE], kal::CharacterAnimationLayer::IdleEmote);
+ ui_vp_sideplayer_char->setPlayOnce(false);
+
// Flip the pair character
if (ao_app->m_serverdata.get_feature(server::BASE_FEATURE_SET::FLIPPING) && m_chatmessage[OTHER_FLIP].toInt() == 1)
{
- ui_vp_sideplayer_char->set_flipped(true);
+ ui_vp_sideplayer_char->setFlipped(true);
}
else
{
- ui_vp_sideplayer_char->set_flipped(false);
+ ui_vp_sideplayer_char->setFlipped(false);
}
- // Play the other pair character's idle animation
- QString filename = "(a)" + m_chatmessage[OTHER_EMOTE];
- ui_vp_sideplayer_char->set_play_once(false);
- ui_vp_sideplayer_char->load_image(filename, m_chatmessage[OTHER_NAME], 0, false);
+ ui_vp_sideplayer_char->startPlayback();
}
}
}
@@ -2973,33 +2972,35 @@ void Courtroom::do_screenshake()
screenshake_animation_group->start();
}
-void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_pos)
+void Courtroom::do_transition(QString p_desk_mod, QString oldPosId, QString newPosId)
{
if (m_chatmessage[EMOTE] != "")
+ {
display_character();
+ }
const QStringList legacy_pos = {"def", "wit", "pro"};
- QString t_old_pos = old_pos;
- QString t_new_pos = new_pos;
+ QString t_old_pos = oldPosId;
+ QString t_new_pos = newPosId;
if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path("court"))))
{
- if (legacy_pos.contains(old_pos))
+ if (legacy_pos.contains(oldPosId))
{
- t_old_pos = "court:" + old_pos;
+ t_old_pos = "court:" + oldPosId;
}
- if (legacy_pos.contains(new_pos))
+ if (legacy_pos.contains(newPosId))
{
- t_new_pos = "court:" + new_pos;
+ t_new_pos = "court:" + newPosId;
}
}
- QPair<QString, int> old_pos_pair = ao_app->get_pos_path(t_old_pos);
- QPair<QString, int> new_pos_pair = ao_app->get_pos_path(t_new_pos);
+ QPair<QString, QRect> old_pos_pair = ao_app->get_pos_path(t_old_pos);
+ QPair<QString, QRect> new_pos_pair = ao_app->get_pos_path(t_new_pos);
int duration = ao_app->get_pos_transition_duration(t_old_pos, t_new_pos);
// conditions to stop slide
- if (old_pos == new_pos || old_pos_pair.first != new_pos_pair.first || new_pos_pair.second == -1 || !Options::getInstance().slidesEnabled() || m_chatmessage[SLIDE] != "1" || duration == -1 || m_chatmessage[EMOTE_MOD].toInt() == ZOOM || m_chatmessage[EMOTE_MOD].toInt() == PREANIM_ZOOM)
+ if (oldPosId == newPosId || old_pos_pair.first != new_pos_pair.first || !new_pos_pair.second.isValid() || !Options::getInstance().slidesEnabled() || m_chatmessage[SLIDE] != "1" || duration == -1 || m_chatmessage[EMOTE_MOD].toInt() == ZOOM || m_chatmessage[EMOTE_MOD].toInt() == PREANIM_ZOOM)
{
#ifdef DEBUG_TRANSITION
qDebug() << "skipping transition - not applicable";
@@ -3016,130 +3017,105 @@ void Courtroom::do_transition(QString p_desk_mod, QString old_pos, QString new_p
qDebug() << "STARTING TRANSITION, CURRENT TIME:" << transition_animation_group->currentTime();
#endif
- set_scene(p_desk_mod.toInt(), old_pos);
-
- QList<AOLayer *> affected_list = {ui_vp_background, ui_vp_desk, ui_vp_player_char};
-
- bool paired = false;
- if (!ui_vp_sideplayer_char->isHidden())
- {
- affected_list.append(ui_vp_sideplayer_char);
- paired = true;
- }
-
- // Set up the background, desk, and player objects' animations
+ set_scene(p_desk_mod.toInt(), oldPosId);
- float scaling_factor = ui_vp_background->get_scaling_factor();
- int offset = (float(old_pos_pair.second) * scaling_factor) - (float(new_pos_pair.second) * scaling_factor);
+ int viewport_width = ui_viewport->width();
+ int viewport_height = ui_viewport->height();
+ double scale = double(viewport_height) / double(ui_vp_background->frameSize().height());
+ QPoint scaled_old_pos = QPoint(old_pos_pair.second.x() * scale, 0);
+ QPoint scaled_new_pos = QPoint(new_pos_pair.second.x() * scale, 0);
- for (AOLayer *ui_element : affected_list)
+ QList<kal::AnimationLayer *> affected_list = {ui_vp_background, ui_vp_desk};
+ for (kal::AnimationLayer *ui_element : affected_list)
{
QPropertyAnimation *transition_animation = new QPropertyAnimation(ui_element, "pos", this);
- transition_animation->setStartValue(ui_element->pos());
transition_animation->setDuration(duration);
- transition_animation->setEndValue(QPoint(ui_element->pos().x() + offset, ui_element->pos().y()));
transition_animation->setEasingCurve(QEasingCurve::InOutCubic);
+ transition_animation->setStartValue(QPoint(-scaled_old_pos.x(), 0));
+ transition_animation->setEndValue(QPoint(-scaled_new_pos.x(), 0));
transition_animation_group->addAnimation(transition_animation);
}
- // Setting up the dummy characters to work for us as our stand-in for the next characters
- // This should be easy. But it isn't
-
- QString slide_emote;
- if (m_chatmessage[OBJECTION_MOD].contains("4") || m_chatmessage[OBJECTION_MOD].toInt() == 2)
- {
- slide_emote = "(a)" + ao_app->read_char_ini(m_chatmessage[CHAR_NAME], "objection_pose", "Options");
- if (slide_emote == "(a)")
+ auto calculate_offset_and_setup_layer = [&, this](kal::CharacterAnimationLayer *layer, QPoint newPos, QString rawOffset) {
+ QPoint offset;
+ QStringList offset_data = rawOffset.split(",");
+ offset.setX(viewport_width * offset_data.at(0).toInt() * 0.01);
+ if (offset_data.size() > 1)
{
- slide_emote = "(a)" + m_chatmessage[EMOTE];
+ offset.setY(viewport_height * offset_data.at(1).toInt() * 0.01);
}
- }
- else
- slide_emote = "(a)" + m_chatmessage[EMOTE];
- QString other_slide_emote = "(a)" + m_chatmessage[OTHER_EMOTE];
+ layer->setParent(ui_vp_background);
+ layer->setPlayOnce(false);
+ layer->pausePlayback(true);
+ layer->startPlayback();
+ layer->move(newPos);
+ layer->show();
+ };
- // Load the image we're going to use to get scaling information, and move it into the final position for animation data
- ui_vp_dummy_char->set_flipped(m_chatmessage[FLIP].toInt());
- ui_vp_dummy_char->load_image(slide_emote, m_chatmessage[CHAR_NAME], 0, false);
- set_self_offset(m_chatmessage[SELF_OFFSET], ui_vp_dummy_char);
+ ui_vp_player_char->loadCharacterEmote(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE], kal::CharacterAnimationLayer::IdleEmote);
+ ui_vp_player_char->setFlipped(m_chatmessage[FLIP].toInt() == 1);
+ calculate_offset_and_setup_layer(ui_vp_player_char, scaled_new_pos, m_chatmessage[SELF_OFFSET]);
- QPoint starting_position = QPoint(ui_vp_player_char->pos().x() - offset, ui_vp_player_char->pos().y());
- QPropertyAnimation *ui_vp_dummy_animation = new QPropertyAnimation(ui_vp_dummy_char, "pos", this);
-
- ui_vp_dummy_animation->setDuration(duration);
- ui_vp_dummy_animation->setStartValue(starting_position);
- ui_vp_dummy_animation->setEndValue(ui_vp_dummy_char->pos());
- ui_vp_dummy_animation->setEasingCurve(QEasingCurve::InOutCubic);
- transition_animation_group->addAnimation(ui_vp_dummy_animation);
-
- ui_vp_dummy_char->move(starting_position.x(), starting_position.y());
-
- // If the new message is paired, do it all again for the pair character. Yippee!
- if (m_chatmessage[OTHER_CHARID].toInt() != -1 && !m_chatmessage[OTHER_NAME].isEmpty())
+ auto is_pairing = [](QString *data) {
+ return (data[OTHER_CHARID].toInt() != -1 && !data[OTHER_NAME].isEmpty());
+ };
+ auto is_pair_under = [](QString data) -> bool {
+ QStringList pair_data = data.split("^");
+ return (pair_data.size() > 1) ? (pair_data.at(1).toInt() == 1) : false;
+ };
+ if (is_pairing(m_chatmessage))
{
- ui_vp_sidedummy_char->set_flipped(m_chatmessage[OTHER_FLIP].toInt());
- ui_vp_sidedummy_char->load_image(other_slide_emote, m_chatmessage[OTHER_NAME], 0, false);
- set_self_offset(m_chatmessage[OTHER_OFFSET], ui_vp_sidedummy_char);
- QStringList args = m_chatmessage[OTHER_CHARID].split("^");
- if (args.size() > 1)
+ ui_vp_sideplayer_char->loadCharacterEmote(m_chatmessage[OTHER_NAME], m_chatmessage[OTHER_EMOTE], kal::CharacterAnimationLayer::IdleEmote);
+ calculate_offset_and_setup_layer(ui_vp_sideplayer_char, scaled_new_pos, m_chatmessage[OTHER_OFFSET]);
+ if (is_pair_under(m_chatmessage[OTHER_CHARID]))
{
- // Change the order of appearance based on the pair order variable
- int order = args.at(1).toInt();
- switch (order)
- {
- case 0: // Our character is in front
- ui_vp_sidedummy_char->stackUnder(ui_vp_dummy_char);
- break;
- case 1: // Our character is behind
- ui_vp_dummy_char->stackUnder(ui_vp_sidedummy_char);
- break;
- default:
- break;
- }
+ ui_vp_player_char->stackUnder(ui_vp_sideplayer_char);
}
+ else
+ {
+ ui_vp_sideplayer_char->stackUnder(ui_vp_player_char);
+ }
+ }
- QPoint other_starting_position = QPoint(ui_vp_sideplayer_char->pos().x() - offset, ui_vp_sideplayer_char->pos().y());
- QPropertyAnimation *ui_vp_sidedummy_animation = new QPropertyAnimation(ui_vp_sidedummy_char, "pos", this);
-
- ui_vp_sidedummy_animation->setDuration(duration);
- ui_vp_sidedummy_animation->setStartValue(starting_position);
- ui_vp_sidedummy_animation->setEndValue(ui_vp_sidedummy_char->pos());
- ui_vp_sidedummy_animation->setEasingCurve(QEasingCurve::InOutCubic);
- transition_animation_group->addAnimation(ui_vp_sidedummy_animation);
+ ui_vp_dummy_char->loadCharacterEmote(m_previous_chatmessage[CHAR_NAME], m_previous_chatmessage[EMOTE], kal::CharacterAnimationLayer::IdleEmote);
+ ui_vp_dummy_char->setFlipped(m_previous_chatmessage[FLIP].toInt() == 1);
+ calculate_offset_and_setup_layer(ui_vp_dummy_char, scaled_old_pos, m_previous_chatmessage[SELF_OFFSET]);
- ui_vp_sidedummy_char->move(starting_position.x(), starting_position.y());
- }
- else
+ if (is_pairing(m_previous_chatmessage))
{
- ui_vp_sidedummy_char->stop();
+ ui_vp_sidedummy_char->loadCharacterEmote(m_previous_chatmessage[OTHER_NAME], m_previous_chatmessage[OTHER_EMOTE], kal::CharacterAnimationLayer::IdleEmote);
+ ui_vp_sidedummy_char->setFlipped(m_previous_chatmessage[OTHER_FLIP].toInt() == 1);
+ calculate_offset_and_setup_layer(ui_vp_sidedummy_char, scaled_old_pos, m_previous_chatmessage[OTHER_OFFSET]);
+ if (is_pair_under(m_previous_chatmessage[OTHER_CHARID]))
+ {
+ ui_vp_dummy_char->stackUnder(ui_vp_sidedummy_char);
+ }
+ else
+ {
+ ui_vp_sidedummy_char->stackUnder(ui_vp_dummy_char);
+ }
}
- ui_vp_player_char->freeze();
- ui_vp_player_char->show();
- if (paired)
- {
- ui_vp_sideplayer_char->freeze();
- ui_vp_sideplayer_char->show();
- }
- else
- {
- ui_vp_sideplayer_char->stop();
- }
- ui_vp_dummy_char->freeze();
- ui_vp_sidedummy_char->freeze();
- QTimer::singleShot(TRANSITION_BOOKEND_DELAY, transition_animation_group, SLOT(start()));
+ transition_animation_group->start();
}
-void Courtroom::on_transition_finish()
+void Courtroom::post_transition_cleanup()
{
transition_animation_group->clear();
- transition_animation_group->setCurrentTime(0);
- QTimer::singleShot(TRANSITION_BOOKEND_DELAY, this, SLOT(post_transition_cleanup()));
-}
-void Courtroom::post_transition_cleanup()
-{
+ for (kal::CharacterAnimationLayer *layer : qAsConst(ui_vp_char_list))
+ {
+ bool is_visible = layer->isVisible();
+ layer->stopPlayback();
+ layer->pausePlayback(false);
+ layer->setParent(ui_viewport);
+ layer->setVisible(is_visible);
+ }
+
+ ui_vp_dummy_char->hide();
+ ui_vp_sidedummy_char->hide();
+
set_scene(m_chatmessage[DESK_MOD].toInt(), m_chatmessage[SIDE]);
// Move the character on the viewport according to the offsets
@@ -3148,10 +3124,6 @@ void Courtroom::post_transition_cleanup()
int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
bool immediate = m_chatmessage[IMMEDIATE].toInt() == 1;
- // Reset the pair character
- ui_vp_sideplayer_char->stop();
- ui_vp_sideplayer_char->move_and_center(0, 0);
-
// If the emote_mod is not zooming
if (emote_mod != ZOOM && emote_rows != PREANIM_ZOOM)
{
@@ -3159,12 +3131,6 @@ void Courtroom::post_transition_cleanup()
display_pair_character(m_chatmessage[OTHER_CHARID], m_chatmessage[OTHER_OFFSET]);
}
- // Reset tweedle dee and tweedle dummy
- ui_vp_dummy_char->stop();
- ui_vp_dummy_char->move_and_center(0, 0);
- ui_vp_sidedummy_char->stop();
- ui_vp_sidedummy_char->move_and_center(0, 0);
-
// Parse the emote_mod part of the chat message
handle_emote_mod(emote_mod, immediate);
}
@@ -3203,11 +3169,11 @@ void Courtroom::do_effect(QString fx_path, QString fx_sound, QString p_char, QSt
{
return;
}
- ui_vp_effect->transform_mode = ao_app->get_scaling(ao_app->get_effect_property(fx_path, p_char, p_folder, "scaling"));
- ui_vp_effect->stretch = ao_app->get_effect_property(fx_path, p_char, p_folder, "stretch").startsWith("true");
- ui_vp_effect->set_flipped(ao_app->get_effect_property(fx_path, p_char, p_folder, "respect_flip").startsWith("true") && m_chatmessage[FLIP].toInt() == 1);
- ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping.
- // Static effects will linger.
+ ui_vp_effect->setTransformationMode(ao_app->get_scaling(ao_app->get_effect_property(fx_path, p_char, p_folder, "scaling")));
+ ui_vp_effect->setStretchToFit(ao_app->get_effect_property(fx_path, p_char, p_folder, "stretch").startsWith("true"));
+ ui_vp_effect->setFlipped(ao_app->get_effect_property(fx_path, p_char, p_folder, "respect_flip").startsWith("true") && m_chatmessage[FLIP].toInt() == 1);
+ ui_vp_effect->setPlayOnce(false); // The effects themselves dictate whether or not they're looping.
+ // Static effects will linger.
bool looping = ao_app->get_effect_property(fx_path, p_char, p_folder, "loop").startsWith("true");
@@ -3269,10 +3235,9 @@ void Courtroom::do_effect(QString fx_path, QString fx_sound, QString p_char, QSt
}
ui_vp_effect->move(effect_x, effect_y);
- ui_vp_effect->set_static_duration(max_duration);
- ui_vp_effect->set_max_duration(max_duration);
- ui_vp_effect->load_image(effect, looping);
- ui_vp_effect->set_cull_image(cull);
+ ui_vp_effect->setMaximumDurationPerFrame(max_duration);
+ ui_vp_effect->loadAndPlayAnimation(effect, looping);
+ ui_vp_effect->setHideWhenStopped(cull);
}
void Courtroom::play_char_sfx(QString sfx_name)
@@ -3384,7 +3349,7 @@ void Courtroom::initialize_chatbox()
else
{
ui_vp_chat_arrow->move(design_ini_result.x + ui_vp_chatbox->x(), design_ini_result.y + ui_vp_chatbox->y());
- ui_vp_chat_arrow->combo_resize(design_ini_result.width, design_ini_result.height);
+ ui_vp_chat_arrow->resize(design_ini_result.width, design_ini_result.height);
}
QString font_name;
@@ -3464,8 +3429,8 @@ void Courtroom::handle_ic_speaking()
// We're zooming, so hide the pair character and ignore pair offsets. This ain't about them.
ui_vp_sideplayer_char->hide();
- ui_vp_player_char->move_and_center(0, 0);
- ui_vp_speedlines->load_image(filename, m_chatmessage[CHAR_NAME], ao_app->get_chat(m_chatmessage[CHAR_NAME]));
+ ui_vp_player_char->move(0, 0);
+ ui_vp_speedlines->loadAndPlayAnimation(filename, m_chatmessage[CHAR_NAME], ao_app->get_chat(m_chatmessage[CHAR_NAME]));
}
// Check if this is a talking color (white text, etc.)
@@ -3474,23 +3439,22 @@ void Courtroom::handle_ic_speaking()
// If color is talking, and our state isn't already talking
if (color_is_talking && text_state == 1 && anim_state < 2)
{
- // Stop the previous animation and play the talking animation
- ui_vp_player_char->stop();
- ui_vp_player_char->set_play_once(false);
- filename = "(b)" + m_chatmessage[EMOTE];
- ui_vp_player_char->load_image(filename, m_chatmessage[CHAR_NAME], 0, false);
- // Set the anim state accordingly
+ // Play the talking animation
anim_state = 2;
+ filename = m_chatmessage[EMOTE];
+ ui_vp_player_char->loadCharacterEmote(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE], kal::CharacterAnimationLayer::TalkEmote);
+ ui_vp_player_char->setPlayOnce(false);
+ ui_vp_player_char->startPlayback();
+ // Set the anim state accordingly
}
else if (anim_state < 3 && anim_state != 3) // Set it to idle as we're not on that already
{
- // Stop the previous animation and play the idle animation
- ui_vp_player_char->stop();
- ui_vp_player_char->set_play_once(false);
- filename = "(a)" + m_chatmessage[EMOTE];
- ui_vp_player_char->load_image(filename, m_chatmessage[CHAR_NAME], 0, false);
- // Set the anim state accordingly
+ // Play the idle animation
anim_state = 3;
+ filename = m_chatmessage[EMOTE];
+ ui_vp_player_char->loadCharacterEmote(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE], kal::CharacterAnimationLayer::IdleEmote);
+ ui_vp_player_char->setPlayOnce(false);
+ ui_vp_player_char->startPlayback();
}
// Begin parsing through the chatbox message
@@ -4025,15 +3989,16 @@ void Courtroom::play_preanim(bool immediate)
qWarning() << "could not find preanim" << f_preanim << "for character" << f_char;
return;
}
- ui_vp_player_char->set_static_duration(preanim_duration);
- 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->loadCharacterEmote(f_char, f_preanim, kal::CharacterAnimationLayer::PreEmote, preanim_duration);
+ ui_vp_player_char->setPlayOnce(true);
+ ui_vp_player_char->startPlayback();
switch (m_chatmessage[DESK_MOD].toInt())
{
case DESK_EMOTE_ONLY_EX:
ui_vp_sideplayer_char->hide();
- ui_vp_player_char->move_and_center(0, 0);
+ ui_vp_player_char->move(0, 0);
[[fallthrough]];
case DESK_EMOTE_ONLY:
case DESK_HIDE:
@@ -4100,7 +4065,7 @@ void Courtroom::start_chat_ticking()
case DESK_PRE_ONLY_EX:
ui_vp_sideplayer_char->hide();
- ui_vp_player_char->move_and_center(0, 0);
+ ui_vp_player_char->move(0, 0);
[[fallthrough]];
case DESK_PRE_ONLY:
case DESK_HIDE:
@@ -4154,12 +4119,12 @@ void Courtroom::start_chat_ticking()
// Show it if chatbox always shows
if (Options::getInstance().characterStickerEnabled() && chatbox_always_show)
{
- ui_vp_sticker->load_image(m_chatmessage[CHAR_NAME]);
+ ui_vp_sticker->loadAndPlayAnimation(m_chatmessage[CHAR_NAME]);
}
// Hide the face sticker
else
{
- ui_vp_sticker->stop();
+ ui_vp_sticker->stopPlayback();
}
}
// If we're not already waiting on the next message, start the timer. We could be overriden if there's an objection planned.
@@ -4176,7 +4141,7 @@ void Courtroom::start_chat_ticking()
if (Options::getInstance().characterStickerEnabled())
{
- ui_vp_sticker->load_image(m_chatmessage[CHAR_NAME]);
+ ui_vp_sticker->loadAndPlayAnimation(m_chatmessage[CHAR_NAME]);
}
if (m_chatmessage[ADDITIVE] != "1")
@@ -4226,8 +4191,6 @@ void Courtroom::chat_tick()
// Due to our new text speed system, we always need to stop the timer now.
chat_tick_timer->stop();
- ui_vp_player_char->set_static_duration(0);
- QString filename;
if (tick_pos >= f_message.size())
{
@@ -4239,20 +4202,21 @@ void Courtroom::chat_tick()
{
QStringList c_paths = {ao_app->get_image_suffix(ao_app->get_character_path(m_chatmessage[CHAR_NAME], "(c)" + m_chatmessage[EMOTE])), ao_app->get_image_suffix(ao_app->get_character_path(m_chatmessage[CHAR_NAME], "(c)/" + m_chatmessage[EMOTE]))};
// if there is a (c) animation for this emote and we haven't played it already
- if (file_exists(ui_vp_player_char->find_image(c_paths)) && (!c_played))
+ if (file_exists(ao_app->find_image(c_paths)) && (!c_played))
{
anim_state = 5;
- ui_vp_player_char->set_play_once(true);
- filename = "(c)" + m_chatmessage[EMOTE];
c_played = true;
+ ui_vp_player_char->loadCharacterEmote(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE], kal::CharacterAnimationLayer::PostEmote);
+ ui_vp_player_char->setPlayOnce(true);
+ ui_vp_player_char->startPlayback();
}
else
{
anim_state = 3;
- ui_vp_player_char->set_play_once(false);
- filename = "(a)" + m_chatmessage[EMOTE];
+ ui_vp_player_char->loadCharacterEmote(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE], kal::CharacterAnimationLayer::IdleEmote);
+ ui_vp_player_char->setPlayOnce(false);
+ ui_vp_player_char->startPlayback();
}
- ui_vp_player_char->load_image(filename, m_chatmessage[CHAR_NAME], 0, false);
}
}
else // We're a narrator msg
@@ -4266,8 +4230,8 @@ void Courtroom::chat_tick()
f_char = m_chatmessage[CHAR_NAME];
f_custom_theme = ao_app->get_chat(f_char);
}
- ui_vp_chat_arrow->transform_mode = ao_app->get_misc_scaling(f_custom_theme);
- ui_vp_chat_arrow->load_image("chat_arrow", f_custom_theme); // Chat stopped being processed, indicate that.
+ ui_vp_chat_arrow->setTransformationMode(ao_app->get_misc_scaling(f_custom_theme));
+ ui_vp_chat_arrow->loadAndPlayAnimation("chat_arrow", f_custom_theme); // Chat stopped being processed, indicate that.
QString f_message_filtered = filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt());
for (int c = 0; c < max_colors; ++c)
{
@@ -4503,19 +4467,17 @@ void Courtroom::chat_tick()
if (color_is_talking && anim_state != 2 && anim_state < 4) // Set it to talking as we're not on that already (though we have
// to avoid interrupting a non-interrupted preanim)
{
- ui_vp_player_char->stop();
- ui_vp_player_char->set_play_once(false);
- filename = "(b)" + m_chatmessage[EMOTE];
- ui_vp_player_char->load_image(filename, m_chatmessage[CHAR_NAME], 0, false);
anim_state = 2;
+ ui_vp_player_char->loadCharacterEmote(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE], kal::CharacterAnimationLayer::TalkEmote);
+ ui_vp_player_char->setPlayOnce(false);
+ ui_vp_player_char->startPlayback();
}
else if (!color_is_talking && anim_state < 3 && anim_state != 3) // Set it to idle as we're not on that already
{
- ui_vp_player_char->stop();
- ui_vp_player_char->set_play_once(false);
- filename = "(a)" + m_chatmessage[EMOTE];
- ui_vp_player_char->load_image(filename, m_chatmessage[CHAR_NAME], 0, false);
anim_state = 3;
+ ui_vp_player_char->loadCharacterEmote(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE], kal::CharacterAnimationLayer::IdleEmote);
+ ui_vp_player_char->setPlayOnce(false);
+ ui_vp_player_char->startPlayback();
}
}
// Continue ticking
@@ -4544,12 +4506,21 @@ void Courtroom::play_sfx()
void Courtroom::set_scene(bool show_desk, const QString f_side)
{
- QPair<QString, int> bg_pair = ao_app->get_pos_path(f_side);
- QPair<QString, int> desk_pair = ao_app->get_pos_path(f_side, true);
- ui_vp_background->load_image(bg_pair.first, bg_pair.second);
- ui_vp_desk->load_image(desk_pair.first, desk_pair.second);
- last_side = f_side;
+ QPair<QString, QRect> bg_pair = ao_app->get_pos_path(f_side);
+ QPair<QString, QRect> desk_pair = ao_app->get_pos_path(f_side, true);
+
+ ui_vp_background->loadAndPlayAnimation(bg_pair.first);
+ ui_vp_desk->loadAndPlayAnimation(desk_pair.first);
+ double scale = double(ui_viewport->height()) / double(ui_vp_background->frameSize().height());
+ QSize scaled_size = ui_vp_background->frameSize() * scale;
+ QPoint scaled_offset = QPoint(-(bg_pair.second.x() * scale), 0);
+ ui_vp_background->resize(scaled_size);
+ ui_vp_background->move(scaled_offset);
+ ui_vp_desk->resize(scaled_size);
+ ui_vp_desk->move(scaled_offset);
+
+ last_side = f_side;
if (show_desk)
{
ui_vp_desk->show();
@@ -4560,7 +4531,7 @@ void Courtroom::set_scene(bool show_desk, const QString f_side)
}
}
-void Courtroom::set_self_offset(const QString &p_list, AOLayer *p_layer)
+void Courtroom::set_self_offset(const QString &p_list, kal::AnimationLayer *p_layer)
{
QStringList self_offsets = p_list.split("&");
int self_offset = self_offsets[0].toInt();
@@ -4573,7 +4544,7 @@ void Courtroom::set_self_offset(const QString &p_list, AOLayer *p_layer)
{
self_offset_v = self_offsets[1].toInt();
}
- p_layer->move_and_center(ui_viewport->width() * self_offset / 100, ui_viewport->height() * self_offset_v / 100);
+ p_layer->move(ui_viewport->width() * self_offset / 100, ui_viewport->height() * self_offset_v / 100);
}
void Courtroom::set_ip_list(QString p_list)
@@ -4729,15 +4700,14 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
QString bg_misc = ao_app->read_design_ini("misc", ao_app->get_background_path("design.ini"));
QString sfx_name;
QString filename;
- ui_vp_wtce->set_static_duration(wtce_static_time);
- ui_vp_wtce->set_max_duration(wtce_max_time);
+ ui_vp_wtce->setMaximumDurationPerFrame(wtce_max_time);
// witness testimony
if (p_wtce == "testimony1")
{
// End testimony indicator
if (variant == 1)
{
- ui_vp_testimony->kill();
+ ui_vp_testimony->stopPlayback();
return;
}
sfx_name = ao_app->get_court_sfx("witness_testimony", bg_misc);
@@ -4746,7 +4716,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
sfx_name = ao_app->get_court_sfx("witnesstestimony", bg_misc);
}
filename = "witnesstestimony_bubble";
- ui_vp_testimony->load_image("testimony", "", bg_misc);
+ ui_vp_testimony->loadAndPlayAnimation("testimony", "", bg_misc);
}
// cross examination
else if (p_wtce == "testimony2")
@@ -4757,12 +4727,11 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
sfx_name = ao_app->get_court_sfx("crossexamination", bg_misc);
}
filename = "crossexamination_bubble";
- ui_vp_testimony->kill();
+ ui_vp_testimony->stopPlayback();
}
else
{
- ui_vp_wtce->set_static_duration(verdict_static_time);
- ui_vp_wtce->set_max_duration(verdict_max_time);
+ ui_vp_wtce->setMaximumDurationPerFrame(verdict_max_time);
// Verdict?
if (p_wtce == "judgeruling")
{
@@ -4774,13 +4743,13 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
sfx_name = ao_app->get_court_sfx("notguilty", bg_misc);
}
filename = "notguilty_bubble";
- ui_vp_testimony->kill();
+ ui_vp_testimony->stopPlayback();
}
else if (variant == 1)
{
sfx_name = ao_app->get_court_sfx("guilty", bg_misc);
filename = "guilty_bubble";
- ui_vp_testimony->kill();
+ ui_vp_testimony->stopPlayback();
}
}
// Completely custom WTCE
@@ -4791,8 +4760,8 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
}
}
sfx_player->findAndPlaySfx(sfx_name);
- ui_vp_wtce->load_image(filename, "", bg_misc);
- ui_vp_wtce->set_play_once(true);
+ ui_vp_wtce->loadAndPlayAnimation(filename, "", bg_misc);
+ ui_vp_wtce->setPlayOnce(true);
}
void Courtroom::set_hp_bar(int p_bar, int p_state)