- if (sweep) {
- int speed = random () % 100 + 100;
- switch (random () % 4) {
- case 0:
- za->w = width;
- za->h = 10;
- za->x = 0;
- za->y = 0;
- za->dx = 0;
- za->dy = speed;
- za->n = (height - 10) * 256 / speed;
- break;
- case 1:
- za->w = 10;
- za->h = height;
- za->x = width - 10;
- za->y = 0;
- za->dx = -speed;
- za->dy = 0;
- za->n = (width - 10) * 256 / speed;
- break;
- case 2:
- za->w = width;
- za->h = 10;
- za->x = 0;
- za->y = height - 10;
- za->dx = 0;
- za->dy = -speed;
- za->n = (height - 10) * 256 / speed;
- break;
- case 3:
- za->w = 10;
- za->h = height;
- za->x = 0;
- za->y = 0;
- za->dx = speed;
- za->dy = 0;
- za->n = (width - 10) * 256 / speed;
- break;
- }
- za->ww = width - za->w;
- za->hh = height - za->h;
-
- /* We want smaller angle increments in sweep mode (looks better) */
-
- za->a1 = 0;
- za->a2 = 0;
- za->inc1 = ((2 * (random() & 1)) - 1) * (1 + random () % 7);
- za->inc2 = ((2 * (random() & 1)) - 1) * (1 + random () % 7);
- } else {
- za->w = 50 + random() % 300;
- za->h = 50 + random() % 300;
-
- if (za->w > width / 3)
- za->w = width / 3;
- if (za->h > height / 3)
- za->h = height / 3;
-
- za->ww = width - za->w;
- za->hh = height - za->h;
-
- za->x = (random() % za->ww);
- za->y = (random() % za->hh);
-
- za->dx = ((2 * (random() & 1)) - 1) * (100 + random() % 300);
- za->dy = ((2 * (random() & 1)) - 1) * (100 + random() % 300);
-
- if (anim) {
- za->n = 50 + random() % 1000;
- za->a1 = 0;
- za->a2 = 0;
- } else {
- za->n = 5 + random() % 10;
- za->a1 = random ();
- za->a2 = random ();
- }
-
- za->inc1 = ((2 * (random() & 1)) - 1) * (random () % 30);
- za->inc2 = ((2 * (random() & 1)) - 1) * (random () % 30);
- }
-
- za->xx = za->x * 256;
- za->yy = za->y * 256;
-
- za->count = 0;
+ if (st->sweep) {
+ int speed = random () % 100 + 100;
+ switch (random () % 4) {
+ case 0:
+ za->w = st->width;
+ za->h = 10;
+ za->x = 0;
+ za->y = 0;
+ za->dx = 0;
+ za->dy = speed;
+ za->n = (st->height - 10) * 256 / speed;
+ break;
+ case 1:
+ za->w = 10;
+ za->h = st->height;
+ za->x = st->width - 10;
+ za->y = 0;
+ za->dx = -speed;
+ za->dy = 0;
+ za->n = (st->width - 10) * 256 / speed;
+ break;
+ case 2:
+ za->w = st->width;
+ za->h = 10;
+ za->x = 0;
+ za->y = st->height - 10;
+ za->dx = 0;
+ za->dy = -speed;
+ za->n = (st->height - 10) * 256 / speed;
+ break;
+ case 3:
+ za->w = 10;
+ za->h = st->height;
+ za->x = 0;
+ za->y = 0;
+ za->dx = speed;
+ za->dy = 0;
+ za->n = (st->width - 10) * 256 / speed;
+ break;
+ }
+ za->ww = st->width - za->w;
+ za->hh = st->height - za->h;
+
+ /* We want smaller angle increments in sweep mode (looks better) */
+
+ za->a1 = 0;
+ za->a2 = 0;
+ za->inc1 = ((2 * (random() & 1)) - 1) * (1 + random () % 7);
+ za->inc2 = ((2 * (random() & 1)) - 1) * (1 + random () % 7);
+ } else if (st->circle) {
+
+ za->w = 50 + random() % 300;
+ if (za->w > st->width / 3)
+ za->w = st->width / 3;
+ if (za->w > st->height / 3)
+ za->w = st->height / 3;
+ za->h = za->w;
+
+ za->ww = st->width - za->w;
+ za->hh = st->height - za->h;
+
+ za->x = (za->ww ? random() % za->ww : 0);
+ za->y = (za->hh ? random() % za->hh : 0);
+ za->dx = 0;
+ za->dy = 0;
+ za->a1 = 0;
+ za->a2 = 0;
+ za->count = 0;
+
+ /* #### If we go clockwise, it doesn't start rotating from 0.
+ So only go counter-clockwise for now. Sigh. */
+ za->inc1 = (random () % 30);
+ za->inc2 = 0;
+ za->n = 50 + random() % 100;
+
+ if (!st->anim) {
+ za->count = random() % (za->n / 2);
+ za->a1 = random();
+ }
+
+ } else {
+ za->w = 50 + random() % 300;
+ za->h = 50 + random() % 300;
+
+ if (za->w > st->width / 3)
+ za->w = st->width / 3;
+ if (za->h > st->height / 3)
+ za->h = st->height / 3;
+
+ za->ww = st->width - za->w;
+ za->hh = st->height - za->h;
+
+ za->x = (za->ww ? random() % za->ww : 0);
+ za->y = (za->hh ? random() % za->hh : 0);
+
+ za->dx = ((2 * (random() & 1)) - 1) * (100 + random() % 300);
+ za->dy = ((2 * (random() & 1)) - 1) * (100 + random() % 300);
+
+ if (st->anim) {
+ za->n = 50 + random() % 1000;
+ za->a1 = 0;
+ za->a2 = 0;
+ } else {
+ za->n = 5 + random() % 10;
+ za->a1 = random ();
+ za->a2 = random ();
+ }
+
+ za->inc1 = ((2 * (random() & 1)) - 1) * (random () % 30);
+ za->inc2 = ((2 * (random() & 1)) - 1) * (random () % 30);
+ }
+
+ za->xx = za->x * 256;
+ za->yy = za->y * 256;
+
+ za->count = 0;