Skip to content

Commit

Permalink
MORTEVIELLE: Added needed palette remapping to drawPicture()
Browse files Browse the repository at this point in the history
The remapping allows the first image to now display using the correct colours.
  • Loading branch information
dreammaster authored and Strangerke committed Apr 6, 2012
1 parent d4802b3 commit 02724f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
25 changes: 11 additions & 14 deletions engines/mortevielle/graphics.cpp
Expand Up @@ -892,8 +892,8 @@ void ScreenSurface::updateScreen() {
* Draws a decoded picture on the screen
* @remarks - Because the ScummVM surface is using a double height 640x400 surface to
* simulate the original 640x400 surface, all Y values have to be doubled.
* - Image resources are stored at 320x200, so when drawn onto the screen every
* other column is interpolated.
* - Image resources are stored at 320x200, so when drawn onto the screen a single pixel
* from the source image is drawn using the two pixels at the given index in the palette map
* - Because the original game supported 320 width resolutions, the X coordinate
* also needs to be doubled for EGA mode
*/
Expand All @@ -906,6 +906,9 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) {
Graphics::Surface destSurface = lockArea(Common::Rect(x * 2, y * 2,
(x + surface.w) * 2, (y + surface.h) * 2));

// Get a lookup for the palette mapping
const byte *paletteMap = &mem[0x7000 * 16 + 2];

// Loop through writing
for (int yp = 0; yp < surface.h; ++yp) {
if (((y + yp) < 0) || ((y + yp) >= 200))
Expand All @@ -915,20 +918,14 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) {
byte *pDest = (byte *)destSurface.getBasePtr(0, yp * 2);

for (int xp = 0; xp < surface.w; ++xp, ++pSrc) {
// Draw pixel from source image
*pDest = *pSrc;
*(pDest + SCREEN_WIDTH) = *pSrc;
// Draw the pixel using the specified index in the palette map
*pDest = paletteMap[*pSrc * 2];
*(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2];
++pDest;

// TODO: I'm not sure what algorithm the original uses to calculate
// which pixel to use on the alternate columns, so for now I'm doing
// a simple output of null values. This should be revisited once we've
// got the palette loading so we can compare palettes. In fact, the
// original had the alternate columns very noticablely striped. With
// the larger 256 colour palette, it may be worthwhile to offer a
// better blended graphics mode as an option.
*pDest = 0;
*(pDest + SCREEN_WIDTH) = 0;
// Use the secondary mapping value to draw the secondary column pixel
*pDest = paletteMap[*pSrc * 2 + 1];
*(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2 + 1];
++pDest;
}
}
Expand Down
1 change: 0 additions & 1 deletion engines/mortevielle/level15.cpp
Expand Up @@ -103,7 +103,6 @@ void pictout(int seg, int dep, int x, int y) {
GfxSurface surface;
surface.decode(&mem[seg * 16 + dep]);

decomp(seg, dep);
if (gd == her) {
mem[0x7000 * 16 + 2] = 0;
mem[0x7000 * 16 + 32] = 15;
Expand Down
2 changes: 1 addition & 1 deletion engines/mortevielle/var_mor.cpp
Expand Up @@ -399,7 +399,7 @@ void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) {

// (* external 'c:\mc\decomp.com'; *)
void decomp(int seg, int dep) {
warning("TODO: decomp");
warning("TODO: decomp deprecated in faovur of GfxSurface::decode");
}

// (* external 'c:\mc\affich.com'; *)
Expand Down

0 comments on commit 02724f7

Please sign in to comment.