aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2008-05-09 01:42:25 +0000
committerNicola Mettifogo2008-05-09 01:42:25 +0000
commitc7c8bb99eefa3b19bc25fa921cd93255489656c5 (patch)
tree186a3b4faf75b85455a01410edc7aaa9d9c7fded /engines
parent1d025957caad81aef5504b8e505b835ce106cf1b (diff)
downloadscummvm-rg350-c7c8bb99eefa3b19bc25fa921cd93255489656c5.tar.gz
scummvm-rg350-c7c8bb99eefa3b19bc25fa921cd93255489656c5.tar.bz2
scummvm-rg350-c7c8bb99eefa3b19bc25fa921cd93255489656c5.zip
Tiny cleanup to ease extraction of the program parser code.
svn-id: r31959
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/exec_br.cpp2
-rw-r--r--engines/parallaction/exec_ns.cpp12
-rw-r--r--engines/parallaction/objects.cpp10
-rw-r--r--engines/parallaction/objects.h2
-rw-r--r--engines/parallaction/parallaction.h1
5 files changed, 14 insertions, 13 deletions
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index e4859a8851..9484c99585 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -399,7 +399,7 @@ DECLARE_INSTRUCTION_OPCODE(inc) {
}
if (inst->_opA._flags & kParaLocal) {
- wrapLocalVar(inst->_opA._local);
+ inst->_opA._local->wrap();
}
}
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index b1889daa21..06969fd01d 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -107,7 +107,7 @@ DECLARE_INSTRUCTION_OPCODE(inc) {
}
if (inst->_opA._flags & kParaLocal) {
- wrapLocalVar(inst->_opA._local);
+ inst->_opA._local->wrap();
}
}
@@ -189,16 +189,6 @@ DECLARE_INSTRUCTION_OPCODE(endscript) {
-void Parallaction_ns::wrapLocalVar(LocalVariable *local) {
-
- if (local->_value >= local->_max)
- local->_value = local->_min;
- if (local->_value < local->_min)
- local->_value = local->_max - 1;
-
- return;
-}
-
DECLARE_COMMAND_OPCODE(invalid) {
error("Can't execute invalid command '%i'", _cmdRunCtxt.cmd->_id);
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index 0491c5c3c7..cac31911f4 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -116,6 +116,16 @@ int16 Program::addLocal(const char *name, int16 value, int16 min, int16 max) {
return _numLocals++;
}
+void LocalVariable::wrap() {
+
+ if (_value >= _max)
+ _value = _min;
+ if (_value < _min)
+ _value = _max - 1;
+
+ return;
+}
+
Zone::Zone() {
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index da9eaac95f..afa6cc5ed5 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -316,6 +316,8 @@ struct LocalVariable {
_min = -10000;
_max = 10000;
}
+
+ void wrap();
};
enum ParaFlags {
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index b32278bfaa..b3e93ee83f 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -683,7 +683,6 @@ protected:
void loadProgram(AnimationPtr a, const char *filename);
void parseLValue(ScriptVar &var, const char *str);
virtual void parseRValue(ScriptVar &var, const char *str);
- void wrapLocalVar(LocalVariable *local);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(invalid);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(set);