From 0ef8d1ffed66d6677b0dff850e4d35d745e93aee Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 25 Jun 2009 15:22:08 +0000 Subject: Implement proper color index conversion for Lands of Lore PC98. (The intro and menu screen work fine now) svn-id: r41867 --- engines/kyra/screen_lol.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'engines/kyra/screen_lol.cpp') diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index e66c1d4a4a..54d64aa71c 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -971,6 +971,30 @@ uint8 Screen_LoL::getShapePaletteSize(const uint8 *shp) { return shp[10]; } +void Screen_LoL::mergeOverlay(int x, int y, int w, int h) { + // For now we convert to 16 colors on overlay merging. If that gives + // any problems, like Screen functionallity not prepared for the + // format PC98 16 color uses, we'll need to think of a better way. + // + // We must do this before merging the overlay, else the font colors + // will be wrong. + if (_use16ColorMode) + convertPC98Gfx(_sjisOverlayPtrs[0] + y * 640 + x, w, h, 640); + + Screen_v2::mergeOverlay(x, y, w, h); +} + +void Screen_LoL::convertPC98Gfx(uint8 *data, int w, int h, int pitch) { + while (h--) { + for (int i = 0; i < w; ++i) { + *data = _paletteConvTable[*data]; + ++data; + } + + data += pitch - w; + } +} + } // end of namespace Kyra #endif // ENABLE_LOL -- cgit v1.2.3