aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2006-03-17 14:19:18 +0000
committerJohannes Schickel2006-03-17 14:19:18 +0000
commitbbd172559825d015cf308c5b2655c1496b82fb01 (patch)
tree2a8bbdad41fbc888f2e217f276e173c6808c12f8
parent4df16b71b842c7777d1900b5494f4ede1d1bc8ef (diff)
downloadscummvm-rg350-bbd172559825d015cf308c5b2655c1496b82fb01.tar.gz
scummvm-rg350-bbd172559825d015cf308c5b2655c1496b82fb01.tar.bz2
scummvm-rg350-bbd172559825d015cf308c5b2655c1496b82fb01.zip
- Fixes bug #1401432 ("KYRA: Brandon graphics glitch when exiting castle catacombs")
- Fixes some sprite redraw bugs introduced with my last commits - Fixes wsa drawing bug in the cave too svn-id: r21346
-rw-r--r--engines/kyra/animator.cpp32
-rw-r--r--engines/kyra/scene.cpp2
-rw-r--r--engines/kyra/script_v1.cpp4
-rw-r--r--engines/kyra/sprites.cpp10
4 files changed, 24 insertions, 24 deletions
diff --git a/engines/kyra/animator.cpp b/engines/kyra/animator.cpp
index 099ba9ef5c..8d7ac5d34c 100644
--- a/engines/kyra/animator.cpp
+++ b/engines/kyra/animator.cpp
@@ -175,13 +175,13 @@ void ScreenAnimator::preserveAnyChangedBackgrounds() {
void ScreenAnimator::preserveOrRestoreBackground(AnimObject *obj, bool restore) {
debugC(9, kDebugLevelAnimator, "ScreenAnimator::preserveOrRestoreBackground(%p, %d)", (const void *)obj, restore);
- int x = 0, y = 0, width = obj->width << 3, height = obj->height;
+ int x = 0, y = 0, width = obj->width, height = obj->height;
if (restore) {
- x = obj->x2;
+ x = obj->x2 >> 3;
y = obj->y2;
} else {
- x = obj->x1;
+ x = obj->x1 >> 3;
y = obj->y1;
}
@@ -193,8 +193,8 @@ void ScreenAnimator::preserveOrRestoreBackground(AnimObject *obj, bool restore)
int temp;
temp = x + width;
- if (temp >= 319) {
- x = 319 - width;
+ if (temp >= 40) {
+ x = 39 - width;
}
temp = y + height;
if (temp >= 136) {
@@ -202,9 +202,9 @@ void ScreenAnimator::preserveOrRestoreBackground(AnimObject *obj, bool restore)
}
if (restore) {
- _screen->copyBlockToPage(_screen->_curPage, x, y, width, height, obj->background);
+ _screen->copyBlockToPage(_screen->_curPage, x << 3, y, width << 3, height, obj->background);
} else {
- _screen->copyRegionToBuffer(_screen->_curPage, x, y, width, height, obj->background);
+ _screen->copyRegionToBuffer(_screen->_curPage, x << 3, y, width << 3, height, obj->background);
}
}
@@ -373,24 +373,24 @@ void ScreenAnimator::copyChangedObjectsForward(int refreshFlag) {
if (curObject->active) {
if (curObject->refreshFlag || refreshFlag) {
int xpos = 0, ypos = 0, width = 0, height = 0;
- xpos = curObject->x1 - curObject->width2 - 8;
+ xpos = (curObject->x1>>3) - (curObject->width2>>3) - 1;
ypos = curObject->y1 - curObject->height2;
- width = (curObject->width<<3) + curObject->width2 + 16;
+ width = curObject->width + (curObject->width2>>3) + 2;
height = curObject->height + curObject->height2*2;
- if (xpos < 8) {
- xpos = 8;
- } else if (xpos + width > 312) {
- width = 312 - xpos;
+ if (xpos < 1) {
+ xpos = 1;
+ } else if (xpos + width > 39) {
+ width = width - (xpos + width - 39);
}
if (ypos < 8) {
ypos = 8;
- } else if (ypos + height > 136) {
- height = 136 - ypos;
+ } else if (ypos + height > 135) {
+ height = height - (ypos + height - 136);
}
- _screen->copyRegion(xpos, ypos, xpos, ypos, width, height, 2, 0, Screen::CR_CLIPPED);
+ _screen->copyRegion(xpos << 3, ypos, xpos << 3, ypos, width << 3, height, 2, 0, Screen::CR_CLIPPED);
curObject->refreshFlag = 0;
_updateScreen = true;
}
diff --git a/engines/kyra/scene.cpp b/engines/kyra/scene.cpp
index 6fbbe2dcbe..ebf6bdc464 100644
--- a/engines/kyra/scene.cpp
+++ b/engines/kyra/scene.cpp
@@ -777,7 +777,7 @@ void KyraEngine::initSceneObjectList(int brandonAlive) {
}
curAnimState->height = _sprites->_anims[i].height;
curAnimState->height2 = _sprites->_anims[i].height2;
- curAnimState->width = _sprites->_anims[i].width;
+ curAnimState->width = _sprites->_anims[i].width + 1;
curAnimState->width2 = _sprites->_anims[i].width2;
curAnimState->drawY = _sprites->_anims[i].drawY;
curAnimState->x1 = curAnimState->x2 = _sprites->_anims[i].x;
diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp
index be04c85a9b..313649c276 100644
--- a/engines/kyra/script_v1.cpp
+++ b/engines/kyra/script_v1.cpp
@@ -410,12 +410,12 @@ int KyraEngine::cmd_setScaleMode(ScriptState *script) {
}
int KyraEngine::cmd_openWSAFile(ScriptState *script) {
- debugC(3, kDebugLevelScriptFuncs, "cmd_openWSAFile(%p) ('%s', %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2));
+ debugC(3, kDebugLevelScriptFuncs, "cmd_openWSAFile(%p) ('%s', %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3));
char *filename = stackPosString(0);
int wsaIndex = stackPos(1);
- _movieObjects[wsaIndex]->open(filename, (stackPos(2) != 0) ? 1 : 0, 0);
+ _movieObjects[wsaIndex]->open(filename, (stackPos(3) != 0) ? 1 : 0, 0);
assert(_movieObjects[wsaIndex]->opened());
return 0;
diff --git a/engines/kyra/sprites.cpp b/engines/kyra/sprites.cpp
index 6e95b5ff30..0407c95267 100644
--- a/engines/kyra/sprites.cpp
+++ b/engines/kyra/sprites.cpp
@@ -76,7 +76,7 @@ void Sprites::setupSceneAnims() {
_anims[i].unk2 = READ_LE_UINT16(data);
data += 4;
- if (_engine->_northExitHeight > READ_LE_UINT16(data))
+ if (_engine->_northExitHeight & 0xFF > READ_LE_UINT16(data))
_anims[i].drawY = _engine->_northExitHeight;
else
_anims[i].drawY = READ_LE_UINT16(data);
@@ -108,13 +108,13 @@ void Sprites::setupSceneAnims() {
_anims[i].script = data;
- int bkgdWidth = _anims[i].width << 3;
+ int bkgdWidth = _anims[i].width;
int bkgdHeight = _anims[i].height;
- if (_anims[i].width2)
- bkgdWidth += _anims[i].width2 << 3;
+ if (_anims[i].width2 > 0)
+ bkgdWidth += (_anims[i].width2 >> 3) + 1;
- if (_anims[i].height2)
+ if (_anims[i].height2 > 0)
bkgdHeight += _anims[i].height2;
_anims[i].background = (uint8 *)malloc(_screen->getRectSize(bkgdWidth + 1, bkgdHeight));