aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/lab/anim.cpp26
-rw-r--r--engines/lab/anim.h3
-rw-r--r--engines/lab/dispman.cpp26
3 files changed, 25 insertions, 30 deletions
diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp
index 9444a8f9bc..5f469d8188 100644
--- a/engines/lab/anim.cpp
+++ b/engines/lab/anim.cpp
@@ -58,10 +58,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) {
_diffFile = nullptr;
_diffFileStart = 0;
_size = 0;
- _rawDiffBM._bytesPerRow = 0;
- _rawDiffBM._drawOnScreen = false;
- for (int i = 0; i < 16; i++)
- _rawDiffBM._planes[i] = nullptr;
+ _scrollScreenBuffer = nullptr;
_waitForEffect = false;
_stopPlayingEnd = false;
_sampleSpeed = 0;
@@ -73,6 +70,11 @@ Anim::Anim(LabEngine *vm) : _vm(vm) {
_diffPalette[i] = 0;
}
+Anim::~Anim() {
+ delete[] _vm->_anim->_scrollScreenBuffer;
+ _vm->_anim->_scrollScreenBuffer = nullptr;
+}
+
void Anim::diffNextFrame(bool onlyDiffData) {
if (_lastBlockHeader == 65535)
// Already done.
@@ -143,9 +145,15 @@ void Anim::diffNextFrame(bool onlyDiffData) {
break;
case 10:
- if (onlyDiffData)
- warning("Boom");
- _diffFile->read(disp->_planes[_curBit], _size);
+ if (onlyDiffData) {
+ if (_curBit > 0)
+ error("diffNextFrame: attempt to read screen to non-zero plane (%d)", _curBit);
+ delete[] _scrollScreenBuffer;
+ _scrollScreenBuffer = new byte[_headerdata._width * _headerdata._height];
+ _diffFile->read(_scrollScreenBuffer, _size);
+ } else {
+ _diffFile->read(disp->_planes[_curBit], _size);
+ }
_curBit++;
break;
@@ -325,8 +333,8 @@ void Anim::readDiff(Common::File *diffFile, bool playOnce, bool onlyDiffData) {
assert(_numChunks < 16);
- for (int i = 0; i < 8; i++)
- _rawDiffBM._planes[i] = nullptr;
+ delete[] _scrollScreenBuffer;
+ _scrollScreenBuffer = nullptr;
if (_headerdata._fps)
_delayMicros = 1000 / _headerdata._fps;
diff --git a/engines/lab/anim.h b/engines/lab/anim.h
index 563f2816ad..db2e23e9b5 100644
--- a/engines/lab/anim.h
+++ b/engines/lab/anim.h
@@ -74,13 +74,14 @@ private:
public:
Anim(LabEngine *vm);
+ virtual ~Anim();
DIFFHeader _headerdata;
char _diffPalette[256 * 3];
bool _waitForEffect; // Wait for each sound effect to finish before continuing.
bool _doBlack; // Black the screen before new picture
bool _noPalChange; // Don't change the palette.
- BitMap _rawDiffBM;
+ byte *_scrollScreenBuffer;
/**
* Reads in a DIFF file.
diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index 2e133500e8..cbf7575ff2 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -704,7 +704,7 @@ void DisplayMan::doScrollWipe(const Common::String filename) {
readPict(filename, true, true);
setPalette(_vm->_anim->_diffPalette, 256);
- byte *mem = _vm->_anim->_rawDiffBM._planes[0];
+ byte *mem = _vm->_anim->_scrollScreenBuffer;
_vm->updateMusicAndEvents();
uint16 by = _vm->_utils->vgaScaleX(3);
@@ -744,42 +744,28 @@ void DisplayMan::doScrollWipe(const Common::String filename) {
}
void DisplayMan::doScrollBounce() {
- const uint16 *newby, *newby1;
-
- const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1};
- const uint16 newbyw[5] = {10, 8, 6, 4, 2}, newby1w[8] = {6, 6, 4, 4, 4, 2, 2, 2};
-
- if (_vm->getPlatform() != Common::kPlatformWindows) {
- newby = newbyd;
- newby1 = newby1d;
- } else {
- newby = newbyw;
- newby1 = newby1w;
- }
+ const uint16 offsets[8] = { 3, 3, 2, 2, 2, 1, 1, 1 };
+ const int multiplier = (_vm->_isHiRes) ? 2 : 1;
_vm->_event->mouseHide();
int width = _vm->_utils->vgaScaleX(320);
int height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2);
- byte *mem = _vm->_anim->_rawDiffBM._planes[0];
+ byte *mem = _vm->_anim->_scrollScreenBuffer;
_vm->updateMusicAndEvents();
int startLine = _vm->_anim->_headerdata._height - height - 1;
for (int i = 0; i < 5; i++) {
_vm->updateMusicAndEvents();
- startLine -= newby[i];
+ startLine -= (5 - i) * multiplier;
copyPage(width, height, 0, startLine, mem);
-
- screenUpdate();
_vm->waitTOF();
}
for (int i = 8; i > 0; i--) {
_vm->updateMusicAndEvents();
- startLine += newby1[i - 1];
+ startLine += offsets[i - 1] * multiplier;
copyPage(width, height, 0, startLine, mem);
-
- screenUpdate();
_vm->waitTOF();
}