aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2004-06-20 20:54:18 +0000
committerEugene Sandulenko2004-06-20 20:54:18 +0000
commit80216dc6d672e7a8d65496971b3adb3ae308192b (patch)
treede48146dc6ba82b35256c1e662538f76425773dc
parent6268fdae257d0682d5b20fc379ec059b6d46088a (diff)
downloadscummvm-rg350-80216dc6d672e7a8d65496971b3adb3ae308192b.tar.gz
scummvm-rg350-80216dc6d672e7a8d65496971b3adb3ae308192b.tar.bz2
scummvm-rg350-80216dc6d672e7a8d65496971b3adb3ae308192b.zip
Rewrote 3DO graphics decoders to more C-like syntax.
svn-id: r13985
-rw-r--r--scumm/gfx.cpp192
-rw-r--r--scumm/gfx.h3
2 files changed, 53 insertions, 142 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 1794c45163..a0dea70ff2 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -1559,11 +1559,11 @@ bool Gdi::decompressBitmap(byte *bgbak_ptr, const byte *src, int numLinesToProce
// 8/9 used in 3do version of puttputt joins the parade maybe others
case 8:
useOrDecompress = true;
- unkDecode12(bgbak_ptr, src, numLinesToProcess);
+ decodeStrip3DO(bgbak_ptr, src, numLinesToProcess, true);
break;
case 9:
- unkDecode13(bgbak_ptr, src, numLinesToProcess);
+ decodeStrip3DO(bgbak_ptr, src, numLinesToProcess, false);
break;
// used in amiga version of Monkey Island
@@ -2173,159 +2173,71 @@ void Gdi::unkDecode11(byte *dst, const byte *src, int height) {
}
-// TODO: C'ify it
-void Gdi::unkDecode12(byte *dst, const byte *src, int height) {
- int var_8, di, var_6;
- const byte *bx;
- byte si, var_4;
+void Gdi::decodeStrip3DO(byte *dst, const byte *src, int height, byte transpCheck) {
+ int destbytes, olddestbytes2, olddestbytes1;
+ byte color;
+ int data;
- var_8 = 0;
+ olddestbytes1 = 0;
- di = height << 3;
+ destbytes = height << 3;
if (!height)
return;
- _cont1:
- bx = src;
- src++;
- si = *bx;
-
- if (!(si & 1)) {
- si >>= 1;
- si++;
- di -= si;
- if (di < 0)
- si += di;
-
- var_6 = di;
- di = var_8;
-
- do {
- bx = src;
- src++;
-
- if (*bx != _transparentColor)
- *dst = *bx;
-
- dst++;
- di++;
- if (!(di & 7))
- dst += 312;
-
- si--;
- } while (si);
- var_8 = di;
- if (var_6 > 0) {
- di = var_6;
- goto _cont1;
- }
- return;
- } else {
- si >>= 1;
- bx = src;
+ do {
+ data = *src;
src++;
- var_4 = *bx;
- si++;
- di -= si;
- if (di < 0)
- si += di;
- var_6 = di;
- di = var_8;
-
- do {
- if (var_4 != _transparentColor)
- *dst = var_4;
- dst++;
- di++;
- if (!(di & 7))
- dst += 312;
- si--;
- } while (si);
- var_8 = di;
- if (var_6 > 0) {
- di = var_6;
- goto _cont1;
- }
- return;
- }
-}
-
-
-// TODO: C'ify it
-void Gdi::unkDecode13(byte *dst, const byte *src, int height) {
- int var_8, di, var_6;
- const byte *bx;
- byte si, var_4;
-
- var_8 = 0;
- di = height << 3;
+ if (!(data & 1)) {
+ data >>= 1;
+ data++;
+ destbytes -= data;
+ if (destbytes < 0)
+ data += destbytes;
- if (!height)
- return;
-
- _cont1:
- bx = src;
- src++;
- si = *bx;
+ olddestbytes2 = destbytes;
+ destbytes = olddestbytes1;
- if (!(si & 1)) {
- si >>= 1;
- si++;
- di -= si;
- if (di < 0)
- si += di;
-
- var_6 = di;
- di = var_8;
+ for (; data > 0; data--, src++, dst++) {
+ if (*src != _transparentColor || !transpCheck)
+ *dst = *src;
+
+ destbytes++;
+ if (!(destbytes & 7))
+ dst += 312;
+ }
- do {
- bx = src;
+ olddestbytes1 = destbytes;
+ if (olddestbytes2 > 0) {
+ destbytes = olddestbytes2;
+ }
+ } else {
+ data >>= 1;
+ color = *src;
src++;
- *dst = *bx;
-
- dst++;
- di++;
- if (!(di & 7))
- dst += 312;
-
- si--;
- } while (si);
- var_8 = di;
- if (var_6 > 0) {
- di = var_6;
- goto _cont1;
- }
- return;
- } else {
- si >>= 1;
- bx = src;
- src++;
- var_4 = *bx;
- si++;
- di -= si;
- if (di < 0)
- si += di;
- var_6 = di;
- di = var_8;
+ data++;
+ destbytes -= data;
+ if (destbytes < 0)
+ data += destbytes;
- do {
- *dst = var_4;
- dst++;
- di++;
- if (!(di & 7))
- dst += 312;
- si--;
- } while (si);
- var_8 = di;
- if (var_6 > 0) {
- di = var_6;
- goto _cont1;
+ olddestbytes2 = destbytes;
+ destbytes = olddestbytes1;
+
+ for (; data > 0; data--, dst++) {
+ if (color != _transparentColor || !transpCheck)
+ *dst = color;
+ destbytes++;
+ if (!(destbytes & 7))
+ dst += 312;
+ }
+ olddestbytes1 = destbytes;
+ if (olddestbytes2 > 0) {
+ destbytes = olddestbytes2;
+ }
}
- return;
- }
+ } while (olddestbytes2 > 0);
}
diff --git a/scumm/gfx.h b/scumm/gfx.h
index 8d22eb01e9..f503eada83 100644
--- a/scumm/gfx.h
+++ b/scumm/gfx.h
@@ -248,8 +248,7 @@ protected:
void unkDecode9(byte *dst, const byte *src, int height);
void unkDecode10(byte *dst, const byte *src, int height);
void unkDecode11(byte *dst, const byte *src, int height);
- void unkDecode12(byte *dst, const byte *src, int height);
- void unkDecode13(byte *dst, const byte *src, int height);
+ void decodeStrip3DO(byte *dst, const byte *src, int height, byte transpCheck);
void draw8ColWithMasking(byte *dst, const byte *src, int height, byte *mask);
void draw8Col(byte *dst, const byte *src, int height);