Fix several palette fading bugs.
svn-id: r45497
This commit is contained in:
parent
fa3305ee01
commit
25b3e687a7
4 changed files with 9 additions and 9 deletions
|
@ -243,15 +243,15 @@ void Game::loop() {
|
|||
if (_fadePhase > 0 && (_vm->_system->getMillis() - _fadeTick) >= kFadingTimeUnit) {
|
||||
_fadeTick = _vm->_system->getMillis();
|
||||
--_fadePhase;
|
||||
const BAFile *startPal = _vm->_paletteArchive->getFile(_currentRoom._palette);
|
||||
const BAFile *endPal = getScheduledPalette() >= 0 ? _vm->_paletteArchive->getFile(getScheduledPalette()) : NULL;
|
||||
_vm->_screen->interpolatePalettes(startPal->_data, endPal->_data, 0, kNumColours, _fadePhases - _fadePhase, _fadePhases);
|
||||
const byte *startPal = _currentRoom._palette >= 0 ? _vm->_paletteArchive->getFile(_currentRoom._palette)->_data : NULL;
|
||||
const byte *endPal = getScheduledPalette() >= 0 ? _vm->_paletteArchive->getFile(getScheduledPalette())->_data : NULL;
|
||||
_vm->_screen->interpolatePalettes(startPal, endPal, 0, kNumColours, _fadePhases - _fadePhase, _fadePhases);
|
||||
if (_loopSubstatus == kSubstatusFade && _fadePhase == 0) {
|
||||
setExitLoop(true);
|
||||
// Rewrite the palette index of the current
|
||||
// room. This is necessary when two fadings
|
||||
// are called after each other, such as in the
|
||||
// intro. We rely on that getScheduledPalette() >= 0.
|
||||
// intro.
|
||||
_currentRoom._palette = getScheduledPalette();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ struct Room {
|
|||
int _roomNum;
|
||||
byte _music;
|
||||
WalkingMap _walkingMap;
|
||||
byte _palette;
|
||||
int _palette;
|
||||
int _numOverlays;
|
||||
int _init, _look, _use, _canUse;
|
||||
bool _imInit, _imLook, _imUse;
|
||||
|
|
|
@ -55,7 +55,7 @@ Screen::~Screen() {
|
|||
*/
|
||||
void Screen::setPalette(const byte *data, uint16 start, uint16 num) {
|
||||
Common::MemoryReadStream pal(data ? data : _blackPalette, 3 * kNumColours);
|
||||
pal.seek(start * 4);
|
||||
pal.seek(start * 3);
|
||||
|
||||
// Copy the palette
|
||||
for (uint16 i = start; i < start + num; ++i) {
|
||||
|
@ -77,8 +77,8 @@ void Screen::setPalette(const byte *data, uint16 start, uint16 num) {
|
|||
void Screen::interpolatePalettes(const byte *first, const byte *second, uint16 start, uint16 num, int index, int number) {
|
||||
Common::MemoryReadStream firstPal(first ? first : _blackPalette, 3 * kNumColours);
|
||||
Common::MemoryReadStream secondPal(second ? second : _blackPalette, 3 * kNumColours);
|
||||
firstPal.seek(start * 4);
|
||||
secondPal.seek(start * 4);
|
||||
firstPal.seek(start * 3);
|
||||
secondPal.seek(start * 3);
|
||||
|
||||
// Interpolate the palettes
|
||||
for (uint16 i = start; i < start + num; ++i) {
|
||||
|
|
|
@ -869,7 +869,7 @@ void Script::setPalette(Common::Queue<int> ¶ms) {
|
|||
}
|
||||
// Immediately update the palette
|
||||
_vm->_screen->copyToScreen();
|
||||
_vm->_system->delayMillis(100);
|
||||
_vm->_system->delayMillis(20);
|
||||
}
|
||||
|
||||
void Script::quitGame(Common::Queue<int> ¶ms) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue