aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-09-26 00:06:51 +0000
committerMax Horn2004-09-26 00:06:51 +0000
commit75b4bd0cc462957391786fa67e76f88975c8a8ec (patch)
tree058ae879e9ae779d22e8fcbf37749a7c38ed2544
parent71216d46caa214ef11d5ddb0d74b923c3f12da23 (diff)
downloadscummvm-rg350-75b4bd0cc462957391786fa67e76f88975c8a8ec.tar.gz
scummvm-rg350-75b4bd0cc462957391786fa67e76f88975c8a8ec.tar.bz2
scummvm-rg350-75b4bd0cc462957391786fa67e76f88975c8a8ec.zip
reorder stuff
svn-id: r15281
-rw-r--r--scumm/gfx.cpp462
1 files changed, 231 insertions, 231 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index e02ad79d91..0900810922 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -967,6 +967,15 @@ bool ScummEngine::isLightOn() const {
return (VAR_CURRENT_LIGHTS == 0xFF) || (VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen);
}
+void ScummEngine::setShake(int mode) {
+ if (_shakeEnabled != (mode != 0))
+ _fullRedraw = true;
+
+ _shakeEnabled = mode != 0;
+ _shakeFrame = 0;
+ _system->set_shake_pos(0);
+}
+
#pragma mark -
#pragma mark --- Image drawing ---
#pragma mark -
@@ -1759,83 +1768,158 @@ void Gdi::resetBackground(int top, int bottom, int strip) {
}
}
-/**
- * Create and fill a table with offsets to the graphic and mask strips in the
- * given V2 EGA bitmap.
- * @param src the V2 EGA bitmap
- * @param width the width of the bitmap
- * @param height the height of the bitmap
- * @param table the strip table to fill
- * @return filled strip table
- */
-StripTable *Gdi::generateStripTable(const byte *src, int width, int height, StripTable *table) const {
+bool Gdi::decompressBitmap(byte *dst, int dstPitch, const byte *src, int numLinesToProcess) {
+ assert(numLinesToProcess);
- // If no strip table was given to use, allocate a new one
- if (table == 0)
- table = (StripTable *)calloc(1, sizeof(StripTable));
+ byte code = *src++;
+ bool useOrDecompress = false;
+
+ if (code <= 10) {
+ switch (code) {
+ case 1:
+ unkDecode7(dst, dstPitch, src, numLinesToProcess);
+ break;
+
+ case 2:
+ unkDecode8(dst, dstPitch, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
+ break;
+
+ case 3:
+ unkDecode9(dst, dstPitch, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
+ break;
+
+ case 4:
+ unkDecode10(dst, dstPitch, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
+ break;
+
+ case 7:
+ unkDecode11(dst, dstPitch, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
+ break;
+
+ // 8/9 used in 3do version of puttputt joins the parade maybe others
+ case 8:
+ useOrDecompress = true;
+ drawStrip3DO(dst, dstPitch, src, numLinesToProcess, true);
+ break;
+
+ case 9:
+ drawStrip3DO(dst, dstPitch, src, numLinesToProcess, false);
+ break;
+
+ // used in amiga version of Monkey Island
+ case 10:
+ drawStripEGA(dst, dstPitch, src, numLinesToProcess);
+ break;
- const byte *bitmapStart = src;
- byte color = 0, data = 0;
- int x, y, length = 0;
- byte run = 1;
+ default:
+ error("Gdi::decompressBitmap: default case %d", code);
+ }
+ } else {
+ _decomp_shr = code % 10;
+ _decomp_mask = 0xFF >> (8 - _decomp_shr);
+ code /= 10;
+
+ switch (code) {
+ case 1:
+ // FIXME: Ugly workaround for bug #901462
+ if (_vm->_version == 8)
+ useOrDecompress = true;
+ drawStripBasicV(dst, dstPitch, src, numLinesToProcess, false);
+ break;
+
+ case 2:
+ drawStripBasicH(dst, dstPitch, src, numLinesToProcess, false);
+ break;
+
+ case 3:
+ useOrDecompress = true;
+ drawStripBasicV(dst, dstPitch, src, numLinesToProcess, true);
+ break;
+
+ case 4:
+ useOrDecompress = true;
+ drawStripBasicH(dst, dstPitch, src, numLinesToProcess, true);
+ break;
+
+ case 6:
+ case 10:
+ // FIXME: Ugly workaround for bug #901462
+ if (_vm->_version == 8 && code == 10)
+ useOrDecompress = true;
+ drawStripComplex(dst, dstPitch, src, numLinesToProcess, false);
+ break;
+
+ case 8:
+ case 12:
+ useOrDecompress = true;
+ drawStripComplex(dst, dstPitch, src, numLinesToProcess, true);
+ break;
+
+ case 13:
+ drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, false);
+ break;
+
+ case 14:
+ useOrDecompress = true;
+ drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, true);
+ break;
+
+ default:
+ error("Gdi::decompressBitmap: default case %d", code);
+ }
+ }
+
+ return useOrDecompress;
+}
- // Decode the graphics strips, and memorize the run/color values
- // as well as the byte offset.
- for (x = 0 ; x < width; x++) {
+void Gdi::decompressMaskImg(byte *dst, const byte *src, int height) const {
+ byte b, c;
- if ((x % 8) == 0) {
- assert(x / 8 < 160);
- table->run[x / 8] = run;
- table->color[x / 8] = color;
- table->offsets[x / 8] = src - bitmapStart;
- }
+ while (height) {
+ b = *src++;
- for (y = 0; y < height; y++) {
- if (--run == 0) {
- data = *src++;
- if (data & 0x80) {
- run = data & 0x7f;
- } else {
- run = data >> 4;
- }
- if (run == 0) {
- run = *src++;
- }
- color = data & 0x0f;
- }
+ if (b & 0x80) {
+ b &= 0x7F;
+ c = *src++;
+
+ do {
+ *dst = c;
+ dst += _numStrips;
+ --height;
+ } while (--b && height);
+ } else {
+ do {
+ *dst = *src++;
+ dst += _numStrips;
+ --height;
+ } while (--b && height);
}
}
+}
- // The mask data follows immediately after the graphics.
- x = 0;
- y = height;
- width /= 8;
-
- for (;;) {
- length = *src++;
- const byte runFlag = length & 0x80;
- if (runFlag) {
- length &= 0x7f;
- data = *src++;
+void Gdi::decompressMaskImgOr(byte *dst, const byte *src, int height) const {
+ byte b, c;
+
+ while (height) {
+ b = *src++;
+
+ if (b & 0x80) {
+ b &= 0x7F;
+ c = *src++;
+
+ do {
+ *dst |= c;
+ dst += _numStrips;
+ --height;
+ } while (--b && height);
+ } else {
+ do {
+ *dst |= *src++;
+ dst += _numStrips;
+ --height;
+ } while (--b && height);
}
- do {
- if (!runFlag)
- data = *src++;
- if (y == height) {
- assert(x < 120);
- table->zoffsets[x] = src - bitmapStart - 1;
- table->zrun[x] = length | runFlag;
- }
- if (--y == 0) {
- if (--width == 0)
- return table;
- x++;
- y = height;
- }
- } while (--length);
}
-
- return table;
}
void Gdi::drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height) {
@@ -1929,6 +2013,85 @@ void Gdi::decodeC64Gfx(const byte *src, byte *dst, int size) const {
}
}
+/**
+ * Create and fill a table with offsets to the graphic and mask strips in the
+ * given V2 EGA bitmap.
+ * @param src the V2 EGA bitmap
+ * @param width the width of the bitmap
+ * @param height the height of the bitmap
+ * @param table the strip table to fill
+ * @return filled strip table
+ */
+StripTable *Gdi::generateStripTable(const byte *src, int width, int height, StripTable *table) const {
+
+ // If no strip table was given to use, allocate a new one
+ if (table == 0)
+ table = (StripTable *)calloc(1, sizeof(StripTable));
+
+ const byte *bitmapStart = src;
+ byte color = 0, data = 0;
+ int x, y, length = 0;
+ byte run = 1;
+
+ // Decode the graphics strips, and memorize the run/color values
+ // as well as the byte offset.
+ for (x = 0 ; x < width; x++) {
+
+ if ((x % 8) == 0) {
+ assert(x / 8 < 160);
+ table->run[x / 8] = run;
+ table->color[x / 8] = color;
+ table->offsets[x / 8] = src - bitmapStart;
+ }
+
+ for (y = 0; y < height; y++) {
+ if (--run == 0) {
+ data = *src++;
+ if (data & 0x80) {
+ run = data & 0x7f;
+ } else {
+ run = data >> 4;
+ }
+ if (run == 0) {
+ run = *src++;
+ }
+ color = data & 0x0f;
+ }
+ }
+ }
+
+ // The mask data follows immediately after the graphics.
+ x = 0;
+ y = height;
+ width /= 8;
+
+ for (;;) {
+ length = *src++;
+ const byte runFlag = length & 0x80;
+ if (runFlag) {
+ length &= 0x7f;
+ data = *src++;
+ }
+ do {
+ if (!runFlag)
+ data = *src++;
+ if (y == height) {
+ assert(x < 120);
+ table->zoffsets[x] = src - bitmapStart - 1;
+ table->zrun[x] = length | runFlag;
+ }
+ if (--y == 0) {
+ if (--width == 0)
+ return table;
+ x++;
+ y = height;
+ }
+ } while (--length);
+ }
+
+ return table;
+}
+
void Gdi::drawStripEGA(byte *dst, int dstPitch, const byte *src, int height) const {
byte color = 0;
int run = 0, x = 0, y = 0, z;
@@ -1988,160 +2151,6 @@ void Gdi::drawStripEGA(byte *dst, int dstPitch, const byte *src, int height) con
}
}
-bool Gdi::decompressBitmap(byte *dst, int dstPitch, const byte *src, int numLinesToProcess) {
- assert(numLinesToProcess);
-
- byte code = *src++;
- bool useOrDecompress = false;
-
- if (code <= 10) {
- switch (code) {
- case 1:
- unkDecode7(dst, dstPitch, src, numLinesToProcess);
- break;
-
- case 2:
- unkDecode8(dst, dstPitch, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
- break;
-
- case 3:
- unkDecode9(dst, dstPitch, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
- break;
-
- case 4:
- unkDecode10(dst, dstPitch, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
- break;
-
- case 7:
- unkDecode11(dst, dstPitch, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
- break;
-
- // 8/9 used in 3do version of puttputt joins the parade maybe others
- case 8:
- useOrDecompress = true;
- drawStrip3DO(dst, dstPitch, src, numLinesToProcess, true);
- break;
-
- case 9:
- drawStrip3DO(dst, dstPitch, src, numLinesToProcess, false);
- break;
-
- // used in amiga version of Monkey Island
- case 10:
- drawStripEGA(dst, dstPitch, src, numLinesToProcess);
- break;
-
- default:
- error("Gdi::decompressBitmap: default case %d", code);
- }
- } else {
- _decomp_shr = code % 10;
- _decomp_mask = 0xFF >> (8 - _decomp_shr);
- code /= 10;
-
- switch (code) {
- case 1:
- // FIXME: Ugly workaround for bug #901462
- if (_vm->_version == 8)
- useOrDecompress = true;
- drawStripBasicV(dst, dstPitch, src, numLinesToProcess, false);
- break;
-
- case 2:
- drawStripBasicH(dst, dstPitch, src, numLinesToProcess, false);
- break;
-
- case 3:
- useOrDecompress = true;
- drawStripBasicV(dst, dstPitch, src, numLinesToProcess, true);
- break;
-
- case 4:
- useOrDecompress = true;
- drawStripBasicH(dst, dstPitch, src, numLinesToProcess, true);
- break;
-
- case 6:
- case 10:
- // FIXME: Ugly workaround for bug #901462
- if (_vm->_version == 8 && code == 10)
- useOrDecompress = true;
- drawStripComplex(dst, dstPitch, src, numLinesToProcess, false);
- break;
-
- case 8:
- case 12:
- useOrDecompress = true;
- drawStripComplex(dst, dstPitch, src, numLinesToProcess, true);
- break;
-
- case 13:
- drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, false);
- break;
-
- case 14:
- useOrDecompress = true;
- drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, true);
- break;
-
- default:
- error("Gdi::decompressBitmap: default case %d", code);
- }
- }
-
- return useOrDecompress;
-}
-
-void Gdi::decompressMaskImg(byte *dst, const byte *src, int height) const {
- byte b, c;
-
- while (height) {
- b = *src++;
-
- if (b & 0x80) {
- b &= 0x7F;
- c = *src++;
-
- do {
- *dst = c;
- dst += _numStrips;
- --height;
- } while (--b && height);
- } else {
- do {
- *dst = *src++;
- dst += _numStrips;
- --height;
- } while (--b && height);
- }
- }
-}
-
-void Gdi::decompressMaskImgOr(byte *dst, const byte *src, int height) const {
- byte b, c;
-
- while (height) {
- b = *src++;
-
- if (b & 0x80) {
- b &= 0x7F;
- c = *src++;
-
- do {
- *dst |= c;
- dst += _numStrips;
- --height;
- } while (--b && height);
- } else {
- do {
- *dst |= *src++;
- dst += _numStrips;
- --height;
- } while (--b && height);
- }
- }
-}
-
#define READ_BIT (shift--, dataBit = data & 1, data >>= 1, dataBit)
#define FILL_BITS do { \
if (shift <= 16) { \
@@ -2551,10 +2560,10 @@ void Gdi::unkDecode11(byte *dst, int dstPitch, const byte *src, int height) cons
} while (--x);
}
-
#undef NEXT_ROW
#undef READ_BIT_256
+
#pragma mark -
#pragma mark --- Transition effects ---
#pragma mark -
@@ -2976,15 +2985,6 @@ void ScummEngine::unkScreenEffect5(int a) {
warning("stub unkScreenEffect(%d)", a);
}
-void ScummEngine::setShake(int mode) {
- if (_shakeEnabled != (mode != 0))
- _fullRedraw = true;
-
- _shakeEnabled = mode != 0;
- _shakeFrame = 0;
- _system->set_shake_pos(0);
-}
-
} // End of namespace Scumm
#ifdef __PALM_OS__