aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-04-07 10:41:23 +0000
committerMax Horn2009-04-07 10:41:23 +0000
commit7444665152c24f0ad473baf8a4db4f1f9130e59b (patch)
tree2e69149da70d09a9715f457e111e179417f57c17
parent8151a1d878f73280bb9497a88005e3449ec76ccb (diff)
downloadscummvm-rg350-7444665152c24f0ad473baf8a4db4f1f9130e59b.tar.gz
scummvm-rg350-7444665152c24f0ad473baf8a4db4f1f9130e59b.tar.bz2
scummvm-rg350-7444665152c24f0ad473baf8a4db4f1f9130e59b.zip
GOB: Gave some numerical constants a name. This codebase is a bit of a mess ;) (tons of duplicate code, unnamed constants, etc.)
svn-id: r39882
-rw-r--r--engines/gob/goblin_v1.cpp1
-rw-r--r--engines/gob/parse.cpp14
-rw-r--r--engines/gob/parse.h10
-rw-r--r--engines/gob/parse_v1.cpp58
-rw-r--r--engines/gob/parse_v2.cpp58
5 files changed, 76 insertions, 65 deletions
diff --git a/engines/gob/goblin_v1.cpp b/engines/gob/goblin_v1.cpp
index 6ac086767b..266e224086 100644
--- a/engines/gob/goblin_v1.cpp
+++ b/engines/gob/goblin_v1.cpp
@@ -671,6 +671,7 @@ void Goblin_v1::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc,
_gobPositions[_currentGoblin].y++;
break;
}
+
if (_currentGoblin == 1) {
if (gobDesc->nextState == 28)
_gobPositions[1].y--;
diff --git a/engines/gob/parse.cpp b/engines/gob/parse.cpp
index b3ce12ce9d..adff890507 100644
--- a/engines/gob/parse.cpp
+++ b/engines/gob/parse.cpp
@@ -304,31 +304,31 @@ void Parse::printExpr_internal(char stopToken) {
debugN(5, "-");
break;
- case 2:
+ case OP_ADD:
debugN(5, "+");
break;
- case 3:
+ case OP_SUB:
debugN(5, "-");
break;
- case 4:
+ case OP_BITOR:
debugN(5, "|");
break;
- case 5:
+ case OP_MUL:
debugN(5, "*");
break;
- case 6:
+ case OP_DIV:
debugN(5, "/");
break;
- case 7:
+ case OP_MOD:
debugN(5, "%%");
break;
- case 8:
+ case OP_BITAND:
debugN(5, "&");
break;
diff --git a/engines/gob/parse.h b/engines/gob/parse.h
index e181b6441e..738c956796 100644
--- a/engines/gob/parse.h
+++ b/engines/gob/parse.h
@@ -28,6 +28,16 @@
namespace Gob {
+enum {
+ OP_ADD = 2,
+ OP_SUB = 3,
+ OP_BITOR = 4,
+ OP_MUL = 5,
+ OP_DIV = 6,
+ OP_MOD = 7,
+ OP_BITAND = 8
+};
+
class Parse {
public:
void skipExpr(char stopToken);
diff --git a/engines/gob/parse_v1.cpp b/engines/gob/parse_v1.cpp
index 5345089b6c..f1b9ebbe7e 100644
--- a/engines/gob/parse_v1.cpp
+++ b/engines/gob/parse_v1.cpp
@@ -197,19 +197,19 @@ int16 Parse_v1::parseValExpr(byte stopToken) {
valPtr -= 2;
switch (operPtr[1]) {
- case 5:
+ case OP_MUL:
valPtr[0] *= valPtr[2];
break;
- case 6:
+ case OP_DIV:
valPtr[0] /= valPtr[2];
break;
- case 7:
+ case OP_MOD:
valPtr[0] %= valPtr[2];
break;
- case 8:
+ case OP_BITAND:
valPtr[0] &= valPtr[2];
break;
}
@@ -244,19 +244,19 @@ int16 Parse_v1::parseValExpr(byte stopToken) {
operPtr -= 2;
valPtr -= 2;
switch (operPtr[0]) {
- case 5:
+ case OP_MUL:
operPtr[-1] *= operPtr[1];
break;
- case 6:
+ case OP_DIV:
operPtr[-1] /= operPtr[1];
break;
- case 7:
+ case OP_MOD:
operPtr[-1] %= operPtr[1];
break;
- case 8:
+ case OP_BITAND:
operPtr[-1] &= operPtr[1];
break;
}
@@ -280,25 +280,25 @@ int16 Parse_v1::parseValExpr(byte stopToken) {
operPtr -= 2;
valPtr -= 2;
switch (operPtr[0]) {
- case 2:
+ case OP_ADD:
values[brackPos] += valPtr[1];
continue;
- case 3:
+ case OP_SUB:
values[brackPos] -= valPtr[1];
continue;
- case 4:
+ case OP_BITOR:
values[brackPos] |= valPtr[1];
continue;
- case 5:
+ case OP_MUL:
valPtr[-1] *= valPtr[1];
continue;
- case 6:
+ case OP_DIV:
valPtr[-1] /= valPtr[1];
continue;
- case 7:
+ case OP_MOD:
valPtr[-1] %= valPtr[1];
continue;
- case 8:
+ case OP_BITAND:
valPtr[-1] &= valPtr[1];
continue;
}
@@ -487,28 +487,28 @@ int16 Parse_v1::parseExpr(byte stopToken, byte *arg_2) {
}
break;
- case 5:
+ case OP_MUL:
valPtr[-2] *= valPtr[0];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 6:
+ case OP_DIV:
valPtr[-2] /= valPtr[0];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 7:
+ case OP_MOD:
valPtr[-2] %= valPtr[0];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 8:
+ case OP_BITAND:
valPtr[-2] &= valPtr[0];
stkPos -= 2;
operPtr -= 2;
@@ -553,27 +553,27 @@ int16 Parse_v1::parseExpr(byte stopToken, byte *arg_2) {
if (stkPos > 2) {
switch (operPtr[-2]) {
- case 5:
+ case OP_MUL:
valPtr[-3] *= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 6:
+ case OP_DIV:
valPtr[-3] /= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 7:
+ case OP_MOD:
valPtr[-3] %= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 8:
+ case OP_BITAND:
valPtr[-3] &= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
@@ -611,42 +611,42 @@ int16 Parse_v1::parseExpr(byte stopToken, byte *arg_2) {
valPtr -= 2;
continue;
- case 3:
+ case OP_SUB:
values[brackStart] -= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
continue;
- case 4:
+ case OP_BITOR:
values[brackStart] |= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
continue;
- case 5:
+ case OP_MUL:
valPtr[-3] *= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 6:
+ case OP_DIV:
valPtr[-3] /= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 7:
+ case OP_MOD:
valPtr[-3] %= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 8:
+ case OP_BITAND:
valPtr[-3] &= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
diff --git a/engines/gob/parse_v2.cpp b/engines/gob/parse_v2.cpp
index c48610d230..1e0617c3e7 100644
--- a/engines/gob/parse_v2.cpp
+++ b/engines/gob/parse_v2.cpp
@@ -335,19 +335,19 @@ int16 Parse_v2::parseValExpr(byte stopToken) {
valPtr -= 2;
switch (operPtr[1]) {
- case 5:
+ case OP_MUL:
valPtr[0] *= valPtr[2];
break;
- case 6:
+ case OP_DIV:
valPtr[0] /= valPtr[2];
break;
- case 7:
+ case OP_MOD:
valPtr[0] %= valPtr[2];
break;
- case 8:
+ case OP_BITAND:
valPtr[0] &= valPtr[2];
break;
}
@@ -383,19 +383,19 @@ int16 Parse_v2::parseValExpr(byte stopToken) {
operPtr -= 2;
valPtr -= 2;
switch (operPtr[0]) {
- case 5:
+ case OP_MUL:
valPtr[-1] *= valPtr[1];
break;
- case 6:
+ case OP_DIV:
valPtr[-1] /= valPtr[1];
break;
- case 7:
+ case OP_MOD:
valPtr[-1] %= valPtr[1];
break;
- case 8:
+ case OP_BITAND:
valPtr[-1] &= valPtr[1];
break;
}
@@ -419,25 +419,25 @@ int16 Parse_v2::parseValExpr(byte stopToken) {
operPtr -= 2;
valPtr -= 2;
switch (operPtr[0]) {
- case 2:
+ case OP_ADD:
values[brackPos] += valPtr[1];
continue;
- case 3:
+ case OP_SUB:
values[brackPos] -= valPtr[1];
continue;
- case 4:
+ case OP_BITOR:
values[brackPos] |= valPtr[1];
continue;
- case 5:
+ case OP_MUL:
valPtr[-1] *= valPtr[1];
continue;
- case 6:
+ case OP_DIV:
valPtr[-1] /= valPtr[1];
continue;
- case 7:
+ case OP_MOD:
valPtr[-1] %= valPtr[1];
continue;
- case 8:
+ case OP_BITAND:
valPtr[-1] &= valPtr[1];
continue;
}
@@ -693,28 +693,28 @@ int16 Parse_v2::parseExpr(byte stopToken, byte *arg_2) {
}
break;
- case 5:
+ case OP_MUL:
valPtr[-2] *= valPtr[0];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 6:
+ case OP_DIV:
valPtr[-2] /= valPtr[0];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 7:
+ case OP_MOD:
valPtr[-2] %= valPtr[0];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 8:
+ case OP_BITAND:
valPtr[-2] &= valPtr[0];
stkPos -= 2;
operPtr -= 2;
@@ -756,28 +756,28 @@ int16 Parse_v2::parseExpr(byte stopToken, byte *arg_2) {
if (stkPos > 2) {
switch (operPtr[-2]) {
- case 5:
+ case OP_MUL:
valPtr[-3] *= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 6:
+ case OP_DIV:
valPtr[-3] /= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 7:
+ case OP_MOD:
valPtr[-3] %= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 8:
+ case OP_BITAND:
valPtr[-3] &= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
@@ -815,42 +815,42 @@ int16 Parse_v2::parseExpr(byte stopToken, byte *arg_2) {
valPtr -= 2;
continue;
- case 3:
+ case OP_SUB:
values[brackStart] -= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
continue;
- case 4:
+ case OP_BITOR:
values[brackStart] |= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
continue;
- case 5:
+ case OP_MUL:
valPtr[-3] *= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 6:
+ case OP_DIV:
valPtr[-3] /= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 7:
+ case OP_MOD:
valPtr[-3] %= valPtr[-1];
stkPos -= 2;
operPtr -= 2;
valPtr -= 2;
break;
- case 8:
+ case OP_BITAND:
valPtr[-3] &= valPtr[-1];
stkPos -= 2;
operPtr -= 2;