aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorKawa2019-06-23 00:46:53 +0200
committerFilippos Karapetis2019-06-23 01:46:53 +0300
commit9aadb2726732e1fcd517088bdcaff60a8a49710d (patch)
tree75a2b0d25058ad47cf8bd523ffa471dc1b3900f7 /engines
parent536db4d7e72a0c775be4fbab5d560f8012b019c1 (diff)
downloadscummvm-rg350-9aadb2726732e1fcd517088bdcaff60a8a49710d.tar.gz
scummvm-rg350-9aadb2726732e1fcd517088bdcaff60a8a49710d.tar.bz2
scummvm-rg350-9aadb2726732e1fcd517088bdcaff60a8a49710d.zip
SCI: Add some more SCI11+ features
Also gate them behind the presence of a 184.VOC resource instead of GID_CATDATE. This should not matter with regards to the remap effects -- the 2015 and 2016 demos had none, and the first that did has an unknown release status. Only the 2017 demo would fall, which would be easily fixed by dropping in a valid 184.VOC patch file.
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kernel.cpp3
-rw-r--r--engines/sci/engine/kernel.h1
-rw-r--r--engines/sci/engine/kernel_tables.h1
-rw-r--r--engines/sci/engine/kmisc.cpp29
-rw-r--r--engines/sci/graphics/view.cpp20
-rw-r--r--engines/sci/sci.cpp2
6 files changed, 44 insertions, 12 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index d75c910d30..ab332511d7 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -775,8 +775,9 @@ void Kernel::loadKernelNames(GameFeatures *features) {
_kernelNames[0x84] = "ShowMovie";
} else if (g_sci->getGameId() == GID_QFG4DEMO) {
_kernelNames[0x7b] = "RemapColors"; // QFG4 Demo has this SCI2 function instead of StrSplit
- } else if (g_sci->getGameId() == GID_CATDATE) {
+ } else if (_resMan->testResource(ResourceId(kResourceTypeVocab, 184))) {
_kernelNames[0x7b] = "RemapColorsKawa";
+ _kernelNames[0x88] = "KawaDbugStr";
_kernelNames[0x89] = "KawaHacks";
}
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index a27df1ad08..c1cce33e5d 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -408,6 +408,7 @@ reg_t kEmpty(EngineState *s, int argc, reg_t *argv);
reg_t kStub(EngineState *s, int argc, reg_t *argv);
reg_t kStubNull(EngineState *s, int argc, reg_t *argv);
reg_t kKawaHacks(EngineState *s, int argc, reg_t *argv);
+reg_t kKawaDbugStr(EngineState *s, int argc, reg_t *argv);
#ifdef ENABLE_SCI32
// SCI2 Kernel Functions
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 4d2b3b4108..f0ad559ba5 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -866,6 +866,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_DUMMY(PlayBack), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_DUMMY(DbugStr), SIG_EVERYWHERE, "(.*)", NULL, NULL },
// Used in Kawa's SCI11+
+ { MAP_CALL(KawaDbugStr), SIG_SCI11, SIGFOR_ALL, "(.*)", NULL, NULL },
{ MAP_CALL(KawaHacks), SIG_SCI11, SIGFOR_ALL, "(.*)", NULL, NULL },
// =======================================================================================================
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 848cf189e6..72e2028559 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -30,6 +30,7 @@
#include "sci/engine/kernel.h"
#include "sci/engine/gc.h"
#include "sci/graphics/cursor.h"
+#include "sci/graphics/palette.h"
#ifdef ENABLE_SCI32
#include "sci/graphics/cursor32.h"
#endif
@@ -731,18 +732,34 @@ reg_t kKawaHacks(EngineState *s, int argc, reg_t *argv) {
showScummVMDialog(s->_segMan->getString(argv[1]));
return NULL_REG;
}
- case 1: // ZaWarudo
- // Unused, would invert the color palette for the specified range.
- return NULL_REG;
- case 2: // SetTitleColors
+ case 1: { // ZaWarudo
+ // Invert the color palette for the specified range.
+ uint16 from = argv[1].toUint16();
+ uint16 to = argv[2].toUint16();
+ Palette pal = g_sci->_gfxPalette16->_sysPalette;
+ for (uint16 i = from; i <= to; i++)
+ {
+ pal.colors[i].r = 255 - pal.colors[i].r;
+ pal.colors[i].g = 255 - pal.colors[i].g;
+ pal.colors[i].b = 255 - pal.colors[i].b;
+ }
+ g_sci->_gfxPalette16->set(&pal, true);
+ return NULL_REG;
+ }
+ case 2: // SetTitleColors
// Unused, would change the colors for plain windows' title bars.
return NULL_REG;
case 3: // IsDebug
- // Should return 1 if running with an internal debugger, 2 if we have AddMenu support, 3 if both.
- return TRUE_REG;
+ // Return 1 if running with an internal debugger, 2 if we have AddMenu support, 3 if both.
+ return make_reg(0, 3);
}
return NULL_REG;
}
+reg_t kKawaDbugStr(EngineState *s, int argc, reg_t *argv)
+{
+ debug(Common::String::format(s->_segMan->getString(argv[0]).c_str(), argc - 1, argv + 1).c_str());
+ return NULL_REG;
+}
reg_t kEmpty(EngineState *s, int argc, reg_t *argv) {
// Placeholder for empty kernel functions which are still called from the
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 5924571660..c387a58573 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -838,8 +838,14 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
if (g_sci->_gfxRemap16 && g_sci->_gfxRemap16->isRemapped(outputColor))
outputColor = g_sci->_gfxRemap16->remapColor(outputColor, _screen->getVisual(x2, y2));
// SCI11+ remapping (Catdate)
- if ((scaleSignal & 0x200) && g_sci->_gfxRemap16)
- outputColor = g_sci->_gfxRemap16->remapColor(253, outputColor);
+ if ((scaleSignal & 0xFF00) && g_sci->_gfxRemap16 && _resMan->testResource(ResourceId(kResourceTypeVocab, 184))) {
+ if ((scaleSignal >> 8) == 1) // all black
+ outputColor = 0;
+ else if ((scaleSignal >> 8) == 2) // darken
+ outputColor = g_sci->_gfxRemap16->remapColor(253, outputColor);
+ else if ((scaleSignal >> 8) == 3) // shadow
+ outputColor = g_sci->_gfxRemap16->remapColor(253, _screen->getVisual(x2, y2));
+ }
_screen->putPixel(x2, y2, drawMask, outputColor, priority, 0);
}
}
@@ -932,8 +938,14 @@ void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect,
if (g_sci->_gfxRemap16 && g_sci->_gfxRemap16->isRemapped(outputColor))
outputColor = g_sci->_gfxRemap16->remapColor(outputColor, _screen->getVisual(x2, y2));
// SCI11+ remapping (Catdate)
- if ((scaleSignal & 0x200) && g_sci->_gfxRemap16)
- outputColor = g_sci->_gfxRemap16->remapColor(253, outputColor);
+ if ((scaleSignal & 0xFF00) && g_sci->_gfxRemap16 && _resMan->testResource(ResourceId(kResourceTypeVocab, 184))) {
+ if ((scaleSignal >> 8) == 1) // all black
+ outputColor = 0;
+ else if ((scaleSignal >> 8) == 2) // darken
+ outputColor = g_sci->_gfxRemap16->remapColor(253, outputColor);
+ else if ((scaleSignal >> 8) == 3) // shadow
+ outputColor = g_sci->_gfxRemap16->remapColor(253, _screen->getVisual(x2, y2));
+ }
_screen->putPixel(x2, y2, drawMask, outputColor, priority, 0);
}
}
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 01d44da025..428c914a0d 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -590,7 +590,7 @@ void SciEngine::initGraphics() {
} else {
#endif
_gfxPalette16 = new GfxPalette(_resMan, _gfxScreen);
- if (getGameId() == GID_QFG4DEMO || getGameId() == GID_CATDATE)
+ if (getGameId() == GID_QFG4DEMO || _resMan->testResource(ResourceId(kResourceTypeVocab, 184)))
_gfxRemap16 = new GfxRemap(_gfxPalette16);
#ifdef ENABLE_SCI32
}