aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-09-05 15:44:29 +0000
committerTorbjörn Andersson2004-09-05 15:44:29 +0000
commit11a449a08c4f9ddafa0226aa89673af3782251b7 (patch)
tree29115a2bdf9ec5b68a8d8b915e0195f7898fbbcf /scumm
parent548e51dce85d44d9da214a8b679d18aed5cff7ed (diff)
downloadscummvm-rg350-11a449a08c4f9ddafa0226aa89673af3782251b7.tar.gz
scummvm-rg350-11a449a08c4f9ddafa0226aa89673af3782251b7.tar.bz2
scummvm-rg350-11a449a08c4f9ddafa0226aa89673af3782251b7.zip
Fixed scrollEffect() regression introduced when move_screen() was removed.
I have tested this on all the cases I know of where scrollEffect() is used: * The diving scene in Monkey Island 2 * The camel and balloon rides in Fate of Atlantis * The arrival of the thunder storm in Day of the Tentacle * Seeing the loose end in Sam & Max So far it seems to work fine. Knock on wood. svn-id: r14908
Diffstat (limited to 'scumm')
-rw-r--r--scumm/gfx.cpp29
-rw-r--r--scumm/scumm.cpp21
-rw-r--r--scumm/scumm.h2
3 files changed, 52 insertions, 0 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 369f4b236b..e25151f7cc 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -2768,6 +2768,12 @@ void ScummEngine::dissolveEffect(int width, int height) {
}
void ScummEngine::scrollEffect(int dir) {
+ // It is at least technically possible that this function will be
+ // called without _scrollBuffer having been set up, but will it ever
+ // happen? I don't know.
+ if (!_scrollBuffer)
+ warning("scrollEffect: No scroll buffer. This may look bad");
+
VirtScreen *vs = &virtscr[0];
int x, y;
@@ -2789,6 +2795,11 @@ void ScummEngine::scrollEffect(int dir) {
vs->pitch,
0, vs->h - y,
vs->w, y);
+ if (_scrollBuffer)
+ _system->copyRectToScreen(_scrollBuffer + y * vs->w,
+ vs->w,
+ 0, 0,
+ vs->w, vs->h - y);
_system->updateScreen();
waitForTimer(kPictureDelay);
@@ -2803,6 +2814,11 @@ void ScummEngine::scrollEffect(int dir) {
vs->pitch,
0, 0,
vs->w, y);
+ if (_scrollBuffer)
+ _system->copyRectToScreen(_scrollBuffer,
+ vs->w,
+ 0, y,
+ vs->w, vs->h - y);
_system->updateScreen();
waitForTimer(kPictureDelay);
@@ -2817,6 +2833,11 @@ void ScummEngine::scrollEffect(int dir) {
vs->pitch,
vs->w - x, 0,
x, vs->h);
+ if (_scrollBuffer)
+ _system->copyRectToScreen(_scrollBuffer + x,
+ vs->w,
+ 0, 0,
+ vs->w - x, vs->h);
_system->updateScreen();
waitForTimer(kPictureDelay);
@@ -2831,6 +2852,11 @@ void ScummEngine::scrollEffect(int dir) {
vs->pitch,
0, 0,
x, vs->h);
+ if (_scrollBuffer)
+ _system->copyRectToScreen(_scrollBuffer,
+ vs->w,
+ x, 0,
+ vs->w - x, vs->h);
_system->updateScreen();
waitForTimer(kPictureDelay);
@@ -2838,6 +2864,9 @@ void ScummEngine::scrollEffect(int dir) {
}
break;
}
+
+ free(_scrollBuffer);
+ _scrollBuffer = NULL;
}
void ScummEngine::unkScreenEffect6() {
diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp
index 1fb63414a9..d8c50f348b 100644
--- a/scumm/scumm.cpp
+++ b/scumm/scumm.cpp
@@ -598,6 +598,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
_newEffect = 0;
_switchRoomEffect2 = 0;
_switchRoomEffect = 0;
+ _scrollBuffer = NULL;
_doEffect = false;
memset(&_flashlight, 0, sizeof(_flashlight));
_roomStrips = 0;
@@ -2260,6 +2261,26 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
VAR(VAR_NEW_ROOM) = room; // gamevars, eg Zak cashcards
runExitScript();
+
+ if (_switchRoomEffect >= 130 && _switchRoomEffect <= 133) {
+ // We're going to use scrollEffect(), so we'll need a copy of
+ // the current VirtScreen zero.
+
+ VirtScreen *vs = &virtscr[0];
+
+ free(_scrollBuffer);
+ _scrollBuffer = (byte *) malloc(vs->h * vs->w);
+
+ byte *src = vs->getPixels(0, 0);
+ byte *dst = _scrollBuffer;
+
+ for (int y = 0; y < vs->h; y++) {
+ memcpy(dst, src, vs->w);
+ src += vs->w;
+ dst += vs->pitch;
+ }
+ }
+
killScriptsAndResources();
clearEnqueue();
if (_version >= 4 && _heversion <= 60)
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 6b54b1387c..51ef188288 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -890,6 +890,8 @@ protected:
byte _newEffect, _switchRoomEffect2, _switchRoomEffect;
bool _doEffect;
+
+ byte *_scrollBuffer;
struct {
int x, y, w, h;