aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/script.h
diff options
context:
space:
mode:
authorDenis Kasak2009-07-04 14:48:36 +0000
committerDenis Kasak2009-07-04 14:48:36 +0000
commit885ce59ce8b02046e165598c40facccceda48927 (patch)
treed36ce64d2bf4d20198f82d9ea0fe06564182d34e /engines/draci/script.h
parenta4e6464a63fdf109df39c3c3106e1b3cd84bf5a7 (diff)
downloadscummvm-rg350-885ce59ce8b02046e165598c40facccceda48927.tar.gz
scummvm-rg350-885ce59ce8b02046e165598c40facccceda48927.tar.bz2
scummvm-rg350-885ce59ce8b02046e165598c40facccceda48927.zip
Restructured Script so I can start adding callbacks to GPL commands (added DraciEngine * member to Script, added Script::setupCommandList() which initialises the command list array, added Script::dummy() callback for the Load command for testing).
svn-id: r42090
Diffstat (limited to 'engines/draci/script.h')
-rw-r--r--engines/draci/script.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/engines/draci/script.h b/engines/draci/script.h
index ac994f1d27..c4d9e75100 100644
--- a/engines/draci/script.h
+++ b/engines/draci/script.h
@@ -28,13 +28,21 @@
#include "common/str.h"
#include "common/stream.h"
+#include "common/queue.h"
namespace Draci {
/** The maximum number of parameters for a GPL command */
const int kMaxParams = 3;
-// FIXME: Add function handlers
+class DraciEngine;
+class Script;
+
+enum {
+ kNumCommands = 55
+};
+
+typedef void (Script::* GPLHandler)(Common::Queue<int> &);
/**
* Represents a single command in the GPL scripting language bytecode.
@@ -48,6 +56,7 @@ struct GPL2Command {
Common::String _name;
uint16 _numParams;
int _paramTypes[kMaxParams];
+ GPLHandler _handler;
};
/**
@@ -65,11 +74,22 @@ struct GPL2Program {
class Script {
public:
+ Script(DraciEngine *vm) : _vm(vm) { setupCommandList(); };
+
int run(GPL2Program program, uint16 offset);
-
+
private:
- GPL2Command *findCommand(byte num, byte subnum);
- void handleMathExpression(Common::MemoryReadStream &reader);
+
+ /** List of all GPL commands. Initialised in the constructor. */
+ const GPL2Command *_commandList;
+
+ void dummy(Common::Queue<int> &params);
+
+ void setupCommandList();
+ const GPL2Command *findCommand(byte num, byte subnum);
+ int handleMathExpression(Common::MemoryReadStream &reader);
+
+ DraciEngine *_vm;
};