aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrichiesams2013-08-31 23:42:00 -0500
committerWillem Jan Palenstijn2013-09-24 13:59:40 +0200
commitf1bd8de21dd504fd9b8fa07c76ab75b5c40d29cd (patch)
tree7df450c53d29e2b23e26293f883ee3fef3459d85
parent2ad40edd47098144cecb808cf308bca8329479ff (diff)
downloadscummvm-rg350-f1bd8de21dd504fd9b8fa07c76ab75b5c40d29cd.tar.gz
scummvm-rg350-f1bd8de21dd504fd9b8fa07c76ab75b5c40d29cd.tar.bz2
scummvm-rg350-f1bd8de21dd504fd9b8fa07c76ab75b5c40d29cd.zip
ZVISION: Overload ZVision::playAnimation to support general video files
-rw-r--r--engines/zvision/animation.cpp44
-rw-r--r--engines/zvision/zvision.h1
2 files changed, 45 insertions, 0 deletions
diff --git a/engines/zvision/animation.cpp b/engines/zvision/animation.cpp
index 8ca892dfda..f43e854f73 100644
--- a/engines/zvision/animation.cpp
+++ b/engines/zvision/animation.cpp
@@ -23,6 +23,7 @@
#include "common/scummsys.h"
#include "common/system.h"
+#include "video/video_decoder.h"
#include "zvision/zvision.h"
#include "zvision/rlf_animation.h"
@@ -84,4 +85,47 @@ void ZVision::playAnimation(RlfAnimation *animation, uint16 x, uint16 y, Dispose
}
}
+void ZVision::playAnimation(Video::VideoDecoder *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse) {
+ _clock.stop();
+ animation->start();
+
+ // Only continue while the video is still playing
+ while (!shouldQuit() && !animation->endOfVideo() && animation->isPlaying()) {
+ // Check for engine quit and video stop key presses
+ while (!animation->endOfVideo() && animation->isPlaying() && _eventMan->pollEvent(_event)) {
+ switch (_event.type) {
+ case Common::EVENT_KEYDOWN:
+ switch (_event.kbd.keycode) {
+ case Common::KEYCODE_q:
+ if (_event.kbd.hasFlags(Common::KBD_CTRL))
+ quitGame();
+ break;
+ case Common::KEYCODE_SPACE:
+ animation->stop();
+ break;
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ if (animation->needsUpdate()) {
+ const Graphics::Surface *frame = animation->decodeNextFrame();
+
+ if (frame) {
+ _system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, x, y, frame->w, frame->h);
+ }
+ }
+
+ // Always update the screen so the mouse continues to render
+ _system->updateScreen();
+
+ _system->delayMillis(animation->getTimeToNextFrame());
+ }
+
+ _clock.start();
+}
+
} // End of namespace ZVision
diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h
index a02fecc43d..f961f1fda9 100644
--- a/engines/zvision/zvision.h
+++ b/engines/zvision/zvision.h
@@ -126,6 +126,7 @@ public:
void playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &destRect = Common::Rect(0, 0, 0, 0), bool skippable = true);
void playAnimation(RlfAnimation *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
+ void playAnimation(Video::VideoDecoder *animation, uint16 x, uint16 y, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
/**
* Utility method to cycle through all the cursors in the game. After