1 /* third part of synchro.
3 * handle global elements.
5 * this should be spread over the frames for reduced cpu load.
13 #if defined(TARGET_X11)
17 register unsigned int x;
18 register unsigned int y;
19 register unsigned int count;
20 register unsigned long random;
22 /* update variables */
23 if(lev.score > 9999) lev.score = 9999;
25 if(lev.time) lev.time--;
26 if(lev.android_move_cnt-- == 0) lev.android_move_cnt = lev.android_move_time;
27 if(lev.android_clone_cnt-- == 0) lev.android_clone_cnt = lev.android_clone_time;
28 if(lev.ball_state) if(lev.ball_cnt-- == 0) lev.ball_cnt = lev.ball_time;
29 if(lev.lenses_cnt) lev.lenses_cnt--;
30 if(lev.magnify_cnt) lev.magnify_cnt--;
31 if(lev.wheel_cnt) lev.wheel_cnt--;
32 if(lev.wind_cnt) lev.wind_cnt--;
33 if(lev.wonderwall_time && lev.wonderwall_state) lev.wonderwall_time--;
35 if(lev.time > 0 && lev.time <= 50 && lev.time % 5 == 0) play[SAMPLE_time] = 1;
36 if(lev.wheel_cnt) play[SAMPLE_wheel] = 1;
40 for(count = lev.ameuba_time; count--;) {
41 x = (random >> 10) % (WIDTH - 2);
42 y = (random >> 20) % (HEIGHT - 2);
52 if(tab_ameuba[Cave[y-1][x]] || tab_ameuba[Cave[y][x+1]] || tab_ameuba[Cave[y+1][x]] || tab_ameuba[Cave[y][x-1]]) Cave[y][x] = Xdrip_eat;
54 random = random * 129 + 1;
58 /* handle explosions */
59 for(y = 1; y < HEIGHT - 1; y++) for(x = 1; x < WIDTH - 1; x++) {
63 Cave[y-1][x] = tab_explode_normal[Cave[y-1][x]];
64 Cave[y][x-1] = tab_explode_normal[Cave[y][x-1]];
65 Cave[y][x+1] = tab_explode_normal[Cave[y][x+1]];
66 Cave[y+1][x] = tab_explode_normal[Cave[y+1][x]];
67 Cave[y-1][x-1] = tab_explode_normal[Cave[y-1][x-1]];
68 Cave[y-1][x+1] = tab_explode_normal[Cave[y-1][x+1]];
69 Cave[y+1][x-1] = tab_explode_normal[Cave[y+1][x-1]];
70 Cave[y+1][x+1] = tab_explode_normal[Cave[y+1][x+1]];
74 Cave[y-1][x] = tab_explode_dynamite[Cave[y-1][x]];
75 Cave[y][x-1] = tab_explode_dynamite[Cave[y][x-1]];
76 Cave[y][x+1] = tab_explode_dynamite[Cave[y][x+1]];
77 Cave[y+1][x] = tab_explode_dynamite[Cave[y+1][x]];
78 Cave[y-1][x-1] = tab_explode_dynamite[Cave[y-1][x-1]];
79 Cave[y-1][x+1] = tab_explode_dynamite[Cave[y-1][x+1]];
80 Cave[y+1][x-1] = tab_explode_dynamite[Cave[y+1][x-1]];
81 Cave[y+1][x+1] = tab_explode_dynamite[Cave[y+1][x+1]];
86 /* triple buffering */
87 for(y = 0; y < HEIGHT; y++) for(x = 0; x < WIDTH; x++) {
88 Next[y][x] = Cave[y][x];