aboutsummaryrefslogtreecommitdiff
path: root/aocharmovie.cpp
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2017-02-15 15:32:20 +0100
committerDavid Skoland <davidskoland@gmail.com>2017-02-15 15:32:20 +0100
commitbe017b727831826257ea8d4c34bd8d33138cd5c0 (patch)
treed50c3b59f580142540ce54eb1286c6782ad304bc /aocharmovie.cpp
parentf7db8fa64aae47f2945e0d3c9344f6fac4534b57 (diff)
fixed all known bugs + improved preanims(probably)
Diffstat (limited to 'aocharmovie.cpp')
-rw-r--r--aocharmovie.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/aocharmovie.cpp b/aocharmovie.cpp
index db584fa8..f4aac9ca 100644
--- a/aocharmovie.cpp
+++ b/aocharmovie.cpp
@@ -19,7 +19,8 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_
this->setMovie(m_movie);
connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
- connect(preanim_timer, SIGNAL(timeout()), this, SLOT(preanim_done()));
+ connect(m_movie, SIGNAL(finished()), this, SLOT(movie_done()));
+ connect(preanim_timer, SIGNAL(timeout()), this, SLOT(timer_done()));
}
void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
@@ -63,8 +64,15 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
{
+ if (duration == 0)
+ play_once = true;
+
+ else
+ {
+ play_once = false;
+ preanim_timer->start(duration);
+ }
play(p_char, p_emote, "");
- preanim_timer->start(duration);
}
void AOCharMovie::play_talking(QString p_char, QString p_emote)
@@ -95,9 +103,15 @@ void AOCharMovie::frame_change(int n_frame)
{
if (m_flipped && flipped_movie.size() > n_frame)
this->setPixmap(QPixmap::fromImage(flipped_movie.at(n_frame)));
+
+ if (m_movie->frameCount() - 1 == n_frame && play_once)
+ {
+ delay(m_movie->nextFrameDelay());
+ done();
+ }
}
-void AOCharMovie::preanim_done()
+void AOCharMovie::timer_done()
{
done();
}