[Scummvm-git-logs] scummvm master -> 0f1e1894c135f0f7e710e2c8a65dc1a2ea751d17

bgK bastien.bouclet at gmail.com
Sun Feb 9 06:31:36 UTC 2020


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

Summary:
678c9fd532 MOHAWK: RIVEN: Add script patch for the gallows throne hotspot bug
3567c4f159 BASE: Reset the keymapper on RTL with dynamic plugins enabled
0f1e1894c1 GUI: Add the arrow keys to the GUI keymap


Commit: 678c9fd532f746fd815a38d034a8b3e02a4cb450
    https://github.com/scummvm/scummvm/commit/678c9fd532f746fd815a38d034a8b3e02a4cb450
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-02-09T07:29:43+01:00

Commit Message:
MOHAWK: RIVEN: Add script patch for the gallows throne hotspot bug

Changed paths:
    engines/mohawk/riven_card.cpp
    engines/mohawk/riven_card.h


diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index 657936a..08bbc1c 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -88,6 +88,7 @@ void RivenCard::applyPatches(uint16 id) {
 	applyPropertiesPatch22118(globalId);
 	applyPropertiesPatchE2E(globalId);
 	applyPropertiesPatch1518D(globalId);
+	applyPropertiesPatch2B414(globalId);
 }
 
 void RivenCard::applyPropertiesPatch8EB7(uint32 globalId, const Common::String &var, uint16 hotspotId) {
@@ -470,6 +471,100 @@ void RivenCard::applyPropertiesPatch1518D(uint32 globalId) {
 	}
 }
 
