Skip to content

Commit

Permalink
LILLIPUT: Implement fade in/fade out
Browse files Browse the repository at this point in the history
Fade from/to black
  • Loading branch information
sylvaintv authored and sev- committed Mar 28, 2018
1 parent 3780999 commit eeb69f4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
1 change: 0 additions & 1 deletion engines/lilliput/lilliput.cpp
Expand Up @@ -648,7 +648,6 @@ byte *LilliputEngine::loadVGA(Common::String filename, bool loadPal) {
remainingSize -= 768;

fixPaletteEntries(_curPalette, 256);
_system->getPaletteManager()->setPalette(_curPalette, 0, 256);
}

uint8 curByte;
Expand Down
32 changes: 26 additions & 6 deletions engines/lilliput/script.cpp
Expand Up @@ -24,6 +24,8 @@
#include "lilliput/script.h"
#include "common/debug.h"

#include "common/system.h"

namespace Lilliput {

LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL) {
Expand Down Expand Up @@ -1649,10 +1651,28 @@ void LilliputScript::OC_sub182EC() {
warning("OC_sub182EC");
}
void LilliputScript::OC_unkPaletteFunction_1() {
warning("OC_unkPaletteFunction_1");

byte palette[768];
for (int fade = 256; fade >= 0; fade -= 8) {
for (int i = 0; i < 768; i++) {
palette[i] = (_vm->_curPalette[i] * fade) >> 8;
}
_vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
_vm->_system->updateScreen();
_vm->_system->delayMillis(33);
}
}
void LilliputScript::OC_unkPaletteFunction_2() {
warning("OC_unkPaletteFunction_2");

byte palette[768];
for (int fade = 8; fade <= 256; fade += 8) {
for (int i = 0; i < 768; i++) {
palette[i] = (_vm->_curPalette[i] * fade) >> 8;
}
_vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
_vm->_system->updateScreen();
_vm->_system->delayMillis(33);
}
}

void LilliputScript::OC_loadAndDisplayCUBESx_GFX() {
Expand Down Expand Up @@ -1741,13 +1761,13 @@ void LilliputScript::OC_displayVGAFile() {
debugC(1, kDebugScript, "OC_displayVGAFile()");

_byte12A09 = 1;
warning("TODO: unkPaletteFunction_1");
OC_unkPaletteFunction_1();
int curWord = _currScript->readUint16LE();
int index = _vm->_rulesChunk3[curWord];
Common::String fileName = Common::String((const char *)&_vm->_rulesChunk4[index]);
_word1881B = -1;
_vm->displayVGAFile(fileName);
warning("TODO: unkPaletteFunction_2");
OC_unkPaletteFunction_2();
}

void LilliputScript::OC_sub184D7() {
Expand Down Expand Up @@ -1789,14 +1809,14 @@ void LilliputScript::OC_displayTitleScreen() {
void LilliputScript::OC_sub1853B() {
debugC(1, kDebugScript, "OC_initArr1853B()");

warning("TODO: unkPaletteFunction_1");
OC_unkPaletteFunction_1();
_byte16F08 = 0;
_byte15FFA = 0;
sub130B6();

_vm->displayFunction12();

warning("TODO: unkPaletteFunction_2");
OC_unkPaletteFunction_2();
_byte12A09 = 0;
warning("TODO: call sound function #5");
}
Expand Down

0 comments on commit eeb69f4

Please sign in to comment.