- int rnd, i, x, y, ix, iy, dx, dy, dir, w, h, size, inc;
- static int last = -1;
-
- if (last == -1) last = random () % 2;
-
-/* alternate between horizontal and vertical slides */
-/* note that dir specifies the direction the _hole_ moves, not the tiles */
- if (last == VERTICAL) {
- if ((rnd = random () % (grid_w - 1)) < hole_x) {
- dx = -1; dir = LEFT; hole_x -= rnd;
- } else {
- dx = 1; dir = RIGHT; rnd -= hole_x;
- }
- dy = 0; w = size = rnd + 1; h = 1;
- last = HORIZONTAL;
- } else {
- if ((rnd = random () % (grid_h - 1)) < hole_y) {
- dy = -1; dir = UP; hole_y -= rnd;
- } else {
- dy = 1; dir = DOWN; rnd -= hole_y;
- }
- dx = 0; h = size = rnd + 1; w = 1;
- last = VERTICAL;
- }
+
+ if (st->img_loader) /* still loading */
+ {
+ st->img_loader = load_image_async_simple (st->img_loader, 0, 0, 0, 0, 0);
+ if (! st->img_loader) /* just finished */
+ draw_grid (st);
+ return st->delay;
+ }
+
+ if (! st->draw_initted)
+ {
+ if (!slidescreen_draw_early (st))
+ {
+ st->draw_initted = 1;
+ return st->delay2;
+ }
+ else
+ return st->delay;
+ }
+
+ if (st->draw_i == 0)
+ {
+ if (st->draw_last == -1) st->draw_last = random () % 2;
+
+ /* alternate between horizontal and vertical slides */
+ /* note that draw_dir specifies the direction the _hole_ moves, not the tiles */
+ if (st->draw_last == VERTICAL) {
+ if (((st->grid_w > 1) ? st->draw_rnd = random () % (st->grid_w - 1) : 0)
+ < st->hole_x) {
+ st->draw_dx = -1; st->draw_dir = LEFT; st->hole_x -= st->draw_rnd;
+ } else {
+ st->draw_dx = 1; st->draw_dir = RIGHT; st->draw_rnd -= st->hole_x;
+ }
+ st->draw_dy = 0; st->draw_w = st->draw_size = st->draw_rnd + 1; st->draw_h = 1;
+ st->draw_last = HORIZONTAL;
+ } else {
+ if (((st->grid_h > 1) ? st->draw_rnd = random () % (st->grid_h - 1) : 0)
+ < st->hole_y) {
+ st->draw_dy = -1; st->draw_dir = UP; st->hole_y -= st->draw_rnd;
+ } else {
+ st->draw_dy = 1; st->draw_dir = DOWN; st->draw_rnd -= st->hole_y;
+ }
+ st->draw_dx = 0; st->draw_h = st->draw_size = st->draw_rnd + 1; st->draw_w = 1;
+ st->draw_last = VERTICAL;
+ }