mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-13 07:14:59 +00:00
MADS: Add debugger commands for the game vocab
This commit is contained in:
parent
0d09060fa8
commit
e409f4dedd
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -151,6 +151,11 @@ public:
|
||||
*/
|
||||
void addActiveVocab(int vocabId);
|
||||
|
||||
/**
|
||||
* Get the number of entries in the game's vocabulary
|
||||
*/
|
||||
uint32 getVocabStringsCount() const;
|
||||
|
||||
/**
|
||||
* Clear the sequence list
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user