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

OMGPizzaGuy 48367439+OMGPizzaGuy at users.noreply.github.com
Thu Jun 18 23:46:27 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:
34ceda4350 ULTIMA8: Combine event handling to a single switch statement
ee63bbc28a ULTIMA8: Replace uses of CoreApp::ForceQuit() with Engine::quitGame()


Commit: 34ceda4350bbf7278b598c47e2dc3fc0d54cd2e8
    https://github.com/scummvm/scummvm/commit/34ceda4350bbf7278b598c47e2dc3fc0d54cd2e8
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2020-06-18T18:44:36-05:00

Commit Message:
ULTIMA8: Combine event handling to a single switch statement

Remove todo about mouse handedness as that can be handled with the keymapper.
Removed special key handling for a ForceQuit action that is no longer needed as it only performs a normal quit currently.

Changed paths:
    engines/ultima/ultima8/ultima8.cpp


diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index e397085083..7cf44a7046 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -709,8 +709,6 @@ void Ultima8Engine::leaveTextMode(Gump *gump) {
 }
 
 void Ultima8Engine::handleEvent(const Common::Event &event) {
-	//bool handled = false;
-
 	switch (event.type) {
 	case Common::EVENT_KEYDOWN:
 		break;
@@ -722,6 +720,34 @@ void Ultima8Engine::handleEvent(const Common::Event &event) {
 		_mouse->setMouseCoords(event.mouse.x, event.mouse.y);
 		break;
 
+	case Common::EVENT_LBUTTONDOWN:
+	case Common::EVENT_MBUTTONDOWN:
+	case Common::EVENT_RBUTTONDOWN: {
+		Shared::MouseButton button = Shared::BUTTON_LEFT;
+		if (event.type == Common::EVENT_RBUTTONDOWN)
+			button = Shared::BUTTON_RIGHT;
+		else if (event.type == Common::EVENT_MBUTTONDOWN)
+			button = Shared::BUTTON_MIDDLE;
+
+		_mouse->setMouseCoords(event.mouse.x, event.mouse.y);
+		_mouse->buttonDown(button);
+		break;
+	}
+
+	case Common::EVENT_LBUTTONUP:
+	case Common::EVENT_MBUTTONUP:
+	case Common::EVENT_RBUTTONUP: {
+		Shared::MouseButton button = Shared::BUTTON_LEFT;
+		if (event.type == Common::EVENT_RBUTTONUP)
+			button = Shared::BUTTON_RIGHT;
+		else if (event.type == Common::EVENT_MBUTTONUP)
+			button = Shared::BUTTON_MIDDLE;
+
+		_mouse->setMouseCoords(event.mouse.x, event.mouse.y);
+		_mouse->buttonUp(button);
+		break;
+	}
+
 	case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
 		MetaEngine::pressAction((KeybindingAction)event.customType);
 		return;
@@ -787,58 +813,6 @@ void Ultima8Engine::handleEvent(const Common::Event &event) {
 			}
 		}
 	}
-
-	// Old style input begins here
-	switch (event.type) {
-
-		//!! TODO: handle mouse handedness. (swap left/right mouse buttons here)
-
-		// most of these events will probably be passed to a gump manager,
-		// since almost all (all?) user input will be handled by a gump
-
-	case Common::EVENT_LBUTTONDOWN:
-	case Common::EVENT_MBUTTONDOWN:
-	case Common::EVENT_RBUTTONDOWN: {
-		Shared::MouseButton button = Shared::BUTTON_LEFT;
-		if (event.type == Common::EVENT_RBUTTONDOWN)
-			button = Shared::BUTTON_RIGHT;
-		else if (event.type == Common::EVENT_MBUTTONDOWN)
-			button = Shared::BUTTON_MIDDLE;
-
-		_mouse->setMouseCoords(event.mouse.x, event.mouse.y);
-		_mouse->buttonDown(button);
-		//if (_mouse->buttonDown(button)) handled = true;
-		break;
-	}
-
-	case Common::EVENT_LBUTTONUP:
-	case Common::EVENT_MBUTTONUP:
-	case Common::EVENT_RBUTTONUP: {
-		Shared::MouseButton button = Shared::BUTTON_LEFT;
-		if (event.type == Common::EVENT_RBUTTONUP)
-			button = Shared::BUTTON_RIGHT;
-		else if (event.type == Common::EVENT_MBUTTONUP)
-			button = Shared::BUTTON_MIDDLE;
-
-		_mouse->setMouseCoords(event.mouse.x, event.mouse.y);
-		_mouse->buttonUp(button);
-		//if (_mouse->buttonUp(button)) handled = true;
-		break;
-	}
-
-	case Common::EVENT_KEYDOWN:
-		if (_mouse->dragging() != Mouse::DRAG_NOT)
-			break;
-
-		// Any special key handling goes here
-		if ((event.kbd.keycode == Common::KEYCODE_q || event.kbd.keycode == Common::KEYCODE_x) &&
-			(event.kbd.flags & (Common::KBD_CTRL | Common::KBD_ALT | Common::KBD_META)) != 0)
-			ForceQuit();
-		break;
-
-	default:
-		break;
-	}
 }
 
 void Ultima8Engine::handleDelayedEvents() {


Commit: ee63bbc28a672e516c587664494a97009a8a7110
    https://github.com/scummvm/scummvm/commit/ee63bbc28a672e516c587664494a97009a8a7110
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2020-06-18T18:46:04-05:00

Commit Message:
ULTIMA8: Replace uses of CoreApp::ForceQuit() with Engine::quitGame()

Changed paths:
    engines/ultima/ultima8/gumps/quit_gump.cpp
    engines/ultima/ultima8/kernel/core_app.h


diff --git a/engines/ultima/ultima8/gumps/quit_gump.cpp b/engines/ultima/ultima8/gumps/quit_gump.cpp
index 21655c35d5..5bac84ed3a 100644
--- a/engines/ultima/ultima8/gumps/quit_gump.cpp
+++ b/engines/ultima/ultima8/gumps/quit_gump.cpp
@@ -161,7 +161,7 @@ void QuitGump::ChildNotify(Gump *child, uint32 message) {
 	ObjId cid = child->getObjId();
 	if (message == ButtonWidget::BUTTON_CLICK) {
 		if (cid == _yesWidget) {
-			Ultima8Engine::get_instance()->ForceQuit();
+			Ultima8Engine::get_instance()->quitGame();
 		} else if (cid == _noWidget) {
 			Close();
 		}
@@ -172,7 +172,7 @@ bool QuitGump::OnTextInput(int unicode) {
 	if (!(unicode & 0xFF80)) {
 		char c = unicode & 0x7F;
 		if (_TL_("Yy").find(c) != Std::string::npos) {
-			Ultima8Engine::get_instance()->ForceQuit();
+			Ultima8Engine::get_instance()->quitGame();
 		} else if (_TL_("Nn").find(c) != Std::string::npos) {
 			Close();
 		}
diff --git a/engines/ultima/ultima8/kernel/core_app.h b/engines/ultima/ultima8/kernel/core_app.h
index b58a20db15..d87d1022e6 100644
--- a/engines/ultima/ultima8/kernel/core_app.h
+++ b/engines/ultima/ultima8/kernel/core_app.h
@@ -60,10 +60,6 @@ public:
 		return false;
 	}
 
-	virtual void ForceQuit() {
-		_isRunning = false;
-	};
-
 	//! Startup the application. This will prepare the application for run().
 	//! Should call parent class' startup().
 	void startup();




More information about the Scummvm-git-logs mailing list