aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2008-04-16 22:23:09 +0000
committerJohannes Schickel2008-04-16 22:23:09 +0000
commitb2a586acb2a4917e822a59f7cb246231b0b81329 (patch)
tree8a8755e58e146fab2c91ad82d8c1ba0b42356f63 /engines
parente463ac03672630e997b68408590cc86887449765 (diff)
downloadscummvm-rg350-b2a586acb2a4917e822a59f7cb246231b0b81329.tar.gz
scummvm-rg350-b2a586acb2a4917e822a59f7cb246231b0b81329.tar.bz2
scummvm-rg350-b2a586acb2a4917e822a59f7cb246231b0b81329.zip
Fixed shape drawing in HoF (regression) and Kyra3.
svn-id: r31521
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/scene_v3.cpp2
-rw-r--r--engines/kyra/screen.cpp21
-rw-r--r--engines/kyra/screen.h3
3 files changed, 20 insertions, 6 deletions
diff --git a/engines/kyra/scene_v3.cpp b/engines/kyra/scene_v3.cpp
index 822bf3c8cd..54fb02b4d1 100644
--- a/engines/kyra/scene_v3.cpp
+++ b/engines/kyra/scene_v3.cpp
@@ -358,7 +358,7 @@ void KyraEngine_v3::loadSceneMsc() {
_maskPageMinY = minY;
_maskPageMaxY = minY + height - 1;
- _screen->setShapePages(3, 5);
+ _screen->setShapePages(5, 3, _maskPageMinY, _maskPageMaxY);
musicUpdate(0);
_screen->loadBitmap(filename, 5, 5, 0, true);
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 9f0c58e4a6..a460a73456 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -1111,7 +1111,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
_dsTable = va_arg(args, uint8*);
_dsTableLoopCount = va_arg(args, int);
if (!_dsTableLoopCount)
- flags &= 0xFFFFFEFF;
+ flags &= ~0x100;
}
if (flags & 0x1000) {
@@ -1205,6 +1205,9 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
int ppc = (flags >> 8) & 0x3F;
_dsPlot = dsPlotFunc[ppc];
+ DsPlotFunc dsPlot2 = dsPlotFunc[ppc], dsPlot3 = dsPlotFunc[ppc];
+ if (flags & 0x800)
+ dsPlot3 = dsPlotFunc[((flags >> 8) & 0xF7) & 0x3F];
if (!_dsPlot) {
warning("Missing drawShape plotting method type %d", ppc);
@@ -1212,6 +1215,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
return;
}
+ int curY = y;
const uint8 *src = shapeData;
uint8 *dst = _dsDstPage = getPagePtr(pageNum);
@@ -1257,7 +1261,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
uint16 frameSize = READ_LE_UINT16(src); src += 2;
- int colorTableColors = ((_vm->gameFlags().gameID != GI_KYRA2) && (shapeFlags & 4)) ? *src++ : 16;
+ int colorTableColors = ((_vm->gameFlags().gameID != GI_KYRA1) && (shapeFlags & 4)) ? *src++ : 16;
if (!(flags & 0x8000) && (shapeFlags & 1))
_dsTable2 = src;
@@ -1370,6 +1374,12 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
uint8 *d = dst;
while (shapeHeight--) {
+ ++curY;
+
+ bool normalPlot = true;
+ if (flags & 0x800)
+ normalPlot = (curY > _maskMinY && curY < _maskMaxY);
+
while (!(scaleCounterV & 0xff00)) {
scaleCounterV += _dsScaleH;
if (!(scaleCounterV & 0xff00)) {
@@ -1389,6 +1399,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
if (_dsTmpWidth) {
cnt += shpWidthScaled1;
if (cnt > 0) {
+ _dsPlot = normalPlot ? dsPlot2 : dsPlot3;
(this->*_dsProcessLine)(d, s, cnt, scaleState);
}
cnt += _dsOffscreenRight;
@@ -2360,10 +2371,12 @@ bool Screen::isMouseVisible() const {
return _mouseLockCount == 0;
}
-void Screen::setShapePages(int page1, int page2) {
- debugC(9, kDebugLevelScreen, "Screen::setShapePages(%d, %d)", page1, page2);
+void Screen::setShapePages(int page1, int page2, int minY, int maxY) {
+ debugC(9, kDebugLevelScreen, "Screen::setShapePages(%d, %d)", page1, page2, minY, maxY);
_shapePages[0] = _pagePtrs[page1];
_shapePages[1] = _pagePtrs[page2];
+ _maskMinY = minY;
+ _maskMaxY = maxY;
}
void Screen::setMouseCursor(int x, int y, byte *shape) {
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index a0403e6c68..4ae66fbb64 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -200,7 +200,7 @@ public:
void setAnimBlockPtr(int size);
- void setShapePages(int page1, int page2);
+ void setShapePages(int page1, int page2, int minY = -1, int maxY = 321);
byte getShapeFlag1(int x, int y);
byte getShapeFlag2(int x, int y);
@@ -216,6 +216,7 @@ public:
int _curPage;
uint8 *_currentPalette;
uint8 *_shapePages[2];
+ int _maskMinY, _maskMaxY;
FontId _currentFont;
bool _disableScreen;