Replaced global revBitMask array with a macro
svn-id: r18104
This commit is contained in:
parent
e5bbfe8df9
commit
fb11e79387
9 changed files with 18 additions and 24 deletions
|
@ -96,7 +96,6 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *v1; // struct v1 *
|
void *v1; // struct v1 *
|
||||||
const byte *revBitMask;
|
|
||||||
|
|
||||||
const byte *_srcptr;
|
const byte *_srcptr;
|
||||||
int _height;
|
int _height;
|
||||||
|
|
|
@ -14,7 +14,6 @@ UInt32 CostumeRenderer_proc3(void *userData68KP) {
|
||||||
|
|
||||||
SETPTRV (V1CodecType * , v1, v1comp )
|
SETPTRV (V1CodecType * , v1, v1comp )
|
||||||
|
|
||||||
SETPTR (const byte * ,revBitMask )
|
|
||||||
SETPTR (const byte * ,_srcptr )
|
SETPTR (const byte * ,_srcptr )
|
||||||
SET32 (int ,_height )
|
SET32 (int ,_height )
|
||||||
SET8 (byte ,_scaleIndexX )
|
SET8 (byte ,_scaleIndexX )
|
||||||
|
@ -60,7 +59,7 @@ UInt32 CostumeRenderer_proc3(void *userData68KP) {
|
||||||
height = _height;
|
height = _height;
|
||||||
|
|
||||||
scaleytab = &v1.scaletable[_scaleIndexY];
|
scaleytab = &v1.scaletable[_scaleIndexY];
|
||||||
maskbit = revBitMask[v1.x & 7];
|
maskbit = revBitMask(v1.x & 7);
|
||||||
mask = v1.mask_ptr + v1.x / 8;
|
mask = v1.mask_ptr + v1.x / 8;
|
||||||
|
|
||||||
if (len)
|
if (len)
|
||||||
|
@ -108,7 +107,7 @@ UInt32 CostumeRenderer_proc3(void *userData68KP) {
|
||||||
if (v1.x < 0 || v1.x >= _out_w)
|
if (v1.x < 0 || v1.x >= _out_w)
|
||||||
//return _scaleIndexX;
|
//return _scaleIndexX;
|
||||||
goto end_jump;
|
goto end_jump;
|
||||||
maskbit = revBitMask[v1.x & 7];
|
maskbit = revBitMask(v1.x & 7);
|
||||||
v1.destptr += v1.scaleXstep;
|
v1.destptr += v1.scaleXstep;
|
||||||
}
|
}
|
||||||
_scaleIndexX += v1.scaleXstep;
|
_scaleIndexX += v1.scaleXstep;
|
||||||
|
|
|
@ -522,7 +522,7 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) {
|
||||||
height = _height;
|
height = _height;
|
||||||
|
|
||||||
scaleytab = &v1.scaletable[v1.scaleYindex];
|
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);
|
mask = _vm->getMaskBuffer(v1.x - (_vm->virtscr[0].xstart & 7), v1.y, _zbuf);
|
||||||
|
|
||||||
if (len)
|
if (len)
|
||||||
|
@ -577,7 +577,7 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) {
|
||||||
v1.x += v1.scaleXstep;
|
v1.x += v1.scaleXstep;
|
||||||
if (v1.x < 0 || v1.x >= _out.w)
|
if (v1.x < 0 || v1.x >= _out.w)
|
||||||
return;
|
return;
|
||||||
maskbit = revBitMask[v1.x & 7];
|
maskbit = revBitMask(v1.x & 7);
|
||||||
v1.destptr += v1.scaleXstep;
|
v1.destptr += v1.scaleXstep;
|
||||||
skip_column = false;
|
skip_column = false;
|
||||||
} else
|
} else
|
||||||
|
@ -1061,7 +1061,7 @@ void AkosRenderer::akos16Decompress(byte *dest, int32 pitch, const byte *src, in
|
||||||
byte *tmp_buf = akos16.buffer;
|
byte *tmp_buf = akos16.buffer;
|
||||||
int maskpitch;
|
int maskpitch;
|
||||||
byte *maskptr;
|
byte *maskptr;
|
||||||
const byte maskbit = revBitMask[maskLeft & 7];
|
const byte maskbit = revBitMask(maskLeft & 7);
|
||||||
|
|
||||||
if (dir < 0) {
|
if (dir < 0) {
|
||||||
dest -= (t_width - 1);
|
dest -= (t_width - 1);
|
||||||
|
|
|
@ -236,7 +236,7 @@ void ScummEngine::drawBomp(const BompDrawData &bd, bool mirror) {
|
||||||
src = bd.dataptr;
|
src = bd.dataptr;
|
||||||
dst = (byte *)bd.dst.pixels + bd.y * bd.dst.pitch + (bd.x + clip.left);
|
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
|
// Mask against any additionally imposed mask
|
||||||
if (bd.maskPtr) {
|
if (bd.maskPtr) {
|
||||||
|
@ -377,7 +377,7 @@ int32 setupBompScale(byte *scaling, int32 size, byte scale) {
|
||||||
*tmp_scaling++ = a;
|
*tmp_scaling++ = a;
|
||||||
}
|
}
|
||||||
if ((size & 7) != 0) {
|
if ((size & 7) != 0) {
|
||||||
*(tmp_scaling - 1) |= revBitMask[size & 7];
|
*(tmp_scaling - 1) |= revBitMask(size & 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
count = (size + 7) / 8;
|
count = (size + 7) / 8;
|
||||||
|
|
|
@ -1557,7 +1557,7 @@ void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, con
|
||||||
for (x = 0; x < width; x++) {
|
for (x = 0; x < width; x++) {
|
||||||
if ((x % 8) == 0)
|
if ((x % 8) == 0)
|
||||||
bits = *src++;
|
bits = *src++;
|
||||||
if ((bits & revBitMask[x % 8]) && y + drawTop >= 0) {
|
if ((bits & revBitMask(x % 8)) && y + drawTop >= 0) {
|
||||||
if (_dropShadow) {
|
if (_dropShadow) {
|
||||||
*(dst + 1) = _shadowColor;
|
*(dst + 1) = _shadowColor;
|
||||||
*(dst + s.pitch) = _shadowColor;
|
*(dst + s.pitch) = _shadowColor;
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
|
|
||||||
namespace Scumm {
|
namespace Scumm {
|
||||||
|
|
||||||
const byte revBitMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
|
|
||||||
|
|
||||||
#ifdef __PALM_OS__
|
#ifdef __PALM_OS__
|
||||||
const byte *smallCostumeScaleTable;
|
const byte *smallCostumeScaleTable;
|
||||||
#else
|
#else
|
||||||
|
@ -330,7 +328,7 @@ static const int v1MMActorPalatte2[25] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MASK_AT(xoff) \
|
#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) \
|
#define LINE(c,p) \
|
||||||
pcolor = (color >> c) & 3; \
|
pcolor = (color >> c) & 3; \
|
||||||
if (pcolor) { \
|
if (pcolor) { \
|
||||||
|
@ -420,7 +418,6 @@ void ClassicCostumeRenderer::proc3(Codec1 &v1) {
|
||||||
ARM_START(CostumeProc3Type)
|
ARM_START(CostumeProc3Type)
|
||||||
ARM_INIT(SCUMM_PROC3)
|
ARM_INIT(SCUMM_PROC3)
|
||||||
ARM_ADDP(v1)
|
ARM_ADDP(v1)
|
||||||
ARM_ADDM(revBitMask)
|
|
||||||
ARM_ADDM(_srcptr)
|
ARM_ADDM(_srcptr)
|
||||||
ARM_ADDM(_height)
|
ARM_ADDM(_height)
|
||||||
ARM_ADDM(_scaleIndexX)
|
ARM_ADDM(_scaleIndexX)
|
||||||
|
@ -454,7 +451,7 @@ void ClassicCostumeRenderer::proc3(Codec1 &v1) {
|
||||||
height = _height;
|
height = _height;
|
||||||
|
|
||||||
scaleytab = &v1.scaletable[_scaleIndexY];
|
scaleytab = &v1.scaletable[_scaleIndexY];
|
||||||
maskbit = revBitMask[v1.x & 7];
|
maskbit = revBitMask(v1.x & 7);
|
||||||
mask = v1.mask_ptr + v1.x / 8;
|
mask = v1.mask_ptr + v1.x / 8;
|
||||||
|
|
||||||
if (len)
|
if (len)
|
||||||
|
@ -499,7 +496,7 @@ void ClassicCostumeRenderer::proc3(Codec1 &v1) {
|
||||||
v1.x += v1.scaleXstep;
|
v1.x += v1.scaleXstep;
|
||||||
if (v1.x < 0 || v1.x >= _out.w)
|
if (v1.x < 0 || v1.x >= _out.w)
|
||||||
return;
|
return;
|
||||||
maskbit = revBitMask[v1.x & 7];
|
maskbit = revBitMask(v1.x & 7);
|
||||||
v1.destptr += v1.scaleXstep;
|
v1.destptr += v1.scaleXstep;
|
||||||
}
|
}
|
||||||
_scaleIndexX += v1.scaleXstep;
|
_scaleIndexX += v1.scaleXstep;
|
||||||
|
@ -525,7 +522,7 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
|
||||||
height = _height;
|
height = _height;
|
||||||
width = _width;
|
width = _width;
|
||||||
src = _srcptr;
|
src = _srcptr;
|
||||||
maskbit = revBitMask[v1.x & 7];
|
maskbit = revBitMask(v1.x & 7);
|
||||||
y = v1.y;
|
y = v1.y;
|
||||||
oldXpos = v1.x;
|
oldXpos = v1.x;
|
||||||
oldScaleIndexX = _scaleIndexX;
|
oldScaleIndexX = _scaleIndexX;
|
||||||
|
@ -547,7 +544,7 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
|
||||||
if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
|
if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
|
||||||
v1.x += v1.scaleXstep;
|
v1.x += v1.scaleXstep;
|
||||||
dst += v1.scaleXstep;
|
dst += v1.scaleXstep;
|
||||||
maskbit = revBitMask[v1.x & 7];
|
maskbit = revBitMask(v1.x & 7);
|
||||||
}
|
}
|
||||||
_scaleIndexX += v1.scaleXstep;
|
_scaleIndexX += v1.scaleXstep;
|
||||||
mask = v1.mask_ptr + v1.x / 8;
|
mask = v1.mask_ptr + v1.x / 8;
|
||||||
|
@ -707,7 +704,7 @@ byte NESCostumeRenderer::drawLimb(const Actor *a, int limb) {
|
||||||
continue;
|
continue;
|
||||||
int my = _actorY + y + ty;
|
int my = _actorY + y + ty;
|
||||||
int mx = _actorX + x + tx;
|
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];
|
*((byte *)_out.pixels + my * _out.pitch + mx) = palette[c];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,7 +378,7 @@ void NutRenderer::draw2byte(const Graphics::Surface &s, int c, int x, int y, byt
|
||||||
bits = *src++;
|
bits = *src++;
|
||||||
if (x + tx < 0 || x + tx >= s.w || y + ty < 0)
|
if (x + tx < 0 || x + tx >= s.w || y + ty < 0)
|
||||||
continue;
|
continue;
|
||||||
if (bits & revBitMask[tx & 7]) {
|
if (bits & revBitMask(tx % 8)) {
|
||||||
dst[tx] = color;
|
dst[tx] = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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++) {
|
for (int i = 0; i < w; i++) {
|
||||||
if ((i % 8) == 0)
|
if ((i % 8) == 0)
|
||||||
bits = *src++;
|
bits = *src++;
|
||||||
if (bits & revBitMask[i % 8]) {
|
if (bits & revBitMask(i % 8)) {
|
||||||
dst[i + 1] = 0;
|
dst[i + 1] = 0;
|
||||||
dst[dst_width + i] = 0;
|
dst[dst_width + i] = 0;
|
||||||
dst[dst_width + i + 1] = 0;
|
dst[dst_width + i + 1] = 0;
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
namespace Scumm {
|
namespace Scumm {
|
||||||
|
|
||||||
|
#define revBitMask(x) (0x80 >> (x))
|
||||||
|
|
||||||
class BaseScummFile : public Common::File {
|
class BaseScummFile : public Common::File {
|
||||||
public:
|
public:
|
||||||
virtual void setEnc(byte value) = 0;
|
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) */
|
/* Direction conversion functions (between old dir and new dir format) */
|
||||||
int newDirToOldDir(int dir);
|
int newDirToOldDir(int dir);
|
||||||
int oldDirToNewDir(int dir);
|
int oldDirToNewDir(int dir);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue