[Scummvm-git-logs] scummvm master -> 07cc1803747cb13a00af379dd902d729f688677e

sev- noreply at scummvm.org
Sun Oct 30 23:00:40 UTC 2022


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:
74577539c1 JANITORIAL: Whitespaces
07cc180374 SAGA2: Implement teleport_place console command


Commit: 74577539c10f402a059bf3d5ce55334535e1c432
    https://github.com/scummvm/scummvm/commit/74577539c10f402a059bf3d5ce55334535e1c432
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-10-30T23:31:43+01:00

Commit Message:
JANITORIAL: Whitespaces

Changed paths:
    engines/saga2/console.cpp
    engines/saga2/console.h


diff --git a/engines/saga2/console.cpp b/engines/saga2/console.cpp
index 67c24a6714d..85f7345f1f3 100644
--- a/engines/saga2/console.cpp
+++ b/engines/saga2/console.cpp
@@ -43,55 +43,30 @@ Console::Console(Saga2Engine *vm) : GUI::Debugger() {
 	_vm = vm;
 
 	registerCmd("kill_protag", WRAP_METHOD(Console, cmdKillProtag));
-
 	registerCmd("kill", WRAP_METHOD(Console, cmdKill));
-
 	registerCmd("godmode", WRAP_METHOD(Console, cmdGodmode));
-
 	registerCmd("obj_name", WRAP_METHOD(Console, cmdObjName));
-
 	registerCmd("nid2id", WRAP_METHOD(Console, cmdObjNameIndexToID));
-
 	registerCmd("search", WRAP_METHOD(Console, cmdSearchObj));
-
 	registerCmd("add", WRAP_METHOD(Console, cmdAddObj));
-
 	registerCmd("position", WRAP_METHOD(Console, cmdPosition));
-
 	registerCmd("teleport_on_click", WRAP_METHOD(Console, cmdTeleportOnClick));
-
 	registerCmd("teleport_on_map", WRAP_METHOD(Console, cmdTeleportOnMap));
-
 	registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
-
 	registerCmd("teleport_to_npc", WRAP_METHOD(Console, cmdTeleportToNPC));
-
 	registerCmd("teleport_npc", WRAP_METHOD(Console, cmdTeleportNPC));
-
 	registerCmd("teleport_npc_here", WRAP_METHOD(Console, cmdTeleportNPCHere));
-
 	registerCmd("teleport_party_here", WRAP_METHOD(Console, cmdTeleportPartyHere));
-
 	registerCmd("save_loc", WRAP_METHOD(Console, cmdSaveLoc));
-
 	registerCmd("load_loc", WRAP_METHOD(Console, cmdLoadLoc));
-
 	registerCmd("goto_place", WRAP_METHOD(Console, cmdGotoPlace));
-
 	registerCmd("list_places", WRAP_METHOD(Console, cmdListPlaces));
-
 	registerCmd("stats", WRAP_METHOD(Console, cmdStats));
-
 	registerCmd("status_msg", WRAP_METHOD(Console, cmdStatusMsg));
-
 	registerCmd("dump_map", WRAP_METHOD(Console, cmdDumpMap));
-
 	registerCmd("play_music", WRAP_METHOD(Console, cmdPlayMusic));
-
 	registerCmd("play_voice", WRAP_METHOD(Console, cmdPlayVoice));
-
 	registerCmd("invis", WRAP_METHOD(Console, cmdInvisibility));
-
 	registerCmd("map_cheat", WRAP_METHOD(Console, cmdMapCheat));
 }
 
diff --git a/engines/saga2/console.h b/engines/saga2/console.h
index 6db905dc00f..666276e2c50 100644
--- a/engines/saga2/console.h
+++ b/engines/saga2/console.h
@@ -40,81 +40,56 @@ private:
 
 	TilePoint _savedLoc;
 
-    // Input: <None>. Kills the center actor.
+	// Input: <None>. Kills the center actor.
 	bool cmdKillProtag(int argc, const char **argv);
-
-    // Input: <Actor ID>. Kills an actor.
+	// Input: <Actor ID>. Kills an actor.
 	bool cmdKill(int argc, const char **argv);
-
-    // Input: <Object ID>. Prints an object's name.
+	// Input: <Object ID>. Prints an object's name.
 	bool cmdObjName(int argc, const char **argv);
-
-    // Input: <Name Index>. Prints an ObjectID corresponding to the name index.
+	// Input: <Name Index>. Prints an ObjectID corresponding to the name index.
 	bool cmdObjNameIndexToID(int argc, const char **argv);
-
-    // Input: <Object Name>. Prints a list of objects containing the string in their name.
+	// Input: <Object Name>. Prints a list of objects containing the string in their name.
 	bool cmdSearchObj(int argc, const char **argv);
