Fixed emote synchronization, ...
* Fixed emote synchronization * Still requires identical frame count. Will still cause freeze as it syncs. * Fixed frame effects not working on idle and talk emotes. * Characters are now repositioned after background sliding is over.
This commit is contained in:
parent
52fc8d3594
commit
d135bbc511
@ -131,12 +131,16 @@ void AnimationLayer::jumpToFrame(int number)
|
||||
return;
|
||||
}
|
||||
|
||||
bool is_processing = m_processing;
|
||||
if (m_ticker->isActive())
|
||||
{
|
||||
m_ticker->stop();
|
||||
}
|
||||
m_frame_number = number;
|
||||
m_target_frame_number = number;
|
||||
if (is_processing)
|
||||
{
|
||||
frameTicker();
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationLayer::setPlayOnce(bool enabled)
|
||||
@ -161,7 +165,7 @@ void AnimationLayer::setFlipped(bool enabled)
|
||||
|
||||
void AnimationLayer::setTransformationMode(Qt::TransformationMode mode)
|
||||
{
|
||||
m_transformation_mode = mode;
|
||||
m_transformation_mode_hint = mode;
|
||||
}
|
||||
|
||||
void AnimationLayer::setMinimumDurationPerFrame(int duration)
|
||||
@ -247,6 +251,11 @@ void AnimationLayer::calculateFrameGeometry()
|
||||
// display the frame in its center
|
||||
int x = (m_scaled_frame_size.width() - widget_size.width()) / 2;
|
||||
m_display_rect = QRect(x, 0, widget_size.width(), m_scaled_frame_size.height());
|
||||
|
||||
if (m_transformation_mode_hint == Qt::FastTransformation)
|
||||
{
|
||||
m_transformation_mode = scale < 1.0 ? Qt::SmoothTransformation : Qt::FastTransformation;
|
||||
}
|
||||
}
|
||||
|
||||
displayCurrentFrame();
|
||||
@ -314,6 +323,8 @@ void AnimationLayer::frameTicker()
|
||||
finishPlayback();
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_pause && !m_first_frame)
|
||||
@ -340,6 +351,11 @@ void AnimationLayer::frameTicker()
|
||||
}
|
||||
|
||||
m_first_frame = false;
|
||||
if (m_target_frame_number != -1)
|
||||
{
|
||||
m_frame_number = m_target_frame_number;
|
||||
m_target_frame_number = -1;
|
||||
}
|
||||
m_current_frame = m_loader->frame(m_frame_number);
|
||||
displayCurrentFrame();
|
||||
Q_EMIT frameNumberChanged(m_frame_number);
|
||||
@ -380,6 +396,7 @@ void CharacterAnimationLayer::loadCharacterEmote(QString character, QString file
|
||||
|
||||
m_character = character;
|
||||
m_emote = fileName;
|
||||
m_resolved_emote = fileName;
|
||||
m_emote_type = emoteType;
|
||||
|
||||
QStringList prefixes;
|
||||
@ -410,19 +427,31 @@ void CharacterAnimationLayer::loadCharacterEmote(QString character, QString file
|
||||
}
|
||||
|
||||
QVector<VPath> path_list;
|
||||
QVector<QString> prefixed_emote_list;
|
||||
for (const QString &prefix : qAsConst(prefixes))
|
||||
{
|
||||
path_list << ao_app->get_character_path(character, prefix + m_emote);
|
||||
prefixed_emote_list << prefix + m_emote;
|
||||
}
|
||||
path_list << ao_app->get_character_path(character, m_emote);
|
||||
prefixed_emote_list << m_emote;
|
||||
|
||||
if (placeholder_fallback)
|
||||
{
|
||||
path_list << ao_app->get_character_path(character, QStringLiteral("placeholder"));
|
||||
prefixed_emote_list << QStringLiteral("placeholder");
|
||||
path_list << ao_app->get_theme_path("placeholder", ao_app->default_theme);
|
||||
prefixed_emote_list << QStringLiteral("placeholder");
|
||||
}
|
||||
|
||||
setFileName(ao_app->get_image_path(path_list));
|
||||
int index = -1;
|
||||
QString file_path = ao_app->get_image_path(path_list, index);
|
||||
if (index != -1)
|
||||
{
|
||||
m_resolved_emote = prefixed_emote_list[index];
|
||||
}
|
||||
|
||||
setFileName(file_path);
|
||||
setPlayOnce(play_once);
|
||||
setTransformationMode(ao_app->get_scaling(ao_app->get_emote_property(character, fileName, "scaling")));
|
||||
setStretchToFit(ao_app->get_emote_property(character, fileName, "stretch").startsWith("true"));
|
||||
@ -519,7 +548,7 @@ void CharacterAnimationLayer::notifyFrameEffect(int frameNumber)
|
||||
{
|
||||
for (const FrameEffect &effect : qAsConst(*it))
|
||||
{
|
||||
if (effect.emote_name == m_emote)
|
||||
if (effect.emote_name == m_resolved_emote)
|
||||
{
|
||||
switch (effect.type)
|
||||
{
|
||||
|
@ -90,6 +90,7 @@ private:
|
||||
bool m_flipped = false;
|
||||
int m_minimum_duration = 0;
|
||||
int m_maximum_duration = 0;
|
||||
Qt::TransformationMode m_transformation_mode_hint = Qt::FastTransformation;
|
||||
Qt::TransformationMode m_transformation_mode = Qt::FastTransformation;
|
||||
AnimationLoader *m_loader = nullptr;
|
||||
QSize m_frame_size;
|
||||
@ -103,6 +104,7 @@ private:
|
||||
QTimer *m_ticker = nullptr;
|
||||
bool m_first_frame = false;
|
||||
int m_frame_number = 0;
|
||||
int m_target_frame_number = -1;
|
||||
int m_frame_count = 0;
|
||||
AnimationFrame m_current_frame;
|
||||
|
||||
@ -170,6 +172,7 @@ private:
|
||||
|
||||
QString m_character;
|
||||
QString m_emote;
|
||||
QString m_resolved_emote;
|
||||
EmoteType m_emote_type = NoEmoteType;
|
||||
QTimer *m_duration_timer = nullptr;
|
||||
int m_duration = 0;
|
||||
|
@ -120,6 +120,7 @@ public:
|
||||
VPath get_evidence_path(QString p_file);
|
||||
QVector<VPath> get_asset_paths(QString p_element, QString p_theme = QString(), QString p_subtheme = QString(), QString p_default_theme = QString(), QString p_misc = QString(), QString p_character = QString(), QString p_placeholder = QString());
|
||||
QString get_asset_path(QVector<VPath> pathlist);
|
||||
QString get_image_path(QVector<VPath> pathlist, int &index, bool static_image = false);
|
||||
QString get_image_path(QVector<VPath> pathlist, bool static_image = false);
|
||||
QString get_sfx_path(QVector<VPath> pathlist);
|
||||
QString get_config_value(QString p_identifier, QString p_config, QString p_theme = QString(), QString p_subtheme = QString(), QString p_default_theme = QString(), QString p_misc = QString());
|
||||
|
@ -3110,6 +3110,7 @@ void Courtroom::post_transition_cleanup()
|
||||
layer->stopPlayback();
|
||||
layer->pausePlayback(false);
|
||||
layer->setParent(ui_viewport);
|
||||
layer->stackUnder(ui_vp_desk);
|
||||
layer->setVisible(is_visible);
|
||||
}
|
||||
|
||||
|
@ -239,19 +239,27 @@ QString AOApplication::get_asset_path(QVector<VPath> pathlist)
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString AOApplication::get_image_path(QVector<VPath> pathlist, bool static_image)
|
||||
QString AOApplication::get_image_path(QVector<VPath> pathlist, int &index, bool static_image)
|
||||
{
|
||||
for (const VPath &p : pathlist)
|
||||
for (int i = 0; i < pathlist.size(); i++)
|
||||
{
|
||||
QString path = get_image_suffix(p, static_image);
|
||||
QString path = get_image_suffix(pathlist[i], static_image);
|
||||
if (!path.isEmpty())
|
||||
{
|
||||
index = i;
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString AOApplication::get_image_path(QVector<VPath> pathlist, bool static_image)
|
||||
{
|
||||
int dummy;
|
||||
return get_image_path(pathlist, dummy, static_image);
|
||||
}
|
||||
|
||||
QString AOApplication::get_sfx_path(QVector<VPath> pathlist)
|
||||
{
|
||||
for (const VPath &p : pathlist)
|
||||
|
Loading…
Reference in New Issue
Block a user