fix freddemo intro glitches

svn-id: r15225
This commit is contained in:
Gregory Montoir 2004-09-21 20:21:31 +00:00
parent 2f9ea12ddd
commit 6e9ce1b17c
3 changed files with 32 additions and 43 deletions

View file

@ -1890,39 +1890,32 @@ void ScummEngine::postProcessAuxQueue() {
if (ae->actorNum != -1) { if (ae->actorNum != -1) {
Actor *a = derefActor(ae->actorNum, "postProcessAuxQueue"); Actor *a = derefActor(ae->actorNum, "postProcessAuxQueue");
const uint8 *cost = getResourceAddress(rtCostume, a->costume); const uint8 *cost = getResourceAddress(rtCostume, a->costume);
int dy = a->offs_y + a->_pos.y - a->getElevation(); int dy = a->offs_y + a->_pos.y - a->getElevation();
int dx = a->offs_x + a->_pos.x; int dx = a->offs_x + a->_pos.x;
const uint8 *akax = findResource(MKID('AKAX'), cost); const uint8 *akax = findResource(MKID('AKAX'), cost);
if (!akax) { assert(akax);
error("No AKAX block for actor %d", ae->actorNum);
}
const uint8 *auxd = findPalInPals(akax, ae->subIndex) - _resourceHeaderSize; const uint8 *auxd = findPalInPals(akax, ae->subIndex) - _resourceHeaderSize;
if (!auxd) { assert(auxd);
error("No AUXD block for actor %d", ae->actorNum);
}
const uint8 *axfd = findResourceData(MKID('AXFD'), auxd); const uint8 *axfd = findResourceData(MKID('AXFD'), auxd);
if (!axfd) { assert(axfd);
error("No AXFD block for actor %d", ae->actorNum);
} else { uint16 comp = READ_LE_UINT16(axfd);
uint16 comp = READ_LE_UINT16(axfd); if (comp != 0) {
if (comp != 0) { int x = (int16)READ_LE_UINT16(axfd + 2) + dx;
int x = (int16)READ_LE_UINT16(axfd + 2) + dx; int y = (int16)READ_LE_UINT16(axfd + 4) + dy;
int y = (int16)READ_LE_UINT16(axfd + 4) + dy; int w = (int16)READ_LE_UINT16(axfd + 6);
int w = (int16)READ_LE_UINT16(axfd + 6); int h = (int16)READ_LE_UINT16(axfd + 8);
int h = (int16)READ_LE_UINT16(axfd + 8); VirtScreen *pvs = &virtscr[kMainVirtScreen];
VirtScreen *pvs = &virtscr[kMainVirtScreen]; uint8 *dst1 = pvs->getPixels(0, pvs->topline);
uint8 *dst1 = pvs->getPixels(0, pvs->topline); uint8 *dst2 = pvs->getBackPixels(0, pvs->topline);
uint8 *dst2 = pvs->getBackPixels(0, pvs->topline); switch (comp) {
switch (comp) { case 1:
case 1: gdi.copyAuxImage(dst1, dst2, axfd + 10, pvs->w, pvs->h, x, y, w, h, NULL);
gdi.copyAuxImage(dst1, dst2, axfd + 10, pvs->w, pvs->h, x, y, w, h, NULL); break;
break; default:
default: warning("unimplemented compression type %d", comp);
warning("unimplemented compression type %d", comp); break;
break;
}
} }
} }
const uint8 *axur = findResourceData(MKID('AXUR'), auxd); const uint8 *axur = findResourceData(MKID('AXUR'), auxd);
@ -1933,7 +1926,7 @@ void ScummEngine::postProcessAuxQueue() {
int y1 = (int16)READ_LE_UINT16(axur + 2) + dy; int y1 = (int16)READ_LE_UINT16(axur + 2) + dy;
int x2 = (int16)READ_LE_UINT16(axur + 4) + dx; int x2 = (int16)READ_LE_UINT16(axur + 4) + dx;
int y2 = (int16)READ_LE_UINT16(axur + 6) + dy; int y2 = (int16)READ_LE_UINT16(axur + 6) + dy;
markRectAsDirty(kMainVirtScreen, x1, x2, y1, y2); markRectAsDirty(kMainVirtScreen, x1, x2, y1, y2 + 1);
axur += 8; axur += 8;
} }
} }

View file

