-SDL_Rect *
-GetNextPoint (void)
-{
- static SDL_Rect rect = {0, 0, WIDTH, HEIGHT};
- static int cur = -1;
- static int inc, err, thre, swap;
- static int x1, y1, x2, y2;
- static int x, y;
- int next;
- next = (cur + 1) % psize;
- if (IS_CENTER (points[next].x, points[next].y, rect.x, rect.y) || cur == -1)
- {
- cur = next;
- next = (cur + 1) % psize;
- err = 0;
- swap = 0;
- x1 = points[cur].x;
- y1 = points[cur].y;
- x2 = points[next].x;
- y2 = points[next].y;
- inc = y2 - y1;
- thre = x2 - x1;
- if (ABS (inc) > ABS (thre))
- {
- SWAP (inc, thre);
- SWAP (x1, y1);
- SWAP (x2, y2);
- swap = 1;
- }
- x = x1;
- y = y1;
- }
- rect.x = (swap ? y : x) - WIDTH/2;
- rect.y = (swap ? x : y) - HEIGHT/2;
- (x2 < x1) ? x-- : x++;
- err += ABS (inc);
- if (err >= ABS (thre))
- {
- err -= ABS (thre);
- y += (inc < 0) ? -1 : 1;
- }
- return ▭
-}
-