diff options
-rw-r--r-- | scumm/script_v7he.cpp | 7 | ||||
-rw-r--r-- | scumm/wiz_he.cpp | 9 |
2 files changed, 10 insertions, 6 deletions
diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index 8b635f0d45..d1e1cf4196 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -1038,8 +1038,8 @@ void ScummEngine_v70he::o70_setWindowCaption() { void ScummEngine_v70he::o70_polygonOps() { int vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y; - int id; - int fromId, toId; + int id, fromId, toId; + bool flag; byte subOp = fetchScriptByte(); @@ -1056,8 +1056,9 @@ void ScummEngine_v70he::o70_polygonOps() { vert2x = pop(); vert1y = pop(); vert1x = pop(); + flag = (subOp == 69 || subOp == 248); id = pop(); - _wiz.polygonStore(id, (subOp == 69 || subOp == 248), vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y); + _wiz.polygonStore(id, flag, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y); break; case 28: // HE 100 case 247: diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp index 13e7835b88..5e6b8a3403 100644 --- a/scumm/wiz_he.cpp +++ b/scumm/wiz_he.cpp @@ -41,7 +41,10 @@ void Wiz::imageNumClear() { } void Wiz::polygonClear() { - memset(&_polygons, 0, sizeof(_polygons)); + for (int i = 0; i < ARRAYSIZE(_polygons); i++) { + if (_polygons[i].flag == 1) + memset(&_polygons[i], 0, sizeof(WizPolygon)); + } } void Wiz::polygonLoad(const uint8 *polData) { @@ -157,10 +160,10 @@ bool Wiz::polygonContains(const WizPolygon &pol, int x, int y) { bool r = false; for (int i = 0; i < pol.numVerts; i++) { - curdir = (y <= pol.vert[i].y); + curdir = (y < pol.vert[i].y); if (curdir != diry) { - if (((pol.vert[pi].y - pol.vert[i].y) * (pol.vert[i].x - x) <= + if (((pol.vert[pi].y - pol.vert[i].y) * (pol.vert[i].x - x) < (pol.vert[pi].x - pol.vert[i].x) * (pol.vert[i].y - y)) == diry) r = !r; } |