aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBendegúz Nagy2016-08-12 10:02:44 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commitc798b1ca02c248a86958d6b43b92f323bd2326e0 (patch)
tree8cdcc6b2666f9a016df62aabd8a7b0cc53e7840b
parent6ea782eeb57a5164e3bfdf4d9ff72e4bfa385f82 (diff)
downloadscummvm-rg350-c798b1ca02c248a86958d6b43b92f323bd2326e0.tar.gz
scummvm-rg350-c798b1ca02c248a86958d6b43b92f323bd2326e0.tar.bz2
scummvm-rg350-c798b1ca02c248a86958d6b43b92f323bd2326e0.zip
DM: Add offset to debug command pos
-rw-r--r--engines/dm/console.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/engines/dm/console.cpp b/engines/dm/console.cpp
index b8fae4285b..31a0e13679 100644
--- a/engines/dm/console.cpp
+++ b/engines/dm/console.cpp
@@ -118,9 +118,10 @@ argumentError:
}
bool Console::Cmd_pos(int argc, const char** argv) {
+ DungeonMan &dm = *_vm->_dungeonMan;
if (argc == 2 && cstrEquals("get", argv[1])) {
- debugPrintf("Position: (%d, %d) Direction: %s\n", _vm->_dungeonMan->_g306_partyMapX,
- _vm->_dungeonMan->_g307_partyMapY, debugGetDirectionName(_vm->_dungeonMan->_g308_partyDir));
+ debugPrintf("Position: (%d, %d) Direction: %s\n", dm._g306_partyMapX + dm._g269_currMap->_offsetMapX,
+ dm._g307_partyMapY + dm._g269_currMap->_offsetMapY, debugGetDirectionName(_vm->_dungeonMan->_g308_partyDir));
} else if (argc == 4 && cstrEquals("set", argv[1])) {
int x = atoi(argv[2]);
int y = atoi(argv[3]);
@@ -131,9 +132,10 @@ bool Console::Cmd_pos(int argc, const char** argv) {
Map &currMap = *_vm->_dungeonMan->_g269_currMap;
// not >= because dimensions are inslucsive
- if (x > currMap._width || y > currMap._height) {
+ if (x < currMap._offsetMapX || x > currMap._width + currMap._offsetMapX
+ || y < currMap._offsetMapY || y > currMap._height + currMap._offsetMapY) {
debugPrintf("Position (%d, %d) is out of bounds, possible values: ([1-%d],[1-%d])\n", x, y,
- currMap._width, currMap._height);
+ currMap._width + currMap._offsetMapX, currMap._height + currMap._offsetMapY);
return true;
}
@@ -141,7 +143,8 @@ bool Console::Cmd_pos(int argc, const char** argv) {
if (haventWarned.check())
debugPrintf("Setting position directly can cause glitches and crashes.\n");
debugPrintf("Position set to (%d, %d)\n", x, y);
- _vm->_moveSens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, x, y);
+ _vm->_moveSens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY,
+ x - currMap._offsetMapX, y - currMap._offsetMapY);
} else
goto argumentError;