-
-    // Input: <Object ID>. Adds the object to the center actor's inventory.
+	// Input: <Object ID>. Adds the object to the center actor's inventory.
 	bool cmdAddObj(int argc, const char **argv);
-
-    // Input: <1/0>. Sets godmode.
+	// Input: <1/0>. Sets godmode.
 	bool cmdGodmode(int argc, const char **argv);
-
-    // Input: <1/0>. Sets whether the position coordinates show.
+	// Input: <1/0>. Sets whether the position coordinates show.
 	bool cmdPosition(int argc, const char **argv);
-
-    // Input: <1/0>. Sets whether an item's stats show when holding it.
+	// Input: <1/0>. Sets whether an item's stats show when holding it.
 	bool cmdStats(int argc, const char **argv);
-
 	// Input: <1/0>. Sets whether the original debug status messages show.
 	bool cmdStatusMsg(int argc, const char **argv);
-
-    // Input: <1/0>. Sets whether you can teleport by right clicking on the screen.
+	// Input: <1/0>. Sets whether you can teleport by right clicking on the screen.
 	bool cmdTeleportOnClick(int argc, const char **argv);
-
-    // Input: <1/0>. Sets whether you can teleport by clicking on the map.
+	// Input: <1/0>. Sets whether you can teleport by clicking on the map.
 	bool cmdTeleportOnMap(int argc, const char **argv);
-
-    // Input: <u> <v> <z>. Teleports the center character to the given position.
+	// Input: <u> <v> <z>. Teleports the center character to the given position.
 	bool cmdTeleport(int argc, const char **argv);
-
-    // Input: <Actor ID>. Teleports the character to the npc.
+	// Input: <Actor ID>. Teleports the character to the npc.
 	bool cmdTeleportToNPC(int argc, const char **argv);
-
-    // Input: <Actor ID> <u> <v> <z>. Teleports the npc to the given position.
+	// Input: <Actor ID> <u> <v> <z>. Teleports the npc to the given position.
 	bool cmdTeleportNPC(int argc, const char **argv);
-
-    // Input: <Actor ID>. Teleports the npc to the center actor.
+	// Input: <Actor ID>. Teleports the npc to the center actor.
 	bool cmdTeleportNPCHere(int argc, const char **argv);
-
-    // Input: <None>. Teleport the three brothers to the center actor.
+	// Input: <None>. Teleport the three brothers to the center actor.
 	bool cmdTeleportPartyHere(int argc, const char **argv);
-
-    // Input: <None>. Saves the current location locally.
+	// Input: <None>. Saves the current location locally.
 	bool cmdSaveLoc(int argc, const char **argv);
-
-    // Input: <None>. Teleports the center actor to the location saved with cmdSaveLoc.
+	// Input: <None>. Teleports the center actor to the location saved with cmdSaveLoc.
 	bool cmdLoadLoc(int argc, const char **argv);
-
-    // Input: <Place ID>. Teleports to the given place.
+	// Input: <Place ID>. Teleports to the given place.
 	bool cmdGotoPlace(int argc, const char **argv);
-
-    // Input: <None>. Lists all of the place names along with their IDs.
+	// Input: <None>. Lists all of the place names along with their IDs.
 	bool cmdListPlaces(int argc, const char **argv);
-
-    // Input: <Map Scale Multiplier>. Dumps the map into a png.
+	// Input: <Map Scale Multiplier>. Dumps the map into a png.
 	bool cmdDumpMap(int argc, const char **argv);
-
-    // Input: <Music Index>. Plays a music track.
+	// Input: <Music Index>. Plays a music track.
 	bool cmdPlayMusic(int argc, const char **argv);
-
-    // Input: <Voice ID>. Plays a voice track.
+	// Input: <Voice ID>. Plays a voice track.
 	bool cmdPlayVoice(int argc, const char **argv);
-
 	// Input: <1/0>. Sets the invisibility effect on the party.
 	bool cmdInvisibility(int argc, const char **argv);
-
 	// Input: <1/0>. Sets state of Automap cheat for testing.
 	bool cmdMapCheat(int argc, const char **argv);
 };


Commit: 07cc1803747cb13a00af379dd902d729f688677e
    https://github.com/scummvm/scummvm/commit/07cc1803747cb13a00af379dd902d729f688677e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-10-30T23:48:15+01:00

Commit Message:
SAGA2: Implement teleport_place console command

Changed paths:
    engines/saga2/console.cpp
    engines/saga2/console.h
    engines/saga2/mapfeatr.h
    engines/saga2/saga2.cpp
    engines/saga2/saga2.h


