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 */
29 if (lev.android_move_cnt-- == 0)
30 lev.android_move_cnt = lev.android_move_time;
31 if (lev.android_clone_cnt-- == 0)
32 lev.android_clone_cnt = lev.android_clone_time;
34 if (lev.ball_cnt-- == 0)
35 lev.ball_cnt = lev.ball_time;
44 if (lev.wonderwall_time && lev.wonderwall_state)
45 lev.wonderwall_time--;
47 if (lev.time > 0 && lev.time <= 50 && lev.time % 5 == 0)
48 play[SAMPLE_time] = 1;
51 play[SAMPLE_wheel] = 1;
57 for (count = lev.ameuba_time; count--;)
59 x = (random >> 10) % (WIDTH - 2);
60 y = (random >> 20) % (HEIGHT - 2);
71 if (tab_ameuba[Cave[y-1][x]] ||
72 tab_ameuba[Cave[y][x+1]] ||
73 tab_ameuba[Cave[y+1][x]] ||
74 tab_ameuba[Cave[y][x-1]])
75 Cave[y][x] = Xdrip_eat;
78 random = random * 129 + 1;
83 /* handle explosions */
85 for (y = 1; y < HEIGHT - 1; y++)
86 for (x = 1; x < WIDTH - 1; x++)
92 Cave[y-1][x] = tab_explode_normal[Cave[y-1][x]];
93 Cave[y][x-1] = tab_explode_normal[Cave[y][x-1]];
94 Cave[y][x+1] = tab_explode_normal[Cave[y][x+1]];
95 Cave[y+1][x] = tab_explode_normal[Cave[y+1][x]];
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]];
98 Cave[y+1][x-1] = tab_explode_normal[Cave[y+1][x-1]];
99 Cave[y+1][x+1] = tab_explode_normal[Cave[y+1][x+1]];
103 Cave[y][x] = Xboom_1;
104 Cave[y-1][x] = tab_explode_dynamite[Cave[y-1][x]];
105 Cave[y][x-1] = tab_explode_dynamite[Cave[y][x-1]];
106 Cave[y][x+1] = tab_explode_dynamite[Cave[y][x+1]];
107 Cave[y+1][x] = tab_explode_dynamite[Cave[y+1][x]];
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]];
110 Cave[y+1][x-1] = tab_explode_dynamite[Cave[y+1][x-1]];
111 Cave[y+1][x+1] = tab_explode_dynamite[Cave[y+1][x+1]];
116 /* triple buffering */
118 for (y = 0; y < HEIGHT; y++)
119 for (x = 0; x < WIDTH; x++)
120 Next[y][x] = Cave[y][x];