aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-08-25 14:27:29 +0000
committerMax Horn2003-08-25 14:27:29 +0000
commit953e4216b80decd6e658ed4efa266ad73a7b0955 (patch)
tree4d67b5e08ae5c9723214de65ccb2396a050e1753
parent285570f0d356cc8e067b1fedc40669e364cf3180 (diff)
downloadscummvm-rg350-953e4216b80decd6e658ed4efa266ad73a7b0955.tar.gz
scummvm-rg350-953e4216b80decd6e658ed4efa266ad73a7b0955.tar.bz2
scummvm-rg350-953e4216b80decd6e658ed4efa266ad73a7b0955.zip
implemented V1/C64 object masking, and simplified drawStripC64Mask a bit
svn-id: r9859
-rw-r--r--scumm/gfx.cpp36
-rw-r--r--scumm/gfx.h2
2 files changed, 21 insertions, 17 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 896288107c..67b22e000c 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -1165,11 +1165,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi
if (_vm->_version == 1) {
mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + y * _numStrips + x + _imgBufOffs[1];
- if (_C64ObjectMode) {
- // FIXME/TODO: V1 object masks are stored separately
- } else {
- drawStripC64Mask(mask_ptr, stripnr, height);
- }
+ drawStripC64Mask(mask_ptr, stripnr, width, height);
} else if (_vm->_version == 2) {
// Do nothing here for V2 games - zplane was handled already.
} else if (flag & dbDrawMaskOnAll) {
@@ -1344,11 +1340,13 @@ StripTable *Gdi::generateStripTable(const byte *src, int width, int height, Stri
}
void Gdi::drawStripC64Background(byte *dst, int stripnr, int height) {
+ int charIdx;
height >>= 3;
for (int y = 0; y < height; y++) {
_C64Colors[3] = (_C64ColorMap[y + stripnr * height] & 7);
+ charIdx = _C64PicMap[y + stripnr * height] * 8;
for (int i = 0; i < 8; i++) {
- byte c = _C64CharMap[_C64PicMap[y + stripnr * height] * 8 + i];
+ byte c = _C64CharMap[charIdx + i];
dst[0] = dst[1] = _C64Colors[(c >> 6) & 3];
dst[2] = dst[3] = _C64Colors[(c >> 4) & 3];
dst[4] = dst[5] = _C64Colors[(c >> 2) & 3];
@@ -1359,12 +1357,14 @@ void Gdi::drawStripC64Background(byte *dst, int stripnr, int height) {
}
void Gdi::drawStripC64Object(byte *dst, int stripnr, int width, int height) {
+ int charIdx;
height >>= 3;
width >>= 3;
for (int y = 0; y < height; y++) {
- _C64Colors[3] = (_C64ObjectMap[y * width + stripnr + (width * height)] & 7);
+ _C64Colors[3] = (_C64ObjectMap[(y + height) * width + stripnr] & 7);
+ charIdx = _C64ObjectMap[y * width + stripnr] * 8;
for (int i = 0; i < 8; i++) {
- byte c = _C64CharMap[_C64ObjectMap[y * width + stripnr] * 8 + i];
+ byte c = _C64CharMap[charIdx + i];
dst[0] = dst[1] = _C64Colors[(c >> 6) & 3];
dst[2] = dst[3] = _C64Colors[(c >> 4) & 3];
dst[4] = dst[5] = _C64Colors[(c >> 2) & 3];
@@ -1374,17 +1374,21 @@ void Gdi::drawStripC64Object(byte *dst, int stripnr, int width, int height) {
}
}
-void Gdi::drawStripC64Mask(byte *dst, int stripnr, int height) {
+void Gdi::drawStripC64Mask(byte *dst, int stripnr, int width, int height) {
+ int maskIdx;
height >>= 3;
for (int y = 0; y < height; y++) {
+ if (_C64ObjectMode)
+ maskIdx = _C64ObjectMap[(y + 2 * height) * width + stripnr] * 8;
+ else
+ maskIdx = _C64MaskMap[y + stripnr * height] * 8;
for (int i = 0; i < 8; i++) {
- byte c = _C64MaskChar[_C64MaskMap[y + stripnr * height] * 8 + i];
- byte tmp1 = ((c >> 6) & 3) == 0;
- byte tmp2 = ((c >> 4) & 3) == 0;
- byte tmp3 = ((c >> 2) & 3) == 0;
- byte tmp4 = ((c >> 0) & 3) == 0;
- *dst = (tmp1 << 7) | (tmp1 << 6) | (tmp2 << 5) | (tmp2 << 4) |
- (tmp3 << 3) | (tmp3 << 2) | (tmp4 << 1) | (tmp4 << 0);
+ byte c = _C64MaskChar[maskIdx + i];
+
+ // Room masks are inverted compared to the object masks
+ if (!_C64ObjectMode)
+ c ^= 0xFF;
+ *dst = c;
dst += _numStrips;
}
}
diff --git a/scumm/gfx.h b/scumm/gfx.h
index b6c8cba163..eb14a176a9 100644
--- a/scumm/gfx.h
+++ b/scumm/gfx.h
@@ -133,7 +133,7 @@ protected:
void decodeC64Gfx(const byte *src, byte *dst, int size);
void drawStripC64Object(byte *dst, int stripnr, int width, int height);
void drawStripC64Background(byte *dst, int stripnr, int height);
- void drawStripC64Mask(byte *dst, int stripnr, int height);
+ void drawStripC64Mask(byte *dst, int stripnr, int width, int height);
void unkDecodeA(byte *dst, const byte *src, int height);
void unkDecodeA_trans(byte *dst, const byte *src, int height);
void unkDecodeB(byte *dst, const byte *src, int height);