|
|
|
|
@ -5811,11 +5811,12 @@ BOOL LineClear(int x1, int y1, int x2, int y2)
|
|
|
|
|
|
|
|
|
|
BOOL LineClearF1(BOOL (*Clear)(int, int, int), int monst, int x1, int y1, int x2, int y2) |
|
|
|
|
{ |
|
|
|
|
int xorg, yorg; |
|
|
|
|
int dx, dy; |
|
|
|
|
int d; |
|
|
|
|
int xorg, yorg; |
|
|
|
|
int xincD, yincD, dincD, dincH; |
|
|
|
|
int tmp; |
|
|
|
|
BOOL done = FALSE; |
|
|
|
|
|
|
|
|
|
xorg = x1; |
|
|
|
|
yorg = y1; |
|
|
|
|
@ -5834,16 +5835,16 @@ BOOL LineClearF1(BOOL (*Clear)(int, int, int), int monst, int x1, int y1, int x2
|
|
|
|
|
} |
|
|
|
|
if (dy > 0) { |
|
|
|
|
d = 2 * dy - dx; |
|
|
|
|
dincH = 2 * (dy - dx); |
|
|
|
|
dincD = 2 * dy; |
|
|
|
|
dincH = 2 * (dy - dx); |
|
|
|
|
yincD = 1; |
|
|
|
|
} else { |
|
|
|
|
d = 2 * dy + dx; |
|
|
|
|
dincH = 2 * (dx + dy); |
|
|
|
|
dincD = 2 * dy; |
|
|
|
|
dincH = 2 * (dx + dy); |
|
|
|
|
yincD = -1; |
|
|
|
|
} |
|
|
|
|
while (x1 != x2 || y1 != y2) { |
|
|
|
|
while (!done && (x1 != x2 || y1 != y2)) { |
|
|
|
|
if ((d <= 0) ^ (yincD < 0)) { |
|
|
|
|
d += dincD; |
|
|
|
|
} else { |
|
|
|
|
@ -5851,8 +5852,7 @@ BOOL LineClearF1(BOOL (*Clear)(int, int, int), int monst, int x1, int y1, int x2
|
|
|
|
|
y1 += yincD; |
|
|
|
|
} |
|
|
|
|
x1++; |
|
|
|
|
if ((x1 != xorg || y1 != yorg) && !Clear(monst, x1, y1)) |
|
|
|
|
break; |
|
|
|
|
done = ((x1 != xorg || y1 != yorg) && !Clear(monst, x1, y1)); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (dy < 0) { |
|
|
|
|
@ -5867,16 +5867,16 @@ BOOL LineClearF1(BOOL (*Clear)(int, int, int), int monst, int x1, int y1, int x2
|
|
|
|
|
} |
|
|
|
|
if (dx > 0) { |
|
|
|
|
d = 2 * dx - dy; |
|
|
|
|
dincH = 2 * (dx - dy); |
|
|
|
|
dincD = 2 * dx; |
|
|
|
|
dincH = 2 * (dx - dy); |
|
|
|
|
xincD = 1; |
|
|
|
|
} else { |
|
|
|
|
d = 2 * dx + dy; |
|
|
|
|
dincH = 2 * (dy + dx); |
|
|
|
|
dincD = 2 * dx; |
|
|
|
|
dincH = 2 * (dy + dx); |
|
|
|
|
xincD = -1; |
|
|
|
|
} |
|
|
|
|
while (y1 != y2 || x1 != x2) { |
|
|
|
|
while (!done && (y1 != y2 || x1 != x2)) { |
|
|
|
|
if ((d <= 0) ^ (xincD < 0)) { |
|
|
|
|
d += dincD; |
|
|
|
|
} else { |
|
|
|
|
@ -5884,8 +5884,7 @@ BOOL LineClearF1(BOOL (*Clear)(int, int, int), int monst, int x1, int y1, int x2
|
|
|
|
|
x1 += xincD; |
|
|
|
|
} |
|
|
|
|
y1++; |
|
|
|
|
if ((y1 != yorg || x1 != xorg) && !Clear(monst, x1, y1)) |
|
|
|
|
break; |
|
|
|
|
done = ((y1 != yorg || x1 != xorg) && !Clear(monst, x1, y1)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return x1 == x2 && y1 == y2; |
|
|
|
|
|