aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorĽubomír Remák2018-07-15 18:19:07 +0200
committerEugene Sandulenko2018-08-25 23:12:01 +0200
commit74ef0d9cfe2106cd0e4286ccd3e829c2edc00f98 (patch)
tree274a6dc0e1ad18b75280561491186c1cc8c7d6b3 /engines
parent2ee0a900598caa2e91b7261eb886793b74f9e25e (diff)
downloadscummvm-rg350-74ef0d9cfe2106cd0e4286ccd3e829c2edc00f98.tar.gz
scummvm-rg350-74ef0d9cfe2106cd0e4286ccd3e829c2edc00f98.tar.bz2
scummvm-rg350-74ef0d9cfe2106cd0e4286ccd3e829c2edc00f98.zip
MUTATIONOFJB: Correctly handle empty animation frames.
Diffstat (limited to 'engines')
-rw-r--r--engines/mutationofjb/animationdecoder.cpp56
1 files changed, 30 insertions, 26 deletions
diff --git a/engines/mutationofjb/animationdecoder.cpp b/engines/mutationofjb/animationdecoder.cpp
index 5b201535c8..c88a9e095d 100644
--- a/engines/mutationofjb/animationdecoder.cpp
+++ b/engines/mutationofjb/animationdecoder.cpp
@@ -61,34 +61,38 @@ bool AnimationDecoder::decode(AnimationDecoderCallback *callback) {
// Subrecords.
if (recordId == 0xF1FA) {
- for (int i = 0; i < subrecords; ++i) {
- int32 filePos = file.pos();
-
- const uint32 subLength = file.readUint32LE();
- const uint16 type = file.readUint16LE();
-
- if (type == 0x0B) {
- loadPalette(file);
- if (callback) {
- callback->onPaletteUpdated(_palette);
- }
- } else if (type == 0x0F) {
- loadFullFrame(file, subLength - 6);
- if (callback) {
- callback->onFrame(frameNo, _surface);
- }
- } else if (type == 0x0C) {
- loadDiffFrame(file, subLength - 6);
- if (callback) {
- callback->onFrame(frameNo, _surface);
+ if (subrecords == 0) {
+ callback->onFrame(frameNo, _surface); // Empty record, frame identical to the previous one.
+ } else {
+ for (int i = 0; i < subrecords; ++i) {
+ int32 filePos = file.pos();
+
+ const uint32 subLength = file.readUint32LE();
+ const uint16 type = file.readUint16LE();
+
+ if (type == 0x0B) {
+ loadPalette(file);
+ if (callback) {
+ callback->onPaletteUpdated(_palette);
+ }
+ } else if (type == 0x0F) {
+ loadFullFrame(file, subLength - 6);
+ if (callback) {
+ callback->onFrame(frameNo, _surface);
+ }
+ } else if (type == 0x0C) {
+ loadDiffFrame(file, subLength - 6);
+ if (callback) {
+ callback->onFrame(frameNo, _surface);
+ }
+ } else {
+ debug(_("Unsupported record type %02X."), type);
+ file.seek(subLength - 6, SEEK_CUR);
}
- } else {
- debug(_("Unsupported record type %02X."), type);
- file.seek(subLength - 6, SEEK_CUR);
- }
- // Makes decoding more robust, because for some reason records might have extra data at the end.
- file.seek(filePos + subLength, SEEK_SET);
+ // Makes decoding more robust, because for some reason records might have extra data at the end.
+ file.seek(filePos + subLength, SEEK_SET);
+ }
}
frameNo++;
} else {