[Scummvm-git-logs] scummvm branch-2-1 -> 92caa661cf6d5be2c39ac1534d979cedf6bb889f

sluicebox 22204938+sluicebox at users.noreply.github.com
Thu Sep 26 06:38:25 CEST 2019


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f66e19cbf0 SCI32: Add QFG4 character import message box
92caa661cf SCI32: Fix comment typo


Commit: f66e19cbf07cc83cbb9a23bf9b31b0e2a9128e75
    https://github.com/scummvm/scummvm/commit/f66e19cbf07cc83cbb9a23bf9b31b0e2a9128e75
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2019-09-25T21:37:14-07:00

Commit Message:
SCI32: Add QFG4 character import message box

Adds the ScummVM message box explaining saved character files
to the QFG4 import character screen.

Changed paths:
    engines/sci/engine/kgraphics.cpp
    engines/sci/engine/script_patches.cpp
    engines/sci/engine/selector.cpp
    engines/sci/engine/selector.h
    engines/sci/graphics/frameout.cpp
    engines/sci/sci.cpp
    engines/sci/sci.h


diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 7294bb1..e6644b5 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 bd21d5f..72196ad 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 d2f6a14..6fbccb8 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 2c1a34e..fa2df8c 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 99fd8e6..e20166b 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 428c914..09adf73 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 353cf5b..8dd73ef 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();


Commit: 92caa661cf6d5be2c39ac1534d979cedf6bb889f
    https://github.com/scummvm/scummvm/commit/92caa661cf6d5be2c39ac1534d979cedf6bb889f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2019-09-25T21:37:28-07:00

Commit Message:
SCI32: Fix comment typo

Changed paths:
    engines/sci/graphics/frameout.cpp


diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index e20166b..d299f8e 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -269,7 +269,6 @@ 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);
@@ -286,7 +285,7 @@ void GfxFrameout::kernelAddPlane(const reg_t object) {
 		// 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
+		//  disabled then we havent'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");





More information about the Scummvm-git-logs mailing list