]> git.localhorst.tv Git - l2e.git/blobdiff - src/common/ScriptRunner.h
revised implementation of script text
[l2e.git] / src / common / ScriptRunner.h
index 4751908960d3dc630922207df86a02abdac6d98b..879877d8467a2463f1680863a78ad1bbb8178328 100644 (file)
@@ -9,8 +9,11 @@
 #define COMMON_SCRIPTRUNNER_H_
 
 #include "fwd.h"
+#include "Script.h"
 #include "../geometry/Vector.h"
 
+#include <SDL.h>
+
 namespace common {
 
 class ScriptRunner {
@@ -23,32 +26,38 @@ public:
        void Run(ScriptHost &, const Script &);
        bool Running() const;
 
-       void *Address0() const { return address0; }
-       void *Address1() const { return address1; }
-       int Integer0() const { return integer0; }
-       int Integer1() const { return integer1; }
-       const geometry::Vector<int> &Vector0() const { return vector0; }
-       const geometry::Vector<int> &Vector1() const { return vector1; }
+       void *AddressRegister(int n) const { return address[n]; }
+       int IntegerRegister(int n) const { return integer[n]; }
+       const geometry::Vector<int> &VectorRegister(int n) const { return vector[n]; }
 
 private:
        void Reset();
-       void Exec(unsigned char code);
+       void Exec(Script::Code code);
 
        void *PopAddress();
+       Script::Code PopCode();
        int PopInt();
        const geometry::Vector<int> &PopVector();
 
+       void Compare(int, int);
+
+       enum CompareFlags {
+               COMPARE_EQUAL = 0,
+               COMPARE_LESS = 1,
+               COMPARE_GREATER = 2,
+       };
+
 private:
        ScriptHost *host;
        const Script *script;
        int cursor;
 
-       void *address0;
-       void *address1;
-       int integer0;
-       int integer1;
-       geometry::Vector<int> vector0;
-       geometry::Vector<int> vector1;
+       static const int numRegisters = 7;
+       void *address[numRegisters];
+       int integer[numRegisters];
+       geometry::Vector<int> vector[numRegisters];
+
+       Uint8 compare;
 
 };