aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2009-07-17 09:56:03 +0000
committerTravis Howell2009-07-17 09:56:03 +0000
commit74178f090cf5ac8e692c9c6345b436e33f629104 (patch)
tree5429c144cb18df4fc8b735afbdbe2dee5acf8af4
parentd329232f5c084193ab8eac3711ae141df54a9793 (diff)
downloadscummvm-rg350-74178f090cf5ac8e692c9c6345b436e33f629104.tar.gz
scummvm-rg350-74178f090cf5ac8e692c9c6345b436e33f629104.tar.bz2
scummvm-rg350-74178f090cf5ac8e692c9c6345b436e33f629104.zip
Fix bug #2822956 - ELVIRA2: Crash at the beginning (regression).
svn-id: r42560
-rw-r--r--engines/agos/vga_e2.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp
index 7f02398e13..f6e6630d43 100644
--- a/engines/agos/vga_e2.cpp
+++ b/engines/agos/vga_e2.cpp
@@ -207,6 +207,7 @@ void AGOSEngine::vc53_dissolveIn() {
uint16 speed = vcReadNextWord() + 1;
byte *src, *dst, *srcOffs, *srcOffs2, *dstOffs, *dstOffs2;
+ int16 xoffs, yoffs;
uint8 color = 0;
// Only uses Video Window 4
@@ -218,15 +219,13 @@ void AGOSEngine::vc53_dissolveIn() {
uint16 dissolveDelay = dissolveCheck * 2 / speed;
uint16 dissolveCount = dissolveCheck * 2 / speed;
- Graphics::Surface *screen = _system->lockScreen();
-
- int16 xoffs = _videoWindows[num * 4 + 0] * 16;
- int16 yoffs = _videoWindows[num * 4 + 1];
- int16 offs = xoffs + yoffs * screen->pitch;
+ int16 x = _videoWindows[num * 4 + 0] * 16;
+ int16 y = _videoWindows[num * 4 + 1];
uint16 count = dissolveCheck * 2;
while (count--) {
- byte *dstPtr = (byte *)screen->pixels + offs;
+ Graphics::Surface *screen = _system->lockScreen();
+ byte *dstPtr = (byte *)screen->pixels + x + y * screen->pitch;
yoffs = _rnd.getRandomNumber(dissolveY);
dst = dstPtr + yoffs * screen->pitch;
@@ -285,6 +284,7 @@ void AGOSEngine::vc54_dissolveOut() {
uint16 speed = vcReadNextWord() + 1;
byte *dst, *dstOffs;
+ int16 xoffs, yoffs;
uint16 dissolveX = _videoWindows[num * 4 + 2] * 8;
uint16 dissolveY = (_videoWindows[num * 4 + 3] + 1) / 2;
@@ -292,15 +292,13 @@ void AGOSEngine::vc54_dissolveOut() {
uint16 dissolveDelay = dissolveCheck * 2 / speed;
uint16 dissolveCount = dissolveCheck * 2 / speed;
- Graphics::Surface *screen = _system->lockScreen();
-
- int16 xoffs = _videoWindows[num * 4 + 0] * 16;
- int16 yoffs = _videoWindows[num * 4 + 1];
- int16 offs = xoffs + yoffs * screen->pitch;
+ int16 x = _videoWindows[num * 4 + 0] * 16;
+ int16 y = _videoWindows[num * 4 + 1];
uint16 count = dissolveCheck * 2;
while (count--) {
- byte *dstPtr = (byte *)screen->pixels + offs;
+ Graphics::Surface *screen = _system->lockScreen();
+ byte *dstPtr = (byte *)screen->pixels + x + y * screen->pitch;
color |= dstPtr[0] & 0xF0;
yoffs = _rnd.getRandomNumber(dissolveY);