diff options
-rw-r--r-- | engines/dreamweb/dreamweb.cpp | 30 | ||||
-rw-r--r-- | engines/dreamweb/dreamweb.h | 5 |
2 files changed, 24 insertions, 11 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index cab9863911..12a43a9a22 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -213,36 +213,46 @@ void DreamWebEngine::setGraphicsMode() { void DreamWebEngine::fadeDos() { waitForVSync(); //processEvents will be called from vsync - PaletteManager *palette = _system->getPaletteManager(); _context.ds = _context.es = _context.data.word(dreamgen::kBuffers); uint8 *dst = _context.es.ptr(dreamgen::kStartpal, 768); - palette->grabPalette(dst, 0, 64); + getPalette(dst, 0, 64); for(int fade = 0; fade < 64; ++fade) { for(int c = 0; c < 768; ++c) { //original sources decrement 768 values -> 256 colors if (dst[c]) { --dst[c]; } } - palette->setPalette(dst, 0, 64); + setPalette(dst, 0, 64); waitForVSync(); } } void DreamWebEngine::setPalette() { - uint8 colors[768]; processEvents(); - PaletteManager *palette = _system->getPaletteManager(); unsigned n = (uint16)_context.cx; uint8 *src = _context.ds.ptr(_context.si, n * 3); - for(unsigned i = 0; i < n * 3; ++i) - colors[i] = src[i] * 3; - //Common::hexdump(colors, n * 3); - palette->setPalette(colors, _context.al, n); + setPalette(src, _context.al, n); _context.si += n * 3; _context.cx = 0; } -void DreamWebEngine::blit(uint8 *src, int pitch, int x, int y, int w, int h) { +void DreamWebEngine::getPalette(uint8 *data, uint start, uint count) { + _system->getPaletteManager()->grabPalette(data, start, count); + while(count--) + *data++ >>= 2; +} + +void DreamWebEngine::setPalette(const uint8 *data, uint start, uint count) { + assert(start + count <= 256); + uint8 fixed[768]; + for(uint i = 0; i < count * 3; ++i) { + fixed[i] = data[i] << 2; + } + _system->getPaletteManager()->setPalette(fixed, start, count); +} + + +void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int h) { _system->copyRectToScreen(src, pitch, x, y, w, h); } diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 3038de3652..0666bb8518 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -87,8 +87,11 @@ public: void setGraphicsMode(); void setPalette(); void fadeDos(); - void blit(uint8 *src, int pitch, int x, int y, int w, int h); + void blit(const uint8 *src, int pitch, int x, int y, int w, int h); void cls(); + + void getPalette(uint8 *data, uint start, uint count); + void setPalette(const uint8 *data, uint start, uint count); private: |