[Scummvm-git-logs] scummvm master -> b1d6daf62c1b040f2969c8f5ccf1c0d24fcfaef7

sev- sev at scummvm.org
Thu Jun 18 22:57:53 UTC 2020


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:
a171c8430b WINTERMUTE: Add some quick engine actions
b1d6daf62c WINTERMUTE: Add keymap for walking actions for Corrosion


Commit: a171c8430b1b1e15db8c823beee942dc31b75c0e
    https://github.com/scummvm/scummvm/commit/a171c8430b1b1e15db8c823beee942dc31b75c0e
Author: lolbot-iichan (lolbot_iichan at mail.ru)
Date: 2020-06-19T00:57:48+02:00

Commit Message:
WINTERMUTE: Add some quick engine actions

Changed paths:
  A engines/wintermute/base/base_game_custom_actions.h
    engines/wintermute/base/base_game.cpp
    engines/wintermute/base/base_game.h
    engines/wintermute/platform_osystem.cpp


diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index b66c5f469b..57a4ca9984 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -3786,6 +3786,56 @@ bool BaseGame::handleMouseWheel(int32 delta) {
 	return true;
 }
 
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::handleCustomActionStart(BaseGameCustomAction action) {
+	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() - 35;
+		break;
+	default:
+		return false;
+	}
+
+	BasePlatform::setCursorPos(p.x, p.y);
+	setActiveObject(_gameRef->_renderer->getObjectAt(p.x, p.y)); 
+
+	return onMouseLeftDown();
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseGame::handleCustomActionEnd(BaseGameCustomAction action) {
+	switch (action) {
+	case kClickAtCenter:
+	case kClickAtLeft:
+	case kClickAtRight:
+	case kClickAtTop:
+	case kClickAtBottom:
+		return onMouseLeftUp();
+	default:
+		break;
+	}
+
+	return false;
+}
 
 //////////////////////////////////////////////////////////////////////////
 bool BaseGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) const {
diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h
index 4d057dffab..9394a6aa77 100644
--- a/engines/wintermute/base/base_game.h
+++ b/engines/wintermute/base/base_game.h
@@ -30,6 +30,7 @@
 #define WINTERMUTE_BASE_GAME_H
 
 #include "engines/wintermute/base/base_object.h"
+#include "engines/wintermute/base/base_game_custom_actions.h"
 #include "engines/wintermute/base/timer.h"
 #include "engines/wintermute/persistent.h"
 #include "engines/wintermute/coll_templ.h"
@@ -202,6 +203,8 @@ public:
 
 	bool handleKeypress(Common::Event *event, bool printable = false) override;
 	virtual void handleKeyRelease(Common::Event *event);
+	bool handleCustomActionStart(BaseGameCustomAction action);
+	bool handleCustomActionEnd(BaseGameCustomAction action);
 
 	bool unfreeze();
 	bool freeze(bool includingMusic = true);
diff --git a/engines/wintermute/base/base_game_custom_actions.h b/engines/wintermute/base/base_game_custom_actions.h
new file mode 100644
index 0000000000..f717771c35
--- /dev/null
+++ b/engines/wintermute/base/base_game_custom_actions.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_GAME_CUSTOM_ACTION_H
+#define WINTERMUTE_BASE_GAME_CUSTOM_ACTION_H
+
+namespace Wintermute {
+
+enum BaseGameCustomAction {
+	kClickAtCenter = 0,
+	kClickAtLeft = 1,
+	kClickAtRight = 2,
+	kClickAtTop = 3,
+	kClickAtBottom = 4
+};
+
+} // End of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp
index 4bc1702bee..217a7c2f9e 100644
--- a/engines/wintermute/platform_osystem.cpp
+++ b/engines/wintermute/platform_osystem.cpp
@@ -109,6 +109,16 @@ void BasePlatform::handleEvent(Common::Event *event) {
 			_gameRef->handleMouseWheel(event->type == Common::EVENT_WHEELUP ? 1 : -1);
 		}
 		break;
+	case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+		if (_gameRef) {
+			_gameRef->handleCustomActionStart((BaseGameCustomAction)event->customType);
+		}
+		break;
+	case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
+		if (_gameRef) {
+			_gameRef->handleCustomActionEnd((BaseGameCustomAction)event->customType);
+		}
+		break;
 	case Common::EVENT_SCREEN_CHANGED:
 		if (_gameRef) {
 			_gameRef->_renderer->onWindowChange();


Commit: b1d6daf62c1b040f2969c8f5ccf1c0d24fcfaef7
    https://github.com/scummvm/scummvm/commit/b1d6daf62c1b040f2969c8f5ccf1c0d24fcfaef7
Author: lolbot-iichan (lolbot_iichan at mail.ru)
Date: 2020-06-19T00:57:48+02:00

Commit Message:
WINTERMUTE: Add keymap for walking actions for Corrosion

Changed paths:
    engines/wintermute/keymapper_tables.h


diff --git a/engines/wintermute/keymapper_tables.h b/engines/wintermute/keymapper_tables.h
index 19e5f92e0b..258195cf2f 100644
--- a/engines/wintermute/keymapper_tables.h
+++ b/engines/wintermute/keymapper_tables.h
@@ -24,6 +24,8 @@
 #include "backends/keymapper/keymapper.h"
 #include "backends/keymapper/standard-actions.h"
 
+#include "engines/wintermute/base/base_game_custom_actions.h"
+
 #include "common/translation.h"
 
 namespace Wintermute {
@@ -69,7 +71,6 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
 		gameId == "bickadoodle" ||
 		gameId == "bthreshold" ||
 		gameId == "colorsoncanvas" ||
-		gameId == "corrosion" ||
 		gameId == "deadcity" ||
 		gameId == "darkfallls" ||
 		gameId == "drbohus" ||
@@ -519,6 +520,34 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
 		act->addDefaultInputMapping("DOWN"); // extra keyboard
 		act->addDefaultInputMapping("JOY_DOWN"); // extra joy
 		gameKeyMap->addAction(act);
+	} else if (gameId == "corrosion") {
+		act = new Action(kStandardActionMoveUp, _("Walk forward"));
+		act->setCustomEngineActionEvent(kClickAtCenter);
+		act->addDefaultInputMapping("UP"); // extra keyboard
+		act->addDefaultInputMapping("KP8"); // extra keyboard
+		act->addDefaultInputMapping("JOY_UP"); // extra joy
+		gameKeyMap->addAction(act);
+
+		act = new Action(kStandardActionMoveDown, _("Walk backward"));
+		act->setCustomEngineActionEvent(kClickAtBottom);
+		act->addDefaultInputMapping("DOWN"); // extra keyboard
+		act->addDefaultInputMapping("KP2"); // extra keyboard
+		act->addDefaultInputMapping("JOY_DOWN"); // extra joy
+		gameKeyMap->addAction(act);
+
+		act = new Action(kStandardActionMoveLeft, _("Turn left"));
+		act->setCustomEngineActionEvent(kClickAtLeft);
+		act->addDefaultInputMapping("LEFT"); // extra keyboard
+		act->addDefaultInputMapping("KP4"); // extra keyboard
+		act->addDefaultInputMapping("JOY_LEFT"); // extra joy
+		gameKeyMap->addAction(act);
+
+		act = new Action(kStandardActionMoveRight, _("Turn right"));
+		act->setCustomEngineActionEvent(kClickAtRight);
+		act->addDefaultInputMapping("RIGHT"); // extra keyboard
+		act->addDefaultInputMapping("KP6"); // extra keyboard
+		act->addDefaultInputMapping("JOY_RIGHT"); // extra joy
+		gameKeyMap->addAction(act);
 	} else if (gameId == "erinmyers") {
 		act = new Action("GUIB", _("Change font size"));
 		act->setKeyEvent(KEYCODE_END);




More information about the Scummvm-git-logs mailing list