aboutsummaryrefslogtreecommitdiff
path: root/engines/voyeur/animation.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2013-12-31 16:08:00 -1000
committerPaul Gilbert2013-12-31 16:08:00 -1000
commit5c20b3c331178129f6c9dcacce9b36b0a1133dd8 (patch)
treed705ef56c630a121750c0c7b92fe1c81853eec92 /engines/voyeur/animation.cpp
parent3e268ca4e0963b95e36d84e506d1d2397fa84ecb (diff)
downloadscummvm-rg350-5c20b3c331178129f6c9dcacce9b36b0a1133dd8.tar.gz
scummvm-rg350-5c20b3c331178129f6c9dcacce9b36b0a1133dd8.tar.bz2
scummvm-rg350-5c20b3c331178129f6c9dcacce9b36b0a1133dd8.zip
VOYEUR: Implementing game end methods
Diffstat (limited to 'engines/voyeur/animation.cpp')
-rw-r--r--engines/voyeur/animation.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index b862f3a8d9..0fc5669c66 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -22,6 +22,7 @@
#include "voyeur/animation.h"
#include "voyeur/staticres.h"
+#include "voyeur/voyeur.h"
#include "common/memstream.h"
#include "common/system.h"
#include "audio/decoders/raw.h"
@@ -97,6 +98,27 @@ RL2Decoder::RL2VideoTrack *RL2Decoder::getVideoTrack() {
return (RL2VideoTrack *)track;
}
+void RL2Decoder::play(::Voyeur::VoyeurEngine *vm) {
+ vm->_eventsManager.getMouseInfo();
+
+ while (!vm->shouldQuit() && !endOfVideo() && !vm->_eventsManager._mouseClicked) {
+ if (hasDirtyPalette()) {
+ const byte *palette = getPalette();
+ vm->_graphicsManager.setPalette(palette, 0, 256);
+ }
+
+ if (needsUpdate()) {
+ const Graphics::Surface *frame = decodeNextFrame();
+
+ Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
+ (byte *)vm->_graphicsManager._screenSurface.getPixels());
+ }
+
+ vm->_eventsManager.getMouseInfo();
+ g_system->delayMillis(10);
+ }
+}
+
/*------------------------------------------------------------------------*/
RL2Decoder::RL2FileHeader::RL2FileHeader() {
@@ -288,18 +310,19 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithoutTransparency(int screenOffs
--frameSize;
} else if (nextByte > 0x80) {
// Lower 7 bits a run length for the following byte
- byte runLength = _fileStream->readByte();
- assert(frameSize >= runLength);
+ int runLength = _fileStream->readByte();
+ runLength = MIN(runLength, frameSize);
+
Common::fill(destP, destP + runLength, nextByte & 0x7f);
destP += runLength;
frameSize -= runLength;
} else {
// Follow byte run length for zeroes. If zero, indicates end of image
- byte runLength = _fileStream->readByte();
+ int runLength = _fileStream->readByte();
if (runLength == 0)
break;
- assert(frameSize >= runLength);
+ runLength = MIN(runLength, frameSize);
Common::fill(destP, destP + runLength, 0);
destP += runLength;
frameSize -= runLength;