1 /* third part of synchro.
3 * handle global elements.
5 * this should be spread over the frames for reduced cpu load.
15 register unsigned int x;
16 register unsigned int y;
17 register unsigned int count;
18 register unsigned long random;
20 /* update variables */
27 if (lev.time_initial == 0)
29 else if (lev.time > 0)
37 if (lev.android_move_cnt-- == 0)
38 lev.android_move_cnt = lev.android_move_time;
39 if (lev.android_clone_cnt-- == 0)
40 lev.android_clone_cnt = lev.android_clone_time;
42 if (lev.ball_cnt-- == 0)
43 lev.ball_cnt = lev.ball_time;
52 if (lev.wonderwall_time && lev.wonderwall_state)
53 lev.wonderwall_time--;
56 if (lev.time_initial > 0 &&
57 lev.time > 0 && lev.time <= 50 && lev.time % 5 == 0 && setup.time_limit)
58 play_sound(-1, -1, SAMPLE_time);
62 play_element_sound(lev.wheel_x, lev.wheel_y, SAMPLE_wheel, Xwheel);
68 for (count = lev.amoeba_time; count--;)
70 x = (random >> 10) % (WIDTH - 2);
71 y = (random >> 20) % (HEIGHT - 2);
82 if (tab_amoeba[Cave[y-1][x]] ||
83 tab_amoeba[Cave[y][x+1]] ||
84 tab_amoeba[Cave[y+1][x]] ||
85 tab_amoeba[Cave[y][x-1]])
86 Cave[y][x] = Xdrip_eat;
89 random = random * 129 + 1;
94 /* handle explosions */
96 for (y = 1; y < HEIGHT - 1; y++)
97 for (x = 1; x < WIDTH - 1; x++)
102 Cave[y][x] = Xboom_1;
103 Cave[y-1][x] = tab_explode_normal[Cave[y-1][x]];
104 Cave[y][x-1] = tab_explode_normal[Cave[y][x-1]];
105 Cave[y][x+1] = tab_explode_normal[Cave[y][x+1]];
106 Cave[y+1][x] = tab_explode_normal[Cave[y+1][x]];
107 Cave[y-1][x-1] = tab_explode_normal[Cave[y-1][x-1]];
108 Cave[y-1][x+1] = tab_explode_normal[Cave[y-1][x+1]];
109 Cave[y+1][x-1] = tab_explode_normal[Cave[y+1][x-1]];
110 Cave[y+1][x+1] = tab_explode_normal[Cave[y+1][x+1]];
114 Cave[y][x] = Xboom_1;
115 Cave[y-1][x] = tab_explode_dynamite[Cave[y-1][x]];
116 Cave[y][x-1] = tab_explode_dynamite[Cave[y][x-1]];
117 Cave[y][x+1] = tab_explode_dynamite[Cave[y][x+1]];
118 Cave[y+1][x] = tab_explode_dynamite[Cave[y+1][x]];
119 Cave[y-1][x-1] = tab_explode_dynamite[Cave[y-1][x-1]];
120 Cave[y-1][x+1] = tab_explode_dynamite[Cave[y-1][x+1]];
121 Cave[y+1][x-1] = tab_explode_dynamite[Cave[y+1][x-1]];
122 Cave[y+1][x+1] = tab_explode_dynamite[Cave[y+1][x+1]];
127 /* triple buffering */
129 for (y = 0; y < HEIGHT; y++)
130 for (x = 0; x < WIDTH; x++)
131 Next[y][x] = Cave[y][x];