SAGA2: Add command to teleport on click

This commit is contained in:
a/ 2021-07-25 05:29:08 +09:00
parent a9f2fa115b
commit c2aac871a9
5 changed files with 20 additions and 1 deletions

View File

@ -61,6 +61,8 @@ Console::Console(Saga2Engine *vm) : GUI::Debugger() {
registerCmd("position", WRAP_METHOD(Console, cmdPosition));
registerCmd("teleport_on_click", WRAP_METHOD(Console, cmdTeleportOnClick));
registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
registerCmd("teleport_to_npc", WRAP_METHOD(Console, cmdTeleportToNPC));
@ -211,6 +213,17 @@ bool Console::cmdStats(int argc, const char **argv) {
return true;
}
bool Console::cmdTeleportOnClick(int argc, const char **argv) {
if (argc != 2)
debugPrintf("Usage: %s <1/0>\n", argv[0]);
else {
bool teleport = atoi(argv[1]);
_vm->_teleportOnClick = teleport;
}
return true;
}
bool Console::cmdTeleport(int argc, const char **argv) {
if (argc != 4)
debugPrintf("Usage: %s <u> <v> <z>\n", argv[0]);

View File

@ -59,6 +59,8 @@ private:
bool cmdStats(int argc, const char **argv);
bool cmdTeleportOnClick(int argc, const char **argv);
bool cmdTeleport(int argc, const char **argv);
bool cmdTeleportToNPC(int argc, const char **argv);

View File

@ -75,6 +75,7 @@ Saga2Engine::Saga2Engine(OSystem *syst)
_speechText = true;
_showPosition = false;
_showStats = false;
_teleportOnClick = false;
SearchMan.addSubDirectoryMatching(gameDataDir, "res");
SearchMan.addSubDirectoryMatching(gameDataDir, "dos/drivers"); // For Miles Sound files

View File

@ -178,6 +178,7 @@ public:
bool _autoWeapon;
bool _showNight;
bool _speechText;
bool _teleportOnClick;
bool _showPosition;
bool _showStats;

View File

@ -1223,7 +1223,9 @@ static APPFUNC(cmdClickTileMap) {
// We're not pointing at an object and the mouse cursor
// does not have an object
else {
if (g_vm->_mouseInfo->getIntent() == GrabInfo::WalkTo
if (g_vm->_teleportOnClick) {
getCenterActor()->setLocation(walkToPos);
} else if (g_vm->_mouseInfo->getIntent() == GrabInfo::WalkTo
&& g_vm->_mouseInfo->getDoable()) {
if (pickedTAI == NULL) {
navigateDirect(walkToPos, false);