[Scummvm-git-logs] scummvm master -> 1784961acae9e40d231901ae8e7df6dd428eb434

lolbot-iichan lolbot_iichan at mail.ru
Sun Jun 21 12:03:28 UTC 2020


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

Summary:
1784961aca WINTERMUTE: Improve keyboard walking for Corrosion (#2340)


Commit: 1784961acae9e40d231901ae8e7df6dd428eb434
    https://github.com/scummvm/scummvm/commit/1784961acae9e40d231901ae8e7df6dd428eb434
Author: lolbot-iichan (lolbot_iichan at mail.ru)
Date: 2020-06-21T15:03:25+03:00

Commit Message:
WINTERMUTE: Improve keyboard walking for Corrosion (#2340)

* WINTERMUTE: Mark custom actions as game-specific

* WINTERMUTE: Disable keyboard walking while city map is open

* WINTERMUTE: Fix misprints in comments

Changed paths:
    engines/wintermute/base/base_game.cpp
    engines/wintermute/base/scriptables/script_engine.cpp
    engines/wintermute/base/scriptables/script_engine.h


diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 57a4ca9984..3605c5ed58 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -3788,52 +3788,55 @@ bool BaseGame::handleMouseWheel(int32 delta) {
 
 //////////////////////////////////////////////////////////////////////////
 bool BaseGame::handleCustomActionStart(BaseGameCustomAction action) {
-	Point32 p;
+	if (BaseEngine::instance().getGameId() == "corrosion") {
+		// Keyboard walking is added, for both original game & Enhanced Edition
+
+		// However, Enhanced Edition contain city map screen, which is
+		// mouse controlled and conflicts with those custom actions
+		const char *m = "items\\street_map\\windows\\street_map_window.script";
+		if (_scEngine->isRunningScript(m)) {
+			return false;
+		}
 
-	switch (action) {
-	case kClickAtCenter:
-		p.x = _renderer->getWidth() / 2;
-		p.y = _renderer->getHeight() / 2;
-		break;
-	case kClickAtLeft:
-		p.x = 30;
-		p.y = _renderer->getHeight() / 2;
-		break;
-	case kClickAtRight:
-		p.x = _renderer->getWidth() - 30;
-		p.y = _renderer->getHeight() / 2;
-		break;
-	case kClickAtTop:
-		p.x = _renderer->getWidth() / 2;
-		p.y = 10;
-		break;
-	case kClickAtBottom:
-		p.x = _renderer->getWidth() / 2;
-		p.y = _renderer->getHeight() - 35;
-		break;
-	default:
-		return false;
-	}
+		Point32 p;
+		switch (action) {
+		case kClickAtCenter:
+			p.x = _renderer->getWidth() / 2;
+			p.y = _renderer->getHeight() / 2;
+			break;
+		case kClickAtLeft:
+			p.x = 30;
+			p.y = _renderer->getHeight() / 2;
+			break;
+		case kClickAtRight:
+			p.x = _renderer->getWidth() - 30;
+			p.y = _renderer->getHeight() / 2;
+			break;
+		case kClickAtTop:
+			p.x = _renderer->getWidth() / 2;
+			p.y = 10;
+			break;
+		case kClickAtBottom:
+			p.x = _renderer->getWidth() / 2;
+			p.y = _renderer->getHeight();
+			p.y -= ConfMan.get("extra").contains("Enhanced") ? 35 : 90;
+			break;
+		default:
+			return false;
+		}
 
-	BasePlatform::setCursorPos(p.x, p.y);
-	setActiveObject(_gameRef->_renderer->getObjectAt(p.x, p.y)); 
+		BasePlatform::setCursorPos(p.x, p.y);
+		setActiveObject(_gameRef->_renderer->getObjectAt(p.x, p.y)); 
+		onMouseLeftDown();
+		onMouseLeftUp();
+		return true;
+	}
 
-	return onMouseLeftDown();
+	return false;
 }
 
 //////////////////////////////////////////////////////////////////////////
 bool BaseGame::handleCustomActionEnd(BaseGameCustomAction action) {
-	switch (action) {
-	case kClickAtCenter:
-	case kClickAtLeft:
-	case kClickAtRight:
-	case kClickAtTop:
-	case kClickAtBottom:
-		return onMouseLeftUp();
-	default:
-		break;
-	}
-
 	return false;
 }
 
diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp
index 3a62d2e644..e420c17d45 100644
--- a/engines/wintermute/base/scriptables/script_engine.cpp
+++ b/engines/wintermute/base/scriptables/script_engine.cpp
@@ -184,6 +184,17 @@ ScScript *ScEngine::runScript(const char *filename, BaseScriptHolder *owner) {
 }
 
 
+//////////////////////////////////////////////////////////////////////////
+bool ScEngine::isRunningScript(const char *filename) {
+	for (uint32 i = 0; i < _scripts.size(); i++) {
+		if (strcmp(_scripts[i]->_filename, filename) == 0) {
+			return true;
+		}
+	}
+	return false;
+}
+
+
 //////////////////////////////////////////////////////////////////////////
 byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache) {
 	// is script in cache?
diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h
index bb6aaf7603..ea2a75ac01 100644
--- a/engines/wintermute/base/scriptables/script_engine.h
+++ b/engines/wintermute/base/scriptables/script_engine.h
@@ -86,6 +86,7 @@ public:
 	bool tick();
 	ScValue *_globals;
 	ScScript *runScript(const char *filename, BaseScriptHolder *owner = nullptr);
+	bool isRunningScript(const char *filename);
 	static const bool _compilerAvailable = false;
 
 	ScEngine(BaseGame *inGame);




More information about the Scummvm-git-logs mailing list