diff --git a/engines/saga2/console.cpp b/engines/saga2/console.cpp
index 85f7345f1f3..cf59364ae1c 100644
--- a/engines/saga2/console.cpp
+++ b/engines/saga2/console.cpp
@@ -53,6 +53,7 @@ Console::Console(Saga2Engine *vm) : GUI::Debugger() {
 	registerCmd("teleport_on_click", WRAP_METHOD(Console, cmdTeleportOnClick));
 	registerCmd("teleport_on_map", WRAP_METHOD(Console, cmdTeleportOnMap));
 	registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
+	registerCmd("teleport_place", WRAP_METHOD(Console, cmdTeleportPlace));
 	registerCmd("teleport_to_npc", WRAP_METHOD(Console, cmdTeleportToNPC));
 	registerCmd("teleport_npc", WRAP_METHOD(Console, cmdTeleportNPC));
 	registerCmd("teleport_npc_here", WRAP_METHOD(Console, cmdTeleportNPCHere));
@@ -310,6 +311,41 @@ bool Console::cmdTeleportPartyHere(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdTeleportPlace(int argc, const char **argv) {
+	if (argc < 1)
+		debugPrintf("Usage: %s <place id>/<place name>\n", argv[0]);
+	else {
+		int placenum = -1;
+
+		if (!Common::isDigit(argv[1][0])) {
+			// First, assemble the name
+			Common::String place = argv[1];
+
+			for (int i = 2; i < argc; i++)
+				place += Common::String(" ") + argv[i];
+
+			for (uint i = 0; i < g_vm->_mapFeatures.size(); ++i) {
+				if (g_vm->_mapFeatures[i] && !place.compareToIgnoreCase(g_vm->_mapFeatures[i]->getText())) {
+					placenum = i;
+					break;
+				}
+			}
+		} else {
+			placenum = atoi(argv[1]);
+		}
+
+		if (placenum == -1) {
+			debugPrintf("Unknown place\n");
+			return true;
+		}
+
+		Actor *a = getCenterActor();
+		a->setLocation(g_vm->_mapFeatures[placenum]->getLocation());
+	}
+
+	return true;
+}
+
 bool Console::cmdSaveLoc(int argc, const char **argv) {
 	if (argc != 1)
 		debugPrintf("Usage: %s\n", argv[0]);
diff --git a/engines/saga2/console.h b/engines/saga2/console.h
index 666276e2c50..d5d5491cb5c 100644
--- a/engines/saga2/console.h
+++ b/engines/saga2/console.h
@@ -74,6 +74,8 @@ private:
 	bool cmdTeleportNPCHere(int argc, const char **argv);
 	// Input: <None>. Teleport the three brothers to the center actor.
 	bool cmdTeleportPartyHere(int argc, const char **argv);
+	// Input: <place id>/<place name>. Teleports the center character to the given place name or number.
+	bool cmdTeleportPlace(int argc, const char **argv);
 	// Input: <None>. Saves the current location locally.
 	bool cmdSaveLoc(int argc, const char **argv);
 	// Input: <None>. Teleports the center actor to the location saved with cmdSaveLoc.
diff --git a/engines/saga2/mapfeatr.h b/engines/saga2/mapfeatr.h
index 2073762c400..0a95aafe7f7 100644
--- a/engines/saga2/mapfeatr.h
+++ b/engines/saga2/mapfeatr.h
@@ -68,6 +68,9 @@ public:
 	int16 getV() {
 		return _featureCoords.v;
 	}
+	TilePoint getLocation() {
+		return _featureCoords;
+	}
 	char *getText() {
 		return _name;
 	}
diff --git a/engines/saga2/saga2.cpp b/engines/saga2/saga2.cpp
index 1cf56cfaf1c..f77c92117e4 100644
--- a/engines/saga2/saga2.cpp
+++ b/engines/saga2/saga2.cpp
@@ -39,6 +39,7 @@
 #include "saga2/band.h"
 #include "saga2/beegee.h"
 #include "saga2/calendar.h"
+#include "saga2/console.h"
 #include "saga2/contain.h"
 #include "saga2/detection.h"
 #include "saga2/dispnode.h"
diff --git a/engines/saga2/saga2.h b/engines/saga2/saga2.h
index 1495045f7fb..1f67f30e2c4 100644
--- a/engines/saga2/saga2.h
+++ b/engines/saga2/saga2.h
@@ -30,7 +30,6 @@
 #include "engines/advancedDetector.h"
 #include "engines/engine.h"
 
-#include "saga2/console.h"
 #include "saga2/gfx.h"
 #include "saga2/idtypes.h"
 #include "saga2/weapons.h"
@@ -47,6 +46,7 @@ class MemoryWriteStreamDynamic;
 namespace Saga2 {
 
 class ContainerManager;
+class Console;
 class Timer;
 class TimerList;
 class BandList;




More information about the Scummvm-git-logs mailing list