aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he/wiz_he.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2007-11-25 10:27:50 +0000
committerEugene Sandulenko2007-11-25 10:27:50 +0000
commit8d228219c9121b0152fbf1f1fcab6a477574e9a2 (patch)
tree3aa964834553e77a9355662426e7f06c05a37cc8 /engines/scumm/he/wiz_he.cpp
parent1266b7eb15ca9d095da8eef310726c3bf10899ad (diff)
downloadscummvm-rg350-8d228219c9121b0152fbf1f1fcab6a477574e9a2.tar.gz
scummvm-rg350-8d228219c9121b0152fbf1f1fcab6a477574e9a2.tar.bz2
scummvm-rg350-8d228219c9121b0152fbf1f1fcab6a477574e9a2.zip
Switch to our common drawLine routine
svn-id: r29635
Diffstat (limited to 'engines/scumm/he/wiz_he.cpp')
-rw-r--r--engines/scumm/he/wiz_he.cpp73
1 files changed, 20 insertions, 53 deletions
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index e4e93232dc..164cfef7f8 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -27,6 +27,7 @@
#include "common/system.h"
#include "graphics/cursorman.h"
+#include "graphics/primitives.h"
#include "scumm/he/intern_he.h"
#include "scumm/resource.h"
#include "scumm/scumm.h"
@@ -1742,6 +1743,20 @@ void Wiz::fillWizRect(const WizParameters *params) {
_vm->_res->setModified(rtImage, params->img.resNum);
}
+struct drawProcP {
+ Common::Rect *imageRect;
+ uint8 *wizd;
+ int width;
+};
+
+static void drawProc(int x, int y, int c, void *data) {
+ drawProcP *param = (drawProcP *)data;
+
+ if (param->imageRect->contains(x, y)) {
+ *(param->wizd + y * param->width + x) = c;
+ }
+}
+
void Wiz::fillWizLine(const WizParameters *params) {
if (params->processFlags & kWPFClipBox2) {
int state = 0;
@@ -1777,61 +1792,13 @@ void Wiz::fillWizLine(const WizParameters *params) {
if (params->processFlags & kWPFThickLine) {
debug(0, "Unsupported ThickLine (%d, %d)", params->lineUnk1, params->lineUnk2);
} else {
- int dx = x2 - x1;
- int incx = 0;
- if (dx > 0) {
- incx = 1;
- } else if (dx < 0) {
- incx = -1;
- }
- int dy = y2 - y1;
- int incy = 0;
- if (dy > 0) {
- incy = 1;
- } else if (dy < 0) {
- incy = -1;
- }
-
- dx = ABS(x2 - x1);
- dy = ABS(y2 - y1);
+ drawProcP lineP;
- if (imageRect.contains(x1, y1)) {
- *(wizd + y1 * w + x1) = color;
- }
+ lineP.imageRect = &imageRect;
+ lineP.wizd = wizd;
+ lineP.width = w;
- if (dx >= dy) {
- int step1_y = (dy - dx) * 2;
- int step2_y = dy * 2;
- int accum_y = dy * 2 - dx;
- while (x1 != x2) {
- if (accum_y <= 0) {
- accum_y += step2_y;
- } else {
- accum_y += step1_y;
- y1 += incy;
- }
- x1 += incx;
- if (imageRect.contains(x1, y1)) {
- *(wizd + y1 * w + x1) = color;
- }
- }
- } else {
- int step1_x = (dx - dy) * 2;
- int step2_x = dx * 2;
- int accum_x = dx * 2 - dy;
- while (y1 != y2) {
- if (accum_x <= 0) {
- accum_x += step2_x;
- } else {
- accum_x += step1_x;
- x1 += incx;
- }
- y1 += incy;
- if (imageRect.contains(x1, y1)) {
- *(wizd + y1 * w + x1) = color;
- }
- }
- }
+ Graphics::drawLine(x1, y1, x2, y2, color, drawProc, &lineP);
}
}
}