[Scummvm-git-logs] scummvm master -> 188d1163b9b7189a5b5b19633ee6aebdf8b621c3

dreammaster paulfgilbert at gmail.com
Sun Apr 12 02:39:52 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:
93c18c09f6 ULTIMA4: Move dungeon jumps to a debugger command
188d1163b9 ULTIMA4: Moving more debug keys to debugger


Commit: 93c18c09f6084790415f8ab371dce1d7fcd6b3e2
    https://github.com/scummvm/scummvm/commit/93c18c09f6084790415f8ab371dce1d7fcd6b3e2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-04-11T19:22:51-07:00

Commit Message:
ULTIMA4: Move dungeon jumps to a debugger command

Changed paths:
    engines/ultima/ultima4/core/debugger.cpp
    engines/ultima/ultima4/core/debugger.h
    engines/ultima/ultima4/game/game.cpp


diff --git a/engines/ultima/ultima4/core/debugger.cpp b/engines/ultima/ultima4/core/debugger.cpp
index e2fa238765..af799e8c9d 100644
--- a/engines/ultima/ultima4/core/debugger.cpp
+++ b/engines/ultima/ultima4/core/debugger.cpp
@@ -43,6 +43,7 @@ Debugger::Debugger() : Shared::Debugger() {
 
 	registerCmd("collisions", WRAP_METHOD(Debugger, cmdCollisions));
 	registerCmd("companions", WRAP_METHOD(Debugger, cmdCompanions));
+	registerCmd("dungeon", WRAP_METHOD(Debugger, cmdDungeon));
 	registerCmd("equipment", WRAP_METHOD(Debugger, cmdEquipment));
 	registerCmd("exit", WRAP_METHOD(Debugger, cmdExit));
 	registerCmd("gate", WRAP_METHOD(Debugger, cmdGate));
@@ -151,6 +152,43 @@ bool Debugger::cmdCompanions(int argc, const char **argv) {
 	return isActive();
 }
 
+bool Debugger::cmdDungeon(int argc, const char **argv) {
+	if (g_context->_location->_context & CTX_WORLDMAP) {
+		if (argc == 2) {
+			int dungNum = strToInt(argv[1]);
+
+			if (dungNum >= 1 && dungNum <= 8) {
+				g_context->_location->_coords = g_context->_location->_map->_portals[dungNum - 1]->_coords;
+				return false;
+			} else if (dungNum == 9) {
+				g_game->setMap(mapMgr->get(MAP_DECEIT), 1, NULL);
+				g_context->_location->_coords = MapCoords(1, 0, 7);
+				g_ultima->_saveGame->_orientation = DIR_SOUTH;
+			} else if (dungNum == 10) {
+				g_game->setMap(mapMgr->get(MAP_DESPISE), 1, NULL);
+				g_context->_location->_coords = MapCoords(3, 2, 7);
+				g_ultima->_saveGame->_orientation = DIR_SOUTH;
+			} else if (dungNum == 11) {
+				g_game->setMap(mapMgr->get(MAP_DESTARD), 1, NULL);
+				g_context->_location->_coords = MapCoords(7, 6, 7);
+				g_ultima->_saveGame->_orientation = DIR_SOUTH;
+			} else {
+				print("Invalid dungeon");
+				return isActive();
+			}
+
+			g_game->finishTurn();
+			return false;
+		} else {
+			print("dungeon <number>");
+		}
+	} else {
+		print("Not here");
+	}
+
+	return isActive();
+}
+
 bool Debugger::cmdEquipment(int argc, const char **argv) {
 	int i;
 
@@ -173,6 +211,7 @@ bool Debugger::cmdExit(int argc, const char **argv) {
 	if (!g_game->exitToParentMap()) {
 		print("Not Here");
 	} else {
+		g_game->finishTurn();
 		g_music->play();
 		print("Exited");
 	}
diff --git a/engines/ultima/ultima4/core/debugger.h b/engines/ultima/ultima4/core/debugger.h
index 3c934b4d12..8b6bf7172a 100644
--- a/engines/ultima/ultima4/core/debugger.h
+++ b/engines/ultima/ultima4/core/debugger.h
@@ -64,6 +64,11 @@ private:
 	 */
 	bool cmdCompanions(int argc, const char **argv);
 
+	/**
+	 * Jumps to a given dungeon
+	 */
+	bool cmdDungeon(int argc, const char **argv);
+
 	/**
 	 * All equipement
 	 */
diff --git a/engines/ultima/ultima4/game/game.cpp b/engines/ultima/ultima4/game/game.cpp
index 21f0e41335..09793cd48b 100644
--- a/engines/ultima/ultima4/game/game.cpp
+++ b/engines/ultima/ultima4/game/game.cpp
@@ -651,45 +651,6 @@ bool GameController::keyPressed(int key) {
 
 		break;
 
-		case U4_FKEY:
-		case U4_FKEY+1:
-		case U4_FKEY+2:
-		case U4_FKEY+3:
-		case U4_FKEY+4:
-		case U4_FKEY+5:
-		case U4_FKEY+6:
-		case U4_FKEY+7:
-			/* teleport to dungeon entrances! */
-			if (settings._debug && (g_context->_location->_context & CTX_WORLDMAP) && (g_context->_transportContext & TRANSPORT_FOOT_OR_HORSE)) {
-				int portal = 16 + (key - U4_FKEY); /* find dungeon portal */
-				g_context->_location->_coords = g_context->_location->_map->_portals[portal]->_coords;
-			} else valid = false;
-			break;
-
-		case U4_FKEY+8:
-			if (settings._debug && (g_context->_location->_context & CTX_WORLDMAP)) {
-				setMap(mapMgr->get(MAP_DECEIT), 1, NULL);
-				g_context->_location->_coords = MapCoords(1, 0, 7);
-				g_ultima->_saveGame->_orientation = DIR_SOUTH;
-			} else valid = false;
-			break;
-
-		case U4_FKEY+9:
-			if (settings._debug && (g_context->_location->_context & CTX_WORLDMAP)) {
-				setMap(mapMgr->get(MAP_DESPISE), 1, NULL);
-				g_context->_location->_coords = MapCoords(3, 2, 7);
-				g_ultima->_saveGame->_orientation = DIR_SOUTH;
-			} else valid = false;
-			break;
-
-		case U4_FKEY+10:
-			if (settings._debug && (g_context->_location->_context & CTX_WORLDMAP)) {
-				setMap(mapMgr->get(MAP_DESTARD), 1, NULL);
-				g_context->_location->_coords = MapCoords(7, 6, 7);
-				g_ultima->_saveGame->_orientation = DIR_SOUTH;
-			} else valid = false;
-			break;
-
 		case U4_FKEY+11:
 			if (settings._debug) {
 				screenMessage("Torch: %d\n", g_context->_party->getTorchDuration());


Commit: 188d1163b9b7189a5b5b19633ee6aebdf8b621c3
    https://github.com/scummvm/scummvm/commit/188d1163b9b7189a5b5b19633ee6aebdf8b621c3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-04-11T19:39:35-07:00

Commit Message:
ULTIMA4: Moving more debug keys to debugger

Changed paths:
    engines/ultima/ultima4/core/debugger.cpp
    engines/ultima/ultima4/core/debugger.h
    engines/ultima/ultima4/game/game.cpp


diff --git a/engines/ultima/ultima4/core/debugger.cpp b/engines/ultima/ultima4/core/debugger.cpp
index af799e8c9d..ddb6ee8d31 100644
--- a/engines/ultima/ultima4/core/debugger.cpp
+++ b/engines/ultima/ultima4/core/debugger.cpp
@@ -29,6 +29,7 @@
 #include "ultima/ultima4/game/stats.h"
 #include "ultima/ultima4/game/weapon.h"
 #include "ultima/ultima4/gfx/screen.h"
+#include "ultima/ultima4/map/dungeonview.h"
 #include "ultima/ultima4/map/mapmgr.h"
 #include "ultima/ultima4/ultima4.h"
 
@@ -41,6 +42,7 @@ Debugger::Debugger() : Shared::Debugger() {
 	g_debugger = this;
 	_collisionOverride = false;
 
+	registerCmd("3d", WRAP_METHOD(Debugger, cmd3d));
 	registerCmd("collisions", WRAP_METHOD(Debugger, cmdCollisions));
 	registerCmd("companions", WRAP_METHOD(Debugger, cmdCompanions));
 	registerCmd("dungeon", WRAP_METHOD(Debugger, cmdDungeon));
@@ -48,6 +50,7 @@ Debugger::Debugger() : Shared::Debugger() {
 	registerCmd("exit", WRAP_METHOD(Debugger, cmdExit));
 	registerCmd("gate", WRAP_METHOD(Debugger, cmdGate));
 	registerCmd("goto", WRAP_METHOD(Debugger, cmdGoto));
+	registerCmd("help", WRAP_METHOD(Debugger, cmdHelp));
 	registerCmd("items", WRAP_METHOD(Debugger, cmdItems));
 	registerCmd("karma", WRAP_METHOD(Debugger, cmdKarma));
 	registerCmd("location", WRAP_METHOD(Debugger, cmdLocation));
@@ -58,6 +61,7 @@ Debugger::Debugger() : Shared::Debugger() {
 	registerCmd("reagents", WRAP_METHOD(Debugger, cmdReagents));
 	registerCmd("stats", WRAP_METHOD(Debugger, cmdStats));
 	registerCmd("summon", WRAP_METHOD(Debugger, cmdSummon));
+	registerCmd("torch", WRAP_METHOD(Debugger, cmdTorch));
 	registerCmd("transport", WRAP_METHOD(Debugger, cmdTransport));
 	registerCmd("up", WRAP_METHOD(Debugger, cmdUp));
 	registerCmd("down", WRAP_METHOD(Debugger, cmdDown));
@@ -130,6 +134,16 @@ Direction Debugger::directionFromName(const Common::String &dirStr) {
 }
 
 
+bool Debugger::cmd3d(int argc, const char **argv) {
+	if (g_context->_location->_context == CTX_DUNGEON) {
+		print("3-D view %s\n", DungeonViewer.toggle3DDungeonView() ? "on" : "off");
+	} else {
+		print("Not here");
+	}
+
+	return isActive();
+}
+
 bool Debugger::cmdCollisions(int argc, const char **argv) {
 	_collisionOverride = !_collisionOverride;
 	print("Collision detection %s",
@@ -295,6 +309,22 @@ bool Debugger::cmdGoto(int argc, const char **argv) {
 	}
 }
 
+bool Debugger::cmdHelp(int argc, const char **argv) {
+	if (!isActive()) {
+		screenMessage("Help!\n");
+		screenPrompt();
+	}
+
+	/* Help! send me to Lord British (who conveniently is right around where you are)! */
+	g_game->setMap(mapMgr->get(100), 1, NULL);
+	g_context->_location->_coords.x = 19;
+	g_context->_location->_coords.y = 8;
+	g_context->_location->_coords.z = 0;
+	g_game->finishTurn();
+
+	return false;
+}
+
 bool Debugger::cmdItems(int argc, const char **argv) {
 	SaveGame &sg = *g_ultima->_saveGame;
 	sg._torches = 99;
@@ -443,6 +473,14 @@ bool Debugger::cmdSummon(int argc, const char **argv) {
 	return isActive();
 }
 
+bool Debugger::cmdTorch(int argc, const char **argv) {
+	print("Torch: %d\n", g_context->_party->getTorchDuration());
+	if (!isActive())
+		screenPrompt();
+
+	return isActive();
+}
+
 bool Debugger::cmdTransport(int argc, const char **argv) {
 	if (!g_context->_location->_map->isWorldMap()) {
 		print("Not here!");
diff --git a/engines/ultima/ultima4/core/debugger.h b/engines/ultima/ultima4/core/debugger.h
index 8b6bf7172a..c4ff877967 100644
--- a/engines/ultima/ultima4/core/debugger.h
+++ b/engines/ultima/ultima4/core/debugger.h
@@ -54,6 +54,11 @@ private:
 	 */
 	Direction directionFromName(const Common::String &dirStr);
 private:
+	/**
+	 * Collision detection on/off
+	 */
+	bool cmd3d(int argc, const char **argv);
+
 	/**
 	 * Collision detection on/off
 	 */
@@ -89,6 +94,11 @@ private:
 	 */
 	bool cmdGoto(int argc, const char **argv);
 
+	/**
+	 * Help.. sends the party to Lord British
+	 */
+	bool cmdHelp(int argc, const char **argv);
+
 	/**
 	 * Grant karma
 	 */
@@ -139,6 +149,11 @@ private:
 	 */
 	bool cmdSummon(int argc, const char **argv);
 
+	/**
+	 * Returns the torch duration
+	 */
+	bool cmdTorch(int argc, const char **argv);
+
 	/**
 	 * Creates a given transport
 	 */
diff --git a/engines/ultima/ultima4/game/game.cpp b/engines/ultima/ultima4/game/game.cpp
index 09793cd48b..4f110ab71b 100644
--- a/engines/ultima/ultima4/game/game.cpp
+++ b/engines/ultima/ultima4/game/game.cpp
@@ -651,40 +651,12 @@ bool GameController::keyPressed(int key) {
 
 		break;
 
-		case U4_FKEY+11:
-			if (settings._debug) {
-				screenMessage("Torch: %d\n", g_context->_party->getTorchDuration());
-				screenPrompt();
-			} else valid = false;
-			break;
-
 		case 4:                     /* ctrl-D */
 			if (settings._debug) {
 				destroy();
 			} else valid = false;
 			break;
 
-		case 8:                     /* ctrl-H */
-			if (settings._debug) {
-				screenMessage("Help!\n");
-				screenPrompt();
-
-				/* Help! send me to Lord British (who conveniently is right around where you are)! */
-				setMap(mapMgr->get(100), 1, NULL);
-				g_context->_location->_coords.x = 19;
-				g_context->_location->_coords.y = 8;
-				g_context->_location->_coords.z = 0;
-			} else valid = false;
-			break;
-
-		case 22: {                  /* ctrl-V */
-			if (settings._debug && g_context->_location->_context == CTX_DUNGEON) {
-				screenMessage("3-D view %s\n", DungeonViewer.toggle3DDungeonView() ? "on" : "off");
-				endTurn = 0;
-			} else valid = false;
-		}
-		break;
-
 		case ' ':
 			screenMessage("Pass\n");
 			break;




More information about the Scummvm-git-logs mailing list