aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorTravis Howell2006-03-02 02:10:54 +0000
committerTravis Howell2006-03-02 02:10:54 +0000
commite3a48bf276b900ccfa450cf0556ece11f7b5a8d8 (patch)
tree55dc4656ffb3271f970e6f1ed4ecdd2306f89b4d /engines/scumm
parentfd8f11f7a452ae18d5e00f58430cc33bc5a48fed (diff)
downloadscummvm-rg350-e3a48bf276b900ccfa450cf0556ece11f7b5a8d8.tar.gz
scummvm-rg350-e3a48bf276b900ccfa450cf0556ece11f7b5a8d8.tar.bz2
scummvm-rg350-e3a48bf276b900ccfa450cf0556ece11f7b5a8d8.zip
Fix actor glitches in C64 maniac and minor cleanup
svn-id: r21001
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/costume.cpp53
1 files changed, 29 insertions, 24 deletions
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index cc6d52f186..6bf737a6d8 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -1006,9 +1006,7 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
int off = (offH << 8) + offL;
const byte *data = _loaded._baseptr + off;
- const byte actorColors[] = {
- 0, 10, actorColorsMMC64[_actorID], 0
- };
+ const byte palette[] = {0, 10, actorColorsMMC64[_actorID], 0};
int width = *data++;
int height = *data++;
@@ -1042,45 +1040,52 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
xpos += _actorX - (a->_width / 2) + 4;
ypos += _actorY - _loaded._maxHeight;
+ // This code is very similar to procC64()
if (flipped) {
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
- byte c = data[y*width+x];
- byte b, d;
+ byte color = data[y * width + x];
+ byte pcolor;
int realX = 0;
if (offsetX == 0||offsetX == 1) {
realX = width-(x+1);
} else if (offsetX == 2) {
realX = width-(x+2);
}
- byte *dest = &(((byte*)_out.pixels)[((y + ypos) * _out.pitch) + ((realX * 8) + xpos)]);
- for (int i = 0; i <= 6; i += 2) {
- if ((d = (c >> i) & 0x03)) {
- b = actorColors[d];
- *dest++ = b;
- *dest++ = b;
- continue;
+ int destY = y + ypos;
+ int destX = realX * 8 + xpos;
+ if (destY >= 0 && destY < _out.h && destX >= 0 && destX < _out.w) {
+ byte *destPtr = &(((byte*)_out.pixels)[destY * _out.pitch + destX]);
+ for (int i = 0; i <= 6; i += 2) {
+ pcolor = (color >> i) & 3;
+ if (pcolor) {
+ destPtr[0] = palette[pcolor];
+ destPtr[1] = palette[pcolor];
+ }
+ destPtr += 2;
}
- dest += 2;
}
}
}
} else {
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
- byte c = data[y*width+x];
- byte b, d;
- byte *dest = &(((byte*)_out.pixels)[((y + ypos) * _out.pitch) + ((x * 8) + xpos)]);
-
- for (int i = 6; i >= 0; i -= 2) {
- if ((d = (c >> i) & 0x03)) {
- b = actorColors[d];
- *dest++ = b;
- *dest++ = b;
- continue;
+ byte color = data[y * width + x];
+ byte pcolor;
+
+ int destY = y + ypos;
+ int destX = x * 8 + xpos;
+ if (destY >= 0 && destY < _out.h && destX >= 0 && destX < _out.w) {
+ byte *destPtr = &(((byte*)_out.pixels)[destY * _out.pitch + destX]);
+ for (int i = 6; i >= 0; i -= 2) {
+ pcolor = (color >> i) & 3;
+ if (pcolor) {
+ destPtr[0] = palette[pcolor];
+ destPtr[1] = palette[pcolor];
+ }
+ destPtr += 2;
}
- dest += 2;
}
}
}