Add masking support for C64 maniac, not perfect

svn-id: r21250
This commit is contained in:
Travis Howell 2006-03-13 06:06:51 +00:00
parent 833e343059
commit 06dddefe90
2 changed files with 12 additions and 9 deletions

View File

@ -42,7 +42,7 @@ struct Box { /* Internal walkbox file format */
byte x2;
byte y1;
byte y2;
byte flags;
byte mask;
} GCC_PACK c64;
struct {
@ -111,8 +111,7 @@ byte ScummEngine::getMaskFromBox(int box) {
if (_game.version == 8)
return (byte) FROM_LE_32(ptr->v8.mask);
else if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64)
// No mask?
return 0;
return ptr->c64.mask;
else if (_game.version <= 2)
return ptr->v2.mask;
else
@ -132,8 +131,6 @@ void ScummEngine::setBoxFlags(int box, int val) {
return;
if (_game.version == 8)
ptr->v8.flags = TO_LE_32(val);
else if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64)
ptr->c64.flags = val;
else if (_game.version <= 2)
ptr->v2.flags = val;
else
@ -148,7 +145,7 @@ byte ScummEngine::getBoxFlags(int box) {
if (_game.version == 8)
return (byte) FROM_LE_32(ptr->v8.flags);
else if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64)
return ptr->c64.flags;
return 0;
else if (_game.version <= 2)
return ptr->v2.flags;
else

View File

@ -981,11 +981,15 @@ static const byte actorColorsMMC64[25] = {
0, 7, 2, 6, 9, 1, 3, 7, 7, 1, 1, 9, 1, 4, 5, 5, 4, 1, 0, 5, 4, 2, 2, 7, 7
};
#define MASK_AT(xoff) \
(mask && (mask[((destX + xoff) / 8)] & revBitMask((destX + xoff) & 7)))
#define LINE(c,p) \
pcolor = (color >> c) & 3; \
if (pcolor) { \
dst[p] = palette[pcolor]; \
dst[p + 1] = palette[pcolor]; \
if (!MASK_AT(p)) \
dst[p] = palette[pcolor]; \
if (!MASK_AT(p + 1)) \
dst[p + 1] = palette[pcolor]; \
}
byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
@ -1074,7 +1078,8 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
int destY = y + ypos;
int destX = realX * 8 + xpos;
if (destY >= 0 && destY < _out.h && destX >= 0 && destX < _out.w) {
byte *dst = &(((byte*)_out.pixels)[destY * _out.pitch + destX]);
byte *dst = (byte *)_out.pixels + destY * _out.pitch + destX;
byte *mask = _vm->getMaskBuffer(0, destY, _zbuf);
if (flipped) {
LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6);
} else {
@ -1094,6 +1099,7 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
}
#undef LINE
#undef MASK_AT
void C64CostumeRenderer::setCostume(int costume, int shadow) {
_loaded.loadCostume(costume);