Allow [Time] to be blank for pre-anims to not be required to use it

play_talking and play_idle reduced in useless code
This commit is contained in:
Crystalwarrior 2019-09-14 19:38:56 +03:00
parent f225df6f19
commit 51c97ad51c
3 changed files with 4 additions and 16 deletions

View File

@ -36,7 +36,7 @@ private:
QVector<QImage> movie_frames;
QTimer *preanim_timer;
const int time_mod = 62;
const int time_mod = 60;
// These are the X and Y values before they are fixed based on the sprite's width.
int x = 0;

View File

@ -75,6 +75,7 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame)
{
qDebug() << "frame " << n_frame << " delay of " << m_movie->nextFrameDelay();
real_duration += m_movie->nextFrameDelay();
m_movie->jumpToFrame(n_frame + 1);
}
@ -86,7 +87,7 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
double percentage_modifier = 100.0;
if (real_duration != 0 && duration != 0)
if (real_duration != 0 && duration > 0)
{
double modifier = full_duration / static_cast<double>(real_duration);
percentage_modifier = 100 / modifier;
@ -116,12 +117,6 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
void AOCharMovie::play_talking(QString p_char, QString p_emote)
{
QString emote_path = ao_app->get_character_path(p_char, "(b)" + p_emote);
m_movie->stop();
this->clear();
m_movie->setFileName(emote_path);
play_once = false;
m_movie->setSpeed(100);
play(p_char, p_emote, "(b)");
@ -129,12 +124,6 @@ void AOCharMovie::play_talking(QString p_char, QString p_emote)
void AOCharMovie::play_idle(QString p_char, QString p_emote)
{
QString emote_path = ao_app->get_character_path(p_char, "(a)" + p_emote);
m_movie->stop();
this->clear();
m_movie->setFileName(emote_path);
play_once = false;
m_movie->setSpeed(100);
play(p_char, p_emote, "(a)");

View File

@ -2049,8 +2049,7 @@ void Courtroom::play_preanim(bool noninterrupting)
sfx_delay_timer->start(sfx_delay);
QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim));
if (!file_exists(anim_to_find) ||
preanim_duration < 0)
if (!file_exists(anim_to_find))
{
if (noninterrupting)
anim_state = 4;