[Scummvm-cvs-logs] CVS: scummvm/scumm nut_renderer.cpp,1.27,1.28 nut_renderer.h,1.9,1.10
Max Horn
fingolfin at users.sourceforge.net
Wed Jun 4 16:52:02 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv9424
Modified Files:
nut_renderer.cpp nut_renderer.h
Log Message:
some more cleanup
Index: nut_renderer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/nut_renderer.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- nut_renderer.cpp 4 Jun 2003 23:32:09 -0000 1.27
+++ nut_renderer.cpp 4 Jun 2003 23:51:25 -0000 1.28
@@ -191,6 +191,8 @@
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 @@
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 @@
}
}
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 @@
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 @@
continue;
if (bits & revBitMask[tx % 8]) {
dst[tx] = color;
- if (useMask) {
+ if (mask) {
mask[maskpos] |= maskmask;
}
}
@@ -294,6 +293,7 @@
}
}
dst += _vm->_screenWidth;
- mask += _vm->gdi._numStrips;
+ if (mask)
+ mask += _vm->gdi._numStrips;
}
}
Index: nut_renderer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/nut_renderer.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- nut_renderer.h 4 Jun 2003 23:32:09 -0000 1.9
+++ nut_renderer.h 4 Jun 2003 23:51:25 -0000 1.10
@@ -39,8 +39,8 @@
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);
More information about the Scummvm-git-logs
mailing list