]> git.localhorst.tv Git - l2e.git/blob - src/common/ScriptRunner.h
removed useless comments
[l2e.git] / src / common / ScriptRunner.h
1 #ifndef COMMON_SCRIPTRUNNER_H_
2 #define COMMON_SCRIPTRUNNER_H_
3
4 namespace common {
5         class ScriptHost;
6 }
7
8 #include "Script.h"
9 #include "../math/Vector.h"
10
11 #include <SDL.h>
12
13 namespace common {
14
15 class ScriptRunner {
16
17 public:
18         ScriptRunner();
19         ~ScriptRunner();
20
21 public:
22         void Run(ScriptHost &, const Script &);
23         bool Running() const;
24
25         void *AddressRegister(int n) const { return address[n]; }
26         int IntegerRegister(int n) const { return integer[n]; }
27         const math::Vector<int> &VectorRegister(int n) const { return vector[n]; }
28
29 private:
30         void Reset();
31         void Exec(Script::Code code);
32
33         void *PopAddress();
34         Script::Code PopCode();
35         int PopInt();
36         const math::Vector<int> &PopVector();
37
38         void Compare(int, int);
39
40         enum CompareFlags {
41                 COMPARE_EQUAL = 0,
42                 COMPARE_LESS = 1,
43                 COMPARE_GREATER = 2,
44         };
45
46 private:
47         ScriptHost *host;
48         const Script *script;
49         int cursor;
50
51         static const int numRegisters = 7;
52         void *address[numRegisters];
53         int integer[numRegisters];
54         math::Vector<int> vector[numRegisters];
55
56         Uint8 compare;
57
58 };
59
60 }
61
62 #endif