Skip to content

Commit

Permalink
MADS: Add debugger commands for playing text and anim cutscenes
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Oct 13, 2014
1 parent ffe58e0 commit 7f7e144
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
43 changes: 43 additions & 0 deletions engines/mads/debugger.cpp
Expand Up @@ -24,6 +24,7 @@
#include "mads/compression.h"
#include "mads/mads.h"
#include "mads/debugger.h"
#include "mads/nebular/menu_nebular.h"

namespace MADS {

Expand All @@ -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) {
Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions engines/mads/debugger.h
Expand Up @@ -49,6 +49,8 @@ class Debugger : public GUI::Debugger {
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:
Expand Down
2 changes: 2 additions & 0 deletions engines/mads/nebular/menu_nebular.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 7f7e144

Please sign in to comment.