1 /* second part of synchro.
3 * game logic for monsters.
5 * one giant switch statement to process everything.
7 * this whole thing is a major bottleneck. the compiler must use registers.
14 #define SPRING_ROLL /* spring rolling off round things continues to roll */
16 #define RANDOM (random_em = random_em << 31 | random_em >> 1)
18 static unsigned int random_em;
21 static void set_nearest_player_xy(int x, int y, int *dx, int *dy)
23 int distance, distance_shortest = EM_MAX_CAVE_WIDTH + EM_MAX_CAVE_HEIGHT;
26 /* default values if no players are alive anymore */
30 for (i = 0; i < MAX_PLAYERS; i++)
35 distance = ABS(ply[i].x - x) + ABS(ply[i].y - y);
37 if (distance < distance_shortest)
42 distance_shortest = distance;
47 static void Lboom_bug(int x, int y)
50 Boom[y-1][x-1] = Xemerald;
51 Boom[y-1][x] = Xemerald;
52 Boom[y-1][x+1] = Xemerald;
53 Boom[y][x-1] = Xemerald;
54 Boom[y][x] = Xdiamond;
55 Boom[y][x+1] = Xemerald;
56 Boom[y+1][x-1] = Xemerald;
57 Boom[y+1][x] = Xemerald;
58 Boom[y+1][x+1] = Xemerald;
60 #if PLAY_ELEMENT_SOUND
61 play_element_sound(x, y, SOUND_boom, element);
65 static void Lboom_tank(int x, int y)
68 Boom[y-1][x-1] = Xblank;
69 Boom[y-1][x] = Xblank;
70 Boom[y-1][x+1] = Xblank;
71 Boom[y][x-1] = Xblank;
73 Boom[y][x+1] = Xblank;
74 Boom[y+1][x-1] = Xblank;
75 Boom[y+1][x] = Xblank;
76 Boom[y+1][x+1] = Xblank;
77 #if PLAY_ELEMENT_SOUND
78 play_element_sound(x, y, SOUND_boom, element);
82 static void Landroid(int x, int y)
86 if (lev.android_clone_cnt == 0)
88 if (Cave[y-1][x-1] != Xblank &&
89 Cave[y-1][x] != Xblank &&
90 Cave[y-1][x+1] != Xblank &&
91 Cave[y][x-1] != Xblank &&
92 Cave[y][x+1] != Xblank &&
93 Cave[y+1][x-1] != Xblank &&
94 Cave[y+1][x] != Xblank &&
95 Cave[y+1][x+1] != Xblank)
100 /* randomly find an object to clone */
102 case 0: /* S,NE,W,NW,SE,E,SW,N */
103 temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
104 temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
105 temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
106 temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
107 temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
108 temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
109 temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
110 temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
113 case 1: /* NW,SE,N,S,NE,SW,E,W */
114 temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
115 temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
116 temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
117 temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
118 temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
119 temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
120 temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
121 temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
124 case 2: /* SW,E,S,W,N,NW,SE,NE */
125 temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
126 temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
127 temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
128 temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
129 temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
130 temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
131 temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
132 temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
135 case 3: /* N,SE,NE,E,W,S,NW,SW */
136 temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
137 temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
138 temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
139 temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
140 temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
141 temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
142 temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
143 temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
146 case 4: /* SE,NW,E,NE,SW,W,N,S */
147 temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
148 temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
149 temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
150 temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
151 temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
152 temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
153 temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
154 temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
157 case 5: /* NE,W,SE,SW,S,N,E,NW */
158 temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
159 temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
160 temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
161 temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
162 temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
163 temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
164 temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
165 temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
168 case 6: /* E,N,SW,S,NW,NE,SE,W */
169 temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
170 temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
171 temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
172 temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
173 temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
174 temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
175 temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
176 temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
179 case 7: /* W,SW,NW,N,E,SE,NE,S */
180 temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
181 temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
182 temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
183 temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
184 temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
185 temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
186 temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
187 temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
191 Next[y][x] = temp; /* the item we chose to clone */
192 play_element_sound(x, y, SOUND_android_clone, temp);
196 /* randomly find a direction to move */
198 case 0: /* S,NE,W,NW,SE,E,SW,N */
199 if (Cave[y+1][x] == Xblank) goto android_s;
200 if (Cave[y-1][x+1] == Xblank) goto android_ne;
201 if (Cave[y][x-1] == Xblank) goto android_w;
202 if (Cave[y-1][x-1] == Xblank) goto android_nw;
203 if (Cave[y+1][x+1] == Xblank) goto android_se;
204 if (Cave[y][x+1] == Xblank) goto android_e;
205 if (Cave[y+1][x-1] == Xblank) goto android_sw;
206 if (Cave[y-1][x] == Xblank) goto android_n;
209 case 1: /* NW,SE,N,S,NE,SW,E,W */
210 if (Cave[y-1][x-1] == Xblank) goto android_nw;
211 if (Cave[y+1][x+1] == Xblank) goto android_se;
212 if (Cave[y-1][x] == Xblank) goto android_n;
213 if (Cave[y+1][x] == Xblank) goto android_s;
214 if (Cave[y-1][x+1] == Xblank) goto android_ne;
215 if (Cave[y+1][x-1] == Xblank) goto android_sw;
216 if (Cave[y][x+1] == Xblank) goto android_e;
217 if (Cave[y][x-1] == Xblank) goto android_w;
220 case 2: /* SW,E,S,W,N,NW,SE,NE */
221 if (Cave[y+1][x-1] == Xblank) goto android_sw;
222 if (Cave[y][x+1] == Xblank) goto android_e;
223 if (Cave[y+1][x] == Xblank) goto android_s;
224 if (Cave[y][x-1] == Xblank) goto android_w;
225 if (Cave[y-1][x] == Xblank) goto android_n;
226 if (Cave[y-1][x-1] == Xblank) goto android_nw;
227 if (Cave[y+1][x+1] == Xblank) goto android_se;
228 if (Cave[y-1][x+1] == Xblank) goto android_ne;
231 case 3: /* N,SE,NE,E,W,S,NW,SW */
232 if (Cave[y-1][x] == Xblank) goto android_n;
233 if (Cave[y+1][x+1] == Xblank) goto android_se;
234 if (Cave[y-1][x+1] == Xblank) goto android_ne;
235 if (Cave[y][x+1] == Xblank) goto android_e;
236 if (Cave[y][x-1] == Xblank) goto android_w;
237 if (Cave[y+1][x] == Xblank) goto android_s;
238 if (Cave[y-1][x-1] == Xblank) goto android_nw;
239 if (Cave[y+1][x-1] == Xblank) goto android_sw;
242 case 4: /* SE,NW,E,NE,SW,W,N,S */
243 if (Cave[y+1][x+1] == Xblank) goto android_se;
244 if (Cave[y-1][x-1] == Xblank) goto android_nw;
245 if (Cave[y][x+1] == Xblank) goto android_e;
246 if (Cave[y-1][x+1] == Xblank) goto android_ne;
247 if (Cave[y+1][x-1] == Xblank) goto android_sw;
248 if (Cave[y][x-1] == Xblank) goto android_w;
249 if (Cave[y-1][x] == Xblank) goto android_n;
250 if (Cave[y+1][x] == Xblank) goto android_s;
253 case 5: /* NE,W,SE,SW,S,N,E,NW */
254 if (Cave[y-1][x+1] == Xblank) goto android_ne;
255 if (Cave[y][x-1] == Xblank) goto android_w;
256 if (Cave[y+1][x+1] == Xblank) goto android_se;
257 if (Cave[y+1][x-1] == Xblank) goto android_sw;
258 if (Cave[y+1][x] == Xblank) goto android_s;
259 if (Cave[y-1][x] == Xblank) goto android_n;
260 if (Cave[y][x+1] == Xblank) goto android_e;
261 if (Cave[y-1][x-1] == Xblank) goto android_nw;
264 case 6: /* E,N,SW,S,NW,NE,SE,W */
265 if (Cave[y][x+1] == Xblank) goto android_e;
266 if (Cave[y-1][x] == Xblank) goto android_n;
267 if (Cave[y+1][x-1] == Xblank) goto android_sw;
268 if (Cave[y+1][x] == Xblank) goto android_s;
269 if (Cave[y-1][x-1] == Xblank) goto android_nw;
270 if (Cave[y-1][x+1] == Xblank) goto android_ne;
271 if (Cave[y+1][x+1] == Xblank) goto android_se;
272 if (Cave[y][x-1] == Xblank) goto android_w;
275 case 7: /* W,SW,NW,N,E,SE,NE,S */
276 if (Cave[y][x-1] == Xblank) goto android_w;
277 if (Cave[y+1][x-1] == Xblank) goto android_sw;
278 if (Cave[y-1][x-1] == Xblank) goto android_nw;
279 if (Cave[y-1][x] == Xblank) goto android_n;
280 if (Cave[y][x+1] == Xblank) goto android_e;
281 if (Cave[y+1][x+1] == Xblank) goto android_se;
282 if (Cave[y-1][x+1] == Xblank) goto android_ne;
283 if (Cave[y+1][x] == Xblank) goto android_s;
289 if (lev.android_move_cnt == 0)
291 if (Cave[y-1][x-1] == Zplayer ||
292 Cave[y-1][x] == Zplayer ||
293 Cave[y-1][x+1] == Zplayer ||
294 Cave[y][x-1] == Zplayer ||
295 Cave[y][x+1] == Zplayer ||
296 Cave[y+1][x-1] == Zplayer ||
297 Cave[y+1][x] == Zplayer ||
298 Cave[y+1][x+1] == Zplayer)
301 set_nearest_player_xy(x, y, &dx, &dy);
303 Next[y][x] = Xblank; /* assume we will move */
304 temp = ((x < dx) + 1 - (x > dx)) + ((y < dy) + 1 - (y > dy)) * 3;
310 /* attempt clockwise move first if direct path is blocked */
312 case 0: /* north west */
313 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
314 if (tab_android_move[Cave[y-1][x]]) goto android_n;
315 if (tab_android_move[Cave[y][x-1]]) goto android_w;
319 if (tab_android_move[Cave[y-1][x]]) goto android_n;
320 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
321 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
324 case 2: /* north east */
325 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
326 if (tab_android_move[Cave[y][x+1]]) goto android_e;
327 if (tab_android_move[Cave[y-1][x]]) goto android_n;
331 if (tab_android_move[Cave[y][x-1]]) goto android_w;
332 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
333 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
336 case 4: /* nowhere */
340 if (tab_android_move[Cave[y][x+1]]) goto android_e;
341 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
342 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
345 case 6: /* south west */
346 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
347 if (tab_android_move[Cave[y][x-1]]) goto android_w;
348 if (tab_android_move[Cave[y+1][x]]) goto android_s;
352 if (tab_android_move[Cave[y+1][x]]) goto android_s;
353 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
354 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
357 case 8: /* south east */
358 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
359 if (tab_android_move[Cave[y+1][x]]) goto android_s;
360 if (tab_android_move[Cave[y][x+1]]) goto android_e;
368 /* attempt counterclockwise move first if direct path is blocked */
370 case 0: /* north west */
371 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
372 if (tab_android_move[Cave[y][x-1]]) goto android_w;
373 if (tab_android_move[Cave[y-1][x]]) goto android_n;
377 if (tab_android_move[Cave[y-1][x]]) goto android_n;
378 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
379 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
382 case 2: /* north east */
383 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
384 if (tab_android_move[Cave[y-1][x]]) goto android_n;
385 if (tab_android_move[Cave[y][x+1]]) goto android_e;
389 if (tab_android_move[Cave[y][x-1]]) goto android_w;
390 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
391 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
394 case 4: /* nowhere */
398 if (tab_android_move[Cave[y][x+1]]) goto android_e;
399 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
400 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
403 case 6: /* south west */
404 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
405 if (tab_android_move[Cave[y+1][x]]) goto android_s;
406 if (tab_android_move[Cave[y][x-1]]) goto android_w;
410 if (tab_android_move[Cave[y+1][x]]) goto android_s;
411 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
412 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
415 case 8: /* south east */
416 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
417 if (tab_android_move[Cave[y][x+1]]) goto android_e;
418 if (tab_android_move[Cave[y+1][x]]) goto android_s;
425 Next[y][x] = Xandroid;
429 Cave[y][x] = Yandroid_nB;
430 Cave[y-1][x] = Yandroid_n;
431 Next[y-1][x] = Xandroid;
432 play_element_sound(x, y, SOUND_android_move, Xandroid);
436 Cave[y][x] = Yandroid_neB;
437 Cave[y-1][x+1] = Yandroid_ne;
438 Next[y-1][x+1] = Xandroid;
439 play_element_sound(x, y, SOUND_android_move, Xandroid);
443 Cave[y][x] = Yandroid_eB;
444 Cave[y][x+1] = Yandroid_e;
445 Next[y][x+1] = Xandroid;
446 play_element_sound(x, y, SOUND_android_move, Xandroid);
450 Cave[y][x] = Yandroid_seB;
451 Cave[y+1][x+1] = Yandroid_se;
452 Next[y+1][x+1] = Xandroid;
453 play_element_sound(x, y, SOUND_android_move, Xandroid);
457 Cave[y][x] = Yandroid_sB;
458 Cave[y+1][x] = Yandroid_s;
459 Next[y+1][x] = Xandroid;
460 play_element_sound(x, y, SOUND_android_move, Xandroid);
464 Cave[y][x] = Yandroid_swB;
465 Cave[y+1][x-1] = Yandroid_sw;
466 Next[y+1][x-1] = Xandroid;
467 play_element_sound(x, y, SOUND_android_move, Xandroid);
471 Cave[y][x] = Yandroid_wB;
472 Cave[y][x-1] = Yandroid_w;
473 Next[y][x-1] = Xandroid;
474 play_element_sound(x, y, SOUND_android_move, Xandroid);
478 Cave[y][x] = Yandroid_nwB;
479 Cave[y-1][x-1] = Yandroid_nw;
480 Next[y-1][x-1] = Xandroid;
481 play_element_sound(x, y, SOUND_android_move, Xandroid);
485 static void Landroid_1_n(int x, int y)
487 switch (Cave[y-1][x])
497 Cave[y][x] = Yandroid_nB;
498 if (Cave[y-2][x+1] == Xblank)
499 Cave[y-2][x+1] = Xacid_splash_e;
500 if (Cave[y-2][x-1] == Xblank)
501 Cave[y-2][x-1] = Xacid_splash_w;
503 play_element_sound(x, y, SOUND_acid, Xacid_1);
509 Cave[y][x] = Yandroid_nB;
510 Cave[y-1][x] = Yandroid_n;
512 Next[y-1][x] = Xandroid;
513 play_element_sound(x, y, SOUND_android_move, Xandroid_1_n);
522 static void Landroid_2_n(int x, int y)
524 switch (Cave[y-1][x])
534 Cave[y][x] = Yandroid_nB;
535 if (Cave[y-2][x+1] == Xblank)
536 Cave[y-2][x+1] = Xacid_splash_e;
537 if (Cave[y-2][x-1] == Xblank)
538 Cave[y-2][x-1] = Xacid_splash_w;
540 play_element_sound(x, y, SOUND_acid, Xacid_1);
546 Cave[y][x] = Yandroid_nB;
547 Cave[y-1][x] = Yandroid_n;
549 Next[y-1][x] = Xandroid_1_n;
550 play_element_sound(x, y, SOUND_android_move, Xandroid_2_n);
559 static void Landroid_1_e(int x, int y)
561 switch (Cave[y][x+1])
571 Cave[y][x] = Yandroid_eB;
572 if (Cave[y-1][x+2] == Xblank)
573 Cave[y-1][x+2] = Xacid_splash_e;
574 if (Cave[y-1][x] == Xblank)
575 Cave[y-1][x] = Xacid_splash_w;
577 play_element_sound(x, y, SOUND_acid, Xacid_1);
583 Cave[y][x] = Yandroid_eB;
584 Cave[y][x+1] = Yandroid_e;
586 Next[y][x+1] = Xandroid;
587 play_element_sound(x, y, SOUND_android_move, Xandroid_1_e);
596 static void Landroid_2_e(int x, int y)
598 switch (Cave[y][x+1])
608 Cave[y][x] = Yandroid_eB;
609 if (Cave[y-1][x+2] == Xblank)
610 Cave[y-1][x+2] = Xacid_splash_e;
611 if (Cave[y-1][x] == Xblank)
612 Cave[y-1][x] = Xacid_splash_w;
614 play_element_sound(x, y, SOUND_acid, Xacid_1);
620 Cave[y][x] = Yandroid_eB;
621 Cave[y][x+1] = Yandroid_e;
623 Next[y][x+1] = Xandroid_1_e;
624 play_element_sound(x, y, SOUND_android_move, Xandroid_2_e);
633 static void Landroid_1_s(int x, int y)
635 switch (Cave[y+1][x])
645 Cave[y][x] = Yandroid_sB;
646 if (Cave[y][x+1] == Xblank)
647 Cave[y][x+1] = Xacid_splash_e;
648 if (Cave[y][x-1] == Xblank)
649 Cave[y][x-1] = Xacid_splash_w;
651 play_element_sound(x, y, SOUND_acid, Xacid_1);
657 Cave[y][x] = Yandroid_sB;
658 Cave[y+1][x] = Yandroid_s;
660 Next[y+1][x] = Xandroid;
661 play_element_sound(x, y, SOUND_android_move, Xandroid_1_s);
670 static void Landroid_2_s(int x, int y)
672 switch (Cave[y+1][x])
682 Cave[y][x] = Yandroid_sB;
683 if (Cave[y][x+1] == Xblank)
684 Cave[y][x+1] = Xacid_splash_e;
685 if (Cave[y][x-1] == Xblank)
686 Cave[y][x-1] = Xacid_splash_w;
688 play_element_sound(x, y, SOUND_acid, Xacid_1);
694 Cave[y][x] = Yandroid_sB;
695 Cave[y+1][x] = Yandroid_s;
697 Next[y+1][x] = Xandroid_1_s;
698 play_element_sound(x, y, SOUND_android_move, Xandroid_2_s);
707 static void Landroid_1_w(int x, int y)
709 switch (Cave[y][x-1])
719 Cave[y][x] = Yandroid_wB;
720 if (Cave[y-1][x] == Xblank)
721 Cave[y-1][x] = Xacid_splash_e;
722 if (Cave[y-1][x-2] == Xblank)
723 Cave[y-1][x-2] = Xacid_splash_w;
725 play_element_sound(x, y, SOUND_acid, Xacid_1);
731 Cave[y][x] = Yandroid_wB;
732 Cave[y][x-1] = Yandroid_w;
734 Next[y][x-1] = Xandroid;
735 play_element_sound(x, y, SOUND_android_move, Xandroid_1_w);
744 static void Landroid_2_w(int x, int y)
746 switch (Cave[y][x-1])
756 Cave[y][x] = Yandroid_wB;
757 if (Cave[y-1][x] == Xblank)
758 Cave[y-1][x] = Xacid_splash_e;
759 if (Cave[y-1][x-2] == Xblank)
760 Cave[y-1][x-2] = Xacid_splash_w;
762 play_element_sound(x, y, SOUND_acid, Xacid_1);
768 Cave[y][x] = Yandroid_wB;
769 Cave[y][x-1] = Yandroid_w;
771 Next[y][x-1] = Xandroid_1_w;
772 play_element_sound(x, y, SOUND_android_move, Xandroid_1_w);
781 static void Leater_n(int x, int y)
783 if (Cave[y][x+1] == Xdiamond)
785 Cave[y][x+1] = Ydiamond_blank;
786 Next[y][x+1] = Xblank;
787 play_element_sound(x, y, SOUND_eater_eat, Xeater_n);
791 if (Cave[y+1][x] == Xdiamond)
793 Cave[y+1][x] = Ydiamond_blank;
794 Next[y+1][x] = Xblank;
795 play_element_sound(x, y, SOUND_eater_eat, Xeater_n);
799 if (Cave[y][x-1] == Xdiamond)
801 Cave[y][x-1] = Ydiamond_blank;
802 Next[y][x-1] = Xblank;
803 play_element_sound(x, y, SOUND_eater_eat, Xeater_n);
807 if (Cave[y-1][x] == Xdiamond)
809 Cave[y-1][x] = Ydiamond_blank;
810 Next[y-1][x] = Xblank;
811 play_element_sound(x, y, SOUND_eater_eat, Xeater_n);
815 switch (Cave[y-1][x])
825 Cave[y][x] = Yeater_nB;
826 if (Cave[y-2][x+1] == Xblank)
827 Cave[y-2][x+1] = Xacid_splash_e;
828 if (Cave[y-2][x-1] == Xblank)
829 Cave[y-2][x-1] = Xacid_splash_w;
831 play_element_sound(x, y, SOUND_acid, Xacid_1);
840 Cave[y][x] = Yeater_nB;
841 Cave[y-1][x] = Yeater_n;
843 Next[y-1][x] = Xeater_n;
847 Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
848 play_element_sound(x, y, SOUND_eater, Xeater_n);
853 static void Leater_e(int x, int y)
855 if (Cave[y+1][x] == Xdiamond)
857 Cave[y+1][x] = Ydiamond_blank;
858 Next[y+1][x] = Xblank;
859 play_element_sound(x, y, SOUND_eater_eat, Xeater_e);
863 if (Cave[y][x-1] == Xdiamond)
865 Cave[y][x-1] = Ydiamond_blank;
866 Next[y][x-1] = Xblank;
867 play_element_sound(x, y, SOUND_eater_eat, Xeater_e);
871 if (Cave[y-1][x] == Xdiamond)
873 Cave[y-1][x] = Ydiamond_blank;
874 Next[y-1][x] = Xblank;
875 play_element_sound(x, y, SOUND_eater_eat, Xeater_e);
879 if (Cave[y][x+1] == Xdiamond)
881 Cave[y][x+1] = Ydiamond_blank;
882 Next[y][x+1] = Xblank;
883 play_element_sound(x, y, SOUND_eater_eat, Xeater_e);
887 switch (Cave[y][x+1])
897 Cave[y][x] = Yeater_eB;
898 if (Cave[y-1][x+2] == Xblank)
899 Cave[y-1][x+2] = Xacid_splash_e;
900 if (Cave[y-1][x] == Xblank)
901 Cave[y-1][x] = Xacid_splash_w;
903 play_element_sound(x, y, SOUND_acid, Xacid_1);
912 Cave[y][x] = Yeater_eB;
913 Cave[y][x+1] = Yeater_e;
915 Next[y][x+1] = Xeater_e;
919 Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
920 play_element_sound(x, y, SOUND_eater, Xeater_e);
925 static void Leater_s(int x, int y)
927 if (Cave[y][x-1] == Xdiamond)
929 Cave[y][x-1] = Ydiamond_blank;
930 Next[y][x-1] = Xblank;
931 play_element_sound(x, y, SOUND_eater_eat, Xeater_s);
935 if (Cave[y-1][x] == Xdiamond)
937 Cave[y-1][x] = Ydiamond_blank;
938 Next[y-1][x] = Xblank;
939 play_element_sound(x, y, SOUND_eater_eat, Xeater_s);
943 if (Cave[y][x+1] == Xdiamond)
945 Cave[y][x+1] = Ydiamond_blank;
946 Next[y][x+1] = Xblank;
947 play_element_sound(x, y, SOUND_eater_eat, Xeater_s);
951 if (Cave[y+1][x] == Xdiamond)
953 Cave[y+1][x] = Ydiamond_blank;
954 Next[y+1][x] = Xblank;
955 play_element_sound(x, y, SOUND_eater_eat, Xeater_s);
959 switch (Cave[y+1][x])
969 Cave[y][x] = Yeater_sB;
970 if (Cave[y][x+1] == Xblank)
971 Cave[y][x+1] = Xacid_splash_e;
972 if (Cave[y][x-1] == Xblank)
973 Cave[y][x-1] = Xacid_splash_w;
975 play_element_sound(x, y, SOUND_acid, Xacid_1);
984 Cave[y][x] = Yeater_sB;
985 Cave[y+1][x] = Yeater_s;
987 Next[y+1][x] = Xeater_s;
991 Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
992 play_element_sound(x, y, SOUND_eater, Xeater_s);
997 static void Leater_w(int x, int y)
999 if (Cave[y-1][x] == Xdiamond)
1001 Cave[y-1][x] = Ydiamond_blank;
1002 Next[y-1][x] = Xblank;
1003 play_element_sound(x, y, SOUND_eater_eat, Xeater_w);
1007 if (Cave[y][x+1] == Xdiamond)
1009 Cave[y][x+1] = Ydiamond_blank;
1010 Next[y][x+1] = Xblank;
1011 play_element_sound(x, y, SOUND_eater_eat, Xeater_w);
1015 if (Cave[y+1][x] == Xdiamond)
1017 Cave[y+1][x] = Ydiamond_blank;
1018 Next[y+1][x] = Xblank;
1019 play_element_sound(x, y, SOUND_eater_eat, Xeater_w);
1023 if (Cave[y][x-1] == Xdiamond)
1025 Cave[y][x-1] = Ydiamond_blank;
1026 Next[y][x-1] = Xblank;
1027 play_element_sound(x, y, SOUND_eater_eat, Xeater_w);
1031 switch (Cave[y][x-1])
1041 Cave[y][x] = Yeater_wB;
1042 if (Cave[y-1][x] == Xblank)
1043 Cave[y-1][x] = Xacid_splash_e;
1044 if (Cave[y-1][x-2] == Xblank)
1045 Cave[y-1][x-2] = Xacid_splash_w;
1046 Next[y][x] = Xblank;
1047 play_element_sound(x, y, SOUND_acid, Xacid_1);
1051 case Xacid_splash_e:
1052 case Xacid_splash_w:
1056 Cave[y][x] = Yeater_wB;
1057 Cave[y][x-1] = Yeater_w;
1058 Next[y][x] = Xblank;
1059 Next[y][x-1] = Xeater_w;
1063 Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
1064 play_element_sound(x, y, SOUND_eater, Xeater_w);
1069 static void Lalien(int x, int y)
1080 set_nearest_player_xy(x, y, &dx, &dy);
1087 switch (Cave[y-1][x])
1097 Cave[y][x] = Yalien_nB;
1098 if (Cave[y-2][x+1] == Xblank)
1099 Cave[y-2][x+1] = Xacid_splash_e;
1100 if (Cave[y-2][x-1] == Xblank)
1101 Cave[y-2][x-1] = Xacid_splash_w;
1102 Next[y][x] = Xblank;
1103 play_element_sound(x, y, SOUND_acid, Xacid_1);
1107 case Xacid_splash_e:
1108 case Xacid_splash_w:
1112 Cave[y][x] = Yalien_nB;
1113 Cave[y-1][x] = Yalien_n;
1114 Next[y][x] = Xblank;
1115 Next[y-1][x] = Xalien_pause;
1116 play_element_sound(x, y, SOUND_alien, Xalien);
1122 switch (Cave[y+1][x])
1132 Cave[y][x] = Yalien_sB;
1133 Next[y][x] = Xblank;
1134 if (Cave[y][x+1] == Xblank)
1135 Cave[y][x+1] = Xacid_splash_e;
1136 if (Cave[y][x-1] == Xblank)
1137 Cave[y][x-1] = Xacid_splash_w;
1138 play_element_sound(x, y, SOUND_acid, Xacid_1);
1142 case Xacid_splash_e:
1143 case Xacid_splash_w:
1147 Cave[y][x] = Yalien_sB;
1148 Cave[y+1][x] = Yalien_s;
1149 Next[y][x] = Xblank;
1150 Next[y+1][x] = Xalien_pause;
1151 play_element_sound(x, y, SOUND_alien, Xalien);
1160 switch (Cave[y][x+1])
1170 Cave[y][x] = Yalien_eB;
1171 if (Cave[y-1][x+2] == Xblank)
1172 Cave[y-1][x+2] = Xacid_splash_e;
1173 if (Cave[y-1][x] == Xblank)
1174 Cave[y-1][x] = Xacid_splash_w;
1175 Next[y][x] = Xblank;
1176 play_element_sound(x, y, SOUND_acid, Xacid_1);
1180 case Xacid_splash_e:
1181 case Xacid_splash_w:
1185 Cave[y][x] = Yalien_eB;
1186 Cave[y][x+1] = Yalien_e;
1187 Next[y][x] = Xblank;
1188 Next[y][x+1] = Xalien_pause;
1189 play_element_sound(x, y, SOUND_alien, Xalien);
1195 switch (Cave[y][x-1])
1205 Cave[y][x] = Yalien_wB;
1206 if (Cave[y-1][x] == Xblank)
1207 Cave[y-1][x] = Xacid_splash_e;
1208 if (Cave[y-1][x-2] == Xblank)
1209 Cave[y-1][x-2] = Xacid_splash_w;
1210 Next[y][x] = Xblank;
1211 play_element_sound(x, y, SOUND_acid, Xacid_1);
1215 case Xacid_splash_e:
1216 case Xacid_splash_w:
1220 Cave[y][x] = Yalien_wB;
1221 Cave[y][x-1] = Yalien_w;
1222 Next[y][x] = Xblank;
1223 Next[y][x-1] = Xalien_pause;
1224 play_element_sound(x, y, SOUND_alien, Xalien);
1231 static void Lalien_pause(int x, int y)
1233 Next[y][x] = Xalien;
1236 static void Lbug_n(int x, int y)
1238 switch (Cave[y-1][x])
1248 Cave[y][x] = Ybug_nB;
1249 if (Cave[y-2][x+1] == Xblank)
1250 Cave[y-2][x+1] = Xacid_splash_e;
1251 if (Cave[y-2][x-1] == Xblank)
1252 Cave[y-2][x-1] = Xacid_splash_w;
1253 Next[y][x] = Xblank;
1254 play_element_sound(x, y, SOUND_acid, Xacid_1);
1258 case Xacid_splash_e:
1259 case Xacid_splash_w:
1263 Cave[y][x] = Ybug_nB;
1264 Cave[y-1][x] = Ybug_n;
1265 Next[y][x] = Xblank;
1266 Next[y-1][x] = Xbug_1_n;
1267 play_element_sound(x, y, SOUND_bug, Xbug_1_n);
1271 Cave[y][x] = Ybug_n_w;
1272 Next[y][x] = Xbug_2_w;
1273 play_element_sound(x, y, SOUND_bug, Xbug_1_n);
1278 static void Lbug_1_n(int x, int y)
1280 if (tab_amoeba[Cave[y-1][x]] ||
1281 tab_amoeba[Cave[y][x+1]] ||
1282 tab_amoeba[Cave[y+1][x]] ||
1283 tab_amoeba[Cave[y][x-1]])
1290 switch (Cave[y][x+1])
1293 case Xacid_splash_e:
1294 case Xacid_splash_w:
1306 Cave[y][x] = Ybug_n_e;
1307 Next[y][x] = Xbug_2_e;
1308 play_element_sound(x, y, SOUND_bug, Xbug_1_n);
1317 static void Lbug_2_n(int x, int y)
1319 if (tab_amoeba[Cave[y-1][x]] ||
1320 tab_amoeba[Cave[y][x+1]] ||
1321 tab_amoeba[Cave[y+1][x]] ||
1322 tab_amoeba[Cave[y][x-1]])
1332 static void Lbug_e(int x, int y)
1334 switch (Cave[y][x+1])
1344 Cave[y][x] = Ybug_eB;
1345 if (Cave[y-1][x+2] == Xblank)
1346 Cave[y-1][x+2] = Xacid_splash_e;
1347 if (Cave[y-1][x] == Xblank)
1348 Cave[y-1][x] = Xacid_splash_w;
1349 Next[y][x] = Xblank;
1350 play_element_sound(x, y, SOUND_acid, Xacid_1);
1354 case Xacid_splash_e:
1355 case Xacid_splash_w:
1359 Cave[y][x] = Ybug_eB;
1360 Cave[y][x+1] = Ybug_e;
1361 Next[y][x] = Xblank;
1362 Next[y][x+1] = Xbug_1_e;
1363 play_element_sound(x, y, SOUND_bug, Xbug_1_e);
1367 Cave[y][x] = Ybug_e_n;
1368 Next[y][x] = Xbug_2_n;
1369 play_element_sound(x, y, SOUND_bug, Xbug_1_e);
1374 static void Lbug_1_e(int x, int y)
1376 if (tab_amoeba[Cave[y-1][x]] ||
1377 tab_amoeba[Cave[y][x+1]] ||
1378 tab_amoeba[Cave[y+1][x]] ||
1379 tab_amoeba[Cave[y][x-1]])
1386 switch (Cave[y+1][x])
1389 case Xacid_splash_e:
1390 case Xacid_splash_w:
1402 Cave[y][x] = Ybug_e_s;
1403 Next[y][x] = Xbug_2_s;
1404 play_element_sound(x, y, SOUND_bug, Xbug_1_e);
1413 static void Lbug_2_e(int x, int y)
1415 if (tab_amoeba[Cave[y-1][x]] ||
1416 tab_amoeba[Cave[y][x+1]] ||
1417 tab_amoeba[Cave[y+1][x]] ||
1418 tab_amoeba[Cave[y][x-1]])
1428 static void Lbug_s(int x, int y)
1430 switch (Cave[y+1][x])
1440 Cave[y][x] = Ybug_sB;
1441 if (Cave[y][x+1] == Xblank)
1442 Cave[y][x+1] = Xacid_splash_e;
1443 if (Cave[y][x-1] == Xblank)
1444 Cave[y][x-1] = Xacid_splash_w;
1445 Next[y][x] = Xblank;
1446 play_element_sound(x, y, SOUND_acid, Xacid_1);
1450 case Xacid_splash_e:
1451 case Xacid_splash_w:
1455 Cave[y][x] = Ybug_sB;
1456 Cave[y+1][x] = Ybug_s;
1457 Next[y][x] = Xblank;
1458 Next[y+1][x] = Xbug_1_s;
1459 play_element_sound(x, y, SOUND_bug, Xbug_1_s);
1463 Cave[y][x] = Ybug_s_e;
1464 Next[y][x] = Xbug_2_e;
1465 play_element_sound(x, y, SOUND_bug, Xbug_1_s);
1470 static void Lbug_1_s(int x, int y)
1472 if (tab_amoeba[Cave[y-1][x]] ||
1473 tab_amoeba[Cave[y][x+1]] ||
1474 tab_amoeba[Cave[y+1][x]] ||
1475 tab_amoeba[Cave[y][x-1]])
1482 switch (Cave[y][x-1])
1485 case Xacid_splash_e:
1486 case Xacid_splash_w:
1498 Cave[y][x] = Ybug_s_w;
1499 Next[y][x] = Xbug_2_w;
1500 play_element_sound(x, y, SOUND_bug, Xbug_1_s);
1509 static void Lbug_2_s(int x, int y)
1511 if (tab_amoeba[Cave[y-1][x]] ||
1512 tab_amoeba[Cave[y][x+1]] ||
1513 tab_amoeba[Cave[y+1][x]] ||
1514 tab_amoeba[Cave[y][x-1]])
1524 static void Lbug_w(int x, int y)
1526 switch (Cave[y][x-1])
1536 Cave[y][x] = Ybug_wB;
1537 if (Cave[y-1][x] == Xblank)
1538 Cave[y-1][x] = Xacid_splash_e;
1539 if (Cave[y-1][x-2] == Xblank)
1540 Cave[y-1][x-2] = Xacid_splash_w;
1541 Next[y][x] = Xblank;
1542 play_element_sound(x, y, SOUND_acid, Xacid_1);
1546 case Xacid_splash_e:
1547 case Xacid_splash_w:
1551 Cave[y][x] = Ybug_wB;
1552 Cave[y][x-1] = Ybug_w;
1553 Next[y][x] = Xblank;
1554 Next[y][x-1] = Xbug_1_w;
1555 play_element_sound(x, y, SOUND_bug, Xbug_1_w);
1559 Cave[y][x] = Ybug_w_s;
1560 Next[y][x] = Xbug_2_s;
1561 play_element_sound(x, y, SOUND_bug, Xbug_1_w);
1566 static void Lbug_1_w(int x, int y)
1568 if (tab_amoeba[Cave[y-1][x]] ||
1569 tab_amoeba[Cave[y][x+1]] ||
1570 tab_amoeba[Cave[y+1][x]] ||
1571 tab_amoeba[Cave[y][x-1]])
1578 switch (Cave[y-1][x])
1581 case Xacid_splash_e:
1582 case Xacid_splash_w:
1594 Cave[y][x] = Ybug_w_n;
1595 Next[y][x] = Xbug_2_n;
1596 play_element_sound(x, y, SOUND_bug, Xbug_1_w);
1605 static void Lbug_2_w(int x, int y)
1607 if (tab_amoeba[Cave[y-1][x]] ||
1608 tab_amoeba[Cave[y][x+1]] ||
1609 tab_amoeba[Cave[y+1][x]] ||
1610 tab_amoeba[Cave[y][x-1]])
1620 static void Ltank_n(int x, int y)
1622 switch (Cave[y-1][x])
1632 Cave[y][x] = Ytank_nB;
1633 if (Cave[y-2][x+1] == Xblank)
1634 Cave[y-2][x+1] = Xacid_splash_e;
1635 if (Cave[y-2][x-1] == Xblank)
1636 Cave[y-2][x-1] = Xacid_splash_w;
1637 Next[y][x] = Xblank;
1638 play_element_sound(x, y, SOUND_acid, Xacid_1);
1642 case Xacid_splash_e:
1643 case Xacid_splash_w:
1647 Cave[y][x] = Ytank_nB;
1648 Cave[y-1][x] = Ytank_n;
1649 Next[y][x] = Xblank;
1650 Next[y-1][x] = Xtank_1_n;
1651 play_element_sound(x, y, SOUND_tank, Xtank_1_n);
1655 Cave[y][x] = Ytank_n_e;
1656 Next[y][x] = Xtank_2_e;
1657 play_element_sound(x, y, SOUND_tank, Xtank_1_n);
1662 static void Ltank_1_n(int x, int y)
1664 if (tab_amoeba[Cave[y-1][x]] ||
1665 tab_amoeba[Cave[y][x+1]] ||
1666 tab_amoeba[Cave[y+1][x]] ||
1667 tab_amoeba[Cave[y][x-1]])
1674 switch (Cave[y][x-1])
1677 case Xacid_splash_e:
1678 case Xacid_splash_w:
1690 Cave[y][x] = Ytank_n_w;
1691 Next[y][x] = Xtank_2_w;
1692 play_element_sound(x, y, SOUND_tank, Xtank_1_n);
1701 static void Ltank_2_n(int x, int y)
1703 if (tab_amoeba[Cave[y-1][x]] ||
1704 tab_amoeba[Cave[y][x+1]] ||
1705 tab_amoeba[Cave[y+1][x]] ||
1706 tab_amoeba[Cave[y][x-1]])
1716 static void Ltank_e(int x, int y)
1718 switch (Cave[y][x+1])
1728 Cave[y][x] = Ytank_eB;
1729 if (Cave[y-1][x+2] == Xblank)
1730 Cave[y-1][x+2] = Xacid_splash_e;
1731 if (Cave[y-1][x] == Xblank)
1732 Cave[y-1][x] = Xacid_splash_w;
1733 Next[y][x] = Xblank;
1734 play_element_sound(x, y, SOUND_acid, Xacid_1);
1738 case Xacid_splash_e:
1739 case Xacid_splash_w:
1743 Cave[y][x] = Ytank_eB;
1744 Cave[y][x+1] = Ytank_e;
1745 Next[y][x] = Xblank;
1746 Next[y][x+1] = Xtank_1_e;
1747 play_element_sound(x, y, SOUND_tank, Xtank_1_e);
1751 Cave[y][x] = Ytank_e_s;
1752 Next[y][x] = Xtank_2_s;
1753 play_element_sound(x, y, SOUND_tank, Xtank_1_e);
1758 static void Ltank_1_e(int x, int y)
1760 if (tab_amoeba[Cave[y-1][x]] ||
1761 tab_amoeba[Cave[y][x+1]] ||
1762 tab_amoeba[Cave[y+1][x]] ||
1763 tab_amoeba[Cave[y][x-1]])
1770 switch (Cave[y-1][x])
1773 case Xacid_splash_e:
1774 case Xacid_splash_w:
1786 Cave[y][x] = Ytank_e_n;
1787 Next[y][x] = Xtank_2_n;
1788 play_element_sound(x, y, SOUND_tank, Xtank_1_e);
1797 static void Ltank_2_e(int x, int y)
1799 if (tab_amoeba[Cave[y-1][x]] ||
1800 tab_amoeba[Cave[y][x+1]] ||
1801 tab_amoeba[Cave[y+1][x]] ||
1802 tab_amoeba[Cave[y][x-1]])
1812 static void Ltank_s(int x, int y)
1814 switch (Cave[y+1][x])
1824 Cave[y][x] = Ytank_sB;
1825 if (Cave[y][x+1] == Xblank)
1826 Cave[y][x+1] = Xacid_splash_e;
1827 if (Cave[y][x-1] == Xblank)
1828 Cave[y][x-1] = Xacid_splash_w;
1829 Next[y][x] = Xblank;
1830 play_element_sound(x, y, SOUND_acid, Xacid_1);
1834 case Xacid_splash_e:
1835 case Xacid_splash_w:
1839 Cave[y][x] = Ytank_sB;
1840 Cave[y+1][x] = Ytank_s;
1841 Next[y][x] = Xblank;
1842 Next[y+1][x] = Xtank_1_s;
1843 play_element_sound(x, y, SOUND_tank, Xtank_1_s);
1847 Cave[y][x] = Ytank_s_w;
1848 Next[y][x] = Xtank_2_w;
1849 play_element_sound(x, y, SOUND_tank, Xtank_1_s);
1854 static void Ltank_1_s(int x, int y)
1856 if (tab_amoeba[Cave[y-1][x]] ||
1857 tab_amoeba[Cave[y][x+1]] ||
1858 tab_amoeba[Cave[y+1][x]] ||
1859 tab_amoeba[Cave[y][x-1]])
1866 switch (Cave[y][x+1])
1869 case Xacid_splash_e:
1870 case Xacid_splash_w:
1882 Cave[y][x] = Ytank_s_e;
1883 Next[y][x] = Xtank_2_e;
1884 play_element_sound(x, y, SOUND_tank, Xtank_1_s);
1893 static void Ltank_2_s(int x, int y)
1895 if (tab_amoeba[Cave[y-1][x]] ||
1896 tab_amoeba[Cave[y][x+1]] ||
1897 tab_amoeba[Cave[y+1][x]] ||
1898 tab_amoeba[Cave[y][x-1]])
1908 static void Ltank_w(int x, int y)
1910 switch (Cave[y][x-1])
1920 Cave[y][x] = Ytank_wB;
1921 if (Cave[y-1][x] == Xblank)
1922 Cave[y-1][x] = Xacid_splash_e;
1923 if (Cave[y-1][x-2] == Xblank)
1924 Cave[y-1][x-2] = Xacid_splash_w;
1925 Next[y][x] = Xblank;
1926 play_element_sound(x, y, SOUND_acid, Xacid_1);
1930 case Xacid_splash_e:
1931 case Xacid_splash_w:
1935 Cave[y][x] = Ytank_wB;
1936 Cave[y][x-1] = Ytank_w;
1937 Next[y][x] = Xblank;
1938 Next[y][x-1] = Xtank_1_w;
1939 play_element_sound(x, y, SOUND_tank, Xtank_1_w);
1943 Cave[y][x] = Ytank_w_n;
1944 Next[y][x] = Xtank_2_n;
1945 play_element_sound(x, y, SOUND_tank, Xtank_1_w);
1950 static void Ltank_1_w(int x, int y)
1952 if (tab_amoeba[Cave[y-1][x]] ||
1953 tab_amoeba[Cave[y][x+1]] ||
1954 tab_amoeba[Cave[y+1][x]] ||
1955 tab_amoeba[Cave[y][x-1]])
1962 switch (Cave[y+1][x])
1965 case Xacid_splash_e:
1966 case Xacid_splash_w:
1978 Cave[y][x] = Ytank_w_s;
1979 Next[y][x] = Xtank_2_s;
1980 play_element_sound(x, y, SOUND_tank, Xtank_1_w);
1989 static void Ltank_2_w(int x, int y)
1991 if (tab_amoeba[Cave[y-1][x]] ||
1992 tab_amoeba[Cave[y][x+1]] ||
1993 tab_amoeba[Cave[y+1][x]] ||
1994 tab_amoeba[Cave[y][x-1]])
2004 static void Lemerald(int x, int y)
2006 switch (Cave[y+1][x])
2016 Cave[y][x] = Yemerald_sB;
2017 if (Cave[y][x+1] == Xblank)
2018 Cave[y][x+1] = Xacid_splash_e;
2019 if (Cave[y][x-1] == Xblank)
2020 Cave[y][x-1] = Xacid_splash_w;
2021 Next[y][x] = Xblank;
2022 play_element_sound(x, y, SOUND_acid, Xacid_1);
2026 case Xacid_splash_e:
2027 case Xacid_splash_w:
2028 Cave[y][x] = Yemerald_sB;
2029 Cave[y+1][x] = Yemerald_s;
2030 Next[y][x] = Xblank;
2031 Next[y+1][x] = Xemerald_fall;
2050 case Xemerald_pause:
2052 case Xdiamond_pause:
2089 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2091 Cave[y][x] = Yemerald_eB;
2092 Cave[y][x+1] = Yemerald_e;
2093 Next[y][x] = Xblank;
2094 Next[y][x+1] = Xemerald_pause;
2098 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2100 Cave[y][x] = Yemerald_wB;
2101 Cave[y][x-1] = Yemerald_w;
2102 Next[y][x] = Xblank;
2103 Next[y][x-1] = Xemerald_pause;
2109 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2111 Cave[y][x] = Yemerald_wB;
2112 Cave[y][x-1] = Yemerald_w;
2113 Next[y][x] = Xblank;
2114 Next[y][x-1] = Xemerald_pause;
2118 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2120 Cave[y][x] = Yemerald_eB;
2121 Cave[y][x+1] = Yemerald_e;
2122 Next[y][x] = Xblank;
2123 Next[y][x+1] = Xemerald_pause;
2129 if (++lev.shine_cnt > 50)
2131 lev.shine_cnt = RANDOM & 7;
2132 Cave[y][x] = Xemerald_shine;
2139 static void Lemerald_pause(int x, int y)
2141 switch (Cave[y+1][x])
2151 Cave[y][x] = Yemerald_sB;
2152 if (Cave[y][x+1] == Xblank)
2153 Cave[y][x+1] = Xacid_splash_e;
2154 if (Cave[y][x-1] == Xblank)
2155 Cave[y][x-1] = Xacid_splash_w;
2156 Next[y][x] = Xblank;
2157 play_element_sound(x, y, SOUND_acid, Xacid_1);
2161 case Xacid_splash_e:
2162 case Xacid_splash_w:
2163 Cave[y][x] = Yemerald_sB;
2164 Cave[y+1][x] = Yemerald_s;
2165 Next[y][x] = Xblank;
2166 Next[y+1][x] = Xemerald_fall;
2170 Cave[y][x] = Xemerald;
2171 Next[y][x] = Xemerald;
2176 static void Lemerald_fall(int x, int y)
2178 switch (Cave[y+1][x])
2188 Cave[y][x] = Yemerald_sB;
2189 if (Cave[y][x+1] == Xblank)
2190 Cave[y][x+1] = Xacid_splash_e;
2191 if (Cave[y][x-1] == Xblank)
2192 Cave[y][x-1] = Xacid_splash_w;
2193 Next[y][x] = Xblank;
2194 play_element_sound(x, y, SOUND_acid, Xacid_1);
2198 case Xacid_splash_e:
2199 case Xacid_splash_w:
2201 Cave[y][x] = Yemerald_sB;
2202 Cave[y+1][x] = Yemerald_s;
2203 Next[y][x] = Xblank;
2204 Next[y+1][x] = Xemerald_fall;
2208 if (lev.wonderwall_time)
2210 lev.wonderwall_state = 1;
2211 Cave[y][x] = Yemerald_sB;
2212 if (tab_blank[Cave[y+2][x]])
2214 Cave[y+2][x] = Ydiamond_s;
2215 Next[y+2][x] = Xdiamond_fall;
2218 Next[y][x] = Xblank;
2219 play_element_sound(x, y, SOUND_wonderfall, Xwonderwall);
2224 Cave[y][x] = Xemerald;
2225 Next[y][x] = Xemerald;
2226 play_element_sound(x, y, SOUND_diamond, Xemerald);
2231 static void Ldiamond(int x, int y)
2233 switch (Cave[y+1][x])
2243 Cave[y][x] = Ydiamond_sB;
2244 if (Cave[y][x+1] == Xblank)
2245 Cave[y][x+1] = Xacid_splash_e;
2246 if (Cave[y][x-1] == Xblank)
2247 Cave[y][x-1] = Xacid_splash_w;
2248 Next[y][x] = Xblank;
2249 play_element_sound(x, y, SOUND_acid, Xacid_1);
2253 case Xacid_splash_e:
2254 case Xacid_splash_w:
2255 Cave[y][x] = Ydiamond_sB;
2256 Cave[y+1][x] = Ydiamond_s;
2257 Next[y][x] = Xblank;
2258 Next[y+1][x] = Xdiamond_fall;
2277 case Xemerald_pause:
2279 case Xdiamond_pause:
2316 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2318 Cave[y][x] = Ydiamond_eB;
2319 Cave[y][x+1] = Ydiamond_e;
2320 Next[y][x] = Xblank;
2321 Next[y][x+1] = Xdiamond_pause;
2325 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2327 Cave[y][x] = Ydiamond_wB;
2328 Cave[y][x-1] = Ydiamond_w;
2329 Next[y][x] = Xblank;
2330 Next[y][x-1] = Xdiamond_pause;
2336 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2338 Cave[y][x] = Ydiamond_wB;
2339 Cave[y][x-1] = Ydiamond_w;
2340 Next[y][x] = Xblank;
2341 Next[y][x-1] = Xdiamond_pause;
2345 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2347 Cave[y][x] = Ydiamond_eB;
2348 Cave[y][x+1] = Ydiamond_e;
2349 Next[y][x] = Xblank;
2350 Next[y][x+1] = Xdiamond_pause;
2356 if (++lev.shine_cnt > 50)
2358 lev.shine_cnt = RANDOM & 7;
2359 Cave[y][x] = Xdiamond_shine;
2366 static void Ldiamond_pause(int x, int y)
2368 switch (Cave[y+1][x])
2378 Cave[y][x] = Ydiamond_sB;
2379 if (Cave[y][x+1] == Xblank)
2380 Cave[y][x+1] = Xacid_splash_e;
2381 if (Cave[y][x-1] == Xblank)
2382 Cave[y][x-1] = Xacid_splash_w;
2383 Next[y][x] = Xblank;
2384 play_element_sound(x, y, SOUND_acid, Xacid_1);
2388 case Xacid_splash_e:
2389 case Xacid_splash_w:
2390 Cave[y][x] = Ydiamond_sB;
2391 Cave[y+1][x] = Ydiamond_s;
2392 Next[y][x] = Xblank;
2393 Next[y+1][x] = Xdiamond_fall;
2397 Cave[y][x] = Xdiamond;
2398 Next[y][x] = Xdiamond;
2403 static void Ldiamond_fall(int x, int y)
2405 switch (Cave[y+1][x])
2415 Cave[y][x] = Ydiamond_sB;
2416 if (Cave[y][x+1] == Xblank)
2417 Cave[y][x+1] = Xacid_splash_e;
2418 if (Cave[y][x-1] == Xblank)
2419 Cave[y][x-1] = Xacid_splash_w;
2420 Next[y][x] = Xblank;
2421 play_element_sound(x, y, SOUND_acid, Xacid_1);
2425 case Xacid_splash_e:
2426 case Xacid_splash_w:
2428 Cave[y][x] = Ydiamond_sB;
2429 Cave[y+1][x] = Ydiamond_s;
2430 Next[y][x] = Xblank;
2431 Next[y+1][x] = Xdiamond_fall;
2435 if (lev.wonderwall_time)
2437 lev.wonderwall_state = 1;
2438 Cave[y][x] = Ydiamond_sB;
2439 if (tab_blank[Cave[y+2][x]])
2441 Cave[y+2][x] = Ystone_s;
2442 Next[y+2][x] = Xstone_fall;
2445 Next[y][x] = Xblank;
2446 play_element_sound(x, y, SOUND_wonderfall, Xwonderwall);
2451 Cave[y][x] = Xdiamond;
2452 Next[y][x] = Xdiamond;
2453 play_element_sound(x, y, SOUND_diamond, Xdiamond);
2458 static void Lstone(int x, int y)
2460 switch (Cave[y+1][x])
2470 Cave[y][x] = Ystone_sB;
2471 if (Cave[y][x+1] == Xblank)
2472 Cave[y][x+1] = Xacid_splash_e;
2473 if (Cave[y][x-1] == Xblank)
2474 Cave[y][x-1] = Xacid_splash_w;
2475 Next[y][x] = Xblank;
2476 play_element_sound(x, y, SOUND_acid, Xacid_1);
2480 case Xacid_splash_e:
2481 case Xacid_splash_w:
2484 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
2494 Cave[y][x] = Ystone_sB;
2495 Cave[y+1][x] = Ystone_s;
2496 Next[y][x] = Xblank;
2497 Next[y+1][x] = Xstone_fall;
2501 Cave[y][x] = Xsand_stonein_1;
2502 Cave[y+1][x] = Xsand_sandstone_1;
2503 Next[y][x] = Xsand_stonein_2;
2504 Next[y+1][x] = Xsand_sandstone_2;
2523 case Xemerald_pause:
2525 case Xdiamond_pause:
2555 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2557 Cave[y][x] = Ystone_eB;
2558 Cave[y][x+1] = Ystone_e;
2559 Next[y][x] = Xblank;
2560 Next[y][x+1] = Xstone_pause;
2564 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2566 Cave[y][x] = Ystone_wB;
2567 Cave[y][x-1] = Ystone_w;
2568 Next[y][x] = Xblank;
2569 Next[y][x-1] = Xstone_pause;
2575 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2577 Cave[y][x] = Ystone_wB;
2578 Cave[y][x-1] = Ystone_w;
2579 Next[y][x] = Xblank;
2580 Next[y][x-1] = Xstone_pause;
2584 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2586 Cave[y][x] = Ystone_eB;
2587 Cave[y][x+1] = Ystone_e;
2588 Next[y][x] = Xblank;
2589 Next[y][x+1] = Xstone_pause;
2596 static void Lstone_pause(int x, int y)
2598 switch (Cave[y+1][x])
2608 Cave[y][x] = Ystone_sB;
2609 if (Cave[y][x+1] == Xblank)
2610 Cave[y][x+1] = Xacid_splash_e;
2611 if (Cave[y][x-1] == Xblank)
2612 Cave[y][x-1] = Xacid_splash_w;
2613 Next[y][x] = Xblank;
2614 play_element_sound(x, y, SOUND_acid, Xacid_1);
2618 case Xacid_splash_e:
2619 case Xacid_splash_w:
2620 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
2630 Cave[y][x] = Ystone_sB;
2631 Cave[y+1][x] = Ystone_s;
2632 Next[y][x] = Xblank;
2633 Next[y+1][x] = Xstone_fall;
2637 Cave[y][x] = Xstone;
2638 Next[y][x] = Xstone;
2643 static void Lstone_fall(int x, int y)
2645 switch (Cave[y+1][x])
2655 Cave[y][x] = Ystone_sB;
2656 if (Cave[y][x+1] == Xblank)
2657 Cave[y][x+1] = Xacid_splash_e;
2658 if (Cave[y][x-1] == Xblank)
2659 Cave[y][x-1] = Xacid_splash_w;
2660 Next[y][x] = Xblank;
2661 play_element_sound(x, y, SOUND_acid, Xacid_1);
2665 case Xacid_splash_e:
2666 case Xacid_splash_w:
2668 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
2678 Cave[y][x] = Ystone_sB;
2679 Cave[y+1][x] = Ystone_s;
2680 Next[y][x] = Xblank;
2681 Next[y+1][x] = Xstone_fall;
2686 Cave[y+1][x] = Ynut_stone;
2687 Next[y][x] = Xstone;
2688 Next[y+1][x] = Xemerald;
2689 play_element_sound(x, y, SOUND_crack, Xnut);
2690 score += lev.nut_score;
2701 Cave[y][x] = Ystone_sB;
2702 Cave[y+1][x] = Ybug_stone;
2703 Next[y+1][x] = Znormal;
2704 Boom[y][x-1] = Xemerald;
2705 Boom[y][x] = Xemerald;
2706 Boom[y][x+1] = Xemerald;
2707 Boom[y+1][x-1] = Xemerald;
2708 Boom[y+1][x] = Xdiamond;
2709 Boom[y+1][x+1] = Xemerald;
2710 Boom[y+2][x-1] = Xemerald;
2711 Boom[y+2][x] = Xemerald;
2712 Boom[y+2][x+1] = Xemerald;
2713 #if PLAY_ELEMENT_SOUND
2714 play_element_sound(x, y, SOUND_boom, Xstone_fall);
2716 score += lev.bug_score;
2727 Cave[y][x] = Ystone_sB;
2728 Cave[y+1][x] = Ytank_stone;
2729 Next[y+1][x] = Znormal;
2730 Boom[y][x-1] = Xblank;
2731 Boom[y][x] = Xblank;
2732 Boom[y][x+1] = Xblank;
2733 Boom[y+1][x-1] = Xblank;
2734 Boom[y+1][x] = Xblank;
2735 Boom[y+1][x+1] = Xblank;
2736 Boom[y+2][x-1] = Xblank;
2737 Boom[y+2][x] = Xblank;
2738 Boom[y+2][x+1] = Xblank;
2739 #if PLAY_ELEMENT_SOUND
2740 play_element_sound(x, y, SOUND_boom, Xstone_fall);
2742 score += lev.tank_score;
2748 switch (Cave[y+1][x+1])
2751 case Xacid_splash_e:
2752 case Xacid_splash_w:
2755 Cave[y+1][x] = Xspring_e;
2759 Cave[y+1][x] = Xspring_w;
2765 switch (Cave[y+1][x-1])
2768 case Xacid_splash_e:
2769 case Xacid_splash_w:
2772 Cave[y+1][x] = Xspring_w;
2775 Cave[y+1][x] = Xspring_e;
2780 Next[y][x] = Xstone;
2787 Cave[y][x] = Ystone_sB;
2788 Cave[y+1][x] = Yeater_stone;
2789 Next[y+1][x] = Znormal;
2790 Boom[y][x-1] = lev.eater_array[lev.eater_pos][0];
2791 Boom[y][x] = lev.eater_array[lev.eater_pos][1];
2792 Boom[y][x+1] = lev.eater_array[lev.eater_pos][2];
2793 Boom[y+1][x-1] = lev.eater_array[lev.eater_pos][3];
2794 Boom[y+1][x] = lev.eater_array[lev.eater_pos][4];
2795 Boom[y+1][x+1] = lev.eater_array[lev.eater_pos][5];
2796 Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
2797 Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
2798 Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
2799 #if PLAY_ELEMENT_SOUND
2800 play_element_sound(x, y, SOUND_boom, Xstone_fall);
2802 lev.eater_pos = (lev.eater_pos + 1) & 7;
2803 score += lev.eater_score;
2808 Cave[y][x] = Ystone_sB;
2809 Cave[y+1][x] = Yalien_stone;
2810 Next[y+1][x] = Znormal;
2811 Boom[y][x-1] = Xblank;
2812 Boom[y][x] = Xblank;
2813 Boom[y][x+1] = Xblank;
2814 Boom[y+1][x-1] = Xblank;
2815 Boom[y+1][x] = Xblank;
2816 Boom[y+1][x+1] = Xblank;
2817 Boom[y+2][x-1] = Xblank;
2818 Boom[y+2][x] = Xblank;
2819 Boom[y+2][x+1] = Xblank;
2820 #if PLAY_ELEMENT_SOUND
2821 play_element_sound(x, y, SOUND_boom, Xstone_fall);
2823 score += lev.alien_score;
2827 case Xdiamond_pause:
2828 switch (Cave[y+2][x])
2831 case Xacid_splash_e:
2832 case Xacid_splash_w:
2876 Next[y][x] = Xstone;
2877 play_element_sound(x, y, SOUND_stone, Xstone);
2881 Cave[y][x] = Ystone_sB;
2882 Cave[y+1][x] = Ydiamond_stone;
2883 Next[y][x] = Xblank;
2884 Next[y+1][x] = Xstone_pause;
2885 play_element_sound(x, y, SOUND_squash, Xdiamond);
2890 Cave[y+1][x] = Ybomb_blank;
2891 Next[y+1][x] = Znormal;
2892 Boom[y][x-1] = Xblank;
2893 Boom[y][x] = Xblank;
2894 Boom[y][x+1] = Xblank;
2895 Boom[y+1][x-1] = Xblank;
2896 Boom[y+1][x] = Xblank;
2897 Boom[y+1][x+1] = Xblank;
2898 Boom[y+2][x-1] = Xblank;
2899 Boom[y+2][x] = Xblank;
2900 Boom[y+2][x+1] = Xblank;
2901 #if PLAY_ELEMENT_SOUND
2902 play_element_sound(x, y, SOUND_boom, Xstone_fall);
2907 if (lev.wonderwall_time)
2909 lev.wonderwall_state = 1;
2910 Cave[y][x] = Ystone_sB;
2912 if (tab_blank[Cave[y+2][x]])
2914 Cave[y+2][x] = Yemerald_s;
2915 Next[y+2][x] = Xemerald_fall;
2918 Next[y][x] = Xblank;
2919 play_element_sound(x, y, SOUND_wonderfall, Xwonderwall);
2924 Cave[y][x] = Xstone;
2925 Next[y][x] = Xstone;
2926 play_element_sound(x, y, SOUND_stone, Xstone);
2931 static void Lbomb(int x, int y)
2933 switch (Cave[y+1][x])
2943 Cave[y][x] = Ybomb_sB;
2944 if (Cave[y][x+1] == Xblank)
2945 Cave[y][x+1] = Xacid_splash_e;
2946 if (Cave[y][x-1] == Xblank)
2947 Cave[y][x-1] = Xacid_splash_w;
2948 Next[y][x] = Xblank;
2949 play_element_sound(x, y, SOUND_acid, Xacid_1);
2953 case Xacid_splash_e:
2954 case Xacid_splash_w:
2955 Cave[y][x] = Ybomb_sB;
2956 Cave[y+1][x] = Ybomb_s;
2957 Next[y][x] = Xblank;
2958 Next[y+1][x] = Xbomb_fall;
2977 case Xemerald_pause:
2979 case Xdiamond_pause:
3007 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3009 Cave[y][x] = Ybomb_eB;
3010 Cave[y][x+1] = Ybomb_e;
3011 Next[y][x] = Xblank;
3012 Next[y][x+1] = Xbomb_pause;
3016 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3018 Cave[y][x] = Ybomb_wB;
3019 Cave[y][x-1] = Ybomb_w;
3020 Next[y][x] = Xblank;
3021 Next[y][x-1] = Xbomb_pause;
3027 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3029 Cave[y][x] = Ybomb_wB;
3030 Cave[y][x-1] = Ybomb_w;
3031 Next[y][x] = Xblank;
3032 Next[y][x-1] = Xbomb_pause;
3036 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3038 Cave[y][x] = Ybomb_eB;
3039 Cave[y][x+1] = Ybomb_e;
3040 Next[y][x] = Xblank;
3041 Next[y][x+1] = Xbomb_pause;
3048 static void Lbomb_pause(int x, int y)
3050 switch (Cave[y+1][x])
3060 Cave[y][x] = Ybomb_sB;
3061 if (Cave[y][x+1] == Xblank)
3062 Cave[y][x+1] = Xacid_splash_e;
3063 if (Cave[y][x-1] == Xblank)
3064 Cave[y][x-1] = Xacid_splash_w;
3065 Next[y][x] = Xblank;
3066 play_element_sound(x, y, SOUND_acid, Xacid_1);
3070 case Xacid_splash_e:
3071 case Xacid_splash_w:
3072 Cave[y][x] = Ybomb_sB;
3073 Cave[y+1][x] = Ybomb_s;
3074 Next[y][x] = Xblank;
3075 Next[y+1][x] = Xbomb_fall;
3085 static void Lbomb_fall(int x, int y)
3087 switch (Cave[y+1][x])
3097 Cave[y][x] = Ybomb_sB;
3098 if (Cave[y][x+1] == Xblank)
3099 Cave[y][x+1] = Xacid_splash_e;
3100 if (Cave[y][x-1] == Xblank)
3101 Cave[y][x-1] = Xacid_splash_w;
3102 Next[y][x] = Xblank;
3103 play_element_sound(x, y, SOUND_acid, Xacid_1);
3107 case Xacid_splash_e:
3108 case Xacid_splash_w:
3109 Cave[y][x] = Ybomb_sB;
3110 Cave[y+1][x] = Ybomb_s;
3111 Next[y][x] = Xblank;
3112 Next[y+1][x] = Xbomb_fall;
3116 Cave[y][x] = Ybomb_blank;
3117 Next[y][x] = Znormal;
3118 Boom[y-1][x-1] = Xblank;
3119 Boom[y-1][x] = Xblank;
3120 Boom[y-1][x+1] = Xblank;
3121 Boom[y][x-1] = Xblank;
3122 Boom[y][x] = Xblank;
3123 Boom[y][x+1] = Xblank;
3124 Boom[y+1][x-1] = Xblank;
3125 Boom[y+1][x] = Xblank;
3126 Boom[y+1][x+1] = Xblank;
3127 #if PLAY_ELEMENT_SOUND
3128 play_element_sound(x, y, SOUND_boom, Xbomb_fall);
3134 static void Lnut(int x, int y)
3136 switch (Cave[y+1][x])
3146 Cave[y][x] = Ynut_sB;
3147 if (Cave[y][x+1] == Xblank)
3148 Cave[y][x+1] = Xacid_splash_e;
3149 if (Cave[y][x-1] == Xblank)
3150 Cave[y][x-1] = Xacid_splash_w;
3151 Next[y][x] = Xblank;
3152 play_element_sound(x, y, SOUND_acid, Xacid_1);
3156 case Xacid_splash_e:
3157 case Xacid_splash_w:
3158 Cave[y][x] = Ynut_sB;
3159 Cave[y+1][x] = Ynut_s;
3160 Next[y][x] = Xblank;
3161 Next[y+1][x] = Xnut_fall;
3180 case Xemerald_pause:
3182 case Xdiamond_pause:
3210 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3212 Cave[y][x] = Ynut_eB;
3213 Cave[y][x+1] = Ynut_e;
3214 Next[y][x] = Xblank;
3215 Next[y][x+1] = Xnut_pause;
3219 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3221 Cave[y][x] = Ynut_wB;
3222 Cave[y][x-1] = Ynut_w;
3223 Next[y][x] = Xblank;
3224 Next[y][x-1] = Xnut_pause;
3230 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3232 Cave[y][x] = Ynut_wB;
3233 Cave[y][x-1] = Ynut_w;
3234 Next[y][x] = Xblank;
3235 Next[y][x-1] = Xnut_pause;
3239 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3241 Cave[y][x] = Ynut_eB;
3242 Cave[y][x+1] = Ynut_e;
3243 Next[y][x] = Xblank;
3244 Next[y][x+1] = Xnut_pause;
3251 static void Lnut_pause(int x, int y)
3253 switch (Cave[y+1][x])
3263 Cave[y][x] = Ynut_sB;
3264 if (Cave[y][x+1] == Xblank)
3265 Cave[y][x+1] = Xacid_splash_e;
3266 if (Cave[y][x-1] == Xblank)
3267 Cave[y][x-1] = Xacid_splash_w;
3268 Next[y][x] = Xblank;
3269 play_element_sound(x, y, SOUND_acid, Xacid_1);
3273 case Xacid_splash_e:
3274 case Xacid_splash_w:
3275 Cave[y][x] = Ynut_sB;
3276 Cave[y+1][x] = Ynut_s;
3277 Next[y][x] = Xblank;
3278 Next[y+1][x] = Xnut_fall;
3288 static void Lnut_fall(int x, int y)
3290 switch (Cave[y+1][x])
3300 Cave[y][x] = Ynut_sB;
3301 if (Cave[y][x+1] == Xblank)
3302 Cave[y][x+1] = Xacid_splash_e;
3303 if (Cave[y][x-1] == Xblank)
3304 Cave[y][x-1] = Xacid_splash_w;
3305 Next[y][x] = Xblank;
3306 play_element_sound(x, y, SOUND_acid, Xacid_1);
3310 case Xacid_splash_e:
3311 case Xacid_splash_w:
3313 Cave[y][x] = Ynut_sB;
3314 Cave[y+1][x] = Ynut_s;
3315 Next[y][x] = Xblank;
3316 Next[y+1][x] = Xnut_fall;
3322 play_element_sound(x, y, SOUND_nut, Xnut);
3327 static void Lspring(int x, int y)
3329 switch (Cave[y+1][x])
3339 Cave[y][x] = Yspring_sB;
3340 if (Cave[y][x+1] == Xblank)
3341 Cave[y][x+1] = Xacid_splash_e;
3342 if (Cave[y][x-1] == Xblank)
3343 Cave[y][x-1] = Xacid_splash_w;
3344 Next[y][x] = Xblank;
3345 play_element_sound(x, y, SOUND_acid, Xacid_1);
3349 case Xacid_splash_e:
3350 case Xacid_splash_w:
3353 Cave[y][x] = Yspring_sB;
3354 Cave[y+1][x] = Yspring_s;
3355 Next[y][x] = Xblank;
3356 Next[y+1][x] = Xspring_fall;
3375 case Xemerald_pause:
3377 case Xdiamond_pause:
3405 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3407 Cave[y][x] = Yspring_eB;
3408 Cave[y][x+1] = Yspring_e;
3409 if (Cave[y+1][x] == Xbumper)
3410 Cave[y+1][x] = XbumperB;
3411 Next[y][x] = Xblank;
3414 Next[y][x+1] = Xspring_e;
3416 Next[y][x+1] = Xspring_pause;
3421 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3423 Cave[y][x] = Yspring_wB;
3424 Cave[y][x-1] = Yspring_w;
3425 if (Cave[y+1][x] == Xbumper)
3426 Cave[y+1][x] = XbumperB;
3427 Next[y][x] = Xblank;
3430 Next[y][x-1] = Xspring_w;
3432 Next[y][x-1] = Xspring_pause;
3439 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3441 Cave[y][x] = Yspring_wB;
3442 Cave[y][x-1] = Yspring_w;
3443 if (Cave[y+1][x] == Xbumper)
3444 Cave[y+1][x] = XbumperB;
3445 Next[y][x] = Xblank;
3448 Next[y][x-1] = Xspring_w;
3450 Next[y][x-1] = Xspring_pause;
3455 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3457 Cave[y][x] = Yspring_eB;
3458 Cave[y][x+1] = Yspring_e;
3459 if (Cave[y+1][x] == Xbumper)
3460 Cave[y+1][x] = XbumperB;
3461 Next[y][x] = Xblank;
3464 Next[y][x+1] = Xspring_e;
3466 Next[y][x+1] = Xspring_pause;
3474 static void Lspring_pause(int x, int y)
3476 switch (Cave[y+1][x])
3486 Cave[y][x] = Yspring_sB;
3487 if (Cave[y][x+1] == Xblank)
3488 Cave[y][x+1] = Xacid_splash_e;
3489 if (Cave[y][x-1] == Xblank)
3490 Cave[y][x-1] = Xacid_splash_w;
3491 Next[y][x] = Xblank;
3492 play_element_sound(x, y, SOUND_acid, Xacid_1);
3496 case Xacid_splash_e:
3497 case Xacid_splash_w:
3498 Cave[y][x] = Yspring_sB;
3499 Cave[y+1][x] = Yspring_s;
3500 Next[y][x] = Xblank;
3501 Next[y+1][x] = Xspring_fall;
3505 Cave[y][x] = Xspring;
3506 Next[y][x] = Xspring;
3511 static void Lspring_e(int x, int y)
3513 switch (Cave[y+1][x])
3523 Cave[y][x] = Yspring_sB;
3524 if (Cave[y][x+1] == Xblank)
3525 Cave[y][x+1] = Xacid_splash_e;
3526 if (Cave[y][x-1] == Xblank)
3527 Cave[y][x-1] = Xacid_splash_w;
3528 Next[y][x] = Xblank;
3529 play_element_sound(x, y, SOUND_acid, Xacid_1);
3533 case Xacid_splash_e:
3534 case Xacid_splash_w:
3535 Cave[y][x] = Yspring_sB;
3536 Cave[y+1][x] = Yspring_s;
3537 Next[y][x] = Xblank;
3538 Next[y+1][x] = Xspring_fall;
3542 Cave[y+1][x] = XbumperB;
3545 switch (Cave[y][x+1])
3555 Cave[y][x] = Yspring_eB;
3556 if (Cave[y-1][x+2] == Xblank)
3557 Cave[y-1][x+2] = Xacid_splash_e;
3558 if (Cave[y-1][x] == Xblank)
3559 Cave[y-1][x] = Xacid_splash_w;
3560 Next[y][x] = Xblank;
3561 play_element_sound(x, y, SOUND_acid, Xacid_1);
3565 case Xacid_splash_e:
3566 case Xacid_splash_w:
3571 Cave[y][x] = Yspring_eB;
3572 Cave[y][x+1] = Yspring_e;
3573 Next[y][x] = Xblank;
3574 Next[y][x+1] = Xspring_e;
3583 Cave[y][x] = Yspring_alien_eB;
3584 Cave[y][x+1] = Yspring_alien_e;
3585 Next[y][x] = Xblank;
3586 Next[y][x+1] = Xspring_e;
3587 play_element_sound(x, y, SOUND_slurp, Xalien);
3588 score += lev.slurp_score;
3593 Cave[y][x+1] = XbumperB;
3594 Next[y][x] = Xspring_w;
3595 play_element_sound(x, y, SOUND_spring, Xspring);
3599 Cave[y][x] = Xspring;
3600 Next[y][x] = Xspring;
3601 play_element_sound(x, y, SOUND_spring, Xspring);
3606 static void Lspring_w(int x, int y)
3608 switch (Cave[y+1][x])
3618 Cave[y][x] = Yspring_sB;
3619 if (Cave[y][x+1] == Xblank)
3620 Cave[y][x+1] = Xacid_splash_e;
3621 if (Cave[y][x-1] == Xblank)
3622 Cave[y][x-1] = Xacid_splash_w;
3623 Next[y][x] = Xblank;
3624 play_element_sound(x, y, SOUND_acid, Xacid_1);
3628 case Xacid_splash_e:
3629 case Xacid_splash_w:
3630 Cave[y][x] = Yspring_sB;
3631 Cave[y+1][x] = Yspring_s;
3632 Next[y][x] = Xblank;
3633 Next[y+1][x] = Xspring_fall;
3637 Cave[y+1][x] = XbumperB;
3640 switch (Cave[y][x-1])
3650 Cave[y][x] = Yspring_wB;
3651 if (Cave[y-1][x] == Xblank)
3652 Cave[y-1][x] = Xacid_splash_e;
3653 if (Cave[y-1][x-2] == Xblank)
3654 Cave[y-1][x-2] = Xacid_splash_w;
3655 Next[y][x] = Xblank;
3656 play_element_sound(x, y, SOUND_acid, Xacid_1);
3660 case Xacid_splash_e:
3661 case Xacid_splash_w:
3666 Cave[y][x] = Yspring_wB;
3667 Cave[y][x-1] = Yspring_w;
3668 Next[y][x] = Xblank;
3669 Next[y][x-1] = Xspring_w;
3678 Cave[y][x] = Yspring_alien_wB;
3679 Cave[y][x-1] = Yspring_alien_w;
3680 Next[y][x] = Xblank;
3681 Next[y][x-1] = Xspring_w;
3682 play_element_sound(x, y, SOUND_slurp, Xalien);
3683 score += lev.slurp_score;
3688 Cave[y][x-1] = XbumperB;
3689 Next[y][x] = Xspring_e;
3690 play_element_sound(x, y, SOUND_spring, Xspring);
3694 Cave[y][x] = Xspring;
3695 Next[y][x] = Xspring;
3696 play_element_sound(x, y, SOUND_spring, Xspring);
3701 static void Lspring_fall(int x, int y)
3703 switch (Cave[y+1][x])
3713 Cave[y][x] = Yspring_sB;
3714 if (Cave[y][x+1] == Xblank)
3715 Cave[y][x+1] = Xacid_splash_e;
3716 if (Cave[y][x-1] == Xblank)
3717 Cave[y][x-1] = Xacid_splash_w;
3718 Next[y][x] = Xblank;
3719 play_element_sound(x, y, SOUND_acid, Xacid_1);
3723 case Xacid_splash_e:
3724 case Xacid_splash_w:
3726 Cave[y][x] = Yspring_sB;
3727 Cave[y+1][x] = Yspring_s;
3728 Next[y][x] = Xblank;
3729 Next[y+1][x] = Xspring_fall;
3734 Cave[y+1][x] = Ybomb_blank;
3735 Next[y+1][x] = Znormal;
3736 Boom[y][x-1] = Xblank;
3737 Boom[y][x] = Xblank;
3738 Boom[y][x+1] = Xblank;
3739 Boom[y+1][x-1] = Xblank;
3740 Boom[y+1][x] = Xblank;
3741 Boom[y+1][x+1] = Xblank;
3742 Boom[y+2][x-1] = Xblank;
3743 Boom[y+2][x] = Xblank;
3744 Boom[y+2][x+1] = Xblank;
3745 #if PLAY_ELEMENT_SOUND
3746 play_element_sound(x, y, SOUND_boom, Xspring_fall);
3758 Cave[y][x] = Yspring_sB;
3759 Cave[y+1][x] = Ybug_spring;
3760 Next[y+1][x] = Znormal;
3761 Boom[y][x-1] = Xemerald;
3762 Boom[y][x] = Xemerald;
3763 Boom[y][x+1] = Xemerald;
3764 Boom[y+1][x-1] = Xemerald;
3765 Boom[y+1][x] = Xdiamond;
3766 Boom[y+1][x+1] = Xemerald;
3767 Boom[y+2][x-1] = Xemerald;
3768 Boom[y+2][x] = Xemerald;
3769 Boom[y+2][x+1] = Xemerald;
3770 #if PLAY_ELEMENT_SOUND
3771 play_element_sound(x, y, SOUND_boom, Xspring_fall);
3773 score += lev.bug_score;
3784 Cave[y][x] = Yspring_sB;
3785 Cave[y+1][x] = Ytank_spring;
3786 Next[y+1][x] = Znormal;
3787 Boom[y][x-1] = Xblank;
3788 Boom[y][x] = Xblank;
3789 Boom[y][x+1] = Xblank;
3790 Boom[y+1][x-1] = Xblank;
3791 Boom[y+1][x] = Xblank;
3792 Boom[y+1][x+1] = Xblank;
3793 Boom[y+2][x-1] = Xblank;
3794 Boom[y+2][x] = Xblank;
3795 Boom[y+2][x+1] = Xblank;
3796 #if PLAY_ELEMENT_SOUND
3797 play_element_sound(x, y, SOUND_boom, Xspring_fall);
3799 score += lev.tank_score;
3806 Cave[y][x] = Yspring_sB;
3807 Cave[y+1][x] = Yeater_spring;
3808 Next[y+1][x] = Znormal;
3809 Boom[y][x-1] = lev.eater_array[lev.eater_pos][0];
3810 Boom[y][x] = lev.eater_array[lev.eater_pos][1];
3811 Boom[y][x+1] = lev.eater_array[lev.eater_pos][2];
3812 Boom[y+1][x-1] = lev.eater_array[lev.eater_pos][3];
3813 Boom[y+1][x] = lev.eater_array[lev.eater_pos][4];
3814 Boom[y+1][x+1] = lev.eater_array[lev.eater_pos][5];
3815 Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
3816 Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
3817 Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
3818 #if PLAY_ELEMENT_SOUND
3819 play_element_sound(x, y, SOUND_boom, Xspring_fall);
3821 lev.eater_pos = (lev.eater_pos + 1) & 7;
3822 score += lev.eater_score;
3827 Cave[y][x] = Yspring_sB;
3828 Cave[y+1][x] = Yalien_spring;
3829 Next[y+1][x] = Znormal;
3830 Boom[y][x-1] = Xblank;
3831 Boom[y][x] = Xblank;
3832 Boom[y][x+1] = Xblank;
3833 Boom[y+1][x-1] = Xblank;
3834 Boom[y+1][x] = Xblank;
3835 Boom[y+1][x+1] = Xblank;
3836 Boom[y+2][x-1] = Xblank;
3837 Boom[y+2][x] = Xblank;
3838 Boom[y+2][x+1] = Xblank;
3839 #if PLAY_ELEMENT_SOUND
3840 play_element_sound(x, y, SOUND_boom, Xspring_fall);
3842 score += lev.alien_score;
3846 Cave[y][x] = Xspring;
3847 Next[y][x] = Xspring;
3848 play_element_sound(x, y, SOUND_spring, Xspring);
3853 static void Lpush_emerald_e(int x, int y)
3855 switch (Cave[y][x+1])
3865 Cave[y][x] = Xemerald;
3866 Next[y][x] = Xemerald;
3870 Cave[y][x] = Yemerald_eB;
3871 Cave[y][x+1] = Yemerald_e;
3872 Next[y][x] = Xblank;
3873 Next[y][x+1] = Xemerald_pause;
3878 static void Lpush_emerald_w(int x, int y)
3880 switch (Cave[y][x-1])
3890 Cave[y][x] = Xemerald;
3891 Next[y][x] = Xemerald;
3895 Cave[y][x] = Yemerald_wB;
3896 Cave[y][x-1] = Yemerald_w;
3897 Next[y][x] = Xblank;
3898 Next[y][x-1] = Xemerald_pause;
3903 static void Lpush_diamond_e(int x, int y)
3905 switch (Cave[y][x+1])
3915 Cave[y][x] = Xdiamond;
3916 Next[y][x] = Xdiamond;
3920 Cave[y][x] = Ydiamond_eB;
3921 Cave[y][x+1] = Ydiamond_e;
3922 Next[y][x] = Xblank;
3923 Next[y][x+1] = Xdiamond_pause;
3928 static void Lpush_diamond_w(int x, int y)
3930 switch (Cave[y][x-1])
3940 Cave[y][x] = Xdiamond;
3941 Next[y][x] = Xdiamond;
3945 Cave[y][x] = Ydiamond_wB;
3946 Cave[y][x-1] = Ydiamond_w;
3947 Next[y][x] = Xblank;
3948 Next[y][x-1] = Xdiamond_pause;
3953 static void Lpush_stone_e(int x, int y)
3955 switch (Cave[y][x+1])
3965 Cave[y][x] = Xstone;
3966 Next[y][x] = Xstone;
3970 Cave[y][x] = Ystone_eB;
3971 Cave[y][x+1] = Ystone_e;
3972 Next[y][x] = Xblank;
3973 Next[y][x+1] = Xstone_pause;
3978 static void Lpush_stone_w(int x, int y)
3980 switch (Cave[y][x-1])
3990 Cave[y][x] = Xstone;
3991 Next[y][x] = Xstone;
3995 Cave[y][x] = Ystone_wB;
3996 Cave[y][x-1] = Ystone_w;
3997 Next[y][x] = Xblank;
3998 Next[y][x-1] = Xstone_pause;
4003 static void Lpush_bomb_e(int x, int y)
4005 switch (Cave[y][x+1])
4020 Cave[y][x] = Ybomb_eB;
4021 Cave[y][x+1] = Ybomb_e;
4022 Next[y][x] = Xblank;
4023 Next[y][x+1] = Xbomb_pause;
4028 static void Lpush_bomb_w(int x, int y)
4030 switch (Cave[y][x-1])
4045 Cave[y][x] = Ybomb_wB;
4046 Cave[y][x-1] = Ybomb_w;
4047 Next[y][x] = Xblank;
4048 Next[y][x-1] = Xbomb_pause;
4053 static void Lpush_nut_e(int x, int y)
4055 switch (Cave[y][x+1])
4070 Cave[y][x] = Ynut_eB;
4071 Cave[y][x+1] = Ynut_e;
4072 Next[y][x] = Xblank;
4073 Next[y][x+1] = Xnut_pause;
4078 static void Lpush_nut_w(int x, int y)
4080 switch (Cave[y][x-1])
4095 Cave[y][x] = Ynut_wB;
4096 Cave[y][x-1] = Ynut_w;
4097 Next[y][x] = Xblank;
4098 Next[y][x-1] = Xnut_pause;
4103 static void Lpush_spring_e(int x, int y)
4105 switch (Cave[y][x+1])
4115 Cave[y][x] = Xspring;
4116 Next[y][x] = Xspring;
4120 Cave[y][x] = Yspring_eB;
4121 Cave[y][x+1] = Yspring_e;
4122 Next[y][x] = Xblank;
4123 Next[y][x+1] = Xspring_e;
4128 static void Lpush_spring_w(int x, int y)
4130 switch (Cave[y][x-1])
4140 Cave[y][x] = Xspring;
4141 Next[y][x] = Xspring;
4145 Cave[y][x] = Yspring_wB;
4146 Cave[y][x-1] = Yspring_w;
4147 Next[y][x] = Xblank;
4148 Next[y][x-1] = Xspring_w;
4153 static void Lballoon(int x, int y)
4155 if (lev.wind_cnt == 0)
4158 switch (lev.wind_direction)
4161 switch (Cave[y-1][x])
4171 Cave[y][x] = Yballoon_nB;
4172 if (Cave[y-2][x+1] == Xblank)
4173 Cave[y-2][x+1] = Xacid_splash_e;
4174 if (Cave[y-2][x-1] == Xblank)
4175 Cave[y-2][x-1] = Xacid_splash_w;
4176 Next[y][x] = Xblank;
4177 play_element_sound(x, y, SOUND_acid, Xacid_1);
4181 case Xacid_splash_e:
4182 case Xacid_splash_w:
4183 Cave[y][x] = Yballoon_nB;
4184 Cave[y-1][x] = Yballoon_n;
4185 Next[y][x] = Xblank;
4186 Next[y-1][x] = Xballoon;
4192 switch (Cave[y][x+1])
4202 Cave[y][x] = Yballoon_eB;
4203 if (Cave[y-1][x+2] == Xblank)
4204 Cave[y-1][x+2] = Xacid_splash_e;
4205 if (Cave[y-1][x] == Xblank)
4206 Cave[y-1][x] = Xacid_splash_w;
4207 Next[y][x] = Xblank;
4208 play_element_sound(x, y, SOUND_acid, Xacid_1);
4212 case Xacid_splash_e:
4213 case Xacid_splash_w:
4214 Cave[y][x] = Yballoon_eB;
4215 Cave[y][x+1] = Yballoon_e;
4216 Next[y][x] = Xblank;
4217 Next[y][x+1] = Xballoon;
4223 switch (Cave[y+1][x])
4233 Cave[y][x] = Yballoon_sB;
4234 if (Cave[y][x+1] == Xblank)
4235 Cave[y][x+1] = Xacid_splash_e;
4236 if (Cave[y][x-1] == Xblank)
4237 Cave[y][x-1] = Xacid_splash_w;
4238 Next[y][x] = Xblank;
4239 play_element_sound(x, y, SOUND_acid, Xacid_1);
4243 case Xacid_splash_e:
4244 case Xacid_splash_w:
4245 Cave[y][x] = Yballoon_sB;
4246 Cave[y+1][x] = Yballoon_s;
4247 Next[y][x] = Xblank;
4248 Next[y+1][x] = Xballoon;
4254 switch (Cave[y][x-1])
4264 Cave[y][x] = Yballoon_wB;
4265 if (Cave[y-1][x] == Xblank)
4266 Cave[y-1][x] = Xacid_splash_e;
4267 if (Cave[y-1][x-2] == Xblank)
4268 Cave[y-1][x-2] = Xacid_splash_w;
4269 Next[y][x] = Xblank;
4270 play_element_sound(x, y, SOUND_acid, Xacid_1);
4274 case Xacid_splash_e:
4275 case Xacid_splash_w:
4276 Cave[y][x] = Yballoon_wB;
4277 Cave[y][x-1] = Yballoon_w;
4278 Next[y][x] = Xblank;
4279 Next[y][x-1] = Xballoon;
4286 static void Lball_common(int x, int y)
4288 play_element_sound(x, y, SOUND_ball, Xball_1);
4290 if (lev.ball_random)
4295 if (lev.ball_array[lev.ball_pos][0] != Xblank &&
4296 tab_blank[Cave[y-1][x-1]])
4298 Cave[y-1][x-1] = Yball_blank;
4299 Next[y-1][x-1] = lev.ball_array[lev.ball_pos][0];
4304 if (lev.ball_array[lev.ball_pos][1] != Xblank &&
4305 tab_blank[Cave[y-1][x]])
4307 Cave[y-1][x] = Yball_blank;
4308 Next[y-1][x] = lev.ball_array[lev.ball_pos][1];
4313 if (lev.ball_array[lev.ball_pos][2] != Xblank &&
4314 tab_blank[Cave[y-1][x+1]])
4316 Cave[y-1][x+1] = Yball_blank;
4317 Next[y-1][x+1] = lev.ball_array[lev.ball_pos][2];
4322 if (lev.ball_array[lev.ball_pos][3] != Xblank &&
4323 tab_blank[Cave[y][x-1]])
4325 Cave[y][x-1] = Yball_blank;
4326 Next[y][x-1] = lev.ball_array[lev.ball_pos][3];
4331 if (lev.ball_array[lev.ball_pos][4] != Xblank &&
4332 tab_blank[Cave[y][x+1]])
4334 Cave[y][x+1] = Yball_blank;
4335 Next[y][x+1] = lev.ball_array[lev.ball_pos][4];
4340 if (lev.ball_array[lev.ball_pos][5] != Xblank &&
4341 tab_blank[Cave[y+1][x-1]])
4343 Cave[y+1][x-1] = Yball_blank;
4344 Next[y+1][x-1] = lev.ball_array[lev.ball_pos][5];
4349 if (lev.ball_array[lev.ball_pos][6] != Xblank &&
4350 tab_blank[Cave[y+1][x]])
4352 Cave[y+1][x] = Yball_blank;
4353 Next[y+1][x] = lev.ball_array[lev.ball_pos][6];
4358 if (lev.ball_array[lev.ball_pos][7] != Xblank &&
4359 tab_blank[Cave[y+1][x+1]])
4361 Cave[y+1][x+1] = Yball_blank;
4362 Next[y+1][x+1] = lev.ball_array[lev.ball_pos][7];
4369 if (lev.ball_array[lev.ball_pos][0] != Xblank &&
4370 tab_blank[Cave[y-1][x-1]])
4372 Cave[y-1][x-1] = Yball_blank;
4373 Next[y-1][x-1] = lev.ball_array[lev.ball_pos][0];
4376 if (lev.ball_array[lev.ball_pos][1] != Xblank &&
4377 tab_blank[Cave[y-1][x]])
4379 Cave[y-1][x] = Yball_blank;
4380 Next[y-1][x] = lev.ball_array[lev.ball_pos][1];
4383 if (lev.ball_array[lev.ball_pos][2] != Xblank &&
4384 tab_blank[Cave[y-1][x+1]])
4386 Cave[y-1][x+1] = Yball_blank;
4387 Next[y-1][x+1] = lev.ball_array[lev.ball_pos][2];
4390 if (lev.ball_array[lev.ball_pos][3] != Xblank &&
4391 tab_blank[Cave[y][x-1]])
4393 Cave[y][x-1] = Yball_blank;
4394 Next[y][x-1] = lev.ball_array[lev.ball_pos][3];
4397 if (lev.ball_array[lev.ball_pos][4] != Xblank &&
4398 tab_blank[Cave[y][x+1]])
4400 Cave[y][x+1] = Yball_blank;
4401 Next[y][x+1] = lev.ball_array[lev.ball_pos][4];
4404 if (lev.ball_array[lev.ball_pos][5] != Xblank &&
4405 tab_blank[Cave[y+1][x-1]])
4407 Cave[y+1][x-1] = Yball_blank;
4408 Next[y+1][x-1] = lev.ball_array[lev.ball_pos][5];
4411 if (lev.ball_array[lev.ball_pos][6] != Xblank &&
4412 tab_blank[Cave[y+1][x]])
4414 Cave[y+1][x] = Yball_blank;
4415 Next[y+1][x] = lev.ball_array[lev.ball_pos][6];
4418 if (lev.ball_array[lev.ball_pos][7] != Xblank &&
4419 tab_blank[Cave[y+1][x+1]])
4421 Cave[y+1][x+1] = Yball_blank;
4422 Next[y+1][x+1] = lev.ball_array[lev.ball_pos][7];
4426 lev.ball_pos = (lev.ball_pos + 1) % lev.num_ball_arrays;
4429 static void Lball_1(int x, int y)
4431 if (lev.ball_state == 0)
4434 Cave[y][x] = Yball_1;
4435 Next[y][x] = Xball_2;
4442 static void Lball_2(int x, int y)
4444 if (lev.ball_state == 0)
4447 Cave[y][x] = Yball_2;
4448 Next[y][x] = Xball_1;
4455 static void Ldrip(int x, int y)
4457 Next[y][x] = Xdrip_fall;
4460 static void Ldrip_fall(int x, int y)
4464 switch (Cave[y+1][x])
4474 Cave[y][x] = Ydrip_1_sB;
4475 if (Cave[y][x+1] == Xblank)
4476 Cave[y][x+1] = Xacid_splash_e;
4477 if (Cave[y][x-1] == Xblank)
4478 Cave[y][x-1] = Xacid_splash_w;
4479 Next[y][x] = Xdrip_stretchB;
4480 play_element_sound(x, y, SOUND_acid, Xacid_1);
4484 case Xacid_splash_e:
4485 case Xacid_splash_w:
4489 Cave[y][x] = Ydrip_1_sB;
4490 Cave[y+1][x] = Ydrip_1_s;
4491 Next[y][x] = Xdrip_stretchB;
4492 Next[y+1][x] = Xdrip_stretch;
4533 play_element_sound(x, y, SOUND_drip, Xdrip_fall);
4538 static void Ldrip_stretch(int x, int y)
4540 Cave[y][x] = Ydrip_2_s;
4541 Next[y][x] = Xdrip_fall;
4544 static void Ldrip_stretchB(int x, int y)
4546 Cave[y][x] = Ydrip_2_sB;
4547 Next[y][x] = Xblank;
4550 static void Lwonderwall(int x, int y)
4552 if (lev.wonderwall_time && lev.wonderwall_state)
4554 Cave[y][x] = XwonderwallB;
4555 play_element_sound(x, y, SOUND_wonder, Xwonderwall);
4559 static void Lsand_stone(int x, int y)
4561 switch (Cave[y+1][x])
4571 Cave[y][x] = Xsand_stonesand_quickout_1;
4572 if (Cave[y][x+1] == Xblank)
4573 Cave[y][x+1] = Xacid_splash_e;
4574 if (Cave[y][x-1] == Xblank)
4575 Cave[y][x-1] = Xacid_splash_w;
4576 Next[y][x] = Xsand_stonesand_quickout_2;
4577 play_element_sound(x, y, SOUND_acid, Xacid_1);
4581 case Xacid_splash_e:
4582 case Xacid_splash_w:
4583 Cave[y][x] = Xsand_stonesand_quickout_1;
4584 Cave[y+1][x] = Xsand_stoneout_1;
4585 Next[y][x] = Xsand_stonesand_quickout_2;
4586 Next[y+1][x] = Xsand_stoneout_2;
4590 Cave[y][x] = Xsand_stonesand_1;
4591 Cave[y+1][x] = Xsand_sandstone_1;
4592 Next[y][x] = Xsand_stonesand_2;
4593 Next[y+1][x] = Xsand_sandstone_2;
4598 static void Lsand_stonein_1(int x, int y)
4600 Next[y][x] = Xsand_stonein_2;
4603 static void Lsand_stonein_2(int x, int y)
4605 Next[y][x] = Xsand_stonein_3;
4608 static void Lsand_stonein_3(int x, int y)
4610 Next[y][x] = Xsand_stonein_4;
4613 static void Lsand_stonein_4(int x, int y)
4615 Next[y][x] = Xblank;
4618 static void Lsand_stonesand_1(int x, int y)
4620 Next[y][x] = Xsand_stonesand_2;
4623 static void Lsand_stonesand_2(int x, int y)
4625 Next[y][x] = Xsand_stonesand_3;
4628 static void Lsand_stonesand_3(int x, int y)
4630 Next[y][x] = Xsand_stonesand_4;
4633 static void Lsand_stonesand_4(int x, int y)
4638 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
4639 static void Lsand_stonesand_quickout_1(int x, int y)
4641 Next[y][x] = Xsand_stonesand_quickout_2;
4644 static void Lsand_stonesand_quickout_2(int x, int y)
4650 static void Lsand_stoneout_1(int x, int y)
4652 Next[y][x] = Xsand_stoneout_2;
4655 static void Lsand_stoneout_2(int x, int y)
4657 Next[y][x] = Xstone_fall;
4660 static void Lsand_sandstone_1(int x, int y)
4662 Next[y][x] = Xsand_sandstone_2;
4665 static void Lsand_sandstone_2(int x, int y)
4667 Next[y][x] = Xsand_sandstone_3;
4670 static void Lsand_sandstone_3(int x, int y)
4672 Next[y][x] = Xsand_sandstone_4;
4675 static void Lsand_sandstone_4(int x, int y)
4677 Next[y][x] = Xsand_stone;
4680 static void Lslidewall_ns(int x, int y)
4682 if (tab_blank[Cave[y-1][x]])
4684 Cave[y-1][x] = Yslidewall_ns_blank;
4685 Next[y-1][x] = Xslidewall_ns;
4686 play_element_sound(x, y, SOUND_slidewall, Xslidewall_ns);
4689 if (tab_blank[Cave[y+1][x]])
4691 Cave[y+1][x] = Yslidewall_ns_blank;
4692 Next[y+1][x] = Xslidewall_ns;
4693 play_element_sound(x, y, SOUND_slidewall, Xslidewall_ns);
4697 static void Lslidewall_ew(int x, int y)
4699 if (tab_blank[Cave[y][x+1]])
4701 Cave[y][x+1] = Yslidewall_ew_blank;
4702 Next[y][x+1] = Xslidewall_ew;
4703 play_element_sound(x, y, SOUND_slidewall, Xslidewall_ew);
4706 if (tab_blank[Cave[y][x-1]])
4708 Cave[y][x-1] = Yslidewall_ew_blank;
4709 Next[y][x-1] = Xslidewall_ew;
4710 play_element_sound(x, y, SOUND_slidewall, Xslidewall_ew);
4714 static void Lexit(int x, int y)
4716 if (lev.required > 0)
4719 int temp = RANDOM & 63;
4723 Cave[y][x] = Xexit_1;
4724 Next[y][x] = Xexit_2;
4728 Cave[y][x] = Xexit_2;
4729 Next[y][x] = Xexit_3;
4733 Cave[y][x] = Xexit_3;
4734 Next[y][x] = Xexit_1;
4737 play_element_sound(x, y, SOUND_exit_open, Xexit);
4740 static void Lexit_1(int x, int y)
4742 Next[y][x] = Xexit_2;
4745 static void Lexit_2(int x, int y)
4747 Next[y][x] = Xexit_3;
4750 static void Lexit_3(int x, int y)
4752 Next[y][x] = Xexit_1;
4755 static void Lacid_1(int x, int y)
4757 Next[y][x] = Xacid_2;
4760 static void Lacid_2(int x, int y)
4762 Next[y][x] = Xacid_3;
4765 static void Lacid_3(int x, int y)
4767 Next[y][x] = Xacid_4;
4770 static void Lacid_4(int x, int y)
4772 Next[y][x] = Xacid_5;
4775 static void Lacid_5(int x, int y)
4777 Next[y][x] = Xacid_6;
4780 static void Lacid_6(int x, int y)
4782 Next[y][x] = Xacid_7;
4785 static void Lacid_7(int x, int y)
4787 Next[y][x] = Xacid_8;
4790 static void Lacid_8(int x, int y)
4792 Next[y][x] = Xacid_1;
4795 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
4796 static void Lfake_acid_1(int x, int y)
4798 Next[y][x] = Xfake_acid_2;
4801 static void Lfake_acid_2(int x, int y)
4803 Next[y][x] = Xfake_acid_3;
4806 static void Lfake_acid_3(int x, int y)
4808 Next[y][x] = Xfake_acid_4;
4811 static void Lfake_acid_4(int x, int y)
4813 Next[y][x] = Xfake_acid_5;
4816 static void Lfake_acid_5(int x, int y)
4818 Next[y][x] = Xfake_acid_6;
4821 static void Lfake_acid_6(int x, int y)
4823 Next[y][x] = Xfake_acid_7;
4826 static void Lfake_acid_7(int x, int y)
4828 Next[y][x] = Xfake_acid_8;
4831 static void Lfake_acid_8(int x, int y)
4833 Next[y][x] = Xfake_acid_1;
4837 static void Lpause(int x, int y)
4839 Next[y][x] = Xblank;
4842 static void Ldynamite_1(int x, int y)
4844 play_element_sound(x, y, SOUND_tick, Xdynamite_1);
4845 Next[y][x] = Xdynamite_2;
4848 static void Ldynamite_2(int x, int y)
4850 play_element_sound(x, y, SOUND_tick, Xdynamite_2);
4851 Next[y][x] = Xdynamite_3;
4854 static void Ldynamite_3(int x, int y)
4856 play_element_sound(x, y, SOUND_tick, Xdynamite_3);
4857 Next[y][x] = Xdynamite_4;
4860 static void Ldynamite_4(int x, int y)
4862 play_element_sound(x, y, SOUND_tick, Xdynamite_4);
4863 Next[y][x] = Zdynamite;
4864 Boom[y-1][x-1] = Xblank;
4865 Boom[y-1][x] = Xblank;
4866 Boom[y-1][x+1] = Xblank;
4867 Boom[y][x-1] = Xblank;
4868 Boom[y][x] = Xblank;
4869 Boom[y][x+1] = Xblank;
4870 Boom[y+1][x-1] = Xblank;
4871 Boom[y+1][x] = Xblank;
4872 Boom[y+1][x+1] = Xblank;
4875 static void Lwheel(int x, int y)
4877 if (lev.wheel_cnt && x == lev.wheel_x && y == lev.wheel_y)
4878 Cave[y][x] = XwheelB;
4881 static void Lswitch(int x, int y)
4884 Cave[y][x] = XswitchB;
4887 static void Lfake_amoeba(int x, int y)
4890 Cave[y][x] = Xfake_amoebaB;
4893 static void Lfake_blank(int x, int y)
4896 Cave[y][x] = Xfake_blankB;
4899 static void Lfake_grass(int x, int y)
4901 if (lev.magnify_cnt)
4902 Cave[y][x] = Xfake_grassB;
4905 static void Lfake_door_1(int x, int y)
4907 if (lev.magnify_cnt)
4908 Cave[y][x] = Xdoor_1;
4911 static void Lfake_door_2(int x, int y)
4913 if (lev.magnify_cnt)
4914 Cave[y][x] = Xdoor_2;
4917 static void Lfake_door_3(int x, int y)
4919 if (lev.magnify_cnt)
4920 Cave[y][x] = Xdoor_3;
4923 static void Lfake_door_4(int x, int y)
4925 if (lev.magnify_cnt)
4926 Cave[y][x] = Xdoor_4;
4929 static void Lfake_door_5(int x, int y)
4931 if (lev.magnify_cnt)
4932 Cave[y][x] = Xdoor_5;
4935 static void Lfake_door_6(int x, int y)
4937 if (lev.magnify_cnt)
4938 Cave[y][x] = Xdoor_6;
4941 static void Lfake_door_7(int x, int y)
4943 if (lev.magnify_cnt)
4944 Cave[y][x] = Xdoor_7;
4947 static void Lfake_door_8(int x, int y)
4949 if (lev.magnify_cnt)
4950 Cave[y][x] = Xdoor_8;
4953 static void Lboom_1(int x, int y)
4955 Next[y][x] = Xboom_2;
4956 #if !PLAY_ELEMENT_SOUND
4957 if (x != lev.exit_x && y != lev.exit_y)
4958 play_sound(x, y, SOUND_boom);
4960 lev.exit_x = lev.exit_y = -1;
4964 static void Lboom_2(int x, int y)
4966 Next[y][x] = Boom[y][x];
4969 static void Lboom_android(int x, int y)
4971 #if PLAY_ELEMENT_SOUND
4972 play_element_sound(x, y, SOUND_boom, Xandroid);
4978 void synchro_2(void)
4982 short *cave_cache = Cave[y]; /* might be a win */
4985 random_em = RandomEM;
4990 element = cave_cache[++x];
4994 case Xacid_1: Lacid_1(x, y); goto loop;
4995 case Xacid_2: Lacid_2(x, y); goto loop;
4996 case Xacid_3: Lacid_3(x, y); goto loop;
4997 case Xacid_4: Lacid_4(x, y); goto loop;
4998 case Xacid_5: Lacid_5(x, y); goto loop;
4999 case Xacid_6: Lacid_6(x, y); goto loop;
5000 case Xacid_7: Lacid_7(x, y); goto loop;
5001 case Xacid_8: Lacid_8(x, y); goto loop;
5003 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
5004 case Xfake_acid_1: Lfake_acid_1(x, y); goto loop;
5005 case Xfake_acid_2: Lfake_acid_2(x, y); goto loop;
5006 case Xfake_acid_3: Lfake_acid_3(x, y); goto loop;
5007 case Xfake_acid_4: Lfake_acid_4(x, y); goto loop;
5008 case Xfake_acid_5: Lfake_acid_5(x, y); goto loop;
5009 case Xfake_acid_6: Lfake_acid_6(x, y); goto loop;
5010 case Xfake_acid_7: Lfake_acid_7(x, y); goto loop;
5011 case Xfake_acid_8: Lfake_acid_8(x, y); goto loop;
5014 case Xandroid: Landroid(x, y); goto loop;
5015 case Xandroid_1_n: Landroid_1_n(x, y); goto loop;
5016 case Xandroid_2_n: Landroid_2_n(x, y); goto loop;
5017 case Xandroid_1_e: Landroid_1_e(x, y); goto loop;
5018 case Xandroid_2_e: Landroid_2_e(x, y); goto loop;
5019 case Xandroid_1_s: Landroid_1_s(x, y); goto loop;
5020 case Xandroid_2_s: Landroid_2_s(x, y); goto loop;
5021 case Xandroid_1_w: Landroid_1_w(x, y); goto loop;
5022 case Xandroid_2_w: Landroid_2_w(x, y); goto loop;
5024 case Xeater_n: Leater_n(x, y); goto loop;
5025 case Xeater_e: Leater_e(x, y); goto loop;
5026 case Xeater_s: Leater_s(x, y); goto loop;
5027 case Xeater_w: Leater_w(x, y); goto loop;
5029 case Xalien: Lalien(x, y); goto loop;
5030 case Xalien_pause: Lalien_pause(x, y); goto loop;
5032 case Xbug_1_n: Lbug_1_n(x, y); goto loop;
5033 case Xbug_2_n: Lbug_2_n(x, y); goto loop;
5034 case Xbug_1_e: Lbug_1_e(x, y); goto loop;
5035 case Xbug_2_e: Lbug_2_e(x, y); goto loop;
5036 case Xbug_1_s: Lbug_1_s(x, y); goto loop;
5037 case Xbug_2_s: Lbug_2_s(x, y); goto loop;
5038 case Xbug_1_w: Lbug_1_w(x, y); goto loop;
5039 case Xbug_2_w: Lbug_2_w(x, y); goto loop;
5041 case Xtank_1_n: Ltank_1_n(x, y); goto loop;
5042 case Xtank_2_n: Ltank_2_n(x, y); goto loop;
5043 case Xtank_1_e: Ltank_1_e(x, y); goto loop;
5044 case Xtank_2_e: Ltank_2_e(x, y); goto loop;
5045 case Xtank_1_s: Ltank_1_s(x, y); goto loop;
5046 case Xtank_2_s: Ltank_2_s(x, y); goto loop;
5047 case Xtank_1_w: Ltank_1_w(x, y); goto loop;
5048 case Xtank_2_w: Ltank_2_w(x, y); goto loop;
5050 case Xemerald: Lemerald(x, y); goto loop;
5051 case Xemerald_pause: Lemerald_pause(x, y); goto loop;
5052 case Xemerald_fall: Lemerald_fall(x, y); goto loop;
5054 case Xdiamond: Ldiamond(x, y); goto loop;
5055 case Xdiamond_pause: Ldiamond_pause(x, y); goto loop;
5056 case Xdiamond_fall: Ldiamond_fall(x, y); goto loop;
5058 case Xstone: Lstone(x, y); goto loop;
5059 case Xstone_pause: Lstone_pause(x, y); goto loop;
5060 case Xstone_fall: Lstone_fall(x, y); goto loop;
5062 case Xbomb: Lbomb(x, y); goto loop;
5063 case Xbomb_pause: Lbomb_pause(x, y); goto loop;
5064 case Xbomb_fall: Lbomb_fall(x, y); goto loop;
5066 case Xnut: Lnut(x, y); goto loop;
5067 case Xnut_pause: Lnut_pause(x, y); goto loop;
5068 case Xnut_fall: Lnut_fall(x, y); goto loop;
5070 case Xspring: Lspring(x, y); goto loop;
5071 case Xspring_pause: Lspring_pause(x, y); goto loop;
5072 case Xspring_e: Lspring_e(x, y); goto loop;
5073 case Xspring_w: Lspring_w(x, y); goto loop;
5074 case Xspring_fall: Lspring_fall(x, y); goto loop;
5076 case Xpush_emerald_e: Lpush_emerald_e(x, y); goto loop;
5077 case Xpush_emerald_w: Lpush_emerald_w(x, y); goto loop;
5078 case Xpush_diamond_e: Lpush_diamond_e(x, y); goto loop;
5079 case Xpush_diamond_w: Lpush_diamond_w(x, y); goto loop;
5080 case Xpush_stone_e: Lpush_stone_e(x, y); goto loop;
5081 case Xpush_stone_w: Lpush_stone_w(x, y); goto loop;
5082 case Xpush_bomb_e: Lpush_bomb_e(x, y); goto loop;
5083 case Xpush_bomb_w: Lpush_bomb_w(x, y); goto loop;
5084 case Xpush_nut_e: Lpush_nut_e(x, y); goto loop;
5085 case Xpush_nut_w: Lpush_nut_w(x, y); goto loop;
5086 case Xpush_spring_e: Lpush_spring_e(x, y); goto loop;
5087 case Xpush_spring_w: Lpush_spring_w(x, y); goto loop;
5089 case Xdynamite_1: Ldynamite_1(x, y); goto loop;
5090 case Xdynamite_2: Ldynamite_2(x, y); goto loop;
5091 case Xdynamite_3: Ldynamite_3(x, y); goto loop;
5092 case Xdynamite_4: Ldynamite_4(x, y); goto loop;
5094 case Xfake_door_1: Lfake_door_1(x, y); goto loop;
5095 case Xfake_door_2: Lfake_door_2(x, y); goto loop;
5096 case Xfake_door_3: Lfake_door_3(x, y); goto loop;
5097 case Xfake_door_4: Lfake_door_4(x, y); goto loop;
5098 case Xfake_door_5: Lfake_door_5(x, y); goto loop;
5099 case Xfake_door_6: Lfake_door_6(x, y); goto loop;
5100 case Xfake_door_7: Lfake_door_7(x, y); goto loop;
5101 case Xfake_door_8: Lfake_door_8(x, y); goto loop;
5103 case Xballoon: Lballoon(x, y); goto loop;
5105 case Xball_1: Lball_1(x, y); goto loop;
5106 case Xball_2: Lball_2(x, y); goto loop;
5108 case Xdrip: Ldrip(x, y); goto loop;
5109 case Xdrip_fall: Ldrip_fall(x, y); goto loop;
5110 case Xdrip_stretch: Ldrip_stretch(x, y); goto loop;
5111 case Xdrip_stretchB: Ldrip_stretchB(x, y); goto loop;
5113 case Xwonderwall: Lwonderwall(x, y); goto loop;
5115 case Xwheel: Lwheel(x, y); goto loop;
5117 case Xswitch: Lswitch(x, y); goto loop;
5119 case Xfake_blank: Lfake_blank(x, y); goto loop;
5120 case Xfake_grass: Lfake_grass(x, y); goto loop;
5121 case Xfake_amoeba: Lfake_amoeba(x, y); goto loop;
5123 case Xsand_stone: Lsand_stone(x, y); goto loop;
5124 case Xsand_stonein_1: Lsand_stonein_1(x, y); goto loop;
5125 case Xsand_stonein_2: Lsand_stonein_2(x, y); goto loop;
5126 case Xsand_stonein_3: Lsand_stonein_3(x, y); goto loop;
5127 case Xsand_stonein_4: Lsand_stonein_4(x, y); goto loop;
5128 case Xsand_sandstone_1: Lsand_sandstone_1(x, y); goto loop;
5129 case Xsand_sandstone_2: Lsand_sandstone_2(x, y); goto loop;
5130 case Xsand_sandstone_3: Lsand_sandstone_3(x, y); goto loop;
5131 case Xsand_sandstone_4: Lsand_sandstone_4(x, y); goto loop;
5132 case Xsand_stonesand_1: Lsand_stonesand_1(x, y); goto loop;
5133 case Xsand_stonesand_2: Lsand_stonesand_2(x, y); goto loop;
5134 case Xsand_stonesand_3: Lsand_stonesand_3(x, y); goto loop;
5135 case Xsand_stonesand_4: Lsand_stonesand_4(x, y); goto loop;
5136 case Xsand_stoneout_1: Lsand_stoneout_1(x, y); goto loop;
5137 case Xsand_stoneout_2: Lsand_stoneout_2(x, y); goto loop;
5138 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
5139 case Xsand_stonesand_quickout_1:Lsand_stonesand_quickout_1(x, y);goto loop;
5140 case Xsand_stonesand_quickout_2:Lsand_stonesand_quickout_2(x, y);goto loop;
5143 case Xslidewall_ns: Lslidewall_ns(x, y); goto loop;
5144 case Xslidewall_ew: Lslidewall_ew(x, y); goto loop;
5146 case Xexit: Lexit(x, y); goto loop;
5147 case Xexit_1: Lexit_1(x, y); goto loop;
5148 case Xexit_2: Lexit_2(x, y); goto loop;
5149 case Xexit_3: Lexit_3(x, y); goto loop;
5151 case Xpause: Lpause(x, y); goto loop;
5153 case Xboom_bug: Lboom_bug(x, y); goto loop;
5154 case Xboom_bomb: Lboom_tank(x, y); goto loop;
5155 case Xboom_android: Lboom_android(x, y); goto loop;
5156 case Xboom_1: Lboom_1(x, y); goto loop;
5157 case Xboom_2: Lboom_2(x, y); goto loop;
5160 if (++y < HEIGHT - 1)
5163 cave_cache = Cave[y];
5175 if (ply[0].alive || ply[1].alive || ply[2].alive || ply[3].alive)
5176 lev.score += score; /* only add a score if someone is alive */
5178 game_em.game_over = TRUE;
5180 RandomEM = random_em;
5185 /* triple buffering */