diff options
author | Jaromir Wysoglad | 2019-06-25 15:57:18 +0200 |
---|---|---|
committer | Thierry Crozat | 2019-07-28 15:09:14 +0100 |
commit | 5ddc251528b5588b9460d4e00fa90c44b34f6061 (patch) | |
tree | 315c73669e3e0eb5f02388018f4e4f485fae8275 | |
parent | 09975e10c2c1e635206d4f3ab9234c6ead358279 (diff) | |
download | scummvm-rg350-5ddc251528b5588b9460d4e00fa90c44b34f6061.tar.gz scummvm-rg350-5ddc251528b5588b9460d4e00fa90c44b34f6061.tar.bz2 scummvm-rg350-5ddc251528b5588b9460d4e00fa90c44b34f6061.zip |
SUPERNOVA: Preload exit list on room entry
-rw-r--r-- | engines/supernova/game-manager.cpp | 9 | ||||
-rw-r--r-- | engines/supernova/supernova1/state.cpp | 11 | ||||
-rw-r--r-- | engines/supernova/supernova2/state.cpp | 11 |
3 files changed, 17 insertions, 14 deletions
diff --git a/engines/supernova/game-manager.cpp b/engines/supernova/game-manager.cpp index b5bbe2e58f..e6a6943acf 100644 --- a/engines/supernova/game-manager.cpp +++ b/engines/supernova/game-manager.cpp @@ -689,6 +689,15 @@ void GameManager::roomBrightness() { void GameManager::changeRoom(RoomId id) { _currentRoom = _rooms[id]; _newRoom = true; + + for (int i = 0; i < 25; i++) + _exitList[i] = -1; + for (int i = 0; i < kMaxObject; i++) { + if (_currentRoom->getObject(i)->hasProperty(EXIT)) { + byte r = _currentRoom->getObject(i)->_direction; + _exitList[r] = i; + } + } } void GameManager::wait(int ticks) { diff --git a/engines/supernova/supernova1/state.cpp b/engines/supernova/supernova1/state.cpp index e9c4d34dee..1f9c81b864 100644 --- a/engines/supernova/supernova1/state.cpp +++ b/engines/supernova/supernova1/state.cpp @@ -1067,15 +1067,12 @@ void GameManager1::shock() { } void GameManager1::drawMapExits() { -// TODO: Preload _exitList on room entry instead on every call _vm->renderBox(281, 161, 39, 39, kColorWhite25); - for (int i = 0; i < 25; i++) - _exitList[i] = -1; - for (int i = 0; i < kMaxObject; i++) { - if (_currentRoom->getObject(i)->hasProperty(EXIT)) { - byte r = _currentRoom->getObject(i)->_direction; - _exitList[r] = i; + int idx; + for (int i = 0; i < 25; i++) { + if ((idx = _exitList[i]) != -1) { + byte r = _currentRoom->getObject(idx)->_direction; int x = 284 + 7 * (r % 5); int y = 164 + 7 * (r / 5); _vm->renderBox(x, y, 5, 5, kColorDarkRed); diff --git a/engines/supernova/supernova2/state.cpp b/engines/supernova/supernova2/state.cpp index b280b77f71..1b2d28a234 100644 --- a/engines/supernova/supernova2/state.cpp +++ b/engines/supernova/supernova2/state.cpp @@ -451,19 +451,16 @@ void GameManager2::handleTime() { } void GameManager2::drawMapExits() { -// TODO: Preload _exitList on room entry instead on every call _vm->renderBox(281, 161, 39, 39, kColorWhite25); if ((_currentRoom >= _rooms[PYR_ENTRANCE] && _currentRoom <= _rooms[HOLE_ROOM]) || (_currentRoom >= _rooms[FLOORDOOR] && _currentRoom <= _rooms[BST_DOOR])) compass(); else { - for (int i = 0; i < 25; i++) - _exitList[i] = -1; - for (int i = 0; i < kMaxObject; i++) { - if (_currentRoom->getObject(i)->hasProperty(EXIT)) { - byte r = _currentRoom->getObject(i)->_direction; - _exitList[r] = i; + int idx; + for (int i = 0; i < 25; i++) { + if ((idx = _exitList[i]) != -1) { + byte r = _currentRoom->getObject(idx)->_direction; int x = 284 + 7 * (r % 5); int y = 164 + 7 * (r / 5); _vm->renderBox(x, y, 5, 5, kColorDarkRed); |