aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agos/script.cpp')
-rw-r--r--engines/agos/script.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp
index 3ba88524d9..ecc43038c1 100644
--- a/engines/agos/script.cpp
+++ b/engines/agos/script.cpp
@@ -61,8 +61,7 @@ int AGOSEngine::getScriptReturn() {
// -----------------------------------------------------------------------
void AGOSEngine::o_invalid() {
- // TODO: Better error reporting
- error("Invalid opcode");
+ error("Invalid opcode %d", _opcode);
}
void AGOSEngine::o_at() {
@@ -883,7 +882,6 @@ void AGOSEngine::writeVariable(uint variable, uint16 contents) {
}
int AGOSEngine::runScript() {
- int opcode;
bool flag;
do {
@@ -891,12 +889,12 @@ int AGOSEngine::runScript() {
dumpOpcode(_codePtr);
if (getGameType() == GType_ELVIRA1) {
- opcode = getVarOrWord();
- if (opcode == 10000)
+ _opcode = getVarOrWord();
+ if (_opcode == 10000)
return 0;
} else {
- opcode = getByte();
- if (opcode == 0xFF)
+ _opcode = getByte();
+ if (_opcode == 0xFF)
return 0;
}
@@ -906,17 +904,17 @@ int AGOSEngine::runScript() {
/* Invert condition? */
flag = false;
if (getGameType() == GType_ELVIRA1) {
- if (opcode == 203) {
+ if (_opcode == 203) {
flag = true;
- opcode = getVarOrWord();
- if (opcode == 10000)
+ _opcode = getVarOrWord();
+ if (_opcode == 10000)
return 0;
}
} else {
- if (opcode == 0) {
+ if (_opcode == 0) {
flag = true;
- opcode = getByte();
- if (opcode == 0xFF)
+ _opcode = getByte();
+ if (_opcode == 0xFF)
return 0;
}
}
@@ -924,10 +922,10 @@ int AGOSEngine::runScript() {
setScriptCondition(true);
setScriptReturn(0);
- if (opcode > _numOpcodes)
- error("Invalid opcode '%d' encountered", opcode);
+ if (_opcode > _numOpcodes)
+ error("Invalid opcode '%d' encountered", _opcode);
- executeOpcode(opcode);
+ executeOpcode(_opcode);
} while (getScriptCondition() != flag && !getScriptReturn());
return getScriptReturn();