aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/util.h
diff options
context:
space:
mode:
authorJohannes Schickel2008-04-19 13:52:09 +0000
committerJohannes Schickel2008-04-19 13:52:09 +0000
commitbf46b5f17868cee22aea71b274a3515593206fbd (patch)
tree2b991a7c516d8a5c04266ba011caa8ab8c650b67 /engines/kyra/util.h
parent76b1f4bcea6a89e37087f61d672cd55b47e6f719 (diff)
downloadscummvm-rg350-bf46b5f17868cee22aea71b274a3515593206fbd.tar.gz
scummvm-rg350-bf46b5f17868cee22aea71b274a3515593206fbd.tar.bz2
scummvm-rg350-bf46b5f17868cee22aea71b274a3515593206fbd.zip
- reworked tim handling
- moved tim interpreter to new class TIMInterpreter svn-id: r31569
Diffstat (limited to 'engines/kyra/util.h')
-rw-r--r--engines/kyra/util.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/engines/kyra/util.h b/engines/kyra/util.h
index 1c4b8462cc..78925441f3 100644
--- a/engines/kyra/util.h
+++ b/engines/kyra/util.h
@@ -78,10 +78,37 @@ private:
Res (T::*_func)(Arg);
};
-struct ScriptState;
+template<class Arg1, class Arg2, class Res>
+struct Functor2 : public Common::BinaryFunction<Arg1, Arg2, Res> {
+ virtual ~Functor2() {}
+
+ virtual bool isValid() const = 0;
+ virtual Res operator()(Arg1, Arg2) const = 0;
+};
+
+template<class Arg1, class Arg2, class Res, class T>
+class Functor2Mem : public Functor2<Arg1, Arg2, Res> {
+public:
+ typedef Res (T::*FuncType)(Arg1, Arg2);
+
+ Functor2Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
+
+ bool isValid() const { return _func != 0; }
+ Res operator()(Arg1 v1, Arg2 v2) const {
+ return (_t->*_func)(v1, v2);
+ }
+private:
+ mutable T *_t;
+ Res (T::*_func)(Arg1, Arg2);
+};
+struct ScriptState;
typedef Functor1<ScriptState*, int> Opcode;
+struct TIM;
+typedef Functor2<const TIM*, const uint16*, int> TIMOpcode;
+
} // end of namespace Kyra
#endif
+