diff options
author | Filippos Karapetis | 2014-05-20 05:43:49 +0300 |
---|---|---|
committer | Filippos Karapetis | 2014-05-20 05:43:49 +0300 |
commit | e409f4dedd989b49184a865f59dc152e85303489 (patch) | |
tree | fbebde2411ea4fea95c6d0eeaf3392df94823944 | |
parent | 0d09060fa8a08000116fb3defb0c930eb30c6526 (diff) | |
download | scummvm-rg350-e409f4dedd989b49184a865f59dc152e85303489.tar.gz scummvm-rg350-e409f4dedd989b49184a865f59dc152e85303489.tar.bz2 scummvm-rg350-e409f4dedd989b49184a865f59dc152e85303489.zip |
MADS: Add debugger commands for the game vocab
-rw-r--r-- | engines/mads/debugger.cpp | 42 | ||||
-rw-r--r-- | engines/mads/debugger.h | 2 | ||||
-rw-r--r-- | engines/mads/scene.cpp | 4 | ||||
-rw-r--r-- | engines/mads/scene.h | 5 |
4 files changed, 53 insertions, 0 deletions
diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index e3ddf02a5a..8baafddc69 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -39,6 +39,8 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("show_codes", WRAP_METHOD(Debugger, Cmd_ShowCodes)); DCmd_Register("dump_file", WRAP_METHOD(Debugger, Cmd_DumpFile)); DCmd_Register("show_quote", WRAP_METHOD(Debugger, Cmd_ShowQuote)); + DCmd_Register("show_vocab", WRAP_METHOD(Debugger, Cmd_ShowVocab)); + DCmd_Register("dump_vocab", WRAP_METHOD(Debugger, Cmd_DumpVocab)); DCmd_Register("item", WRAP_METHOD(Debugger, Cmd_Item)); } @@ -200,6 +202,46 @@ bool Debugger::Cmd_ShowQuote(int argc, const char **argv) { return true; } +bool Debugger::Cmd_ShowVocab(int argc, const char **argv) { + if (argc != 2) { + for (uint32 i = 0; i < _vm->_game->_scene.getVocabStringsCount(); i++) { + DebugPrintf("%03d: '%s'\n", i, _vm->_game->_scene.getVocab(i + 1).c_str()); + } + } else { + int vocabId = strToInt(argv[1]); + DebugPrintf("%03d: '%s'\n", vocabId, _vm->_game->_scene.getVocab(vocabId + 1).c_str()); + } + + return true; +} + +bool Debugger::Cmd_DumpVocab(int argc, const char **argv) { + Common::DumpFile outFile; + outFile.open("vocab.txt"); + + for (uint32 i = 0; i < _vm->_game->_scene.getVocabStringsCount(); i++) { + Common::String curId = Common::String::format("%x", i + 1); + Common::String curVocab = _vm->_game->_scene.getVocab(i + 1); + curVocab.toUppercase(); + + for (uint j = 0; j < curVocab.size(); j++) { + if (curVocab[j] == ' ' || curVocab[j] == '-') + curVocab.setChar('_', j); + } + + Common::String cur = "\tNOUN_" + curVocab + " = 0x" + curId + ",\n"; + + outFile.writeString(cur.c_str()); + } + + outFile.flush(); + outFile.close(); + + DebugPrintf("Game vocab dumped\n"); + + return true; +} + bool Debugger::Cmd_Item(int argc, const char **argv) { InventoryObjects &objects = _vm->_game->_objects; diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h index 19827495d4..0c048f2368 100644 --- a/engines/mads/debugger.h +++ b/engines/mads/debugger.h @@ -43,6 +43,8 @@ protected: bool Cmd_ShowCodes(int argc, const char **argv); bool Cmd_DumpFile(int argc, const char **argv); bool Cmd_ShowQuote(int argc, const char **argv); + bool Cmd_ShowVocab(int argc, const char **argv); + bool Cmd_DumpVocab(int argc, const char **argv); bool Cmd_Item(int argc, const char **argv); public: bool _showMousePos; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 84e4edc08d..0c241eb9ab 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -254,6 +254,10 @@ void Scene::loadVocabStrings() { f.close(); } +uint32 Scene::getVocabStringsCount() const { + return _vocabStrings.size(); +} + void Scene::initPaletteAnimation(Common::Array<PaletteCycle> &palCycles, bool animFlag) { // Initialize the animation palette and ticks list _cycleTicks.clear(); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 69a2c0d78d..27fb901a25 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -152,6 +152,11 @@ public: void addActiveVocab(int vocabId); /** + * Get the number of entries in the game's vocabulary + */ + uint32 getVocabStringsCount() const; + + /** * Clear the sequence list */ void clearSequenceList(); |