From ca2209cb5fd3c9548946d69cc7444431d3cce863 Mon Sep 17 00:00:00 2001 From: Kawa Date: Sun, 2 Dec 2018 21:56:19 +0100 Subject: SCI: Add support for The Dating Pool (#1403) --- engines/sci/engine/kernel.cpp | 3 +++ engines/sci/engine/kernel.h | 2 ++ engines/sci/engine/kernel_tables.h | 7 ++++++- engines/sci/engine/kgraphics.cpp | 29 +++++++++++++++++++++++++++++ engines/sci/engine/kmisc.cpp | 23 +++++++++++++++++++++-- 5 files changed, 61 insertions(+), 3 deletions(-) (limited to 'engines/sci/engine') diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index e828db6f40..29d16ab753 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -781,6 +781,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) { + _kernelNames[0x7b] = "RemapColorsKawa"; + _kernelNames[0x89] = "KawaHacks"; } _kernelNames[0x71] = "PalVary"; diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 404aa5af67..bac0e9e375 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -406,10 +406,12 @@ reg_t kTextColors(EngineState *s, int argc, reg_t *argv); reg_t kTextFonts(EngineState *s, int argc, reg_t *argv); reg_t kShow(EngineState *s, int argc, reg_t *argv); reg_t kRemapColors(EngineState *s, int argc, reg_t *argv); +reg_t kRemapColorsKawa(EngineState *s, int argc, reg_t *argv); reg_t kDummy(EngineState *s, int argc, reg_t *argv); 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); #ifdef ENABLE_SCI32 // SCI2 Kernel Functions diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index 547c5c3683..47786e5ada 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -780,6 +780,7 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_CALL(Random), SIG_EVERYWHERE, "(i)(i)", NULL, kRandom_workarounds }, { MAP_CALL(ReadNumber), SIG_EVERYWHERE, "r", NULL, kReadNumber_workarounds }, { MAP_CALL(RemapColors), SIG_SCI11, SIGFOR_ALL, "i(i)(i)(i)(i)", NULL, NULL }, + { MAP_CALL(RemapColorsKawa), SIG_SCI11, SIGFOR_ALL, "i(i)(i)(i)(i)(i)", NULL, NULL }, #ifdef ENABLE_SCI32 { "RemapColors", kRemapColors32, SIG_SCI32, SIGFOR_ALL, "i(i)(i)(i)(i)(i)", kRemapColors_subops, NULL }, #endif @@ -863,6 +864,8 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_DUMMY(Record), SIG_EVERYWHERE, "(.*)", NULL, NULL }, { MAP_DUMMY(PlayBack), SIG_EVERYWHERE, "(.*)", NULL, NULL }, { MAP_DUMMY(DbugStr), SIG_EVERYWHERE, "(.*)", NULL, NULL }, + // Used in Kawa's SCI11+ + { MAP_CALL(KawaHacks), SIG_SCI11, SIGFOR_ALL, "(.*)", NULL, NULL }, // ======================================================================================================= @@ -1181,7 +1184,9 @@ static const char *const s_defaultKernelNames[] = { /*0x85*/ "ShowMovie", /*0x86*/ "SetVideoMode", /*0x87*/ "SetQuitStr", - /*0x88*/ "DbugStr" // for debugging + /*0x88*/ "DbugStr", // for debugging + /*0x89*/ "Empty", + /*0x8a*/ "Empty" }; #ifdef ENABLE_SCI32 diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 3c23cd515f..ee9212bd47 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -1278,4 +1278,33 @@ reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } +// Later SCI32-style kRemapColors, but in SCI11+. +reg_t kRemapColorsKawa(EngineState *s, int argc, reg_t *argv) { + uint16 operation = argv[0].toUint16(); + + switch (operation) { + case 0: // off + break; + case 1: { // remap by percent + uint16 from = argv[1].toUint16(); + uint16 percent = argv[2].toUint16(); + g_sci->_gfxRemap16->resetRemapping(); + g_sci->_gfxRemap16->setRemappingPercent(from, percent); + } + break; + case 2: { // remap by range + uint16 from = argv[1].toUint16(); + uint16 to = argv[2].toUint16(); + uint16 base = argv[3].toUint16(); + g_sci->_gfxRemap16->resetRemapping(); + g_sci->_gfxRemap16->setRemappingRange(254, from, to, base); + } + break; + default: + error("Unsupported SCI32-style kRemapColors(%d) has been called", operation); + break; + } + return s->r_acc; +} + } // End of namespace Sci diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 92a9cfaf8b..f8b41a2b71 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -629,6 +629,8 @@ reg_t kPlatform(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } +extern void showScummVMDialog(const Common::String &message); + #ifdef ENABLE_SCI32 reg_t kPlatform32(EngineState *s, int argc, reg_t *argv) { enum Operation { @@ -693,8 +695,6 @@ reg_t kWinExec(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } -extern void showScummVMDialog(const Common::String &message); - reg_t kWinDLL(EngineState *s, int argc, reg_t *argv) { uint16 operation = argv[0].toUint16(); Common::String dllName = s->_segMan->getString(argv[1]); @@ -726,6 +726,25 @@ reg_t kWinDLL(EngineState *s, int argc, reg_t *argv) { #endif +reg_t kKawaHacks(EngineState *s, int argc, reg_t *argv) { + switch (argv[0].toUint16()) { + case 0: { // DoAlert + 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 + // 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 NULL_REG; +} + reg_t kEmpty(EngineState *s, int argc, reg_t *argv) { // Placeholder for empty kernel functions which are still called from the // engine scripts (like the empty kSetSynonyms function in SCI1.1). This -- cgit v1.2.3