[Scummvm-git-logs] scummvm master -> 187c5d13c2635f0286e6c7928f07c1c76386123a

bluegr noreply at scummvm.org
Thu Jan 1 11:51:30 UTC 2026


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

Summary:
187c5d13c2 HUGO: Fix direction handling by retaining keycodes.


Commit: 187c5d13c2635f0286e6c7928f07c1c76386123a
    https://github.com/scummvm/scummvm/commit/187c5d13c2635f0286e6c7928f07c1c76386123a
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2026-01-01T13:51:26+02:00

Commit Message:
HUGO: Fix direction handling by retaining keycodes.
The keybinding action now map back to the original keycodes, making fewer alterations to route code. Directions based on keycodes are stored in game objects and mouse hotspots. These keycodes would either need to be retained or translated into different values.
This partially reverts commit fac22eeccd79f44a82d3e9bbc0a8f6371c1215cc.
Fixes bug #16403

Changed paths:
    engines/hugo/parser.cpp
    engines/hugo/route.cpp
    engines/hugo/route.h


diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp
index 466f0b9feb4..c735e0e4f25 100644
--- a/engines/hugo/parser.cpp
+++ b/engines/hugo/parser.cpp
@@ -381,15 +381,36 @@ void Parser::actionHandler(Common::Event event) {
 		}
 		break;
 	case kActionMoveTop:
+		_vm->_route->resetRoute();                   // Stop any automatic route
+		_vm->_route->setWalk(Common::KEYCODE_UP);    // Direction of hero travel
+		break;
 	case kActionMoveBottom:
+		_vm->_route->resetRoute();                   // Stop any automatic route
+		_vm->_route->setWalk(Common::KEYCODE_DOWN);  // Direction of hero travel
+		break;
 	case kActionMoveLeft:
+		_vm->_route->resetRoute();                   // Stop any automatic route
+		_vm->_route->setWalk(Common::KEYCODE_LEFT);  // Direction of hero travel
+		break;
 	case kActionMoveRight:
+		_vm->_route->resetRoute();                   // Stop any automatic route
+		_vm->_route->setWalk(Common::KEYCODE_RIGHT); // Direction of hero travel
+		break;
 	case kActionMoveTopLeft:
+		_vm->_route->resetRoute();                  // Stop any automatic route
+		_vm->_route->setWalk(Common::KEYCODE_KP7);  // Direction of hero travel
+		break;
 	case kActionMoveTopRight:
+		_vm->_route->resetRoute();                  // Stop any automatic route
+		_vm->_route->setWalk(Common::KEYCODE_KP9);  // Direction of hero travel
+		break;
 	case kActionMoveBottomLeft:
+		_vm->_route->resetRoute();                  // Stop any automatic route
+		_vm->_route->setWalk(Common::KEYCODE_KP1);  // Direction of hero travel
+		break;
 	case kActionMoveBottomRight:
-		_vm->_route->resetRoute();              // Stop any automatic route
-		_vm->_route->setWalk(event.customType); // Direction of hero travel
+		_vm->_route->resetRoute();                  // Stop any automatic route
+		_vm->_route->setWalk(Common::KEYCODE_KP3);  // Direction of hero travel
 		break;
 	default:
 		break;
diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp
index ba8a3daff6a..bc954a7f024 100644
--- a/engines/hugo/route.cpp
+++ b/engines/hugo/route.cpp
@@ -68,27 +68,43 @@ int16 Route::getRouteIndex() const {
 /**
  * Face hero in new direction, based on cursor key input by user.
  */
-void Route::setDirection(const uint16 direction) {
-	debugC(1, kDebugRoute, "setDirection(%d)", direction);
+void Route::setDirection(const uint16 keyCode) {
+	debugC(1, kDebugRoute, "setDirection(%d)", keyCode);
 
 	Object *obj = _vm->_hero;                     // Pointer to hero object
 
 	// Set first image in sequence
-	switch (direction) {
-	case kActionMoveTop:
+	switch (keyCode) {
+	case Common::KEYCODE_UP:
+	case Common::KEYCODE_KP8:
 		obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr;
 		break;
-	case kActionMoveBottom:
+	case Common::KEYCODE_DOWN:
+	case Common::KEYCODE_KP2:
 		obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr;
 		break;
-	case kActionMoveLeft:
-	case kActionMoveTopLeft:
-	case kActionMoveBottomLeft:
+	case Common::KEYCODE_LEFT:
+	case Common::KEYCODE_KP4:
 		obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
 		break;
-	case kActionMoveRight:
-	case kActionMoveTopRight:
-	case kActionMoveBottomRight:
+	case Common::KEYCODE_RIGHT:
+	case Common::KEYCODE_KP6:
+		obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
+		break;
+	case Common::KEYCODE_HOME:
+	case Common::KEYCODE_KP7:
+		obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
+		break;
+	case Common::KEYCODE_END:
+	case Common::KEYCODE_KP1:
+		obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr;
+		break;
+	case Common::KEYCODE_PAGEUP:
+	case Common::KEYCODE_KP9:
+		obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
+		break;
+	case Common::KEYCODE_PAGEDOWN:
+	case Common::KEYCODE_KP3:
 		obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr;
 		break;
 	default:
@@ -115,39 +131,46 @@ void Route::setWalk(const uint16 direction) {
 		// Direction has changed
 		setDirection(direction);                    // Face new direction
 		obj->_vx = obj->_vy = 0;
-
-		switch (direction) {
-		case kActionMoveTop:
+		switch (direction) {                        // And set correct velocity
+		case Common::KEYCODE_UP:
+		case Common::KEYCODE_KP8:
 			obj->_vy = -kStepDy;
 			break;
-		case kActionMoveBottom:
-			obj->_vy = kStepDy;
+		case Common::KEYCODE_DOWN:
+		case Common::KEYCODE_KP2:
+			obj->_vy =  kStepDy;
 			break;
-		case kActionMoveLeft:
+		case Common::KEYCODE_LEFT:
+		case Common::KEYCODE_KP4:
 			obj->_vx = -kStepDx;
 			break;
-		case kActionMoveRight:
-			obj->_vx = kStepDx;
+		case Common::KEYCODE_RIGHT:
+		case Common::KEYCODE_KP6:
+			obj->_vx =  kStepDx;
 			break;
-		case kActionMoveTopLeft:
+		case Common::KEYCODE_HOME:
+		case Common::KEYCODE_KP7:
 			obj->_vx = -kStepDx;
 			// Note: in v1 Dos and v2 Dos, obj->vy is set to DY
 			obj->_vy = -kStepDy / 2;
 			break;
-		case kActionMoveTopRight:
-			obj->_vx = kStepDx;
+		case Common::KEYCODE_END:
+		case Common::KEYCODE_KP1:
+			obj->_vx = -kStepDx;
 			// Note: in v1 Dos and v2 Dos, obj->vy is set to -DY
-			obj->_vy = -kStepDy / 2;
+			obj->_vy =  kStepDy / 2;
 			break;
-		case kActionMoveBottomLeft:
-			obj->_vx = -kStepDx;
+		case Common::KEYCODE_PAGEUP:
+		case Common::KEYCODE_KP9:
+			obj->_vx =  kStepDx;
 			// Note: in v1 Dos and v2 Dos, obj->vy is set to -DY
-			obj->_vy = kStepDy / 2;
+			obj->_vy = -kStepDy / 2;
 			break;
-		case kActionMoveBottomRight:
-			obj->_vx = kStepDx;
+		case Common::KEYCODE_PAGEDOWN:
+		case Common::KEYCODE_KP3:
+			obj->_vx =  kStepDx;
 			// Note: in v1 Dos and v2 Dos, obj->vy is set to DY
-			obj->_vy = kStepDy / 2;
+			obj->_vy =  kStepDy / 2;
 			break;
 		default:
 			break;
diff --git a/engines/hugo/route.h b/engines/hugo/route.h
index 72f4a8f3832..697a6283fa1 100644
--- a/engines/hugo/route.h
+++ b/engines/hugo/route.h
@@ -52,7 +52,7 @@ public:
 
 	void processRoute();
 	bool startRoute(const RouteType routeType, const int16 objId, int16 cx, int16 cy);
-	void setDirection(const uint16 direction);
+	void setDirection(const uint16 keyCode);
 	void setWalk(const uint16 direction);
 
 private:




More information about the Scummvm-git-logs mailing list