diff options
author | Thierry Crozat | 2017-11-18 00:49:23 +0000 |
---|---|---|
committer | Thierry Crozat | 2018-01-23 02:15:41 +0000 |
commit | 55fc09571f52c26392a0b54951db650968e99ff2 (patch) | |
tree | dd8e2f243fed4584a41d4ee569ad3fb25780cc82 /engines/supernova/state.cpp | |
parent | 1ff953b8159110ce0707404746214f6a52ce8a1f (diff) | |
download | scummvm-rg350-55fc09571f52c26392a0b54951db650968e99ff2.tar.gz scummvm-rg350-55fc09571f52c26392a0b54951db650968e99ff2.tar.bz2 scummvm-rg350-55fc09571f52c26392a0b54951db650968e99ff2.zip |
SUPERNOVA: Fix handling of room brightness
There were several issues with the brighness due to the different
implementation between the original and the code in scummvm. The
code has now been modified to be much closer to the original, which
fixed those issues and allowed to remove workarounds that had been
added in various places to deal with those issues (but those
workarounds had their own issues such as fade in happening too
soon before switching to the new room).
Diffstat (limited to 'engines/supernova/state.cpp')
-rw-r--r-- | engines/supernova/state.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp index 1e7ebc8ef4..3907370b62 100644 --- a/engines/supernova/state.cpp +++ b/engines/supernova/state.cpp @@ -325,6 +325,7 @@ void GameManager::initState() { _processInput = false; _guiEnabled = true; _animationEnabled = true; + _roomBrightness = 255; _mouseClicked = false; _keyPressed = false; _mouseX = -1; @@ -832,7 +833,6 @@ void GameManager::supernovaEvent() { _rooms[MEETUP2]->removeSentence(0, 1); } _rooms[MEETUP2]->removeSentence(1, 1); - _vm->paletteFadeIn(); } _rooms[AIRLOCK]->getObject(4)->setProperty(WORN); _rooms[AIRLOCK]->getObject(5)->setProperty(WORN); @@ -1048,7 +1048,12 @@ void GameManager::mousePosDialog(int x, int y) { } void GameManager::turnOff() { + if (_state._powerOff) + return; + _state._powerOff = true; + roomBrightness(); + _vm->paletteBrightness(); } void GameManager::turnOn() { @@ -1191,18 +1196,19 @@ void GameManager::mouseInput3() { } void GameManager::roomBrightness() { - _vm->_brightness = 255; + _roomBrightness = 255; if ((_currentRoom->getId() != OUTSIDE) && (_currentRoom->getId() < ROCKS) ) { if (_state._powerOff) - _vm->_brightness = 153; + _roomBrightness = 153; } else if (_currentRoom->getId() == CAVE) { - _vm->_brightness = 0; + _roomBrightness = 0; } else if (_currentRoom->getId() == GUARD3) { if (_state._powerOff) - _vm->_brightness = 0; + _roomBrightness = 0; } - _vm->paletteBrightness(); + if (_vm->_brightness != 0) + _vm->_brightness = _roomBrightness; } void GameManager::changeRoom(RoomID id) { @@ -1613,6 +1619,7 @@ bool GameManager::genericInteract(Action verb, Object &obj1, Object &obj2) { getInput(); _vm->renderRoom(*_currentRoom); roomBrightness(); + _vm->paletteBrightness(); _vm->renderMessage(kStringGenericInteract_12); } else if ((verb == ACTION_LOOK) && (obj1._id == KEYCARD2)) { _vm->renderMessage(obj1._description); @@ -1930,7 +1937,13 @@ void GameManager::executeRoom() { drawStatus(); drawCommandBox(); } + roomBrightness(); + if (_vm->_brightness == 0) + _vm->paletteFadeIn(); + else + _vm->paletteBrightness(); + if (!_currentRoom->hasSeen()) _currentRoom->onEntrance(); } |