MADS: Add debugger commands for playing text and anim cutscenes

This commit is contained in:
Paul Gilbert 2014-10-13 16:59:15 -04:00
parent ffe58e058c
commit 7f7e144dd2
3 changed files with 47 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include "mads/compression.h"
#include "mads/mads.h"
#include "mads/debugger.h"
#include "mads/nebular/menu_nebular.h"
namespace MADS {
@ -46,6 +47,8 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("show_item", WRAP_METHOD(Debugger, Cmd_ShowItem));
registerCmd("dump_items", WRAP_METHOD(Debugger, Cmd_DumpItems));
registerCmd("item", WRAP_METHOD(Debugger, Cmd_Item));
registerCmd("play_anim", WRAP_METHOD(Debugger, Cmd_PlayAnim));
registerCmd("play_text", WRAP_METHOD(Debugger, Cmd_PlayText));
}
static int strToInt(const char *s) {
@ -348,4 +351,44 @@ bool Debugger::Cmd_Item(int argc, const char **argv) {
}
}
bool Debugger::Cmd_PlayAnim(int argc, const char **argv) {
if (argc != 2) {
debugPrintf("Usage: %s <anim name>\n", argv[0]);
return true;
} else {
Common::String resName = argv[1];
if (resName.hasPrefix("@"))
resName.deleteChar(0);
Common::File f;
if (f.exists(resName) || f.exists(resName + ".res")) {
Nebular::AnimationView::execute(_vm, resName);
return false;
} else {
debugPrintf("Could not find resource file\n");
return true;
}
}
}
bool Debugger::Cmd_PlayText(int argc, const char **argv) {
if (argc != 2) {
debugPrintf("Usage: %s <text name>\n", argv[0]);
return true;
} else {
Common::String resName = argv[1];
if (resName.hasPrefix("@"))
resName.deleteChar(0);
Common::File f;
if (f.exists(resName) || f.exists(resName + ".res")) {
Nebular::TextView::execute(_vm, resName);
return false;
} else {
debugPrintf("Could not find resource file\n");
return true;
}
}
}
} // End of namespace MADS

View File

@ -49,6 +49,8 @@ protected:
bool Cmd_ShowItem(int argc, const char **argv);
bool Cmd_DumpItems(int argc, const char **argv);
bool Cmd_Item(int argc, const char **argv);
bool Cmd_PlayAnim(int argc, const char **argv);
bool Cmd_PlayText(int argc, const char **argv);
public:
bool _showMousePos;
public:

View File

@ -793,6 +793,8 @@ void AnimationView::execute(MADSEngine *vm, const Common::String &resName) {
}
AnimationView::AnimationView(MADSEngine *vm) : MenuView(vm) {
_redrawFlag = false;
_soundDriverLoaded = false;
_previousUpdate = 0;
_screenId = -1;