From 6279c566152203fd761cae9b7333f27320730261 Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Wed, 10 Aug 2016 17:09:37 +0200 Subject: DM: Add debug command 'items', add option 'list' --- engines/dm/console.cpp | 22 ++++++++++++++++++++++ engines/dm/console.h | 4 +--- engines/dm/objectman.h | 1 - 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/engines/dm/console.cpp b/engines/dm/console.cpp index 703bd23e34..1145165612 100644 --- a/engines/dm/console.cpp +++ b/engines/dm/console.cpp @@ -30,6 +30,7 @@ #include "champion.h" #include "dungeonman.h" #include "movesens.h" +#include "objectman.h" namespace DM { @@ -58,6 +59,7 @@ Console::Console(DM::DMEngine* vm) : _vm(vm) { registerCmd("noclip", WRAP_METHOD(Console, Cmd_noclip)); registerCmd("pos", WRAP_METHOD(Console, Cmd_pos)); registerCmd("map", WRAP_METHOD(Console, Cmd_map)); + registerCmd("items", WRAP_METHOD(Console, Cmd_items)); } bool Console::Cmd_godmode(int argc, const char** argv) { @@ -188,4 +190,24 @@ argumentError: debugPrintf("Usage: %s get\nUsage: %s set <#>\n", argv[0], argv[0]); return true; } + +bool Console::Cmd_items(int argc, const char** argv) { + if (argc == 2 && cstrEquals("list", argv[1])) { + debugPrintf("| %s", _vm->_objectMan->_g352_objectNames[0]); + for (uint16 i = 1; i < k199_ObjectNameCount; ++i) { + const char *name = _vm->_objectMan->_g352_objectNames[i - 1]; + const char *prevName = _vm->_objectMan->_g352_objectNames[i]; + if (!cstrEquals(prevName, name)) + debugPrintf(" | %s", name); + if (i % 5 == 0) + debugPrintf("\n"); + } + debugPrintf("\n"); + } else { + debugPrintf("Usage: %s list\n", argv[0]); + return true; + } + return true; +} + } diff --git a/engines/dm/console.h b/engines/dm/console.h index 9493b353a4..461c89f2bc 100644 --- a/engines/dm/console.h +++ b/engines/dm/console.h @@ -51,11 +51,9 @@ public: bool _debugNoclip; bool Cmd_noclip(int argc, const char **argv); - // Cmd_pos bool Cmd_pos(int argc, const char **argv); - - // Cmd_map bool Cmd_map(int argc, const char **argv); + bool Cmd_items(int argc, const char **argv); }; } diff --git a/engines/dm/objectman.h b/engines/dm/objectman.h index 3b55e194f9..1aa4c54637 100644 --- a/engines/dm/objectman.h +++ b/engines/dm/objectman.h @@ -66,7 +66,6 @@ public: IconIndice f39_getIconIndexInSlotBox(uint16 slotBoxIndex); // @ F0039_OBJECT_GetIconIndexInSlotBox void f35_clearLeaderObjectName(); // @ F0035_OBJECT_ClearLeaderHandObjectName void f37_drawIconToScreen(int16 iconIndex, int16 posX, int16 posY); // @ F0037_OBJECT_DrawIconToScreen - }; } -- cgit v1.2.3