aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/graphics/controls.cpp18
-rw-r--r--engines/sci/graphics/paint16.cpp19
-rw-r--r--engines/sci/graphics/paint16.h1
3 files changed, 37 insertions, 1 deletions
diff --git a/engines/sci/graphics/controls.cpp b/engines/sci/graphics/controls.cpp
index 2570b4cb33..80670020df 100644
--- a/engines/sci/graphics/controls.cpp
+++ b/engines/sci/graphics/controls.cpp
@@ -251,7 +251,15 @@ int GfxControls::getPicNotValid() {
}
void GfxControls::kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite) {
+ int16 sci0EarlyPen, sci0EarlyBack;
if (!hilite) {
+ if (getSciVersion() == SCI_VERSION_0_EARLY) {
+ // SCI0early actually used hardcoded green/black buttons instead of using the port colors
+ sci0EarlyPen = _ports->_curPort->penClr;
+ sci0EarlyBack = _ports->_curPort->backClr;
+ _ports->penColor(0);
+ _ports->backColor(2);
+ }
rect.grow(1);
_paint16->eraseRect(rect);
_paint16->frameRect(rect);
@@ -266,8 +274,16 @@ void GfxControls::kernelDrawButton(Common::Rect rect, reg_t obj, const char *tex
rect.grow(1);
_paint16->bitsShow(rect);
}
+ if (getSciVersion() == SCI_VERSION_0_EARLY) {
+ _ports->penColor(sci0EarlyPen);
+ _ports->backColor(sci0EarlyBack);
+ }
} else {
- _paint16->invertRect(rect);
+ // SCI0early used xor to invert button rectangles resulting in pink/white buttons
+ if (getSciVersion() == SCI_VERSION_0_EARLY)
+ _paint16->invertRectViaXOR(rect);
+ else
+ _paint16->invertRect(rect);
_paint16->bitsShow(rect);
}
}
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index 90c68c4e5f..a769ca4314 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -182,6 +182,25 @@ void GfxPaint16::invertRect(const Common::Rect &rect) {
_ports->_curPort->penMode = oldpenmode;
}
+// used in SCI0early exclusively
+void GfxPaint16::invertRectViaXOR(const Common::Rect &rect) {
+ Common::Rect r = rect;
+ int16 x, y;
+ byte curVisual;
+
+ r.clip(_ports->_curPort->rect);
+ if (r.isEmpty()) // nothing to invert
+ return;
+
+ _ports->offsetRect(r);
+ for (y = r.top; y < r.bottom; y++) {
+ for (x = r.left; x < r.right; x++) {
+ curVisual = _screen->getVisual(x, y);
+ _screen->putPixel(x, y, SCI_SCREEN_MASK_VISUAL, curVisual ^ 0x0f, 0, 0);
+ }
+ }
+}
+
void GfxPaint16::eraseRect(const Common::Rect &rect) {
fillRect(rect, SCI_SCREEN_MASK_VISUAL, _ports->_curPort->backClr);
}
diff --git a/engines/sci/graphics/paint16.h b/engines/sci/graphics/paint16.h
index f962c6e02a..b18c879387 100644
--- a/engines/sci/graphics/paint16.h
+++ b/engines/sci/graphics/paint16.h
@@ -60,6 +60,7 @@ public:
void clearScreen(byte color = 255);
void invertRect(const Common::Rect &rect);
+ 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);