1 /* third part of synchro.
3 * handle global elements.
5 * this should be spread over the frames for reduced cpu load.
18 /* update variables */
23 if (lev.android_move_cnt-- == 0)
24 lev.android_move_cnt = lev.android_move_time;
25 if (lev.android_clone_cnt-- == 0)
26 lev.android_clone_cnt = lev.android_clone_time;
28 if (lev.ball_cnt-- == 0)
29 lev.ball_cnt = lev.ball_time;
38 if (lev.wonderwall_time && lev.wonderwall_state)
39 lev.wonderwall_time--;
42 play_element_sound(lev.wheel_x, lev.wheel_y, SAMPLE_wheel, Xwheel);
48 for (count = lev.amoeba_time; count--;)
50 x = (random >> 10) % (WIDTH - 2);
51 y = (random >> 20) % (HEIGHT - 2);
62 if (tab_amoeba[Cave[y-1][x]] ||
63 tab_amoeba[Cave[y][x+1]] ||
64 tab_amoeba[Cave[y+1][x]] ||
65 tab_amoeba[Cave[y][x-1]])
66 Cave[y][x] = Xdrip_eat;
69 random = random * 129 + 1;
74 /* handle explosions */
76 for (y = 1; y < HEIGHT - 1; y++)
77 for (x = 1; x < WIDTH - 1; x++)
83 Cave[y-1][x] = tab_explode_normal[Cave[y-1][x]];
84 Cave[y][x-1] = tab_explode_normal[Cave[y][x-1]];
85 Cave[y][x+1] = tab_explode_normal[Cave[y][x+1]];
86 Cave[y+1][x] = tab_explode_normal[Cave[y+1][x]];
87 Cave[y-1][x-1] = tab_explode_normal[Cave[y-1][x-1]];
88 Cave[y-1][x+1] = tab_explode_normal[Cave[y-1][x+1]];
89 Cave[y+1][x-1] = tab_explode_normal[Cave[y+1][x-1]];
90 Cave[y+1][x+1] = tab_explode_normal[Cave[y+1][x+1]];
95 Cave[y-1][x] = tab_explode_dynamite[Cave[y-1][x]];
96 Cave[y][x-1] = tab_explode_dynamite[Cave[y][x-1]];
97 Cave[y][x+1] = tab_explode_dynamite[Cave[y][x+1]];
98 Cave[y+1][x] = tab_explode_dynamite[Cave[y+1][x]];
99 Cave[y-1][x-1] = tab_explode_dynamite[Cave[y-1][x-1]];
100 Cave[y-1][x+1] = tab_explode_dynamite[Cave[y-1][x+1]];
101 Cave[y+1][x-1] = tab_explode_dynamite[Cave[y+1][x-1]];
102 Cave[y+1][x+1] = tab_explode_dynamite[Cave[y+1][x+1]];
107 /* triple buffering */
109 for (y = 0; y < HEIGHT; y++)
110 for (x = 0; x < WIDTH; x++)
111 Next[y][x] = Cave[y][x];