aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics
diff options
context:
space:
mode:
authorKawa2018-12-02 21:56:19 +0100
committerFilippos Karapetis2018-12-02 22:56:19 +0200
commitca2209cb5fd3c9548946d69cc7444431d3cce863 (patch)
treef481787dc05e169213fce48d13ce28e02d9709fb /engines/sci/graphics
parentbbbd40477d1afe62df63b222193e016d1e9fdd7d (diff)
downloadscummvm-rg350-ca2209cb5fd3c9548946d69cc7444431d3cce863.tar.gz
scummvm-rg350-ca2209cb5fd3c9548946d69cc7444431d3cce863.tar.bz2
scummvm-rg350-ca2209cb5fd3c9548946d69cc7444431d3cce863.zip
SCI: Add support for The Dating Pool (#1403)
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r--engines/sci/graphics/paint16.cpp40
-rw-r--r--engines/sci/graphics/paint16.h6
-rw-r--r--engines/sci/graphics/view.cpp10
-rw-r--r--engines/sci/graphics/view.h4
4 files changed, 46 insertions, 14 deletions
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index aac922d278..80349f119a 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -80,7 +80,7 @@ void GfxPaint16::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mi
}
// This one is the only one that updates screen!
-void GfxPaint16::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) {
+void GfxPaint16::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY, uint16 scaleSignal) {
GfxView *view = _cache->getView(viewId);
Common::Rect celRect;
@@ -90,7 +90,7 @@ void GfxPaint16::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo,
celRect.right = celRect.left + view->getWidth(loopNo, celNo);
celRect.bottom = celRect.top + view->getHeight(loopNo, celNo);
- drawCel(view, loopNo, celNo, celRect, priority, paletteNo, scaleX, scaleY);
+ drawCel(view, loopNo, celNo, celRect, priority, paletteNo, scaleX, scaleY, scaleSignal);
if (getSciVersion() >= SCI_VERSION_1_1) {
if (!_screen->_picNotValidSci11) {
@@ -104,12 +104,12 @@ void GfxPaint16::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo,
}
// This version of drawCel is not supposed to call BitsShow()!
-void GfxPaint16::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) {
- drawCel(_cache->getView(viewId), loopNo, celNo, celRect, priority, paletteNo, scaleX, scaleY);
+void GfxPaint16::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY, uint16 scaleSignal) {
+ drawCel(_cache->getView(viewId), loopNo, celNo, celRect, priority, paletteNo, scaleX, scaleY, scaleSignal);
}
// This version of drawCel is not supposed to call BitsShow()!
-void GfxPaint16::drawCel(GfxView *view, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) {
+void GfxPaint16::drawCel(GfxView *view, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY, uint16 scaleSignal) {
Common::Rect clipRect = celRect;
clipRect.clip(_ports->_curPort->rect);
if (clipRect.isEmpty()) // nothing to draw
@@ -118,9 +118,9 @@ void GfxPaint16::drawCel(GfxView *view, int16 loopNo, int16 celNo, const Common:
Common::Rect clipRectTranslated = clipRect;
_ports->offsetRect(clipRectTranslated);
if (scaleX == 128 && scaleY == 128)
- view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, false);
+ view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, false, scaleSignal);
else
- view->drawScaled(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, scaleX, scaleY);
+ view->drawScaled(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, scaleX, scaleY, scaleSignal);
}
// This is used as replacement for drawCelAndShow() when hires-cels are drawn to
@@ -472,6 +472,7 @@ void GfxPaint16::kernelGraphRedrawBox(Common::Rect rect) {
#define SCI_DISPLAY_SAVEUNDER 107
#define SCI_DISPLAY_RESTOREUNDER 108
#define SCI_DISPLAY_DONTSHOWBITS 121
+#define SCI_DISPLAY_SETSTROKE 122
reg_t GfxPaint16::kernelDisplay(const char *text, uint16 languageSplitter, int argc, reg_t *argv) {
reg_t displayArg;
@@ -480,6 +481,7 @@ reg_t GfxPaint16::kernelDisplay(const char *text, uint16 languageSplitter, int a
bool doSaveUnder = false;
Common::Rect rect;
reg_t result = NULL_REG;
+ int16 stroke = 0; // Kawa's SCI11+
// Make a "backup" of the port settings (required for some SCI0LATE and
// SCI01+ only)
@@ -539,6 +541,10 @@ reg_t GfxPaint16::kernelDisplay(const char *text, uint16 languageSplitter, int a
case SCI_DISPLAY_DONTSHOWBITS:
bRedraw = 0;
break;
+ case SCI_DISPLAY_SETSTROKE: // From Kawa's SCI11+
+ stroke = argv[0].toUint16();
+ argc--; argv++;
+ break;
default:
SciCallOrigin originReply;
@@ -563,10 +569,30 @@ reg_t GfxPaint16::kernelDisplay(const char *text, uint16 languageSplitter, int a
rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop);
}
+ // Kawa's SCI11+
+ if (stroke)
+ rect.grow(1);
+
if (doSaveUnder)
result = bitsSave(rect, GFX_SCREEN_MASK_VISUAL);
if (colorBack != -1)
fillRect(rect, GFX_SCREEN_MASK_VISUAL, colorBack, 0, 0);
+
+ // Kawa's SCI11+
+ if (stroke) {
+ _ports->penColor(0);
+ rect.translate(1, 0); if (stroke & 1) _text16->Box(text, languageSplitter, false, rect, alignment, -1); // right
+ rect.translate(0, 1); if (stroke & 2) _text16->Box(text, languageSplitter, false, rect, alignment, -1); // bottom right
+ rect.translate(-1, 0); if (stroke & 4) _text16->Box(text, languageSplitter, false, rect, alignment, -1); // bottom
+ rect.translate(-1, 0); if (stroke & 8) _text16->Box(text, languageSplitter, false, rect, alignment, -1); // bottom left
+ rect.translate(0, -1); if (stroke & 16) _text16->Box(text, languageSplitter, false, rect, alignment, -1); // left
+ rect.translate(0, -1); if (stroke & 32) _text16->Box(text, languageSplitter, false, rect, alignment, -1); // top left
+ rect.translate(1, 0); if (stroke & 64) _text16->Box(text, languageSplitter, false, rect, alignment, -1); // top
+ rect.translate(1, 0); if (stroke & 128) _text16->Box(text, languageSplitter, false, rect, alignment, -1); // top right
+ rect.translate(-1, 1); // and back to center
+ _ports->penColor(colorPen);
+ }
+
_text16->Box(text, languageSplitter, false, rect, alignment, -1);
if (_screen->_picNotValid == 0 && bRedraw)
bitsShow(rect);
diff --git a/engines/sci/graphics/paint16.h b/engines/sci/graphics/paint16.h
index 6fc9cbbdfc..db19efa261 100644
--- a/engines/sci/graphics/paint16.h
+++ b/engines/sci/graphics/paint16.h
@@ -44,9 +44,9 @@ public:
void debugSetEGAdrawingVisualize(bool state);
void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId);
- void drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
- void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
- void drawCel(GfxView *view, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
+ void drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128, uint16 scaleSignal = 0);
+ void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128, uint16 scaleSignal = 0);
+ void drawCel(GfxView *view, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128, uint16 scaleSignal = 0);
void drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, reg_t upscaledHiresHandle, uint16 scaleX = 128, uint16 scaleY = 128);
void clearScreen(byte color = 255);
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 319e3ac4fb..9ed08cee1b 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -776,7 +776,7 @@ void GfxView::unditherBitmap(SciSpan<byte> &bitmapPtr, int16 width, int16 height
}
void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated,
- int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires) {
+ int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires, uint16 scaleSignal) {
const Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette;
const CelInfo *celInfo = getCelInfo(loopNo, celNo);
const SciSpan<const byte> &bitmap = getBitmap(loopNo, celNo);
@@ -832,6 +832,9 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
// SCI16 remapping (QFG4 demo)
if (g_sci->_gfxRemap16 && g_sci->_gfxRemap16->isRemapped(outputColor))
outputColor = g_sci->_gfxRemap16->remapColor(outputColor, _screen->getVisual(x2, y2));
+ // SCI16+ remapping (Catdate)
+ if ((scaleSignal & 0x200) && g_sci->_gfxRemap16 && !g_sci->_gfxRemap16->isRemapped(outputColor))
+ outputColor = g_sci->_gfxRemap16->remapColor(253, outputColor);
_screen->putPixel(x2, y2, drawMask, outputColor, priority, 0);
}
}
@@ -846,7 +849,7 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
* matter because the scaled cel rect is definitely the same as in sierra sci.
*/
void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated,
- int16 loopNo, int16 celNo, byte priority, int16 scaleX, int16 scaleY) {
+ int16 loopNo, int16 celNo, byte priority, int16 scaleX, int16 scaleY, uint16 scaleSignal) {
const Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette;
const CelInfo *celInfo = getCelInfo(loopNo, celNo);
const SciSpan<const byte> &bitmap = getBitmap(loopNo, celNo);
@@ -923,6 +926,9 @@ void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect,
// SCI16 remapping (QFG4 demo)
if (g_sci->_gfxRemap16 && g_sci->_gfxRemap16->isRemapped(outputColor))
outputColor = g_sci->_gfxRemap16->remapColor(outputColor, _screen->getVisual(x2, y2));
+ // SCI16+ remapping (Catdate)
+ if ((scaleSignal & 0x200) && g_sci->_gfxRemap16 && !g_sci->_gfxRemap16->isRemapped(outputColor))
+ outputColor = g_sci->_gfxRemap16->remapColor(253, outputColor);
_screen->putPixel(x2, y2, drawMask, outputColor, priority, 0);
}
}
diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h
index 5ecf7e6fa3..1876567013 100644
--- a/engines/sci/graphics/view.h
+++ b/engines/sci/graphics/view.h
@@ -70,8 +70,8 @@ public:
void getCelSpecialHoyle4Rect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const;
void getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, Common::Rect &outRect) const;
const SciSpan<const byte> &getBitmap(int16 loopNo, int16 celNo);
- void draw(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires);
- void drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated, int16 loopNo, int16 celNo, byte priority, int16 scaleX, int16 scaleY);
+ void draw(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires, uint16 scaleSignal = 0);
+ void drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated, int16 loopNo, int16 celNo, byte priority, int16 scaleX, int16 scaleY, uint16 scaleSignal = 0);
uint16 getLoopCount() const { return _loop.size(); }
uint16 getCelCount(int16 loopNo) const;
Palette *getPalette();