diff options
-rw-r--r-- | engines/draci/game.cpp | 12 | ||||
-rw-r--r-- | engines/draci/script.cpp | 22 |
2 files changed, 13 insertions, 21 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 6051e0d651..419e2e9c29 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -168,8 +168,10 @@ void Game::start() { if (_newRoom != _currentRoom._roomNum) { // Set the first two variables to the new room / gate - _variables[0] = _newGate; - _variables[1] = _newRoom; + // Before setting these variables we have to convert the values to + // 1-based indexing because this is how everything is stored in the data files + _variables[0] = _newGate + 1; + _variables[1] = _newRoom + 1; // If the new room is the map room, set the appropriate coordinates // for the dragon in the persons array @@ -263,8 +265,10 @@ void Game::init() { _newRoom = _currentRoom._roomNum; _newGate = _currentGate; - _variables[0] = _currentGate; - _variables[1] = _currentRoom._roomNum; + // Before setting these variables we have to convert the values to 1-based indexing + // because this is how everything is stored in the data files + _variables[0] = _currentGate + 1; + _variables[1] = _currentRoom._roomNum + 1; changeRoom(_currentRoom._roomNum); runGateProgram(_currentGate); diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index b30a081027..f526bdc874 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -394,20 +394,8 @@ void Script::start(Common::Queue<int> ¶ms) { return; } - int objID = params.pop(); - int animID = params.pop(); - - // Fixes bug in the data files which makes the game crash in the intro - // TODO: This is possibly exclusive to the English version, so check for that - if (animID == 657) { - Common::Queue<int> tmp; - tmp.push(objID); - tmp.push(animID); - this->load(tmp); - } - - objID -= 1; - animID -= 1; + int objID = params.pop() - 1; + int animID = params.pop() - 1; GameObject *obj = _vm->_game->getObject(objID); @@ -780,12 +768,12 @@ int Script::handleMathExpression(Common::MemoryReadStream &reader) { break; case kMathVariable: - value = reader.readSint16LE(); + value = reader.readSint16LE() - 1; - stk.push(_vm->_game->getVariable(value-1)); + stk.push(_vm->_game->getVariable(value)); debugC(3, kDraciBytecodeDebugLevel, "\t\tvariable: %d (%d)", value, - _vm->_game->getVariable(value-1)); + _vm->_game->getVariable(value)); break; case kMathFunctionCall: |