diff options
author | Gregory Montoir | 2004-10-05 22:28:13 +0000 |
---|---|---|
committer | Gregory Montoir | 2004-10-05 22:28:13 +0000 |
commit | 5912d5d25a9b5c246fdad4be11cf59871fc11aed (patch) | |
tree | 92229d1297a7e3a1bbf21d3c3801552161dc2328 /scumm | |
parent | 3ea5ebce0eba744e50fda6d1ae8c788b63344295 (diff) | |
download | scummvm-rg350-5912d5d25a9b5c246fdad4be11cf59871fc11aed.tar.gz scummvm-rg350-5912d5d25a9b5c246fdad4be11cf59871fc11aed.tar.bz2 scummvm-rg350-5912d5d25a9b5c246fdad4be11cf59871fc11aed.zip |
fix drawWizPolygon glitch
svn-id: r15422
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/script_v72he.cpp | 21 | ||||
-rw-r--r-- | scumm/script_v7he.cpp | 58 |
2 files changed, 36 insertions, 43 deletions
diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index dcc68bfd0e..529bb3fd2d 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -1680,12 +1680,11 @@ struct PolygonDrawData { int32 x2; int32 y2; }; - Common::Point pts[4]; + Common::Point pto; InterArea *ia; int areasNum; PolygonDrawData(int n) { - memset(pts, 0, sizeof(pts)); areasNum = n; ia = new InterArea[areasNum]; memset(ia, 0, sizeof(InterArea) * areasNum); @@ -1704,7 +1703,7 @@ struct PolygonDrawData { int32 x3_step = ((p4->x - p3->x) << 0x10) / dy; int32 y3_step = ((p4->y - p3->y) << 0x10) / dy; - int iaidx = p1->y - pts[0].y; + int iaidx = p1->y - pto.y; while (dy--) { assert(iaidx >= 0 && iaidx < areasNum); InterArea *pia = &ia[iaidx]; @@ -1799,21 +1798,15 @@ void ScummEngine_v72he::drawWizPolygon(int resnum, int state, int id, int flags) ymax_b = wizH - 1; PolygonDrawData pdd(ymax_p - ymin_p + 1); - pdd.pts[0].x = xmin_p; - pdd.pts[0].y = ymin_p; - pdd.pts[1].x = xmax_p; - pdd.pts[1].y = ymax_p; - pdd.pts[2].x = xmin_b; - pdd.pts[2].y = ymin_b; - pdd.pts[3].x = xmax_b; - pdd.pts[3].y = ymax_b; + pdd.pto.x = xmin_p; + pdd.pto.y = ymin_p; for (i = 0; i < 3; ++i) { pdd.calcIntersection(&wp->vert[i], &wp->vert[i + 1], &bbox[i], &bbox[i + 1]); } pdd.calcIntersection(&wp->vert[3], &wp->vert[0], &bbox[3], &bbox[0]); - - uint yoff = pdd.pts[0].y * pvs->w; + + uint yoff = pdd.pto.y * pvs->w; for (i = 0; i < pdd.areasNum; ++i) { PolygonDrawData::InterArea *pia = &pdd.ia[i]; uint16 dx = pia->xmax - pia->xmin + 1; @@ -1829,7 +1822,7 @@ void ScummEngine_v72he::drawWizPolygon(int resnum, int state, int id, int flags) y_acc += y_step; *dstPtr++ = srcWizBuf[srcWizOff]; } - yoff += pvs->w; + yoff += pvs->pitch; } if (flags & 0x10) { diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index aecb0ef784..566f55ba60 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -942,41 +942,41 @@ void ScummEngine_v70he::o70_polygonOps() { void ScummEngine::polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, int vert2y, int vert3x, int vert3y, int vert4x, int vert4y) { - int i; - - for (i = 0; i < _wizNumPolygons; i++) - if (_wizPolygons[i].id == 0) + WizPolygon *wp = NULL; + for (int i = 0; i < _wizNumPolygons; ++i) { + if (_wizPolygons[i].id == 0) { + wp = &_wizPolygons[i]; break; - - if (i == _wizNumPolygons) { + } + } + if (!wp) { error("ScummEngine::polygonStore: out of polygon slot, max = %d", _wizNumPolygons); } - _wizPolygons[i].vert[0].x = vert1x; - _wizPolygons[i].vert[0].y = vert1y; - _wizPolygons[i].vert[1].x = vert2x; - _wizPolygons[i].vert[1].y = vert2y; - _wizPolygons[i].vert[2].x = vert3x; - _wizPolygons[i].vert[2].y = vert3y; - _wizPolygons[i].vert[3].x = vert4x; - _wizPolygons[i].vert[3].y = vert4y; - _wizPolygons[i].vert[4].x = vert1x; - _wizPolygons[i].vert[4].y = vert1y; - _wizPolygons[i].id = id; - _wizPolygons[i].numVerts = 5; - _wizPolygons[i].flag = flag; - - _wizPolygons[i].bound.left = 10000; - _wizPolygons[i].bound.top = 10000; - _wizPolygons[i].bound.right = -10000; - _wizPolygons[i].bound.bottom = -10000; - + wp->vert[0].x = vert1x; + wp->vert[0].y = vert1y; + wp->vert[1].x = vert2x; + wp->vert[1].y = vert2y; + wp->vert[2].x = vert3x; + wp->vert[2].y = vert3y; + wp->vert[3].x = vert4x; + wp->vert[3].y = vert4y; + wp->vert[4].x = vert1x; + wp->vert[4].y = vert1y; + wp->id = id; + wp->numVerts = 5; + wp->flag = flag; + + wp->bound.left = 10000; + wp->bound.top = 10000; + wp->bound.right = -10000; + wp->bound.bottom = -10000; + + // compute bounding box for (int j = 0; j < 5; j++) { - _wizPolygons[i].bound.left = MIN(_wizPolygons[i].bound.left, _wizPolygons[i].vert[j].x); - _wizPolygons[i].bound.top = MIN(_wizPolygons[i].bound.top, _wizPolygons[i].vert[j].y); - _wizPolygons[i].bound.right = MAX(_wizPolygons[i].bound.right, _wizPolygons[i].vert[j].x); - _wizPolygons[i].bound.bottom = MAX(_wizPolygons[i].bound.bottom, _wizPolygons[i].vert[j].y); + Common::Rect r(wp->vert[j].x, wp->vert[j].y, wp->vert[j].x + 1, wp->vert[j].y + 1); + wp->bound.extend(r); } } |