aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2012-01-15 00:58:24 +1100
committerStrangerke2012-04-06 08:19:40 +0200
commit7698c8c523c91b84d24cce8d64e11276bc3c8878 (patch)
treea4a797bad2df560813e7c77108c88d7443db8be7 /engines
parent6c6c0f0ce5ffa2046fdd89f38f91582874d70799 (diff)
downloadscummvm-rg350-7698c8c523c91b84d24cce8d64e11276bc3c8878.tar.gz
scummvm-rg350-7698c8c523c91b84d24cce8d64e11276bc3c8878.tar.bz2
scummvm-rg350-7698c8c523c91b84d24cce8d64e11276bc3c8878.zip
MORTEVIELLE: Implemented the remaining image decoding mode 11
Diffstat (limited to 'engines')
-rw-r--r--engines/mortevielle/graphics.cpp115
-rw-r--r--engines/mortevielle/graphics.h6
2 files changed, 117 insertions, 4 deletions
diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp
index 86cce5de9d..f0dfdd2c8c 100644
--- a/engines/mortevielle/graphics.cpp
+++ b/engines/mortevielle/graphics.cpp
@@ -212,7 +212,7 @@ void GfxSurface::decode(const byte *pSrc) {
// Draw rect alternating top to bottom, bottom to top
INCR_TAIX;
for (int xCtr = 0; xCtr < _xSize; ++xCtr) {
- if (xCtr % 2) {
+ if ((xCtr % 2) == 0) {
for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) {
*pDest = csuiv(pSrc, pLookup);
}
@@ -277,7 +277,7 @@ void GfxSurface::decode(const byte *pSrc) {
break;
case 11:
- warning("TODO: Switch 11");
+ decom11(pSrc, pDest, pLookup);
break;
case 12:
@@ -430,11 +430,16 @@ void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLooku
bool continueFlag = false;
do {
- for (int xIndex = 0; xIndex < _xSize; ++xIndex, ++pDest) {
+ for (int xIndex = 0; xIndex < _xSize; ++xIndex) {
if ((xIndex % 2) == 0) {
+ if (xIndex != 0)
+ ++pDest;
+
// Write out vertical slice top to bottom
for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest += DEFAULT_WIDTH)
*pDest = csuiv(pSrc, pLookup);
+
+ ++pDest;
} else {
// Write out vertical slice bottom to top
for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest -= DEFAULT_WIDTH)
@@ -558,6 +563,110 @@ void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup)
}
}
+void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) {
+ int var26 = 0, var28 = 0;
+ _var1E = DEFAULT_WIDTH;
+ _var22 = -1;
+ --_xSize;
+ --_ySize;
+
+ int areaNum = 0;
+ while (areaNum != -1) {
+ switch (areaNum) {
+ case 0:
+ *pDest = csuiv(pSrc, pLookup);
+ areaNum = 1;
+ break;
+
+ case 1:
+ increments(pDest);
+
+ if (!var28) {
+ NIH();
+ NIV();
+
+ if (var26 == _ySize) {
+ increments(pDest);
+ ++var28;
+ } else {
+ ++var26;
+ }
+
+ *++pDest = csuiv(pSrc, pLookup);
+ areaNum = 2;
+ } else if (var26 != _ySize) {
+ ++var26;
+ --var28;
+ areaNum = 0;
+ } else {
+ NIH();
+ NIV();
+ increments(pDest);
+ ++var28;
+
+ *++pDest = csuiv(pSrc, pLookup);
+
+ if (var28 == _xSize) {
+ areaNum = -1;
+ } else {
+ areaNum = 2;
+ }
+ }
+ break;
+
+ case 2:
+ increments(pDest);
+
+ if (!var26) {
+ NIH();
+ NIV();
+
+ if (var28 == _xSize) {
+ increments(pDest);
+ ++var26;
+ } else {
+ ++var28;
+ }
+
+ pDest += DEFAULT_WIDTH;
+ areaNum = 0;
+ } else if (var28 != _xSize) {
+ ++var28;
+ --var26;
+
+ *pDest = csuiv(pSrc, pLookup);
+ areaNum = 2;
+ } else {
+ pDest += DEFAULT_WIDTH;
+ ++var26;
+ NIH();
+ NIV();
+ increments(pDest);
+
+ *pDest = csuiv(pSrc, pLookup);
+
+ if (var26 == _ySize)
+ areaNum = -1;
+ else
+ areaNum = 1;
+ }
+ break;
+ }
+ }
+}
+
+void GfxSurface::increments(byte *&pDest) {
+ pDest += _var22 + _var1E;
+}
+
+void GfxSurface::NIH() {
+ _var22 = -_var22;
+}
+
+void GfxSurface::NIV() {
+ _var1E = -_var1E;
+}
+
void GfxSurface::diag() {
// The diag method in the original source doesn't seem to have any exit point,
// which if the case, means the routine may not be used by the game
diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h
index 4e7db305ca..0c322df732 100644
--- a/engines/mortevielle/graphics.h
+++ b/engines/mortevielle/graphics.h
@@ -36,7 +36,7 @@ private:
int _var14, _var18, _lookupValue;
bool _nibbleFlag;
int _thickness, _var1E, _var20, _var22;
- int _var24, _var26;
+ int _var24;
int _width, _height;
int _xOffset, _yOffset;
@@ -46,6 +46,10 @@ private:
int desanalyse(const byte *&pSrc);
void horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLookup);
void vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup);
+ void decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup);
+ void increments(byte *&pDest);
+ void NIH();
+ void NIV();
void diag();
public:
void decode(const byte *pSrc);