TITANIC: Added frame debugger command for setting objects' movie frames

This commit is contained in:
Paul Gilbert 2017-08-26 17:58:31 -04:00
parent a97fe8f89f
commit 72b033ca2d
2 changed files with 24 additions and 0 deletions

View File

@ -44,6 +44,7 @@ Debugger::Debugger(TitanicEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("movie", WRAP_METHOD(Debugger, cmdMovie));
registerCmd("sound", WRAP_METHOD(Debugger, cmdSound));
registerCmd("cheat", WRAP_METHOD(Debugger, cmdCheat));
registerCmd("frame", WRAP_METHOD(Debugger, cmdFrame));
}
int Debugger::strToInt(const char *s) {
@ -346,4 +347,22 @@ bool Debugger::cmdCheat(int argc, const char **argv) {
return false;
}
bool Debugger::cmdFrame(int argc, const char **argv) {
if (argc == 3) {
CGameObject *obj = dynamic_cast<CGameObject *>(
g_vm->_window->_project->findByName(argv[1]));
if (obj) {
obj->loadFrame(strToInt(argv[2]));
return false;
} else {
debugPrintf("Object not found\n");
return true;
}
} else {
debugPrintf("frame <object> <frame number>");
return true;
}
}
} // End of namespace Titanic

View File

@ -115,6 +115,11 @@ private:
* Change to the cheat room
*/
bool cmdCheat(int argc, const char **argv);
/**
* Set the movie frame for a given object
*/
bool cmdFrame(int argc, const char **argv);
protected:
TitanicEngine *_vm;
public: