aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2014-06-06 07:24:45 +0200
committerStrangerke2014-06-06 07:24:45 +0200
commit09e3ddf5b966ad8050ba1cc3268e7f382332b2dc (patch)
treefdb55f6aa414f28f65cc5a3cffe7108fcb185f07
parentec17a7ece693a3e5d301d16c34b1833c4ba26cf7 (diff)
downloadscummvm-rg350-09e3ddf5b966ad8050ba1cc3268e7f382332b2dc.tar.gz
scummvm-rg350-09e3ddf5b966ad8050ba1cc3268e7f382332b2dc.tar.bz2
scummvm-rg350-09e3ddf5b966ad8050ba1cc3268e7f382332b2dc.zip
CRUISE: Reduce the scope of variables in fillpoly()
-rw-r--r--engines/cruise/polys.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/engines/cruise/polys.cpp b/engines/cruise/polys.cpp
index 415f0520a6..f6d0691c69 100644
--- a/engines/cruise/polys.cpp
+++ b/engines/cruise/polys.cpp
@@ -211,20 +211,15 @@ void fillpoly(int16 *point_data, int lineCount, ColorP color) {
}
// Reinit array counters
-
- int x1, y1, x2, y2;
- int y, i;
-
- for (i = 0; i < SCREENHEIGHT; i++) {
+ for (int i = 0; i < SCREENHEIGHT; i++) {
num_intersect[i] = 0;
}
// Find the top/bottom of the polygon.
-
int top = point_data[1];
int bottom = point_data[1];
- for (i = 1; i < lineCount; i++) {
+ for (int i = 1; i < lineCount; i++) {
if (point_data[2 * i + 1] < top)
top = point_data[2 * i + 1];
else if (point_data[2 * i + 1] > bottom)
@@ -237,14 +232,13 @@ void fillpoly(int16 *point_data, int lineCount, ColorP color) {
bottom = SCREENHEIGHT - 1;
// Calculate intersections for each scan line
+ for (int y = top; y <= bottom; y++) {
+ int x2 = point_data[2 * lineCount - 2];
+ int y2 = point_data[2 * lineCount - 1];
- for (y = top; y <= bottom; y++) {
- x2 = point_data[2 * lineCount - 2];
- y2 = point_data[2 * lineCount - 1];
-
- for (i = 0; i < lineCount; i++) {
- x1 = x2;
- y1 = y2;
+ for (int i = 0; i < lineCount; i++) {
+ int x1 = x2;
+ int y1 = y2;
x2 = point_data[2 * i];
y2 = point_data[2 * i + 1];
@@ -264,9 +258,8 @@ void fillpoly(int16 *point_data, int lineCount, ColorP color) {
}
// Drawing.
-
- for (y = top; y <= bottom; y++) {
- for (i = 0; i < num_intersect[y]; i += 2) {
+ for (int y = top; y <= bottom; y++) {
+ for (int i = 0; i < num_intersect[y]; i += 2) {
hline(intersect[y][i], intersect[y][i + 1], y, color);
}
}