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.android_move_cnt-- == 0)
28 lev.android_move_cnt = lev.android_move_time;
29 if (lev.android_clone_cnt-- == 0)
30 lev.android_clone_cnt = lev.android_clone_time;
32 if (lev.ball_cnt-- == 0)
33 lev.ball_cnt = lev.ball_time;
42 if (lev.wonderwall_time && lev.wonderwall_state)
43 lev.wonderwall_time--;
45 if (lev.time > 0 && lev.time <= 50 && lev.time % 5 == 0)
46 play_sound(-1, -1, SAMPLE_time);
49 play_sound(-1, -1, SAMPLE_wheel);
55 for (count = lev.amoeba_time; count--;)
57 x = (random >> 10) % (WIDTH - 2);
58 y = (random >> 20) % (HEIGHT - 2);
69 if (tab_amoeba[Cave[y-1][x]] ||
70 tab_amoeba[Cave[y][x+1]] ||
71 tab_amoeba[Cave[y+1][x]] ||
72 tab_amoeba[Cave[y][x-1]])
73 Cave[y][x] = Xdrip_eat;
76 random = random * 129 + 1;
81 /* handle explosions */
83 for (y = 1; y < HEIGHT - 1; y++)
84 for (x = 1; x < WIDTH - 1; x++)
90 Cave[y-1][x] = tab_explode_normal[Cave[y-1][x]];
91 Cave[y][x-1] = tab_explode_normal[Cave[y][x-1]];
92 Cave[y][x+1] = tab_explode_normal[Cave[y][x+1]];
93 Cave[y+1][x] = tab_explode_normal[Cave[y+1][x]];
94 Cave[y-1][x-1] = tab_explode_normal[Cave[y-1][x-1]];
95 Cave[y-1][x+1] = tab_explode_normal[Cave[y-1][x+1]];
96 Cave[y+1][x-1] = tab_explode_normal[Cave[y+1][x-1]];
97 Cave[y+1][x+1] = tab_explode_normal[Cave[y+1][x+1]];
101 Cave[y][x] = Xboom_1;
102 Cave[y-1][x] = tab_explode_dynamite[Cave[y-1][x]];
103 Cave[y][x-1] = tab_explode_dynamite[Cave[y][x-1]];
104 Cave[y][x+1] = tab_explode_dynamite[Cave[y][x+1]];
105 Cave[y+1][x] = tab_explode_dynamite[Cave[y+1][x]];
106 Cave[y-1][x-1] = tab_explode_dynamite[Cave[y-1][x-1]];
107 Cave[y-1][x+1] = tab_explode_dynamite[Cave[y-1][x+1]];
108 Cave[y+1][x-1] = tab_explode_dynamite[Cave[y+1][x-1]];
109 Cave[y+1][x+1] = tab_explode_dynamite[Cave[y+1][x+1]];
114 /* triple buffering */
116 for (y = 0; y < HEIGHT; y++)
117 for (x = 0; x < WIDTH; x++)
118 Next[y][x] = Cave[y][x];