[Scummvm-cvs-logs] SF.net SVN: scummvm: [31568] scummvm/trunk/engines/lure
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Sat Apr 19 02:34:03 CEST 2008
Revision: 31568
http://scummvm.svn.sourceforge.net/scummvm/?rev=31568&view=rev
Author: dreammaster
Date: 2008-04-18 17:34:02 -0700 (Fri, 18 Apr 2008)
Log Message:
-----------
Added a debugger command 'script' to allow execution of script engine methods
Modified Paths:
--------------
scummvm/trunk/engines/lure/debugger.cpp
scummvm/trunk/engines/lure/debugger.h
scummvm/trunk/engines/lure/scripts.cpp
scummvm/trunk/engines/lure/scripts.h
Modified: scummvm/trunk/engines/lure/debugger.cpp
===================================================================
--- scummvm/trunk/engines/lure/debugger.cpp 2008-04-18 22:24:39 UTC (rev 31567)
+++ scummvm/trunk/engines/lure/debugger.cpp 2008-04-19 00:34:02 UTC (rev 31568)
@@ -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 @@
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 @@
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
Modified: scummvm/trunk/engines/lure/debugger.h
===================================================================
--- scummvm/trunk/engines/lure/debugger.h 2008-04-18 22:24:39 UTC (rev 31567)
+++ scummvm/trunk/engines/lure/debugger.h 2008-04-19 00:34:02 UTC (rev 31568)
@@ -48,6 +48,7 @@
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];
Modified: scummvm/trunk/engines/lure/scripts.cpp
===================================================================
--- scummvm/trunk/engines/lure/scripts.cpp 2008-04-18 22:24:39 UTC (rev 31567)
+++ scummvm/trunk/engines/lure/scripts.cpp 2008-04-19 00:34:02 UTC (rev 31568)
@@ -1171,6 +1171,19 @@
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 -*/
/*- -*/
Modified: scummvm/trunk/engines/lure/scripts.h
===================================================================
--- scummvm/trunk/engines/lure/scripts.h 2008-04-18 22:24:39 UTC (rev 31567)
+++ scummvm/trunk/engines/lure/scripts.h 2008-04-19 00:34:02 UTC (rev 31568)
@@ -77,6 +77,7 @@
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list