aboutsummaryrefslogtreecommitdiff
path: root/engines/lab
diff options
context:
space:
mode:
authorStrangerke2015-12-22 21:35:27 +0100
committerWillem Jan Palenstijn2015-12-23 21:35:35 +0100
commit966f82d82e523f9807655c7a06ccb98454c416d4 (patch)
treeaa56615e26a662bd760babe522d9a43c6928a325 /engines/lab
parent50a6cf12ef88503e2f5efd9e91dbc2768abb0f95 (diff)
downloadscummvm-rg350-966f82d82e523f9807655c7a06ccb98454c416d4.tar.gz
scummvm-rg350-966f82d82e523f9807655c7a06ccb98454c416d4.tar.bz2
scummvm-rg350-966f82d82e523f9807655c7a06ccb98454c416d4.zip
LAB: Clarify a bit the use of header in Anim
Diffstat (limited to 'engines/lab')
-rw-r--r--engines/lab/anim.cpp86
-rw-r--r--engines/lab/anim.h2
2 files changed, 44 insertions, 44 deletions
diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp
index d893c9c647..b3a5a8f85c 100644
--- a/engines/lab/anim.cpp
+++ b/engines/lab/anim.cpp
@@ -39,7 +39,7 @@
namespace Lab {
Anim::Anim(LabEngine *vm) : _vm(vm) {
- _header = 0;
+ _lastBlockHeader = 0;
_curBit = 0;
_numChunks = 1;
_headerdata._width = 0;
@@ -74,7 +74,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) {
}
void Anim::diffNextFrame(bool onlyDiffData) {
- if (_header == 65535)
+ if (_lastBlockHeader == 65535)
// Already done.
return;
@@ -131,12 +131,12 @@ void Anim::diffNextFrame(bool onlyDiffData) {
}
_vm->updateMusicAndEvents();
- _header = _diffFile->readUint32LE();
+ _lastBlockHeader = _diffFile->readUint32LE();
_size = _diffFile->readUint32LE();
uint32 curPos = 0;
- switch (_header) {
+ switch (_lastBlockHeader) {
case 8:
_diffFile->read(_diffPalette, _size);
_isPal = true;
@@ -259,7 +259,6 @@ void Anim::stopDiffEnd() {
void Anim::readDiff(Common::File *diffFile, bool playOnce, bool onlyDiffData) {
_playOnce = playOnce;
_delayMicros = 0;
- _header = 0;
_curBit = 0;
_frameNum = 0;
_numChunks = 1;
@@ -275,65 +274,66 @@ void Anim::readDiff(Common::File *diffFile, bool playOnce, bool onlyDiffData) {
_diffFile = diffFile;
_continuous = false;
- uint32 signature = _diffFile->readUint32BE();
- _header = _diffFile->readUint32LE();
+ uint32 signature1 = _diffFile->readUint32BE();
+ uint32 signature2 = _diffFile->readUint32LE();
- if ((signature != MKTAG('D', 'I', 'F', 'F')) || (_header != 1219009121L)) {
+ if ((signature1 != MKTAG('D', 'I', 'F', 'F')) || (signature2 != 1219009121L)) {
_isPlaying = false;
return;
}
- _header = _diffFile->readUint32LE();
+ uint32 signature3 = _diffFile->readUint32LE();
_size = _diffFile->readUint32LE();
- if (_header == 0) {
- // sizeof(headerdata) != 18, but the padding might be at the end
- // 2 bytes, version, unused.
- _diffFile->skip(2);
- _headerdata._width = _diffFile->readUint16LE();
- _headerdata._height = _diffFile->readUint16LE();
- // 1 byte, depth, unused
- _diffFile->skip(1);
- _headerdata._fps = _diffFile->readByte();
+ if (signature3 != 0)
+ return;
- // HACK: The original game defines a 1 second delay when changing screens, which is
- // very annoying. We first removed the delay, but it looked wrong when changing screens
- // as it was possible to see that something was displayed, without being able to tell
- // what it was. A shorter delay (150ms) makes it acceptable during gameplay and
- // readable. The big question is: do we need that message?
- g_system->delayMillis(150);
+ // sizeof(headerdata) != 18, but the padding might be at the end
+ // 2 bytes, version, unused.
+ _diffFile->skip(2);
+ _headerdata._width = _diffFile->readUint16LE();
+ _headerdata._height = _diffFile->readUint16LE();
+ // 1 byte, depth, unused
+ _diffFile->skip(1);
+ _headerdata._fps = _diffFile->readByte();
- if (_headerdata._fps == 1)
- _headerdata._fps = 0;
+ // HACK: The original game defines a 1 second delay when changing screens, which is
+ // very annoying. We first removed the delay, but it looked wrong when changing screens
+ // as it was possible to see that something was displayed, without being able to tell
+ // what it was. A shorter delay (150ms) makes it acceptable during gameplay and
+ // readable. The big question is: do we need that message?
+ g_system->delayMillis(150);
- // 4 + 2 bytes, buffer size and machine, unused
- _diffFile->skip(6);
- _headerdata._flags = _diffFile->readUint32LE();
+ if (_headerdata._fps == 1)
+ _headerdata._fps = 0;
- _diffFile->skip(_size - 18);
+ // 4 + 2 bytes, buffer size and machine, unused
+ _diffFile->skip(6);
+ _headerdata._flags = _diffFile->readUint32LE();
- _continuous = CONTINUOUS & _headerdata._flags;
- _diffWidth = _headerdata._width;
- _diffHeight = _headerdata._height;
- _vm->_utils->setBytesPerRow(_diffWidth);
+ _diffFile->skip(_size - 18);
- _numChunks = (((int32)_diffWidth) * _diffHeight) / 0x10000;
+ _continuous = CONTINUOUS & _headerdata._flags;
+ _diffWidth = _headerdata._width;
+ _diffHeight = _headerdata._height;
+ _vm->_utils->setBytesPerRow(_diffWidth);
- if ((uint32)(_numChunks * 0x10000) < (uint32)(((int32)_diffWidth) * _diffHeight))
- _numChunks++;
+ _numChunks = (((int32)_diffWidth) * _diffHeight) / 0x10000;
- assert (_numChunks < 16);
- } else
- return;
+ if ((uint32)(_numChunks * 0x10000) < (uint32)(((int32)_diffWidth) * _diffHeight))
+ _numChunks++;
- for (_header = 0; _header < 8; _header++)
- _rawDiffBM._planes[_header] = nullptr;
+ assert(_numChunks < 16);
+
+ for (int i = 0; i < 8; i++)
+ _rawDiffBM._planes[i] = nullptr;
if (_headerdata._fps)
_delayMicros = 1000 / _headerdata._fps;
+ _lastBlockHeader = signature3;
if (_playOnce) {
- while (_header != 65535)
+ while (_lastBlockHeader != 65535)
diffNextFrame(onlyDiffData);
} else
diffNextFrame(onlyDiffData);
diff --git a/engines/lab/anim.h b/engines/lab/anim.h
index 9ffaaf77d0..563f2816ad 100644
--- a/engines/lab/anim.h
+++ b/engines/lab/anim.h
@@ -53,7 +53,7 @@ class Anim {
private:
LabEngine *_vm;
- uint32 _header;
+ uint32 _lastBlockHeader;
uint16 _curBit;
uint16 _numChunks;
uint32 _delayMicros;