X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcommon%2FScriptRunner.h;h=7ee5b836c5d3472fec84eaf65f8d9420853f2eb7;hb=4309d259becd96ead792678257e910c03a6b4a3d;hp=4751908960d3dc630922207df86a02abdac6d98b;hpb=6e88a625710c7936f87b38ecf6094472f3a49f4f;p=l2e.git diff --git a/src/common/ScriptRunner.h b/src/common/ScriptRunner.h index 4751908..7ee5b83 100644 --- a/src/common/ScriptRunner.h +++ b/src/common/ScriptRunner.h @@ -1,15 +1,14 @@ -/* - * ScriptRunner.h - * - * Created on: Oct 13, 2012 - * Author: holy - */ - #ifndef COMMON_SCRIPTRUNNER_H_ #define COMMON_SCRIPTRUNNER_H_ -#include "fwd.h" -#include "../geometry/Vector.h" +namespace common { + class ScriptHost; +} + +#include "Script.h" +#include "../math/Vector.h" + +#include namespace common { @@ -23,35 +22,41 @@ 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 &Vector0() const { return vector0; } - const geometry::Vector &Vector1() const { return vector1; } + void *AddressRegister(int n) const { return address[n]; } + int IntegerRegister(int n) const { return integer[n]; } + const math::Vector &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 &PopVector(); + const math::Vector &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 vector0; - geometry::Vector vector1; + static const int numRegisters = 7; + void *address[numRegisters]; + int integer[numRegisters]; + math::Vector vector[numRegisters]; + + Uint8 compare; }; } -#endif /* COMMON_SCRIPTRUNNER_H_ */ +#endif