aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/lure/debugger.cpp27
-rw-r--r--engines/lure/debugger.h1
-rw-r--r--engines/lure/scripts.cpp13
-rw-r--r--engines/lure/scripts.h1
4 files changed, 42 insertions, 0 deletions
diff --git a/engines/lure/debugger.cpp b/engines/lure/debugger.cpp
index 1526db8ce8..5eeb42d4a9 100644
--- a/engines/lure/debugger.cpp
+++ b/engines/lure/debugger.cpp
@@ -33,6 +33,7 @@
#include "lure/res.h"
#include "lure/res_struct.h"
#include "lure/room.h"
+#include "lure/scripts.h"
#include "lure/strings.h"
namespace Lure {
@@ -51,6 +52,7 @@ Debugger::Debugger(): GUI::Debugger() {
DCmd_Register("showanim", WRAP_METHOD(Debugger, cmd_showAnim));
DCmd_Register("strings", WRAP_METHOD(Debugger, cmd_saveStrings));
DCmd_Register("debug", WRAP_METHOD(Debugger, cmd_debug));
+ DCmd_Register("script", WRAP_METHOD(Debugger, cmd_script));
}
static int strToInt(const char *s) {
@@ -596,4 +598,29 @@ bool Debugger::cmd_debug(int argc, const char **argv) {
return true;
}
+bool Debugger::cmd_script(int argc, const char **argv) {
+ if (argc < 2) {
+ DebugPrintf("script <script number> [param 1] [param 2] [param 3] [exit flag]\n");
+ return true;
+ }
+
+ int scriptNumber = strToInt(argv[1]);
+ if ((scriptNumber < 0) || (scriptNumber > 66)) {
+ DebugPrintf("An invalid script number was specified\n");
+ return true;
+ }
+
+ uint16 param1 = 0, param2 = 0, param3 = 0;
+ if (argc >= 3)
+ param1 = strToInt(argv[2]);
+ if (argc >= 4)
+ param2 = strToInt(argv[3]);
+ if (argc >= 5)
+ param3 = strToInt(argv[4]);
+
+ Script::executeMethod(scriptNumber, param1, param2, param3);
+ DebugPrintf("Script executed\n");
+ return true;
+}
+
} // End of namespace Lure
diff --git a/engines/lure/debugger.h b/engines/lure/debugger.h
index f447593fee..4441c2a1dc 100644
--- a/engines/lure/debugger.h
+++ b/engines/lure/debugger.h
@@ -48,6 +48,7 @@ protected:
bool cmd_showAnim(int argc, const char **argv);
bool cmd_saveStrings(int argc, const char **argv);
bool cmd_debug(int argc, const char **argv);
+ bool cmd_script(int argc, const char **argv);
};
extern const char *directionList[5];
diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp
index babbe0280f..7490f05b24 100644
--- a/engines/lure/scripts.cpp
+++ b/engines/lure/scripts.cpp
@@ -1171,6 +1171,19 @@ uint16 Script::execute(uint16 startOffset) {
return result;
}
+void Script::executeMethod(int methodIndex, uint16 v1, uint16 v2, uint16 v3) {
+ const SequenceMethodRecord *rec = &scriptMethods[0];
+ while ((rec->methodIndex != 0xff) && (rec->methodIndex != methodIndex))
+ ++rec;
+
+ if (rec->methodIndex == 0xff)
+ warning("Undefined script method %d", methodIndex);
+ else {
+ SequenceMethodPtr ptr = rec->proc;
+ ptr(v1, v2, v3);
+ }
+}
+
/*------------------------------------------------------------------------*/
/*- Hotspot Script Handler -*/
/*- -*/
diff --git a/engines/lure/scripts.h b/engines/lure/scripts.h
index 92e1ed09a5..b5b6140872 100644
--- a/engines/lure/scripts.h
+++ b/engines/lure/scripts.h
@@ -77,6 +77,7 @@ class Script {
public:
static uint16 execute(uint16 startOffset);
+ static void executeMethod(int methodIndex, uint16 v1, uint16 v2, uint16 v3);
static void activateHotspot(uint16 hotspotId, uint16 v2, uint16 v3);
static void setHotspotScript(uint16 hotspotId, uint16 scriptIndex, uint16 v3);
static void addSound2(uint16 soundIndex, uint16 v2, uint16 v3);