+void RivenCard::applyPropertiesPatch2B414(uint32 globalId) {
+	//
+	// When seated in the Jungle Island's gallows control throne,
+	// the right lever opens or closes the gallows' floor.
+	// The issue is that it is possible to click on the position
+	// where the lever would be when the gallow's floor in the
+	// opposite state as it currently is. And thus to trigger the
+	// corresponding sequence. That is to say for example closing
+	// the floor when it is already closed.
+	//
+	// We simply add the missing script instructions to make
+	// the open and close hotspots mutually exclusive.
+	//
+	// Added script part:
+	//   == Script 0 ==
+	//     type: CardLoad
+	//     [...]
+	//   switch (jgallows) {
+	//     case 0:
+	//       activateBLST(1);
+	//       activateBLST(4);
+	//       break;
+	//     case 1:
+	//       activateBLST(2);
+	//       activateBLST(3);
+	//       break;
+	//   }
+	if (globalId == 0x2B414) {
+		HotspotEnableRecord openGallowsEnabled;
+		openGallowsEnabled.index = 1;
+		openGallowsEnabled.hotspotId = 8;
+		openGallowsEnabled.enabled = 1;
+		_hotspotEnableList.push_back(openGallowsEnabled);
+
+		HotspotEnableRecord openGallowsDisabled;
+		openGallowsDisabled.index = 2;
+		openGallowsDisabled.hotspotId = 8;
+		openGallowsDisabled.enabled = 0;
+		_hotspotEnableList.push_back(openGallowsDisabled);
+
+		HotspotEnableRecord closeGallowsEnabled;
+		closeGallowsEnabled.index = 3;
+		closeGallowsEnabled.hotspotId = 9;
+		closeGallowsEnabled.enabled = 1;
+		_hotspotEnableList.push_back(closeGallowsEnabled);
+
+		HotspotEnableRecord closeGallowsDisabled;
+		closeGallowsDisabled.index = 4;
+		closeGallowsDisabled.hotspotId = 9;
+		closeGallowsDisabled.enabled = 0;
+		_hotspotEnableList.push_back(closeGallowsDisabled);
+
+		uint16 jGallowsVariable = _vm->getStack()->getIdFromName(kVariableNames, "jgallows");
+		uint16 patchData[] = {
+		        1, // Command count in script
+		        kRivenCommandSwitch,
+		        2, // Unused
+		        jGallowsVariable,
+		        2, // Branches count
+
+		        0, // jgallows == 0 branch
+		        2, // Command count in sub-script
+
+		        kRivenCommandActivateBLST,
+		        1, // Argument count
+		        openGallowsEnabled.index,
+
+		        kRivenCommandActivateBLST,
+		        1, // Argument count
+		        closeGallowsDisabled.index,
+
+		        1, // jgallows == 1 branch
+		        2, // Command count in sub-script
+
+		        kRivenCommandActivateBLST,
+		        1, // Argument count
+		        openGallowsDisabled.index,
+
+		        kRivenCommandActivateBLST,
+		        1, // Argument count
+		        closeGallowsEnabled.index,
+
+		};
+
+		RivenScriptPtr patchScript = _vm->_scriptMan->readScriptFromData(patchData, ARRAYSIZE(patchData));
+
+		// Append the patch to the existing script
+		RivenScriptPtr loadScript = getScript(kCardLoadScript);
+		loadScript += patchScript;
+
+		debugC(kRivenDebugPatches, "Applied missing jgallows hotspot enable / disable to card %x", globalId);
+	}
+}
+
 void RivenCard::moveHotspot(uint16 blstId, const Common::Rect &position) {
 	RivenHotspot *hotspot = getHotspotByBlstId(blstId);
 	if (!hotspot) {
diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h
index 53085c8..0074ed9 100644
--- a/engines/mohawk/riven_card.h
+++ b/engines/mohawk/riven_card.h
@@ -157,6 +157,7 @@ private:
 	void applyPropertiesPatch8EB7(uint32 globalId, const Common::String &var, uint16 hotspotId);
 	void applyPropertiesPatch2E76(uint32 globalId);
 	void applyPropertiesPatch22118(uint32 globalId);
+	void applyPropertiesPatch2B414(uint32 globalId);
 	void setCurrentCardVariable();
 
 	void moveHotspot(uint16 blstId, const Common::Rect &position);


Commit: 3567c4f159a4524de3734406ca407aface7275be
    https://github.com/scummvm/scummvm/commit/3567c4f159a4524de3734406ca407aface7275be
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-02-09T07:29:43+01:00

Commit Message:
BASE: Reset the keymapper on RTL with dynamic plugins enabled

When returning to the launcher with dynamic plugins enabled, the config manager
is re-created, invalidating the pointers the keymapper keeps to the
configuration domains.

Fixes #11348.

Changed paths:
    backends/keymapper/keymapper.cpp
    backends/keymapper/keymapper.h
    base/main.cpp


diff --git a/backends/keymapper/keymapper.cpp b/backends/keymapper/keymapper.cpp
index 0ed57f2..0e0c287 100644
--- a/backends/keymapper/keymapper.cpp
+++ b/backends/keymapper/keymapper.cpp
@@ -45,11 +45,20 @@ Keymapper::Keymapper(EventManager *eventMan) :
 }
 
 Keymapper::~Keymapper() {
+	clear();
+}
+
+void Keymapper::clear() {
 	for (KeymapArray::iterator it = _keymaps.begin(); it != _keymaps.end(); it++) {
 		delete *it;
 	}
+	_keymaps.clear();
+
 	delete _backendDefaultBindings;
+	_backendDefaultBindings = nullptr;
+
 	delete _hardwareInputs;
+	_hardwareInputs = nullptr;
 }
 
 void Keymapper::registerHardwareInputSet(HardwareInputSet *inputs) {
@@ -143,6 +152,7 @@ void Keymapper::setEnabledKeymapType(Keymap::KeymapType type) {
 	_enabledKeymapType = type;
 }
 
+
 List<Event> Keymapper::mapEvent(const Event &ev) {
 	if (!_enabled) {
 		List<Event> originalEvent;
diff --git a/backends/keymapper/keymapper.h b/backends/keymapper/keymapper.h
index e778ecc..848943d 100644
--- a/backends/keymapper/keymapper.h
+++ b/backends/keymapper/keymapper.h
@@ -121,6 +121,11 @@ public:
 	void setEnabled(bool enabled) { _enabled = enabled; }
 
 	/**
+	 * Clear all the keymaps and hardware input sets
+	 */
+	void clear();
+
+	/**
 	 * Return a HardwareInput pointer for the given event
 	 */
 	HardwareInput findHardwareInput(const Event &event);
diff --git a/base/main.cpp b/base/main.cpp
index 8a4d73a..92c0bf1 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -358,6 +358,7 @@ static void setupKeymapper(OSystem &system) {
 	using namespace Common;
 
 	Keymapper *mapper = system.getEventManager()->getKeymapper();
+	mapper->clear();
 
 	// Query the backend for hardware keys and default bindings and register them
 	HardwareInputSet *inputSet = system.getHardwareInputSet();
@@ -568,6 +569,8 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
 			PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);
 			// reallocate the config manager to get rid of any fragmentation
 			ConfMan.defragment();
+			// The keymapper keeps pointers to the configuration domains. It needs to be reinitialized.
+			setupKeymapper(system);
 #endif
 
 			// Did an error occur ?


Commit: 0f1e1894c135f0f7e710e2c8a65dc1a2ea751d17
    https://github.com/scummvm/scummvm/commit/0f1e1894c135f0f7e710e2c8a65dc1a2ea751d17
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-02-09T07:29:43+01:00

Commit Message:
GUI: Add the arrow keys to the GUI keymap

Changed paths:
    gui/gui-manager.cpp


diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 868a813..22d7c8a 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -128,6 +128,26 @@ Common::Keymap *GuiManager::getKeymap() const {
 	act->setKeyEvent(KeyState(KEYCODE_ESCAPE, ASCII_ESCAPE, 0));
 	guiMap->addAction(act);
 
+	act = new Action(kStandardActionMoveUp, _("Up"));
+	act->setKeyEvent(KEYCODE_UP);
+	act->addDefaultInputMapping("JOY_UP");
+	guiMap->addAction(act);
+
+	act = new Action(kStandardActionMoveDown, _("Down"));
+	act->setKeyEvent(KEYCODE_DOWN);
+	act->addDefaultInputMapping("JOY_DOWN");
+	guiMap->addAction(act);
+
+	act = new Action(kStandardActionMoveLeft, _("Left"));
+	act->setKeyEvent(KEYCODE_LEFT);
+	act->addDefaultInputMapping("JOY_LEFT");
+	guiMap->addAction(act);
+
+	act = new Action(kStandardActionMoveRight, _("Right"));
+	act->setKeyEvent(KEYCODE_RIGHT);
+	act->addDefaultInputMapping("JOY_RIGHT");
+	guiMap->addAction(act);
+
 	return guiMap;
 }
 




More information about the Scummvm-git-logs mailing list