aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-06-04 23:51:25 +0000
committerMax Horn2003-06-04 23:51:25 +0000
commitb4da713bfd0b3959932745390e61bc7398b40a05 (patch)
tree94e4de12dee5c9bf76097fc0a156f899097b2d20
parent565a100c831fa76c634d210d636065042e96e49a (diff)
downloadscummvm-rg350-b4da713bfd0b3959932745390e61bc7398b40a05.tar.gz
scummvm-rg350-b4da713bfd0b3959932745390e61bc7398b40a05.tar.bz2
scummvm-rg350-b4da713bfd0b3959932745390e61bc7398b40a05.zip
some more cleanup
svn-id: r8304
-rw-r--r--scumm/nut_renderer.cpp40
-rw-r--r--scumm/nut_renderer.h4
-rw-r--r--scumm/smush/smush_font.cpp2
3 files changed, 24 insertions, 22 deletions
diff --git a/scumm/nut_renderer.cpp b/scumm/nut_renderer.cpp
index ec3e1ebeef..50367b57aa 100644
--- a/scumm/nut_renderer.cpp
+++ b/scumm/nut_renderer.cpp
@@ -191,6 +191,8 @@ void NutRenderer::drawShadowChar(int c, int x, int y, byte color, bool useMask)
return;
}
+ byte *dst, *mask = NULL;
+
// HACK: we draw the character a total of 7 times: 6 times shifted
// and in black for the shadow, and once in the right color and position.
// This way we achieve the exact look as the original CMI had. However,
@@ -207,39 +209,40 @@ void NutRenderer::drawShadowChar(int c, int x, int y, byte color, bool useMask)
x += offsetX[i];
y += offsetY[i];
color = cTable[i];
-
+
+ dst = _vm->virtscr[0].screenPtr + y * _vm->_screenWidth + x + _vm->virtscr[0].xstart;
+ if (useMask)
+ mask = _vm->getMaskBuffer(x, y, 0);
+
if(c >= 256 && _vm->_CJKMode)
- draw2byte(c, x, y, color, useMask);
+ draw2byte(dst, mask, c, x, y, color);
else
- drawChar((byte)c, x, y, color, useMask);
+ drawChar(dst, mask, (byte)c, x, y, color);
x -= offsetX[i];
y -= offsetY[i];
}
}
-void NutRenderer::drawChar(byte c, int x, int y, byte color, bool useMask) {
+void NutRenderer::drawChar(byte *dst, byte *mask, byte c, int x, int y, byte color) {
const int width = _chars[c].width;
const int height = _chars[c].height;
const byte *src = _chars[c].src;
+ byte bits = 0;
- byte *dst, *mask = NULL;
byte maskmask;
int maskpos;
- dst = _vm->virtscr[0].screenPtr + y * _vm->_screenWidth + x + _vm->virtscr[0].xstart;
- mask = _vm->getMaskBuffer(x, y, 0);
-
for (int ty = 0; ty < height; ty++) {
maskmask = revBitMask[x & 7];
maskpos = 0;
for (int tx = 0; tx < width; tx++) {
- byte pixel = *src++;
+ bits = *src++;
if (x + tx < 0 || x + tx >= _vm->_screenWidth || y + ty < 0 || y + ty >= _vm->_screenHeight)
continue;
- if (pixel != 0) {
+ if (bits != 0) {
dst[tx] = color;
- if (useMask)
+ if (mask)
mask[maskpos] |= maskmask;
}
maskmask >>= 1;
@@ -249,11 +252,12 @@ void NutRenderer::drawChar(byte c, int x, int y, byte color, bool useMask) {
}
}
dst += _vm->_screenWidth;
- mask += _vm->gdi._numStrips;
+ if (mask)
+ mask += _vm->gdi._numStrips;
}
}
-void NutRenderer::draw2byte(int c, int x, int y, byte color, bool useMask) {
+void NutRenderer::draw2byte(byte *dst, byte *mask, int c, int x, int y, byte color) {
if (!_loaded) {
debug(2, "NutRenderer::draw2byte() Font is not loaded");
return;
@@ -264,14 +268,9 @@ void NutRenderer::draw2byte(int c, int x, int y, byte color, bool useMask) {
byte *src = g_scumm->get2byteCharPtr(c);
byte bits = 0;
- byte *dst, *mask = NULL;
byte maskmask;
int maskpos;
- dst = _vm->virtscr[0].screenPtr + y * _vm->_screenWidth + x + _vm->virtscr[0].xstart;
- mask = _vm->getMaskBuffer(x, y, 0);
-
-// drawBits1(&_vm->virtscr[0], dst, src, mask, ?, width, height);
for (int ty = 0; ty < height; ty++) {
maskmask = revBitMask[x & 7];
maskpos = 0;
@@ -282,7 +281,7 @@ void NutRenderer::draw2byte(int c, int x, int y, byte color, bool useMask) {
continue;
if (bits & revBitMask[tx % 8]) {
dst[tx] = color;
- if (useMask) {
+ if (mask) {
mask[maskpos] |= maskmask;
}
}
@@ -294,6 +293,7 @@ void NutRenderer::draw2byte(int c, int x, int y, byte color, bool useMask) {
}
}
dst += _vm->_screenWidth;
- mask += _vm->gdi._numStrips;
+ if (mask)
+ mask += _vm->gdi._numStrips;
}
}
diff --git a/scumm/nut_renderer.h b/scumm/nut_renderer.h
index 0aaf752a59..aead436bb6 100644
--- a/scumm/nut_renderer.h
+++ b/scumm/nut_renderer.h
@@ -39,8 +39,8 @@ protected:
void decodeCodec44(byte *dst, const byte *src, uint32 length);
- void draw2byte(int c, int x, int y, byte color, bool useMask);
- void drawChar(byte c, int x, int y, byte color, bool useMask);
+ void draw2byte(byte *dst, byte *mask, int c, int x, int y, byte color);
+ void drawChar(byte *dst, byte *mask, byte c, int x, int y, byte color);
public:
NutRenderer(Scumm *vm);
diff --git a/scumm/smush/smush_font.cpp b/scumm/smush/smush_font.cpp
index 49797f15e1..ac2222587d 100644
--- a/scumm/smush/smush_font.cpp
+++ b/scumm/smush/smush_font.cpp
@@ -183,6 +183,8 @@ int SmushFont::drawChar(byte *buffer, int dst_width, int x, int y, byte chr) {
const byte *src = _chars[chr].src;
byte *dst = buffer + dst_width * y + x;
+ assert(dst_width == g_scumm->_screenWidth);
+
if(_original) {
for(int j = 0; j < h; j++) {
for(int i = 0; i < w; i++) {