diff options
author | Paul Gilbert | 2012-01-14 22:41:30 +1100 |
---|---|---|
committer | Strangerke | 2012-04-06 08:19:39 +0200 |
commit | 6c6c0f0ce5ffa2046fdd89f38f91582874d70799 (patch) | |
tree | ffca28245697f0665ba99c2977ac59b372021798 /engines | |
parent | abc2f60edfc0f3dca8d5a871a70728998045a5e5 (diff) | |
download | scummvm-rg350-6c6c0f0ce5ffa2046fdd89f38f91582874d70799.tar.gz scummvm-rg350-6c6c0f0ce5ffa2046fdd89f38f91582874d70799.tar.bz2 scummvm-rg350-6c6c0f0ce5ffa2046fdd89f38f91582874d70799.zip |
MORTEVIELLE: Bugfixes for image decoding.
Decoding types 1 and 7 are now working, so the first scene is partially decoding correctly.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mortevielle/graphics.cpp | 31 | ||||
-rw-r--r-- | engines/mortevielle/level15.cpp | 6 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.cpp | 6 |
3 files changed, 26 insertions, 17 deletions
diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 9b06972232..86cce5de9d 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -25,7 +25,7 @@ namespace Mortevielle { #define INCR_TAIX { if (_xSize & 1) ++_xSize; } -#define DEFAULT_WIDTH 320 +#define DEFAULT_WIDTH (SCREEN_WIDTH / 2) #define BUFFER_SIZE 8192 void GfxSurface::decode(const byte *pSrc) { @@ -98,18 +98,20 @@ void GfxSurface::decode(const byte *pSrc) { _var12 = desanalyse(pSrc); _var14 = desanalyse(pSrc); - bool savedVar15 = _nibbleFlag; + const byte *pSrcSaved = pSrc; + bool savedNibbleFlag = _nibbleFlag; int savedVar18 = _var18; do { - const byte *pTemp = pSrc; - _nibbleFlag = savedVar15; + pSrc = pSrcSaved; + _nibbleFlag = savedNibbleFlag; _var18 = savedVar18; assert(_var14 < 256); - for (int idx = 0; idx < _var14; ++idx, ++tableOffset) + for (int idx = 0; idx < _var14; ++idx, ++tableOffset) { assert(tableOffset < BUFFER_SIZE); - lookupTable[tableOffset] = suiv(pTemp); + lookupTable[tableOffset] = suiv(pSrc); + } } while (--_var12 > 0); } while (_var18 < (lookupBytes - 1)); @@ -190,7 +192,7 @@ void GfxSurface::decode(const byte *pSrc) { break; case 1: - // Draw rect alternating left to right, right to left + // Draw rect using horizontal lines alternating left to right, then right to left INCR_TAIX; for (int yCtr = 0; yCtr < _ySize; ++yCtr) { if ((yCtr % 2) == 0) { @@ -246,11 +248,11 @@ void GfxSurface::decode(const byte *pSrc) { break; case 7: - // Draw box + // Draw rect using horizontal lines left to right INCR_TAIX; for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) { byte *pDestLine = pDest; - for (int xCtr = 0; xCtr < _xSize; ++xCtr, ++pDestLine) + for (int xCtr = 0; xCtr < _xSize; ++xCtr) *pDestLine++ = csuiv(pSrc, pLookup); } break; @@ -348,16 +350,15 @@ void GfxSurface::decode(const byte *pSrc) { pSrc = pSrcStart; } while (--entryCount > 0); - // At this point, the outputBuffer has the data for the image. The pitch is - // 320 pixels, the _xOffset and _yOffset represent the top left of the image data, - // and the _xSize and _ySize fields indicate the image size - create(_xOffset + _xSize, _yOffset + _ySize, Graphics::PixelFormat::createFormatCLUT8()); + // At this point, the outputBuffer has the data for the image. Initialise the surface + // with the calculated size for the full image, and copy the lines to the surface + create(_xOffset + _width, _yOffset + _height, Graphics::PixelFormat::createFormatCLUT8()); - for (int yCtr = 0; yCtr < _ySize; ++yCtr) { + for (int yCtr = 0; yCtr < _height; ++yCtr) { const byte *copySrc = &outputBuffer[yCtr * DEFAULT_WIDTH]; byte *copyDest = (byte *)getBasePtr(_xOffset, yCtr + _yOffset); - Common::copy(copySrc, copySrc + _xSize, copyDest); + Common::copy(copySrc, copySrc + _width, copyDest); } } diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 073b93fd96..7e1f47d668 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/system.h" #include "common/file.h" #include "mortevielle/graphics.h" #include "mortevielle/level15.h" @@ -101,6 +102,11 @@ void pictout(int seg, int dep, int x, int y) { #ifdef DEBUG GfxSurface surface; surface.decode(&mem[0x7000 * 16]); + + g_system->copyRectToScreen((const byte *)surface.pixels, surface.pitch, 0, 0, + surface.w, surface.h); + g_system->updateScreen(); + #endif decomp(seg, dep); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 43534a6ae0..bba22f1ba5 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -172,8 +172,10 @@ Common::Error MortevielleEngine::run() { return err; // TODO: Remove once palette loading is correctly done - uint32 white = 0xffffffff; - g_system->getPaletteManager()->setPalette((const byte *)&white, 15, 1); + for (int idx = 0; idx < 16; ++idx) { + uint32 c = 0x111111 * idx; + g_system->getPaletteManager()->setPalette((const byte *)&c, idx, 1); + } // Dispatch to the game's main routine const char *argv[] = { "" }; |