aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kasak2009-07-07 20:57:14 +0000
committerDenis Kasak2009-07-07 20:57:14 +0000
commitb6b1402368b8f33c825af095bec210829ad33cd3 (patch)
treeeff68e7872b37deebbe5f9eb8ed29b611f99f2b6
parent318d40624212d34df16721d8f7ac2d0fb3ee486a (diff)
downloadscummvm-rg350-b6b1402368b8f33c825af095bec210829ad33cd3.tar.gz
scummvm-rg350-b6b1402368b8f33c825af095bec210829ad33cd3.tar.bz2
scummvm-rg350-b6b1402368b8f33c825af095bec210829ad33cd3.zip
* Changed Game::_variables to public since the GPL interpreter needs to use it and made it int instead of uint16
* Implemented variable accessing by the math evaluator * Fixed bug from previous commit (should have used && when checking for ending instructions, not ||) svn-id: r42242
-rw-r--r--engines/draci/game.cpp2
-rw-r--r--engines/draci/game.h3
-rw-r--r--engines/draci/script.cpp9
3 files changed, 9 insertions, 5 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index cbdeff22ef..072d205436 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -96,7 +96,7 @@ Game::Game(DraciEngine *vm) : _vm(vm) {
file = initArchive.getFile(2);
unsigned int numVariables = file->_length / sizeof (int16);
- _variables = new int16[numVariables];
+ _variables = new int[numVariables];
Common::MemoryReadStream variableData(file->_data, file->_length);
for (i = 0; i < numVariables; ++i) {
diff --git a/engines/draci/game.h b/engines/draci/game.h
index e47f14bd98..1c572f95e9 100644
--- a/engines/draci/game.h
+++ b/engines/draci/game.h
@@ -131,13 +131,14 @@ public:
GameObject *getObject(uint objNum);
+ int *_variables;
+
private:
DraciEngine *_vm;
GameInfo *_info;
Person *_persons;
uint16 *_dialogOffsets;
- int16 *_variables;
byte *_itemStatus;
GameObject *_objects;
Room _currentRoom;
diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp
index 5ffed256ea..f45f45cb76 100644
--- a/engines/draci/script.cpp
+++ b/engines/draci/script.cpp
@@ -297,8 +297,11 @@ int Script::handleMathExpression(Common::MemoryReadStream &reader) {
case kMathVariable:
value = reader.readUint16LE();
- stk.push(value);
- debugC(3, kDraciBytecodeDebugLevel, "\t\tvariable: %d", value);
+
+ stk.push(_vm->_game->_variables[value-1]);
+
+ debugC(3, kDraciBytecodeDebugLevel, "\t\tvariable: %d (%d)", value,
+ _vm->_game->_variables[value-1]);
break;
case kMathFunctionCall:
@@ -458,7 +461,7 @@ int Script::run(GPL2Program program, uint16 offset) {
(this->*(cmd->_handler))(params);
}
- } while (cmd->_name != "gplend" || cmd->_name != "exit");
+ } while (cmd->_name != "gplend" && cmd->_name != "exit");
return 0;
}