MORTEVIELLE: Added needed palette remapping to drawPicture()
The remapping allows the first image to now display using the correct colours.
This commit is contained in:
parent
55f5adeff3
commit
45083e7c94
3 changed files with 12 additions and 16 deletions
|
@ -892,8 +892,8 @@ void ScreenSurface::updateScreen() {
|
||||||
* Draws a decoded picture on the screen
|
* Draws a decoded picture on the screen
|
||||||
* @remarks - Because the ScummVM surface is using a double height 640x400 surface to
|
* @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.
|
* 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
|
* - Image resources are stored at 320x200, so when drawn onto the screen a single pixel
|
||||||
* other column is interpolated.
|
* 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
|
* - Because the original game supported 320 width resolutions, the X coordinate
|
||||||
* also needs to be doubled for EGA mode
|
* also needs to be doubled for EGA mode
|
||||||
*/
|
*/
|
||||||
|
@ -906,6 +906,9 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) {
|
||||||
Graphics::Surface destSurface = lockArea(Common::Rect(x * 2, y * 2,
|
Graphics::Surface destSurface = lockArea(Common::Rect(x * 2, y * 2,
|
||||||
(x + surface.w) * 2, (y + surface.h) * 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
|
// Loop through writing
|
||||||
for (int yp = 0; yp < surface.h; ++yp) {
|
for (int yp = 0; yp < surface.h; ++yp) {
|
||||||
if (((y + yp) < 0) || ((y + yp) >= 200))
|
if (((y + yp) < 0) || ((y + yp) >= 200))
|
||||||
|
@ -915,20 +918,14 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) {
|
||||||
byte *pDest = (byte *)destSurface.getBasePtr(0, yp * 2);
|
byte *pDest = (byte *)destSurface.getBasePtr(0, yp * 2);
|
||||||
|
|
||||||
for (int xp = 0; xp < surface.w; ++xp, ++pSrc) {
|
for (int xp = 0; xp < surface.w; ++xp, ++pSrc) {
|
||||||
// Draw pixel from source image
|
// Draw the pixel using the specified index in the palette map
|
||||||
*pDest = *pSrc;
|
*pDest = paletteMap[*pSrc * 2];
|
||||||
*(pDest + SCREEN_WIDTH) = *pSrc;
|
*(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2];
|
||||||
++pDest;
|
++pDest;
|
||||||
|
|
||||||
// TODO: I'm not sure what algorithm the original uses to calculate
|
// Use the secondary mapping value to draw the secondary column pixel
|
||||||
// which pixel to use on the alternate columns, so for now I'm doing
|
*pDest = paletteMap[*pSrc * 2 + 1];
|
||||||
// a simple output of null values. This should be revisited once we've
|
*(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2 + 1];
|
||||||
// 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;
|
|
||||||
++pDest;
|
++pDest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,6 @@ void pictout(int seg, int dep, int x, int y) {
|
||||||
GfxSurface surface;
|
GfxSurface surface;
|
||||||
surface.decode(&mem[seg * 16 + dep]);
|
surface.decode(&mem[seg * 16 + dep]);
|
||||||
|
|
||||||
decomp(seg, dep);
|
|
||||||
if (gd == her) {
|
if (gd == her) {
|
||||||
mem[0x7000 * 16 + 2] = 0;
|
mem[0x7000 * 16 + 2] = 0;
|
||||||
mem[0x7000 * 16 + 32] = 15;
|
mem[0x7000 * 16 + 32] = 15;
|
||||||
|
|
|
@ -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'; *)
|
// (* external 'c:\mc\decomp.com'; *)
|
||||||
void decomp(int seg, int dep) {
|
void decomp(int seg, int dep) {
|
||||||
warning("TODO: decomp");
|
warning("TODO: decomp deprecated in faovur of GfxSurface::decode");
|
||||||
}
|
}
|
||||||
|
|
||||||
// (* external 'c:\mc\affich.com'; *)
|
// (* external 'c:\mc\affich.com'; *)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue