diff options
author | lukaslw | 2014-08-09 21:44:38 +0200 |
---|---|---|
committer | lukaslw | 2014-08-09 21:44:38 +0200 |
commit | 425132faf9ca3eec69a087a65321bae5c8c7a1ab (patch) | |
tree | a8da0a241ae517367a92662b79298e4a4b538493 /engines/prince | |
parent | b97f726a3e79d11ca243ef48a8a6173d47366c7e (diff) | |
download | scummvm-rg350-425132faf9ca3eec69a087a65321bae5c8c7a1ab.tar.gz scummvm-rg350-425132faf9ca3eec69a087a65321bae5c8c7a1ab.tar.bz2 scummvm-rg350-425132faf9ca3eec69a087a65321bae5c8c7a1ab.zip |
PRINCE: showPalette(), showLogo() - update
Diffstat (limited to 'engines/prince')
-rw-r--r-- | engines/prince/prince.cpp | 56 | ||||
-rw-r--r-- | engines/prince/prince.h | 2 | ||||
-rw-r--r-- | engines/prince/script.cpp | 2 |
3 files changed, 28 insertions, 32 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 7ecdae5fa6..2894831386 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -358,11 +358,10 @@ void PrinceEngine::showLogo() { if (Resource::loadResource(&logo, "logo.raw", true)) { loadSample(0, "LOGO.WAV"); playSample(0, 0); - _graph->setPalette(logo.getPalette()); - //TODO - setPalette(); _graph->draw(_graph->_frontScreen, logo.getSurface()); - _graph->update(_graph->_frontScreen); _graph->change(); + _graph->update(_graph->_frontScreen); + setPalette(logo.getPalette()); _system->delayMillis(1000 / kFPS * 70); } } @@ -1833,35 +1832,32 @@ void PrinceEngine::blackPalette() { free(blackPalette); } -void PrinceEngine::setPalette() { - byte *paletteBackup = nullptr; - byte *blackPalette = (byte *)malloc(256 * 3); - - int fadeStep = 0; - for (int i = 0; i <= kFadeStep; i++) { - paletteBackup = (byte *)_roomBmp->getPalette(); - for (int j = 0; j < 256; j++) { - blackPalette[3 * j] = paletteBackup[3 * j] * fadeStep / 4; - blackPalette[3 * j + 1] = paletteBackup[3 * j + 1] * fadeStep / 4; - blackPalette[3 * j + 2] = paletteBackup[3 * j + 2] * fadeStep / 4; - } - fadeStep++; - _graph->setPalette(blackPalette); - _system->updateScreen(); - Common::Event event; - Common::EventManager *eventMan = _system->getEventManager(); - eventMan->pollEvent(event); - if (shouldQuit()) { - _graph->setPalette(paletteBackup); - free(blackPalette); - return; +void PrinceEngine::setPalette(const byte *palette) { + if (palette != nullptr) { + byte *blackPalette = (byte *)malloc(256 * 3); + int fadeStep = 0; + for (int i = 0; i <= kFadeStep; i++) { + for (int j = 0; j < 256; j++) { + blackPalette[3 * j] = palette[3 * j] * fadeStep / 4; + blackPalette[3 * j + 1] = palette[3 * j + 1] * fadeStep / 4; + blackPalette[3 * j + 2] = palette[3 * j + 2] * fadeStep / 4; + } + fadeStep++; + _graph->setPalette(blackPalette); + _system->updateScreen(); + Common::Event event; + Common::EventManager *eventMan = _system->getEventManager(); + eventMan->pollEvent(event); + if (shouldQuit()) { + _graph->setPalette(palette); + free(blackPalette); + return; + } + pause(); } - pause(); - } - if (paletteBackup != nullptr) { - _graph->setPalette(paletteBackup); + _graph->setPalette(palette); + free(blackPalette); } - free(blackPalette); } void PrinceEngine::pause() { diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 2a9fe8666b..a1e59cc9ae 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -484,7 +484,7 @@ public: static const uint8 kFadeStep = 4; void blackPalette(); - void setPalette(); + void setPalette(const byte *palette); int getMob(Common::Array<Mob> &mobList, bool usePriorityList, int posX, int posY); diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp index 8fa24a4afc..872da2e82d 100644 --- a/engines/prince/script.cpp +++ b/engines/prince/script.cpp @@ -559,7 +559,7 @@ void Interpreter::O_BLACKPALETTE() { } void Interpreter::O_SETUPPALETTE() { - _vm->setPalette(); + _vm->setPalette(_vm->_roomBmp->getPalette()); debugInterpreter("O_SETUPPALETTE"); } |