aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/script.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/scumm/script.h')
-rw-r--r--engines/scumm/script.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/engines/scumm/script.h b/engines/scumm/script.h
index 9081e76c22..dbfa2630e5 100644
--- a/engines/scumm/script.h
+++ b/engines/scumm/script.h
@@ -26,10 +26,40 @@
#ifndef SCUMM_SCRIPT_H
#define SCUMM_SCRIPT_H
-#include "engines/engine.h"
+#include "common/func.h"
namespace Scumm {
+
+typedef Common::Functor0<void> Opcode;
+
+struct OpcodeEntry : Common::NonCopyable {
+ Opcode *proc;
+ const char *desc;
+
+ OpcodeEntry() : proc(0), desc(0) {}
+ ~OpcodeEntry() {
+ setProc(0, 0);
+ }
+
+ void setProc(Opcode *p, const char *d) {
+ if (proc != p) {
+ delete proc;
+ proc = p;
+ }
+ desc = d;
+ }
+};
+
+
+// This is to help devices with small memory (PDA, smartphones, ...)
+// to save abit of memory used by opcode names in the Scumm engine.
+#ifndef REDUCE_MEMORY_USAGE
+# define _OPCODE(ver, x) setProc(new Common::Functor0Mem<void, ver>(this, &ver::x), #x)
+#else
+# define _OPCODE(ver, x) setProc(new Common::Functor0Mem<void, ver>(this, &ver::x), "")
+#endif
+
/**
* The number of script slots, which determines the maximal number
* of concurrently running scripts.