Replaced global revBitMask array with a macro

svn-id: r18104
This commit is contained in:
Max Horn 2005-05-15 10:40:28 +00:00
parent e5bbfe8df9
commit fb11e79387
9 changed files with 18 additions and 24 deletions

View File

@ -96,7 +96,6 @@ typedef struct {
typedef struct {
void *v1; // struct v1 *
const byte *revBitMask;
const byte *_srcptr;
int _height;

View File

@ -14,7 +14,6 @@ UInt32 CostumeRenderer_proc3(void *userData68KP) {
SETPTRV (V1CodecType * , v1, v1comp )
SETPTR (const byte * ,revBitMask )
SETPTR (const byte * ,_srcptr )
SET32 (int ,_height )
SET8 (byte ,_scaleIndexX )
@ -60,7 +59,7 @@ UInt32 CostumeRenderer_proc3(void *userData68KP) {
height = _height;
scaleytab = &v1.scaletable[_scaleIndexY];
maskbit = revBitMask[v1.x & 7];
maskbit = revBitMask(v1.x & 7);
mask = v1.mask_ptr + v1.x / 8;
if (len)
@ -108,7 +107,7 @@ UInt32 CostumeRenderer_proc3(void *userData68KP) {
if (v1.x < 0 || v1.x >= _out_w)
//return _scaleIndexX;
goto end_jump;
maskbit = revBitMask[v1.x & 7];
maskbit = revBitMask(v1.x & 7);
v1.destptr += v1.scaleXstep;
}
_scaleIndexX += v1.scaleXstep;

View File

@ -522,7 +522,7 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) {
height = _height;
scaleytab = &v1.scaletable[v1.scaleYindex];
maskbit = revBitMask[v1.x & 7];
maskbit = revBitMask(v1.x & 7);
mask = _vm->getMaskBuffer(v1.x - (_vm->virtscr[0].xstart & 7), v1.y, _zbuf);
if (len)
@ -577,7 +577,7 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) {
v1.x += v1.scaleXstep;
if (v1.x < 0 || v1.x >= _out.w)
return;
maskbit = revBitMask[v1.x & 7];
maskbit = revBitMask(v1.x & 7);
v1.destptr += v1.scaleXstep;
skip_column = false;
} else
@ -1061,7 +1061,7 @@ void AkosRenderer::akos16Decompress(byte *dest, int32 pitch, const byte *src, in
byte *tmp_buf = akos16.buffer;
int maskpitch;
byte *maskptr;
const byte maskbit = revBitMask[maskLeft & 7];
const byte maskbit = revBitMask(maskLeft & 7);
if (dir < 0) {
dest -= (t_width - 1);

View File

@ -236,7 +236,7 @@ void ScummEngine::drawBomp(const BompDrawData &bd, bool mirror) {
src = bd.dataptr;
dst = (byte *)bd.dst.pixels + bd.y * bd.dst.pitch + (bd.x + clip.left);
const byte maskbit = revBitMask[(bd.x + clip.left) & 7];
const byte maskbit = revBitMask((bd.x + clip.left) & 7);
// Mask against any additionally imposed mask
if (bd.maskPtr) {
@ -377,7 +377,7 @@ int32 setupBompScale(byte *scaling, int32 size, byte scale) {
*tmp_scaling++ = a;
}
if ((size & 7) != 0) {
*(tmp_scaling - 1) |= revBitMask[size & 7];
*(tmp_scaling - 1) |= revBitMask(size & 7);
}
count = (size + 7) / 8;

View File

@ -1557,7 +1557,7 @@ void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, con
for (x = 0; x < width; x++) {
if ((x % 8) == 0)
bits = *src++;
if ((bits & revBitMask[x % 8]) && y + drawTop >= 0) {
if ((bits & revBitMask(x % 8)) && y + drawTop >= 0) {
if (_dropShadow) {
*(dst + 1) = _shadowColor;
*(dst + s.pitch) = _shadowColor;

View File

@ -34,8 +34,6 @@
namespace Scumm {
const byte revBitMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
#ifdef __PALM_OS__
const byte *smallCostumeScaleTable;
#else
@ -330,7 +328,7 @@ static const int v1MMActorPalatte2[25] = {
};
#define MASK_AT(xoff) \
(mask && (mask[((v1.x + xoff) / 8)] & revBitMask[(v1.x + xoff) & 7]))
(mask && (mask[((v1.x + xoff) / 8)] & revBitMask((v1.x + xoff) & 7)))
#define LINE(c,p) \
pcolor = (color >> c) & 3; \
if (pcolor) { \
@ -420,7 +418,6 @@ void ClassicCostumeRenderer::proc3(Codec1 &v1) {
ARM_START(CostumeProc3Type)
ARM_INIT(SCUMM_PROC3)
ARM_ADDP(v1)
ARM_ADDM(revBitMask)
ARM_ADDM(_srcptr)
ARM_ADDM(_height)
ARM_ADDM(_scaleIndexX)
@ -454,7 +451,7 @@ void ClassicCostumeRenderer::proc3(Codec1 &v1) {
height = _height;
scaleytab = &v1.scaletable[_scaleIndexY];
maskbit = revBitMask[v1.x & 7];
maskbit = revBitMask(v1.x & 7);
mask = v1.mask_ptr + v1.x / 8;
if (len)
@ -499,7 +496,7 @@ void ClassicCostumeRenderer::proc3(Codec1 &v1) {
v1.x += v1.scaleXstep;
if (v1.x < 0 || v1.x >= _out.w)
return;
maskbit = revBitMask[v1.x & 7];
maskbit = revBitMask(v1.x & 7);
v1.destptr += v1.scaleXstep;
}
_scaleIndexX += v1.scaleXstep;
@ -525,7 +522,7 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
height = _height;
width = _width;
src = _srcptr;
maskbit = revBitMask[v1.x & 7];
maskbit = revBitMask(v1.x & 7);
y = v1.y;
oldXpos = v1.x;
oldScaleIndexX = _scaleIndexX;
@ -547,7 +544,7 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
v1.x += v1.scaleXstep;
dst += v1.scaleXstep;
maskbit = revBitMask[v1.x & 7];
maskbit = revBitMask(v1.x & 7);
}
_scaleIndexX += v1.scaleXstep;
mask = v1.mask_ptr + v1.x / 8;
@ -707,7 +704,7 @@ byte NESCostumeRenderer::drawLimb(const Actor *a, int limb) {
continue;
int my = _actorY + y + ty;
int mx = _actorX + x + tx;
if (!doMask || !(bgTransBuf[my * _numStrips + mx / 8] & (0x80 >> (mx & 7))))
if (!doMask || !(bgTransBuf[my * _numStrips + mx / 8] & revBitMask(mx & 7)))
*((byte *)_out.pixels + my * _out.pitch + mx) = palette[c];
}
}

View File

@ -378,7 +378,7 @@ void NutRenderer::draw2byte(const Graphics::Surface &s, int c, int x, int y, byt
bits = *src++;
if (x + tx < 0 || x + tx >= s.w || y + ty < 0)
continue;
if (bits & revBitMask[tx & 7]) {
if (bits & revBitMask(tx % 8)) {
dst[tx] = color;
}
}

View File

@ -138,7 +138,7 @@ int SmushFont::draw2byte(byte *buffer, int dst_width, int x, int y, int idx) {
for (int i = 0; i < w; i++) {
if ((i % 8) == 0)
bits = *src++;
if (bits & revBitMask[i % 8]) {
if (bits & revBitMask(i % 8)) {
dst[i + 1] = 0;
dst[dst_width + i] = 0;
dst[dst_width + i + 1] = 0;

View File

@ -27,6 +27,8 @@
namespace Scumm {
#define revBitMask(x) (0x80 >> (x))
class BaseScummFile : public Common::File {
public:
virtual void setEnc(byte value) = 0;
@ -109,9 +111,6 @@ public:
};
// This is a constant lookup table of reverse bit masks
extern const byte revBitMask[8];
/* Direction conversion functions (between old dir and new dir format) */
int newDirToOldDir(int dir);
int oldDirToNewDir(int dir);