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 */
26 if (lev.time_initial == 0)
35 if (lev.android_move_cnt-- == 0)
36 lev.android_move_cnt = lev.android_move_time;
37 if (lev.android_clone_cnt-- == 0)
38 lev.android_clone_cnt = lev.android_clone_time;
40 if (lev.ball_cnt-- == 0)
41 lev.ball_cnt = lev.ball_time;
50 if (lev.wonderwall_time && lev.wonderwall_state)
51 lev.wonderwall_time--;
53 if (lev.time_initial > 0 &&
54 lev.time > 0 && lev.time <= 50 && lev.time % 5 == 0)
55 play_sound(-1, -1, SAMPLE_time);
58 play_sound(-1, -1, SAMPLE_wheel);
64 for (count = lev.amoeba_time; count--;)
66 x = (random >> 10) % (WIDTH - 2);
67 y = (random >> 20) % (HEIGHT - 2);
78 if (tab_amoeba[Cave[y-1][x]] ||
79 tab_amoeba[Cave[y][x+1]] ||
80 tab_amoeba[Cave[y+1][x]] ||
81 tab_amoeba[Cave[y][x-1]])
82 Cave[y][x] = Xdrip_eat;
85 random = random * 129 + 1;
90 /* handle explosions */
92 for (y = 1; y < HEIGHT - 1; y++)
93 for (x = 1; x < WIDTH - 1; x++)
99 Cave[y-1][x] = tab_explode_normal[Cave[y-1][x]];
100 Cave[y][x-1] = tab_explode_normal[Cave[y][x-1]];
101 Cave[y][x+1] = tab_explode_normal[Cave[y][x+1]];
102 Cave[y+1][x] = tab_explode_normal[Cave[y+1][x]];
103 Cave[y-1][x-1] = tab_explode_normal[Cave[y-1][x-1]];
104 Cave[y-1][x+1] = tab_explode_normal[Cave[y-1][x+1]];
105 Cave[y+1][x-1] = tab_explode_normal[Cave[y+1][x-1]];
106 Cave[y+1][x+1] = tab_explode_normal[Cave[y+1][x+1]];
110 Cave[y][x] = Xboom_1;
111 Cave[y-1][x] = tab_explode_dynamite[Cave[y-1][x]];
112 Cave[y][x-1] = tab_explode_dynamite[Cave[y][x-1]];
113 Cave[y][x+1] = tab_explode_dynamite[Cave[y][x+1]];
114 Cave[y+1][x] = tab_explode_dynamite[Cave[y+1][x]];
115 Cave[y-1][x-1] = tab_explode_dynamite[Cave[y-1][x-1]];
116 Cave[y-1][x+1] = tab_explode_dynamite[Cave[y-1][x+1]];
117 Cave[y+1][x-1] = tab_explode_dynamite[Cave[y+1][x-1]];
118 Cave[y+1][x+1] = tab_explode_dynamite[Cave[y+1][x+1]];
123 /* triple buffering */
125 for (y = 0; y < HEIGHT; y++)
126 for (x = 0; x < WIDTH; x++)
127 Next[y][x] = Cave[y][x];