aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-06-06 20:55:39 +0000
committerMax Horn2003-06-06 20:55:39 +0000
commit1cae280e79ded4bf68b5692f74de9c1f47644a5c (patch)
treef1af0b41f992a1a13f7f90ed3a258e389f640c6c
parent0f9d447bd450ad65727c925371773be0519e3d2a (diff)
downloadscummvm-rg350-1cae280e79ded4bf68b5692f74de9c1f47644a5c.tar.gz
scummvm-rg350-1cae280e79ded4bf68b5692f74de9c1f47644a5c.tar.bz2
scummvm-rg350-1cae280e79ded4bf68b5692f74de9c1f47644a5c.zip
rewrite code a bit: personally I find it much easier to understand what the code does this way (the &6 trick is cute, but obfuscates the meaning of the code)
svn-id: r8360
-rw-r--r--scumm/gfx.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index aec3c9ca91..8a5fc45bc7 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -1335,45 +1335,45 @@ StripTable *Gdi::generateStripTable(const byte *src, int width, int height, Stri
}
void Gdi::drawStripC64Background(byte *dst, int stripnr, int height) {
- int y, i, j;
height >>= 3;
- for (y = 0; y < height; y++) {
+ for (int y = 0; y < height; y++) {
_C64Colors[3] = (_C64ColorMap[y + stripnr * height] & 7);
- for (i = 0; i < 8; i++) {
- for (j = 7; j >= 0; j--) {
- byte c = _C64CharMap[_C64PicMap[y + stripnr * height] * 8 + i] >> (j & 6);
- dst[7 - j] = _C64Colors[c & 3];
- }
+ for (int i = 0; i < 8; i++) {
+ byte c = _C64CharMap[_C64PicMap[y + stripnr * height] * 8 + 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];
+ dst[6] = dst[7] = _C64Colors[(c >> 0) & 3];
dst += _vm->_screenWidth;
}
}
}
void Gdi::drawStripC64Object(byte *dst, int stripnr, int width, int height) {
- int y, i, j;
height >>= 3;
width >>= 3;
- for (y = 0; y < height; y++) {
+ for (int y = 0; y < height; y++) {
_C64Colors[3] = (_C64ObjectMap[y * width + stripnr + (width * height)] & 7);
- for (i = 0; i < 8; i++) {
- for (j = 7; j >= 0; j--) {
- byte c = _C64CharMap[_C64ObjectMap[y * width + stripnr] * 8 + i] >> (j & 6);
- dst[7 - j] = _C64Colors[c & 3];
- }
+ for (int i = 0; i < 8; i++) {
+ byte c = _C64CharMap[_C64ObjectMap[y * width + stripnr] * 8 + 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];
+ dst[6] = dst[7] = _C64Colors[(c >> 0) & 3];
dst += _vm->_screenWidth;
}
}
}
void Gdi::drawStripC64Mask(byte *dst, int stripnr, int height) {
- int y, i, j;
height >>= 3;
- for (y = 0; y < height; y++) {
- for (i = 0; i < 8; i++) {
- for (j = 7; j >= 0; j--) {
- byte c = _C64MaskChar[_C64MaskMap[y + stripnr * height] * 8 + i] >> (j & 6);
- dst[7 - j] = c & 3;
- }
+ for (int y = 0; y < height; y++) {
+ for (int i = 0; i < 8; i++) {
+ byte c = _C64MaskChar[_C64MaskMap[y + stripnr * height] * 8 + i];
+ dst[0] = dst[1] = (c >> 6) & 3;
+ dst[2] = dst[3] = (c >> 4) & 3;
+ dst[4] = dst[5] = (c >> 2) & 3;
+ dst[6] = dst[7] = (c >> 0) & 3;
dst += _vm->_screenWidth;
}
}