diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 7 | ||||
-rw-r--r-- | engines/sci/engine/script_patches.cpp | 22 | ||||
-rw-r--r-- | engines/sci/engine/selector.cpp | 1 | ||||
-rw-r--r-- | engines/sci/engine/selector.h | 1 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 24 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 9 | ||||
-rw-r--r-- | engines/sci/sci.h | 3 |
7 files changed, 39 insertions, 28 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 7294bb1e44..e6644b54bd 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -997,12 +997,7 @@ reg_t kDrawControl(EngineState *s, int argc, reg_t *argv) { if (!changeDirButton.isNull()) { // check if checkDirButton is still enabled, in that case we are called the first time during that room if (!(readSelectorValue(s->_segMan, changeDirButton, SELECTOR(state)) & SCI_CONTROLS_STYLE_DISABLED)) { - showScummVMDialog(_("Characters saved inside ScummVM are shown " - "automatically. Character files saved in the original " - "interpreter need to be put inside ScummVM's saved games " - "directory and a prefix needs to be added depending on which " - "game it was saved in: 'qfg1-' for Quest for Glory 1, 'qfg2-' " - "for Quest for Glory 2. Example: 'qfg2-thief.sav'.")); + g_sci->showQfgImportMessageBox(); } } diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index bd21d5fc5d..72196ad91b 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -9963,27 +9963,6 @@ static const uint16 qfg4BenchmarkPatch[] = { PATCH_END }; -// Disable the Change Directory button on the character import screen as we -// don't allow the game engine to change the directory where character files -// are placed. Character files are only read from our save game directory. -// -// Applies to: All versions -// Responsible method: Heap in script 54 -static const uint16 qfg4ChangeDirectorySignature[] = { - // changeButton - SIG_UINT16(0x0003), // state = 3 [ enabled ] - SIG_ADDTOOFFSET(+38), - SIG_MAGICDWORD, - SIG_UINT16(0xfdde), // view = 64990 - SIG_UINT16(0x0001), // loop = 1 - SIG_END, -}; - -static const uint16 qfg4ChangeDirectoryPatch[] = { - PATCH_UINT16(0x0000), // state = 0 [ disabled ] - PATCH_END -}; - // In room 800, at the start of the game, when automatically sliding down a // slope an error may happen inside Grooper::doit caused by a timing issue. // @@ -14041,7 +14020,6 @@ static const SciScriptPatcherEntry qfg4Signatures[] = { { true, 51, "fix necrotaur blackout", 1, qfg4NecrotaurBlackoutSignature,qfg4NecrotaurBlackoutPatch }, { true, 51, "CD: fix necrotaur capture", 3, qfg4NecrotaurCaptureSignature, qfg4NecrotaurCapturePatch }, { true, 53, "NRS: fix wraith lockup", 1, qfg4WraithLockupNrsSignature, qfg4WraithLockupNrsPatch }, - { true, 54, "disable import change directory button", 1, qfg4ChangeDirectorySignature, qfg4ChangeDirectoryPatch }, { true, 83, "fix incorrect array type", 1, qfg4TrapArrayTypeSignature, qfg4TrapArrayTypePatch }, { true, 140, "fix character selection", 1, qfg4CharacterSelectSignature, qfg4CharacterSelectPatch }, { true, 250, "fix hectapus death lockup", 1, qfg4HectapusDeathSignature, qfg4HectapusDeathPatch }, diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp index d2f6a14797..6fbccb81a3 100644 --- a/engines/sci/engine/selector.cpp +++ b/engines/sci/engine/selector.cpp @@ -236,6 +236,7 @@ void Kernel::mapSelectors() { FIND_SELECTOR(dispose); FIND_SELECTOR(masterVolume); FIND_SELECTOR(setCel); + FIND_SELECTOR(value); #endif } diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h index 2c1a34e938..fa2df8ced6 100644 --- a/engines/sci/engine/selector.h +++ b/engines/sci/engine/selector.h @@ -194,6 +194,7 @@ struct SelectorCache { Selector dispose; // for RAMA save/load save from launcher Selector masterVolume; // for RAMA volume sync Selector setCel; // for RAMA volume sync + Selector value; // for QFG4 import dialog #endif }; diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 99fd8e62cb..e20166b8ee 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -269,6 +269,7 @@ void GfxFrameout::kernelDeleteScreenItem(const reg_t object) { #pragma mark Planes void GfxFrameout::kernelAddPlane(const reg_t object) { + Plane *plane = _planes.findByObject(object); if (plane != nullptr) { plane->update(object); @@ -277,6 +278,29 @@ void GfxFrameout::kernelAddPlane(const reg_t object) { plane = new Plane(object); addPlane(plane); } + + // Detect the QFG4 import character dialog, disable the Change Directory + // button, and display a message box explaining how to import saved + // character files in ScummVM. SCI16 games are handled by kDrawControl. + if (g_sci->inQfGImportRoom()) { + // kAddPlane is called several times, this detects the second call + // which is for the import character dialog. If changeButton:value + // is non-zero then the dialog is initializing. If the button isn't + // disabled then we havne't displayed the message box yet. There + // are multiple changeButtons because the script clones the object. + SegManager *segMan = g_sci->getEngineState()->_segMan; + Common::Array<reg_t> changeDirButtons = _segMan->findObjectsByName("changeButton"); + for (uint i = 0; i < changeDirButtons.size(); ++i) { + if (readSelectorValue(segMan, changeDirButtons[i], SELECTOR(value))) { + // disable Change Directory button by setting state to zero + if (readSelectorValue(segMan, changeDirButtons[i], SELECTOR(state))) { + writeSelectorValue(segMan, changeDirButtons[i], SELECTOR(state), 0); + g_sci->showQfgImportMessageBox(); + break; + } + } + } + } } void GfxFrameout::kernelUpdatePlane(const reg_t object) { diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 428c914a0d..09adf73d3b 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -829,6 +829,15 @@ int SciEngine::inQfGImportRoom() const { return 0; } +void SciEngine::showQfgImportMessageBox() const { + showScummVMDialog(_("Characters saved inside ScummVM are shown " + "automatically. Character files saved in the original " + "interpreter need to be put inside ScummVM's saved games " + "directory and a prefix needs to be added depending on which " + "game it was saved in: 'qfg1-' for Quest for Glory 1, 'qfg2-' " + "for Quest for Glory 2. Example: 'qfg2-thief.sav'.")); +} + void SciEngine::sleep(uint32 msecs) { if (!msecs) { return; diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 353cf5b676..8dd73ef5b3 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -312,6 +312,9 @@ public: */ int inQfGImportRoom() const; + /* Shows a ScummVM message box explaining how to import Qfg saved character files */ + void showQfgImportMessageBox() const; + void sleep(uint32 msecs); void scriptDebug(); |