aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2010-08-11 18:19:58 +0000
committerMartin Kiewitz2010-08-11 18:19:58 +0000
commit0c7932cc7cd54ea8fdee9d12663657d67eaa7639 (patch)
tree4cbcbaa6b0cad23f7099f2fead06b08d55c8aa22 /engines
parent38f34465b720272586d3df41ef23f9b03d72945c (diff)
downloadscummvm-rg350-0c7932cc7cd54ea8fdee9d12663657d67eaa7639.tar.gz
scummvm-rg350-0c7932cc7cd54ea8fdee9d12663657d67eaa7639.tar.bz2
scummvm-rg350-0c7932cc7cd54ea8fdee9d12663657d67eaa7639.zip
SCI: fixing kGraphFillBoxAny implementation
working now like in sierra sci, when using priority/control - fixes pepper adventures in time - no failure screen - bug #3040185 cleanup of GfxPaint16::fillRect svn-id: r51994
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kgraphics.cpp4
-rw-r--r--engines/sci/graphics/paint16.cpp20
-rw-r--r--engines/sci/graphics/paint16.h2
3 files changed, 15 insertions, 11 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index e1e92b1cf9..a3f7a90da3 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -300,8 +300,8 @@ reg_t kGraphFillBoxAny(EngineState *s, int argc, reg_t *argv) {
Common::Rect rect = getGraphRect(argv);
int16 colorMask = argv[4].toUint16();
int16 color = argv[5].toSint16();
- int16 priority = (argc > 6) ? argv[6].toSint16() : -1;
- int16 control = (argc > 7) ? argv[7].toSint16() : -1;
+ int16 priority = argv[6].toSint16(); // yes, we may read from stack sometimes here
+ int16 control = argv[7].toSint16(); // sierra did the same
g_sci->_gfxPaint16->kernelGraphFillBox(rect, colorMask, color, priority, control);
return s->r_acc;
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index 4551e9dafc..6e7da7c4dd 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -221,7 +221,7 @@ void GfxPaint16::paintRect(const Common::Rect &rect) {
fillRect(rect, GFX_SCREEN_MASK_VISUAL, _ports->_curPort->penClr);
}
-void GfxPaint16::fillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen, byte clrBack, byte bControl) {
+void GfxPaint16::fillRect(const Common::Rect &rect, int16 drawFlags, byte color, byte priority, byte control) {
Common::Rect r = rect;
r.clip(_ports->_curPort->rect);
if (r.isEmpty()) // nothing to fill
@@ -238,17 +238,17 @@ void GfxPaint16::fillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen
for (y = r.top; y < r.bottom; y++) {
for (x = r.left; x < r.right; x++) {
curVisual = _screen->getVisual(x, y);
- if (curVisual == clrPen) {
- _screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, clrBack, 0, 0);
- } else if (curVisual == clrBack) {
- _screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, clrPen, 0, 0);
+ if (curVisual == color) {
+ _screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, priority, 0, 0);
+ } else if (curVisual == priority) {
+ _screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, color, 0, 0);
}
}
}
- } else { // just fill rect with ClrPen
+ } else { // just fill rect with color
for (y = r.top; y < r.bottom; y++) {
for (x = r.left; x < r.right; x++) {
- _screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, clrPen, 0, 0);
+ _screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, color, 0, 0);
}
}
}
@@ -258,10 +258,14 @@ void GfxPaint16::fillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen
return;
drawFlags &= GFX_SCREEN_MASK_PRIORITY|GFX_SCREEN_MASK_CONTROL;
+ // we need to isolate the bits, sierra sci saved priority and control inside one byte, we don't
+ priority &= 0x0f;
+ control &= 0x0f;
+
if (oldPenMode != 2) {
for (y = r.top; y < r.bottom; y++) {
for (x = r.left; x < r.right; x++) {
- _screen->putPixel(x, y, drawFlags, 0, clrBack, bControl);
+ _screen->putPixel(x, y, drawFlags, 0, priority, control);
}
}
} else {
diff --git a/engines/sci/graphics/paint16.h b/engines/sci/graphics/paint16.h
index e944c71bdd..4f709fd7c6 100644
--- a/engines/sci/graphics/paint16.h
+++ b/engines/sci/graphics/paint16.h
@@ -62,7 +62,7 @@ public:
void invertRectViaXOR(const Common::Rect &rect);
void eraseRect(const Common::Rect &rect);
void paintRect(const Common::Rect &rect);
- void fillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen, byte clrBack = 0, byte bControl = 0);
+ void fillRect(const Common::Rect &rect, int16 drawFlags, byte color, byte priority = 0, byte control = 0);
void frameRect(const Common::Rect &rect);
void bitsShow(const Common::Rect &r);