From 18fda1b2f374e57b10f7ed3bce7e193998cb0014 Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Sat, 18 Jul 2009 03:05:20 +0000 Subject: Fixed a bug where the cursor was not shown when the first room is loaded and has mouse enabled. svn-id: r42582 --- engines/draci/game.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'engines/draci') diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 161f1d82d7..c322a5b286 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -157,8 +157,6 @@ void Game::init() { _currentRoom._roomNum = _info._startRoom; changeRoom(_info._startRoom); - - _vm->_mouse->setCursorType(kNormalCursor); } void Game::loop() { @@ -237,21 +235,15 @@ void Game::loadRoom(int roomNum) { debugC(4, kDraciLogicDebugLevel, "EscRoom: %d", _currentRoom._escRoom); debugC(4, kDraciLogicDebugLevel, "Gates: %d", _currentRoom._numGates); - // Set cursor state - if (_currentRoom._mouseOn) { - debugC(6, kDraciLogicDebugLevel, "Mouse: ON"); - _vm->_mouse->cursorOn(); - } else { - debugC(6, kDraciLogicDebugLevel, "Mouse: OFF"); - _vm->_mouse->cursorOff(); - } + // Read in the gates' numbers Common::Array gates; for (uint i = 0; i < _currentRoom._numGates; ++i) { gates.push_back(roomReader.readSint16LE()); } + // Load the room's objects for (uint i = 0; i < _info._numObjects; ++i) { debugC(7, kDraciLogicDebugLevel, "Checking if object %d (%d) is at the current location (%d)", i, @@ -274,6 +266,7 @@ void Game::loadRoom(int roomNum) { } } + // Load the room's GPL program and run the init part f = _vm->_roomsArchive->getFile(roomNum * 4 + 3); _currentRoom._program._bytecode = f->_data; _currentRoom._program._length = f->_length; @@ -288,9 +281,22 @@ void Game::loadRoom(int roomNum) { _vm->_script->run(_currentRoom._program, gates[i]); } + // Set room palette f = _vm->_paletteArchive->getFile(_currentRoom._palette); _vm->_screen->setPalette(f->_data, 0, kNumColours); + // Set cursor state + // Need to do this after we set the palette since the cursors use it + if (_currentRoom._mouseOn) { + debugC(6, kDraciLogicDebugLevel, "Mouse: ON"); + _vm->_mouse->cursorOn(); + } else { + debugC(6, kDraciLogicDebugLevel, "Mouse: OFF"); + _vm->_mouse->cursorOff(); + } + + _vm->_mouse->setCursorType(kNormalCursor); + // HACK: Create a visible overlay from the walking map so we can test it byte *wlk = new byte[kScreenWidth * kScreenHeight]; memset(wlk, 255, kScreenWidth * kScreenHeight); -- cgit v1.2.3