@ -1404,21 +1404,21 @@ void Gdi::drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y,
} }
static bool calcClipRects(int dst_w, int dst_h, int src_x, int src_y, int src_w, int src_h, const Common::Rect *rect, Common::Rect &srcRect, Common::Rect &dstRect) { static bool calcClipRects(int dst_w, int dst_h, int src_x, int src_y, int src_w, int src_h, const Common::Rect *rect, Common::Rect &srcRect, Common::Rect &dstRect) {
srcRect = Common::Rect(0, 0, src_w, src_h); srcRect = Common::Rect(0, 0, src_w - 1, src_h - 1);
dstRect = Common::Rect(src_x, src_y, src_x + src_w, src_y + src_h); dstRect = Common::Rect(src_x, src_y, src_x + src_w - 1, src_y + src_h - 1);
Common::Rect r3; Common::Rect r3;
int diff; int diff;
if (rect) { if (rect) {
r3 = *rect; r3 = *rect;
Common::Rect r4(0, 0, dst_w, dst_h); Common::Rect r4(0, 0, dst_w - 1, dst_h - 1);
if (r3.intersects(r4)) { if (r3.intersects(r4)) {
r3.clip(r4); r3.clip(r4);
} else { } else {
return false; return false;
} }
} else { } else {
r3 = Common::Rect(0, 0, dst_w, dst_h); r3 = Common::Rect(0, 0, dst_w - 1, dst_h - 1);
} }
diff = dstRect.left - r3.left; diff = dstRect.left - r3.left;
if (diff < 0) { if (diff < 0) {
@ -1564,8 +1564,6 @@ void Gdi::copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int
Common::Rect r1, r2; Common::Rect r1, r2;
if (calcClipRects(dstw, dsth, srcx, srcy, srcw, srch, rect, r1, r2)) { if (calcClipRects(dstw, dsth, srcx, srcy, srcw, srch, rect, r1, r2)) {
if (r1.isValidRect() && r2.isValidRect()) { if (r1.isValidRect() && r2.isValidRect()) {
--r1.right;
--r1.bottom;
decompressAuxImage(dst1, dst2, dstw, r2, src, r1); decompressAuxImage(dst1, dst2, dstw, r2, src, r1);
} }
} }

View file

@ -1454,7 +1454,7 @@ uint8 *ScummEngine_v72he::drawWizImage(int restype, int resnum, int state, int x
cw = pvs->w; cw = pvs->w;
ch = pvs->h; ch = pvs->h;
} }
Common::Rect rScreen(0, 0, cw, ch); Common::Rect rScreen(0, 0, cw - 1, ch - 1);
if (flags & 0x80) { if (flags & 0x80) {
// drawWizImageHelper2(p, wizd, cw, ch, x1, y1, width, height, &rScreen, 0, 2); // drawWizImageHelper2(p, wizd, cw, ch, x1, y1, width, height, &rScreen, 0, 2);
warning("drawWizImage() unhandled flag 0x80"); warning("drawWizImage() unhandled flag 0x80");
@ -1470,15 +1470,13 @@ uint8 *ScummEngine_v72he::drawWizImage(int restype, int resnum, int state, int x
warning("printing Wiz image is unimplemented"); warning("printing Wiz image is unimplemented");
dst = NULL; dst = NULL;
} else { } else {
Common::Rect rImage(x1, y1, x1 + width, y1 + height); Common::Rect rImage(x1, y1, x1 + width - 1, y1 + height - 1);
if (rImage.intersects(rScreen)) { if (rImage.intersects(rScreen)) {
rImage.clip(rScreen); rImage.clip(rScreen);
if (flags & 0x18) { if (flags & 0x18) {
++rImage.bottom; ++rImage.bottom;
markRectAsDirty(kMainVirtScreen, rImage); markRectAsDirty(kMainVirtScreen, rImage);
} else { } else {
--rImage.right;
--rImage.bottom;
gdi.copyVirtScreenBuffers(rImage); gdi.copyVirtScreenBuffers(rImage);
} }
} }
@ -1497,12 +1495,12 @@ struct PolygonDrawData {
int16 y2; int16 y2;
}; };
struct ResArea { struct ResArea {
int16 off; uint16 off;
int16 x_step; int16 x_step;
int16 y_step; int16 y_step;
int16 x_s; int16 x_s;
int16 y_s; int16 y_s;
uint16 w; int16 w;
}; };
Common::Point pts[4]; Common::Point pts[4];
ResArea *ra; ResArea *ra;
@ -1556,7 +1554,7 @@ struct PolygonDrawData {
x3 += x_step_2; x3 += x_step_2;
y3 += y_step; y3 += y_step;
if (p2->y > p1->y) { if (p2->y <= p1->y) {
--iaidx; --iaidx;
} else { } else {
++iaidx; ++iaidx;
@ -1663,6 +1661,7 @@ void ScummEngine_v72he::drawWizPolygon(int resnum, int state, int id, int flags)
uint16 rw = pra->w; uint16 rw = pra->w;
while (rw--) { while (rw--) {
uint srcWizOff = (y_acc >> 0x10) * wizW + (x_acc >> 0x10); uint srcWizOff = (y_acc >> 0x10) * wizW + (x_acc >> 0x10);
assert(srcWizOff < wizW * wizH);
x_acc += pra->x_step; x_acc += pra->x_step;
y_acc += pra->y_step; y_acc += pra->y_step;
*dstPtr++ = srcWizBuf[srcWizOff]; *dstPtr++ = srcWizBuf[srcWizOff];
@ -1679,7 +1678,6 @@ void ScummEngine_v72he::drawWizPolygon(int resnum, int state, int id, int flags)
free(srcWizBuf); free(srcWizBuf);
} }
} }
void ScummEngine_v72he::redrawBGAreas() { void ScummEngine_v72he::redrawBGAreas() {