diff options
-rw-r--r-- | engines/draci/game.cpp | 2 | ||||
-rw-r--r-- | engines/draci/game.h | 3 | ||||
-rw-r--r-- | engines/draci/script.cpp | 9 |
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; } |