diff options
author | Nicola Mettifogo | 2007-03-28 20:12:00 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-03-28 20:12:00 +0000 |
commit | 3903309af338a1cedab353367a459ecd5f0250d8 (patch) | |
tree | 63aed0b2310a045267ee7e5845e90b360f413517 /engines/parallaction/callables.cpp | |
parent | ac1e6c9b75beff06f41302fb76cdaffce1125201 (diff) | |
download | scummvm-rg350-3903309af338a1cedab353367a459ecd5f0250d8.tar.gz scummvm-rg350-3903309af338a1cedab353367a459ecd5f0250d8.tar.bz2 scummvm-rg350-3903309af338a1cedab353367a459ecd5f0250d8.zip |
Overhaul of palette management to bring it back to its original form. Gfx palette code has been updated, and _c_endComment (callable from scripts) has been implemented. As a by-product, palette cycling now finally works!
svn-id: r26314
Diffstat (limited to 'engines/parallaction/callables.cpp')
-rw-r--r-- | engines/parallaction/callables.cpp | 120 |
1 files changed, 103 insertions, 17 deletions
diff --git a/engines/parallaction/callables.cpp b/engines/parallaction/callables.cpp index f7ab236453..760c633204 100644 --- a/engines/parallaction/callables.cpp +++ b/engines/parallaction/callables.cpp @@ -63,15 +63,14 @@ void _c_score(void *parm) { } void _c_fade(void *parm) { - byte palette[PALETTE_SIZE]; - _vm->_gfx->getBlackPalette(palette); - _vm->_gfx->setPalette(palette); + _vm->_gfx->setBlackPalette(); _vm->_gfx->swapBuffers(); + Gfx::Palette pal; for (uint16 _di = 0; _di < 64; _di++) { - _vm->_gfx->fadePalette(palette); - _vm->_gfx->setPalette(palette); + _vm->_gfx->fadePalette(pal); + _vm->_gfx->setPalette(pal); } _vm->waitTime( 1 ); @@ -202,26 +201,113 @@ void _c_setMask(void *parm) { return; } -void _c_endComment(void *parm) { +void _c_endComment(void *param) { -} + byte* _enginePal = _vm->_gfx->_palette; + Gfx::Palette pal; -void _c_frankenstein(void *parm) { - byte pal0[PALETTE_SIZE], pal1[PALETTE_SIZE]; + uint32 si; + for (si = 0; si < 32; si++) { + + byte al = _enginePal[si*3+1]; + if (al > _enginePal[si*3+2]) { + al = _enginePal[si*3+1]; + } else { + al = _enginePal[si*3+2]; + } + + if (al < _enginePal[si*3]) { + al = _enginePal[si*3]; + } else { + al = _enginePal[si*3+1]; + } + + if (al > _enginePal[si*3+2]) { + al = _enginePal[si*3+1]; + } else { + al = _enginePal[si*3+2]; + } + + pal[si*3] = al; + pal[si*3+2] = al; + pal[si*3+1] = al; + + } + + int16 w = 0, h = 0; + _vm->_gfx->getStringExtent(_vm->_location._endComment, 130, &w, &h); + + Common::Rect r(w+5, h+5); + r.moveTo(5, 5); + _vm->_gfx->floodFill(Gfx::kBitFront, r, 0); + + r.setWidth(w+3); + r.setHeight(w+4); + r.moveTo(7, 7); + _vm->_gfx->floodFill(Gfx::kBitFront, r, 1); - for (uint16 i = 0; i <= PALETTE_COLORS; i++) { - pal0[i] = _vm->_gfx->_palette[i]; - pal0[i*3+1] = 0; - pal0[i*3+2] = 0; + _vm->_gfx->setFont("comic"); + _vm->_gfx->displayWrappedString(_vm->_location._endComment, 3, 5, 130, 0); + + uint32 di = 0; + for (di = 0; di < PALETTE_COLORS; di++) { + for (si = 0; si <= 93; si +=3) { + + char al; + + if (_enginePal[si] != pal[si]) { + al = _enginePal[si]; + if (al > pal[si]) + al = 1; + else + al = -1; + _enginePal[si] += al; + } + + if (_enginePal[si+1] != pal[si+1]) { + al = _enginePal[si+1]; + if (al > pal[si+1]) + al = 1; + else + al = -1; + _enginePal[si+1] += al; + } + + if (_enginePal[si+2] != pal[si+2]) { + al = _enginePal[si+2]; + if (al > pal[si+2]) + al = 1; + else + al = -1; + _enginePal[si+2] += al; + } + + } + + _vm->_gfx->setPalette(_enginePal); } - _vm->_gfx->getBlackPalette(pal1); + waitUntilLeftClick(); + + return; +} + +void _c_frankenstein(void *parm) { + Gfx::Palette pal0; + + for (uint16 i = 0; i <= BASE_PALETTE_COLORS; i++) { + pal0[(i+FIRST_BASE_COLOR)] = _vm->_gfx->_palette[i]; + pal0[(i+FIRST_BASE_COLOR)*3+1] = 0; + pal0[(i+FIRST_BASE_COLOR)*3+2] = 0; + pal0[(i+FIRST_EHB_COLOR)*3+1] = 0; + pal0[(i+FIRST_EHB_COLOR)*3+2] = 0; + } for (uint16 _di = 0; _di < 30; _di++) { g_system->delayMillis(20); - _vm->_gfx->setPalette(pal0); + _vm->_gfx->setPalette(pal0, FIRST_BASE_COLOR, BASE_PALETTE_COLORS); g_system->delayMillis(20); - _vm->_gfx->setPalette(pal1); + _vm->_gfx->setPalette(pal0, FIRST_EHB_COLOR, EHB_PALETTE_COLORS); } _vm->_gfx->setPalette(_vm->_gfx->_palette); @@ -272,7 +358,7 @@ void _c_finito(void *parm) { cleanInventory(); refreshInventory(_vm->_characterName); - _vm->_gfx->palUnk0(_vm->_gfx->_palette); + _vm->_gfx->extendPalette(_vm->_gfx->_palette); if (gameCompleted) { _vm->_gfx->setFont("slide"); |