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.
17 #define RANDOM (random = random << 31 | random >> 1)
21 register unsigned int x = 0;
22 register unsigned int y = 1;
23 register unsigned long random = Random;
24 register unsigned short *cave_cache = Cave[y]; /* might be a win */
25 unsigned long score = 0;
27 unsigned int temp = 0; /* initialized to make compilers happy */
28 unsigned int dx; /* only needed to find closest player */
34 element = cave_cache[++x];
41 /* --------------------------------------------------------------------- */
60 Cave[y][x] = Ystone_eB;
61 Cave[y][x+1] = Ystone_e;
63 Next[y][x+1] = Xstone_pause;
83 Cave[y][x] = Ystone_wB;
84 Cave[y][x-1] = Ystone_w;
86 Next[y][x-1] = Xstone_pause;
106 Cave[y][x] = Ynut_eB;
107 Cave[y][x+1] = Ynut_e;
109 Next[y][x+1] = Xnut_pause;
114 switch (Cave[y][x-1])
129 Cave[y][x] = Ynut_wB;
130 Cave[y][x-1] = Ynut_w;
132 Next[y][x-1] = Xnut_pause;
136 case Xspring_force_e:
137 switch (Cave[y][x+1])
147 Cave[y][x] = Xspring;
148 Next[y][x] = Xspring;
152 Cave[y][x] = Yspring_eB;
153 Cave[y][x+1] = Yspring_e;
157 Next[y][x+1] = Xspring_e;
159 Next[y][x+1] = Xspring_pause;
165 case Xspring_force_w:
166 switch (Cave[y][x-1])
176 Cave[y][x] = Xspring;
177 Next[y][x] = Xspring;
181 Cave[y][x] = Yspring_wB;
182 Cave[y][x-1] = Yspring_w;
186 Next[y][x-1] = Xspring_w;
188 Next[y][x-1] = Xspring_pause;
193 case Xemerald_force_e:
194 switch (Cave[y][x+1])
204 Cave[y][x] = Xemerald;
205 Next[y][x] = Xemerald;
209 Cave[y][x] = Yemerald_eB;
210 Cave[y][x+1] = Yemerald_e;
212 Next[y][x+1] = Xemerald_pause;
216 case Xemerald_force_w:
217 switch (Cave[y][x-1])
227 Cave[y][x] = Xemerald;
228 Next[y][x] = Xemerald;
232 Cave[y][x] = Yemerald_wB;
233 Cave[y][x-1] = Yemerald_w;
235 Next[y][x-1] = Xemerald_pause;
239 case Xdiamond_force_e:
240 switch (Cave[y][x+1])
250 Cave[y][x] = Xdiamond;
251 Next[y][x] = Xdiamond;
255 Cave[y][x] = Ydiamond_eB;
256 Cave[y][x+1] = Ydiamond_e;
258 Next[y][x+1] = Xdiamond_pause;
262 case Xdiamond_force_w:
263 switch (Cave[y][x-1])
273 Cave[y][x] = Xdiamond;
274 Next[y][x] = Xdiamond;
278 Cave[y][x] = Ydiamond_wB;
279 Cave[y][x-1] = Ydiamond_w;
281 Next[y][x-1] = Xdiamond_pause;
286 switch (Cave[y][x+1])
301 Cave[y][x] = Ybomb_eB;
302 Cave[y][x+1] = Ybomb_e;
304 Next[y][x+1] = Xbomb_pause;
309 switch (Cave[y][x-1])
324 Cave[y][x] = Ybomb_wB;
325 Cave[y][x-1] = Ybomb_w;
327 Next[y][x-1] = Xbomb_pause;
330 #endif /* BAD_ROLL */
332 /* --------------------------------------------------------------------- */
335 switch (Cave[y+1][x])
345 Cave[y][x] = Ystone_sB;
346 if (Cave[y][x+1] == Xblank)
347 Cave[y][x+1] = Yacid_splash_eB;
348 if (Cave[y][x-1] == Xblank)
349 Cave[y][x-1] = Yacid_splash_wB;
351 play_sound(x, y, SAMPLE_acid);
355 case Yacid_splash_eB:
356 case Yacid_splash_wB:
359 Cave[y][x] = Ystone_sB;
360 Cave[y+1][x] = Ystone_s;
362 Next[y+1][x] = Xstone_fall;
366 Cave[y][x] = Xsand_stonein_1;
367 Cave[y+1][x] = Xsand_sandstone_1;
368 Next[y][x] = Xsand_stonein_2;
369 Next[y+1][x] = Xsand_sandstone_2;
420 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
422 Cave[y][x] = Ystone_eB;
423 Cave[y][x+1] = Ystone_e;
425 Next[y][x+1] = Xstone_pause;
429 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
431 Cave[y][x] = Ystone_wB;
432 Cave[y][x-1] = Ystone_w;
434 Next[y][x-1] = Xstone_pause;
440 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
442 Cave[y][x] = Ystone_wB;
443 Cave[y][x-1] = Ystone_w;
445 Next[y][x-1] = Xstone_pause;
449 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
451 Cave[y][x] = Ystone_eB;
452 Cave[y][x+1] = Ystone_e;
454 Next[y][x+1] = Xstone_pause;
463 /* --------------------------------------------------------------------- */
466 switch (Cave[y+1][x])
476 Cave[y][x] = Ystone_sB;
477 if (Cave[y][x+1] == Xblank)
478 Cave[y][x+1] = Yacid_splash_eB;
479 if (Cave[y][x-1] == Xblank)
480 Cave[y][x-1] = Yacid_splash_wB;
482 play_sound(x, y, SAMPLE_acid);
486 case Yacid_splash_eB:
487 case Yacid_splash_wB:
488 Cave[y][x] = Ystone_sB;
489 Cave[y+1][x] = Ystone_s;
491 Next[y+1][x] = Xstone_fall;
500 /* --------------------------------------------------------------------- */
503 switch (Cave[y+1][x])
513 Cave[y][x] = Ystone_sB;
514 if (Cave[y][x+1] == Xblank)
515 Cave[y][x+1] = Yacid_splash_eB;
516 if (Cave[y][x-1] == Xblank)
517 Cave[y][x-1] = Yacid_splash_wB;
519 play_sound(x, y, SAMPLE_acid);
523 case Yacid_splash_eB:
524 case Yacid_splash_wB:
526 Cave[y][x] = Ystone_sB;
527 Cave[y+1][x] = Ystone_s;
529 Next[y+1][x] = Xstone_fall;
534 Cave[y+1][x] = Yemerald_stone;
536 Next[y+1][x] = Xemerald;
537 play_sound(x, y, SAMPLE_crack);
538 score += lev.nut_score;
549 Cave[y][x] = Ystone_sB;
550 Cave[y+1][x] = Ybug_stone;
551 Next[y+1][x] = Znormal;
552 Boom[y][x-1] = Xemerald;
553 Boom[y][x] = Xemerald;
554 Boom[y][x+1] = Xemerald;
555 Boom[y+1][x-1] = Xemerald;
556 Boom[y+1][x] = Xdiamond;
557 Boom[y+1][x+1] = Xemerald;
558 Boom[y+2][x-1] = Xemerald;
559 Boom[y+2][x] = Xemerald;
560 Boom[y+2][x+1] = Xemerald;
561 score += lev.bug_score;
572 Cave[y][x] = Ystone_sB;
573 Cave[y+1][x] = Ytank_stone;
574 Next[y+1][x] = Znormal;
575 Boom[y][x-1] = Xblank;
577 Boom[y][x+1] = Xblank;
578 Boom[y+1][x-1] = Xblank;
579 Boom[y+1][x] = Xblank;
580 Boom[y+1][x+1] = Xblank;
581 Boom[y+2][x-1] = Xblank;
582 Boom[y+2][x] = Xblank;
583 Boom[y+2][x+1] = Xblank;
584 score += lev.tank_score;
590 switch (Cave[y+1][x+1])
593 case Yacid_splash_eB:
594 case Yacid_splash_wB:
597 Cave[y+1][x] = Xspring_e;
601 Cave[y+1][x] = Xspring_w;
607 switch (Cave[y+1][x-1])
610 case Yacid_splash_eB:
611 case Yacid_splash_wB:
614 Cave[y+1][x] = Xspring_w;
617 Cave[y+1][x] = Xspring_e;
629 Cave[y][x] = Ystone_sB;
630 Cave[y+1][x] = Yeater_stone;
631 Next[y+1][x] = Znormal;
632 Boom[y][x-1] = lev.eater_array[lev.eater_pos][0];
633 Boom[y][x] = lev.eater_array[lev.eater_pos][1];
634 Boom[y][x+1] = lev.eater_array[lev.eater_pos][2];
635 Boom[y+1][x-1] = lev.eater_array[lev.eater_pos][3];
636 Boom[y+1][x] = lev.eater_array[lev.eater_pos][4];
637 Boom[y+1][x+1] = lev.eater_array[lev.eater_pos][5];
638 Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
639 Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
640 Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
641 lev.eater_pos = (lev.eater_pos + 1) & 7;
642 score += lev.eater_score;
647 Cave[y][x] = Ystone_sB;
648 Cave[y+1][x] = Yalien_stone;
649 Next[y+1][x] = Znormal;
650 Boom[y][x-1] = Xblank;
652 Boom[y][x+1] = Xblank;
653 Boom[y+1][x-1] = Xblank;
654 Boom[y+1][x] = Xblank;
655 Boom[y+1][x+1] = Xblank;
656 Boom[y+2][x-1] = Xblank;
657 Boom[y+2][x] = Xblank;
658 Boom[y+2][x+1] = Xblank;
659 score += lev.alien_score;
664 switch (Cave[y+2][x])
667 case Yacid_splash_eB:
668 case Yacid_splash_wB:
713 play_sound(x, y, SAMPLE_stone);
717 Cave[y][x] = Ystone_sB;
718 Cave[y+1][x] = Ydiamond_stone;
720 Next[y+1][x] = Xstone_pause;
721 play_sound(x, y, SAMPLE_squash);
726 Cave[y+1][x] = Ybomb_eat;
727 Next[y+1][x] = Znormal;
728 Boom[y][x-1] = Xblank;
730 Boom[y][x+1] = Xblank;
731 Boom[y+1][x-1] = Xblank;
732 Boom[y+1][x] = Xblank;
733 Boom[y+1][x+1] = Xblank;
734 Boom[y+2][x-1] = Xblank;
735 Boom[y+2][x] = Xblank;
736 Boom[y+2][x+1] = Xblank;
740 if (lev.wonderwall_time)
742 lev.wonderwall_state = 1;
743 Cave[y][x] = Ystone_sB;
745 if (tab_blank[Cave[y+2][x]])
747 Cave[y+2][x] = Yemerald_s;
748 Next[y+2][x] = Xemerald_fall;
752 play_element_sound(x, y, SAMPLE_wonderfall, Xstone);
759 play_sound(x, y, SAMPLE_stone);
763 /* --------------------------------------------------------------------- */
766 switch (Cave[y+1][x])
776 Cave[y][x] = Ynut_sB;
777 if (Cave[y][x+1] == Xblank)
778 Cave[y][x+1] = Yacid_splash_eB;
779 if (Cave[y][x-1] == Xblank)
780 Cave[y][x-1] = Yacid_splash_wB;
782 play_sound(x, y, SAMPLE_acid);
786 case Yacid_splash_eB:
787 case Yacid_splash_wB:
788 Cave[y][x] = Ynut_sB;
789 Cave[y+1][x] = Ynut_s;
791 Next[y+1][x] = Xnut_fall;
840 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
842 Cave[y][x] = Ynut_eB;
843 Cave[y][x+1] = Ynut_e;
845 Next[y][x+1] = Xnut_pause;
849 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
851 Cave[y][x] = Ynut_wB;
852 Cave[y][x-1] = Ynut_w;
854 Next[y][x-1] = Xnut_pause;
860 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
862 Cave[y][x] = Ynut_wB;
863 Cave[y][x-1] = Ynut_w;
865 Next[y][x-1] = Xnut_pause;
869 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
871 Cave[y][x] = Ynut_eB;
872 Cave[y][x+1] = Ynut_e;
874 Next[y][x+1] = Xnut_pause;
883 /* --------------------------------------------------------------------- */
887 switch (Cave[y+1][x])
897 Cave[y][x] = Ynut_sB;
898 if (Cave[y][x+1] == Xblank)
899 Cave[y][x+1] = Yacid_splash_eB;
900 if (Cave[y][x-1] == Xblank)
901 Cave[y][x-1] = Yacid_splash_wB;
903 play_sound(x, y, SAMPLE_acid);
907 case Yacid_splash_eB:
908 case Yacid_splash_wB:
909 Cave[y][x] = Ynut_sB;
910 Cave[y+1][x] = Ynut_s;
912 Next[y+1][x] = Xnut_fall;
921 /* --------------------------------------------------------------------- */
924 switch (Cave[y+1][x])
934 Cave[y][x] = Ynut_sB;
935 if (Cave[y][x+1] == Xblank)
936 Cave[y][x+1] = Yacid_splash_eB;
937 if (Cave[y][x-1] == Xblank)
938 Cave[y][x-1] = Yacid_splash_wB;
940 play_sound(x, y, SAMPLE_acid);
944 case Yacid_splash_eB:
945 case Yacid_splash_wB:
947 Cave[y][x] = Ynut_sB;
948 Cave[y+1][x] = Ynut_s;
950 Next[y+1][x] = Xnut_fall;
956 play_sound(x, y, SAMPLE_nut);
960 /* --------------------------------------------------------------------- */
963 if (tab_amoeba[Cave[y-1][x]] ||
964 tab_amoeba[Cave[y][x+1]] ||
965 tab_amoeba[Cave[y+1][x]] ||
966 tab_amoeba[Cave[y][x-1]])
969 switch (Cave[y][x+1])
972 case Yacid_splash_eB:
973 case Yacid_splash_wB:
985 Cave[y][x] = Ybug_n_e;
986 Next[y][x] = Xbug_goe;
987 play_sound(x, y, SAMPLE_bug);
995 if (tab_amoeba[Cave[y-1][x]] ||
996 tab_amoeba[Cave[y][x+1]] ||
997 tab_amoeba[Cave[y+1][x]] ||
998 tab_amoeba[Cave[y][x-1]])
1003 switch (Cave[y-1][x])
1013 Cave[y][x] = Ybug_nB;
1014 if (Cave[y-2][x+1] == Xblank)
1015 Cave[y-2][x+1] = Yacid_splash_eB;
1016 if (Cave[y-2][x-1] == Xblank)
1017 Cave[y-2][x-1] = Yacid_splash_wB;
1018 Next[y][x] = Xblank;
1019 play_sound(x, y, SAMPLE_acid);
1023 case Yacid_splash_eB:
1024 case Yacid_splash_wB:
1028 Cave[y][x] = Ybug_nB;
1029 Cave[y-1][x] = Ybug_n;
1030 Next[y][x] = Xblank;
1031 Next[y-1][x] = Xbug_n;
1032 play_sound(x, y, SAMPLE_bug);
1036 Cave[y][x] = Ybug_n_w;
1037 Next[y][x] = Xbug_gow;
1038 play_sound(x, y, SAMPLE_bug);
1042 /* --------------------------------------------------------------------- */
1045 if (tab_amoeba[Cave[y-1][x]] ||
1046 tab_amoeba[Cave[y][x+1]] ||
1047 tab_amoeba[Cave[y+1][x]] ||
1048 tab_amoeba[Cave[y][x-1]])
1051 switch (Cave[y+1][x])
1054 case Yacid_splash_eB:
1055 case Yacid_splash_wB:
1067 Cave[y][x] = Ybug_e_s;
1068 Next[y][x] = Xbug_gos;
1069 play_sound(x, y, SAMPLE_bug);
1077 if (tab_amoeba[Cave[y-1][x]] ||
1078 tab_amoeba[Cave[y][x+1]] ||
1079 tab_amoeba[Cave[y+1][x]] ||
1080 tab_amoeba[Cave[y][x-1]])
1085 switch (Cave[y][x+1])
1095 Cave[y][x] = Ybug_eB;
1096 if (Cave[y-1][x+2] == Xblank)
1097 Cave[y-1][x+2] = Yacid_splash_eB;
1098 if (Cave[y-1][x] == Xblank)
1099 Cave[y-1][x] = Yacid_splash_wB;
1100 Next[y][x] = Xblank;
1101 play_sound(x, y, SAMPLE_acid);
1105 case Yacid_splash_eB:
1106 case Yacid_splash_wB:
1110 Cave[y][x] = Ybug_eB;
1111 Cave[y][x+1] = Ybug_e;
1112 Next[y][x] = Xblank;
1113 Next[y][x+1] = Xbug_e;
1114 play_sound(x, y, SAMPLE_bug);
1118 Cave[y][x] = Ybug_e_n;
1119 Next[y][x] = Xbug_gon;
1120 play_sound(x, y, SAMPLE_bug);
1124 /* --------------------------------------------------------------------- */
1127 if (tab_amoeba[Cave[y-1][x]] ||
1128 tab_amoeba[Cave[y][x+1]] ||
1129 tab_amoeba[Cave[y+1][x]] ||
1130 tab_amoeba[Cave[y][x-1]])
1133 switch (Cave[y][x-1])
1136 case Yacid_splash_eB:
1137 case Yacid_splash_wB:
1149 Cave[y][x] = Ybug_s_w;
1150 Next[y][x] = Xbug_gow;
1151 play_sound(x, y, SAMPLE_bug);
1159 if (tab_amoeba[Cave[y-1][x]] ||
1160 tab_amoeba[Cave[y][x+1]] ||
1161 tab_amoeba[Cave[y+1][x]] ||
1162 tab_amoeba[Cave[y][x-1]])
1167 switch (Cave[y+1][x])
1177 Cave[y][x] = Ybug_sB;
1178 if (Cave[y][x+1] == Xblank)
1179 Cave[y][x+1] = Yacid_splash_eB;
1180 if (Cave[y][x-1] == Xblank)
1181 Cave[y][x-1] = Yacid_splash_wB;
1182 Next[y][x] = Xblank;
1183 play_sound(x, y, SAMPLE_acid);
1187 case Yacid_splash_eB:
1188 case Yacid_splash_wB:
1192 Cave[y][x] = Ybug_sB;
1193 Cave[y+1][x] = Ybug_s;
1194 Next[y][x] = Xblank;
1195 Next[y+1][x] = Xbug_s;
1196 play_sound(x, y, SAMPLE_bug);
1200 Cave[y][x] = Ybug_s_e;
1201 Next[y][x] = Xbug_goe;
1202 play_sound(x, y, SAMPLE_bug);
1206 /* --------------------------------------------------------------------- */
1209 if (tab_amoeba[Cave[y-1][x]] ||
1210 tab_amoeba[Cave[y][x+1]] ||
1211 tab_amoeba[Cave[y+1][x]] ||
1212 tab_amoeba[Cave[y][x-1]])
1215 switch (Cave[y-1][x])
1218 case Yacid_splash_eB:
1219 case Yacid_splash_wB:
1231 Cave[y][x] = Ybug_w_n;
1232 Next[y][x] = Xbug_gon;
1233 play_sound(x, y, SAMPLE_bug);
1241 if (tab_amoeba[Cave[y-1][x]] ||
1242 tab_amoeba[Cave[y][x+1]] ||
1243 tab_amoeba[Cave[y+1][x]] ||
1244 tab_amoeba[Cave[y][x-1]])
1249 switch (Cave[y][x-1])
1259 Cave[y][x] = Ybug_wB;
1260 if (Cave[y-1][x] == Xblank)
1261 Cave[y-1][x] = Yacid_splash_eB;
1262 if (Cave[y-1][x-2] == Xblank)
1263 Cave[y-1][x-2] = Yacid_splash_wB;
1264 Next[y][x] = Xblank;
1265 play_sound(x, y, SAMPLE_acid);
1269 case Yacid_splash_eB:
1270 case Yacid_splash_wB:
1274 Cave[y][x] = Ybug_wB;
1275 Cave[y][x-1] = Ybug_w;
1276 Next[y][x] = Xblank;
1277 Next[y][x-1] = Xbug_w;
1278 play_sound(x, y, SAMPLE_bug);
1282 Cave[y][x] = Ybug_w_s;
1283 Next[y][x] = Xbug_gos;
1284 play_sound(x, y, SAMPLE_bug);
1288 /* --------------------------------------------------------------------- */
1291 if (tab_amoeba[Cave[y-1][x]] ||
1292 tab_amoeba[Cave[y][x+1]] ||
1293 tab_amoeba[Cave[y+1][x]] ||
1294 tab_amoeba[Cave[y][x-1]])
1297 switch (Cave[y][x-1])
1300 case Yacid_splash_eB:
1301 case Yacid_splash_wB:
1313 Cave[y][x] = Ytank_n_w;
1314 Next[y][x] = Xtank_gow;
1315 play_sound(x, y, SAMPLE_tank);
1323 if (tab_amoeba[Cave[y-1][x]] ||
1324 tab_amoeba[Cave[y][x+1]] ||
1325 tab_amoeba[Cave[y+1][x]] ||
1326 tab_amoeba[Cave[y][x-1]])
1331 switch (Cave[y-1][x])
1341 Cave[y][x] = Ytank_nB;
1342 if (Cave[y-2][x+1] == Xblank)
1343 Cave[y-2][x+1] = Yacid_splash_eB;
1344 if (Cave[y-2][x-1] == Xblank)
1345 Cave[y-2][x-1] = Yacid_splash_wB;
1346 Next[y][x] = Xblank;
1347 play_sound(x, y, SAMPLE_acid);
1351 case Yacid_splash_eB:
1352 case Yacid_splash_wB:
1356 Cave[y][x] = Ytank_nB;
1357 Cave[y-1][x] = Ytank_n;
1358 Next[y][x] = Xblank;
1359 Next[y-1][x] = Xtank_n;
1360 play_sound(x, y, SAMPLE_tank);
1364 Cave[y][x] = Ytank_n_e;
1365 Next[y][x] = Xtank_goe;
1366 play_sound(x, y, SAMPLE_tank);
1370 /* --------------------------------------------------------------------- */
1373 if (tab_amoeba[Cave[y-1][x]] ||
1374 tab_amoeba[Cave[y][x+1]] ||
1375 tab_amoeba[Cave[y+1][x]] ||
1376 tab_amoeba[Cave[y][x-1]])
1379 switch (Cave[y-1][x])
1382 case Yacid_splash_eB:
1383 case Yacid_splash_wB:
1395 Cave[y][x] = Ytank_e_n;
1396 Next[y][x] = Xtank_gon;
1397 play_sound(x, y, SAMPLE_tank);
1405 if (tab_amoeba[Cave[y-1][x]] ||
1406 tab_amoeba[Cave[y][x+1]] ||
1407 tab_amoeba[Cave[y+1][x]] ||
1408 tab_amoeba[Cave[y][x-1]])
1413 switch (Cave[y][x+1])
1423 Cave[y][x] = Ytank_eB;
1424 if (Cave[y-1][x+2] == Xblank)
1425 Cave[y-1][x+2] = Yacid_splash_eB;
1426 if (Cave[y-1][x] == Xblank)
1427 Cave[y-1][x] = Yacid_splash_wB;
1428 Next[y][x] = Xblank;
1429 play_sound(x, y, SAMPLE_acid);
1433 case Yacid_splash_eB:
1434 case Yacid_splash_wB:
1438 Cave[y][x] = Ytank_eB;
1439 Cave[y][x+1] = Ytank_e;
1440 Next[y][x] = Xblank;
1441 Next[y][x+1] = Xtank_e;
1442 play_sound(x, y, SAMPLE_tank);
1446 Cave[y][x] = Ytank_e_s;
1447 Next[y][x] = Xtank_gos;
1448 play_sound(x, y, SAMPLE_tank);
1452 /* --------------------------------------------------------------------- */
1455 if (tab_amoeba[Cave[y-1][x]] ||
1456 tab_amoeba[Cave[y][x+1]] ||
1457 tab_amoeba[Cave[y+1][x]] ||
1458 tab_amoeba[Cave[y][x-1]])
1461 switch (Cave[y][x+1])
1464 case Yacid_splash_eB:
1465 case Yacid_splash_wB:
1477 Cave[y][x] = Ytank_s_e;
1478 Next[y][x] = Xtank_goe;
1479 play_sound(x, y, SAMPLE_tank);
1487 if (tab_amoeba[Cave[y-1][x]] ||
1488 tab_amoeba[Cave[y][x+1]] ||
1489 tab_amoeba[Cave[y+1][x]] ||
1490 tab_amoeba[Cave[y][x-1]])
1495 switch (Cave[y+1][x])
1505 Cave[y][x] = Ytank_sB;
1506 if (Cave[y][x+1] == Xblank)
1507 Cave[y][x+1] = Yacid_splash_eB;
1508 if (Cave[y][x-1] == Xblank)
1509 Cave[y][x-1] = Yacid_splash_wB;
1510 Next[y][x] = Xblank;
1511 play_sound(x, y, SAMPLE_acid);
1515 case Yacid_splash_eB:
1516 case Yacid_splash_wB:
1520 Cave[y][x] = Ytank_sB;
1521 Cave[y+1][x] = Ytank_s;
1522 Next[y][x] = Xblank;
1523 Next[y+1][x] = Xtank_s;
1524 play_sound(x, y, SAMPLE_tank);
1528 Cave[y][x] = Ytank_s_w;
1529 Next[y][x] = Xtank_gow;
1530 play_sound(x, y, SAMPLE_tank);
1534 /* --------------------------------------------------------------------- */
1537 if (tab_amoeba[Cave[y-1][x]] ||
1538 tab_amoeba[Cave[y][x+1]] ||
1539 tab_amoeba[Cave[y+1][x]] ||
1540 tab_amoeba[Cave[y][x-1]])
1543 switch (Cave[y+1][x])
1546 case Yacid_splash_eB:
1547 case Yacid_splash_wB:
1559 Cave[y][x] = Ytank_w_s;
1560 Next[y][x] = Xtank_gos;
1561 play_sound(x, y, SAMPLE_tank);
1569 if (tab_amoeba[Cave[y-1][x]] ||
1570 tab_amoeba[Cave[y][x+1]] ||
1571 tab_amoeba[Cave[y+1][x]] ||
1572 tab_amoeba[Cave[y][x-1]])
1577 switch (Cave[y][x-1])
1587 Cave[y][x] = Ytank_wB;
1588 if (Cave[y-1][x] == Xblank)
1589 Cave[y-1][x] = Yacid_splash_eB;
1590 if (Cave[y-1][x-2] == Xblank)
1591 Cave[y-1][x-2] = Yacid_splash_wB;
1592 Next[y][x] = Xblank;
1593 play_sound(x, y, SAMPLE_acid);
1597 case Yacid_splash_eB:
1598 case Yacid_splash_wB:
1602 Cave[y][x] = Ytank_wB;
1603 Cave[y][x-1] = Ytank_w;
1604 Next[y][x] = Xblank;
1605 Next[y][x-1] = Xtank_w;
1606 play_sound(x, y, SAMPLE_tank);
1610 Cave[y][x] = Ytank_w_n;
1611 Next[y][x] = Xtank_gon;
1612 play_sound(x, y, SAMPLE_tank);
1616 /* --------------------------------------------------------------------- */
1622 if (lev.android_clone_cnt == 0)
1624 if (Cave[y-1][x-1] != Xblank &&
1625 Cave[y-1][x] != Xblank &&
1626 Cave[y-1][x+1] != Xblank &&
1627 Cave[y][x-1] != Xblank &&
1628 Cave[y][x+1] != Xblank &&
1629 Cave[y+1][x-1] != Xblank &&
1630 Cave[y+1][x] != Xblank &&
1631 Cave[y+1][x+1] != Xblank)
1636 /* randomly find an object to clone */
1638 case 0: /* S,NE,W,NW,SE,E,SW,N */
1639 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1640 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1641 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1642 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1643 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1644 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1645 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1646 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1649 case 1: /* NW,SE,N,S,NE,SW,E,W */
1650 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1651 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1652 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1653 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1654 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1655 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1656 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1657 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1660 case 2: /* SW,E,S,W,N,NW,SE,NE */
1661 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1662 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1663 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1664 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1665 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1666 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1667 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1668 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1671 case 3: /* N,SE,NE,E,W,S,NW,SW */
1672 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1673 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1674 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1675 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1676 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1677 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1678 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1679 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1682 case 4: /* SE,NW,E,NE,SW,W,N,S */
1683 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1684 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1685 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1686 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1687 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1688 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1689 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1690 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1693 case 5: /* NE,W,SE,SW,S,N,E,NW */
1694 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1695 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1696 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1697 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1698 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1699 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1700 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1701 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1704 case 6: /* E,N,SW,S,NW,NE,SE,W */
1705 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1706 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1707 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1708 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1709 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1710 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1711 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1712 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1715 case 7: /* W,SW,NW,N,E,SE,NE,S */
1716 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1717 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1718 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1719 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1720 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1721 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1722 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1723 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1727 Next[y][x] = temp; /* the item we chose to clone */
1728 play_sound(x, y, SAMPLE_android);
1732 /* randomly find a direction to move */
1734 case 0: /* S,NE,W,NW,SE,E,SW,N */
1735 if (Cave[y+1][x] == Xblank) goto android_s;
1736 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1737 if (Cave[y][x-1] == Xblank) goto android_w;
1738 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1739 if (Cave[y+1][x+1] == Xblank) goto android_se;
1740 if (Cave[y][x+1] == Xblank) goto android_e;
1741 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1742 if (Cave[y-1][x] == Xblank) goto android_n;
1745 case 1: /* NW,SE,N,S,NE,SW,E,W */
1746 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1747 if (Cave[y+1][x+1] == Xblank) goto android_se;
1748 if (Cave[y-1][x] == Xblank) goto android_n;
1749 if (Cave[y+1][x] == Xblank) goto android_s;
1750 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1751 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1752 if (Cave[y][x+1] == Xblank) goto android_e;
1753 if (Cave[y][x-1] == Xblank) goto android_w;
1756 case 2: /* SW,E,S,W,N,NW,SE,NE */
1757 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1758 if (Cave[y][x+1] == Xblank) goto android_e;
1759 if (Cave[y+1][x] == Xblank) goto android_s;
1760 if (Cave[y][x-1] == Xblank) goto android_w;
1761 if (Cave[y-1][x] == Xblank) goto android_n;
1762 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1763 if (Cave[y+1][x+1] == Xblank) goto android_se;
1764 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1767 case 3: /* N,SE,NE,E,W,S,NW,SW */
1768 if (Cave[y-1][x] == Xblank) goto android_n;
1769 if (Cave[y+1][x+1] == Xblank) goto android_se;
1770 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1771 if (Cave[y][x+1] == Xblank) goto android_e;
1772 if (Cave[y][x-1] == Xblank) goto android_w;
1773 if (Cave[y+1][x] == Xblank) goto android_s;
1774 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1775 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1778 case 4: /* SE,NW,E,NE,SW,W,N,S */
1779 if (Cave[y+1][x+1] == Xblank) goto android_se;
1780 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1781 if (Cave[y][x+1] == Xblank) goto android_e;
1782 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1783 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1784 if (Cave[y][x-1] == Xblank) goto android_w;
1785 if (Cave[y-1][x] == Xblank) goto android_n;
1786 if (Cave[y+1][x] == Xblank) goto android_s;
1789 case 5: /* NE,W,SE,SW,S,N,E,NW */
1790 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1791 if (Cave[y][x-1] == Xblank) goto android_w;
1792 if (Cave[y+1][x+1] == Xblank) goto android_se;
1793 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1794 if (Cave[y+1][x] == Xblank) goto android_s;
1795 if (Cave[y-1][x] == Xblank) goto android_n;
1796 if (Cave[y][x+1] == Xblank) goto android_e;
1797 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1800 case 6: /* E,N,SW,S,NW,NE,SE,W */
1801 if (Cave[y][x+1] == Xblank) goto android_e;
1802 if (Cave[y-1][x] == Xblank) goto android_n;
1803 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1804 if (Cave[y+1][x] == Xblank) goto android_s;
1805 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1806 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1807 if (Cave[y+1][x+1] == Xblank) goto android_se;
1808 if (Cave[y][x-1] == Xblank) goto android_w;
1811 case 7: /* W,SW,NW,N,E,SE,NE,S */
1812 if (Cave[y][x-1] == Xblank) goto android_w;
1813 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1814 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1815 if (Cave[y-1][x] == Xblank) goto android_n;
1816 if (Cave[y][x+1] == Xblank) goto android_e;
1817 if (Cave[y+1][x+1] == Xblank) goto android_se;
1818 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1819 if (Cave[y+1][x] == Xblank) goto android_s;
1825 if (lev.android_move_cnt == 0)
1827 if (Cave[y-1][x-1] == Zplayer ||
1828 Cave[y-1][x] == Zplayer ||
1829 Cave[y-1][x+1] == Zplayer ||
1830 Cave[y][x-1] == Zplayer ||
1831 Cave[y][x+1] == Zplayer ||
1832 Cave[y+1][x-1] == Zplayer ||
1833 Cave[y+1][x] == Zplayer ||
1834 Cave[y+1][x+1] == Zplayer)
1837 if (ply1.alive && ply2.alive)
1839 if ((ply1.x > x ? ply1.x - x : x - ply1.x) +
1840 (ply1.y > y ? ply1.y - y : y - ply1.y) <
1841 (ply2.x > x ? ply2.x - x : x - ply2.x) +
1842 (ply2.y > y ? ply2.y - y : y - ply2.y))
1853 else if (ply1.alive)
1858 else if (ply2.alive)
1869 Next[y][x] = Xblank; /* assume we will move */
1870 temp = ((x < dx) + 1 - (x > dx)) + ((y < dy) + 1 - (y > dy)) * 3;
1876 /* attempt clockwise move first if direct path is blocked */
1878 case 0: /* north west */
1879 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1880 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1881 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1885 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1886 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1887 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1890 case 2: /* north east */
1891 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1892 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1893 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1897 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1898 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1899 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1902 case 4: /* nowhere */
1906 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1907 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1908 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1911 case 6: /* south west */
1912 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1913 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1914 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1918 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1919 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1920 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1923 case 8: /* south east */
1924 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1925 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1926 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1934 /* attempt counterclockwise move first if direct path is blocked */
1936 case 0: /* north west */
1937 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1938 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1939 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1943 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1944 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1945 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1948 case 2: /* north east */
1949 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1950 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1951 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1955 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1956 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1957 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1960 case 4: /* nowhere */
1964 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1965 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1966 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1969 case 6: /* south west */
1970 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1971 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1972 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1976 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1977 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1978 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1981 case 8: /* south east */
1982 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1983 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1984 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1992 Next[y][x] = Xandroid;
1997 Cave[y][x] = Yandroid_nB;
1998 Cave[y-1][x] = Yandroid_n;
1999 Next[y-1][x] = Xandroid;
2000 play_sound(x, y, SAMPLE_tank);
2005 Cave[y][x] = Yandroid_neB;
2006 Cave[y-1][x+1] = Yandroid_ne;
2007 Next[y-1][x+1] = Xandroid;
2008 play_sound(x, y, SAMPLE_tank);
2013 Cave[y][x] = Yandroid_eB;
2014 Cave[y][x+1] = Yandroid_e;
2015 Next[y][x+1] = Xandroid;
2016 play_sound(x, y, SAMPLE_tank);
2021 Cave[y][x] = Yandroid_seB;
2022 Cave[y+1][x+1] = Yandroid_se;
2023 Next[y+1][x+1] = Xandroid;
2024 play_sound(x, y, SAMPLE_tank);
2029 Cave[y][x] = Yandroid_sB;
2030 Cave[y+1][x] = Yandroid_s;
2031 Next[y+1][x] = Xandroid;
2032 play_sound(x, y, SAMPLE_tank);
2037 Cave[y][x] = Yandroid_swB;
2038 Cave[y+1][x-1] = Yandroid_sw;
2039 Next[y+1][x-1] = Xandroid;
2040 play_sound(x, y, SAMPLE_tank);
2045 Cave[y][x] = Yandroid_wB;
2046 Cave[y][x-1] = Yandroid_w;
2047 Next[y][x-1] = Xandroid;
2048 play_sound(x, y, SAMPLE_tank);
2053 Cave[y][x] = Yandroid_nwB;
2054 Cave[y-1][x-1] = Yandroid_nw;
2055 Next[y-1][x-1] = Xandroid;
2056 play_sound(x, y, SAMPLE_tank);
2059 /* --------------------------------------------------------------------- */
2062 switch (Cave[y-1][x])
2072 Cave[y][x] = Yandroid_nB;
2073 if (Cave[y-2][x+1] == Xblank)
2074 Cave[y-2][x+1] = Yacid_splash_eB;
2075 if (Cave[y-2][x-1] == Xblank)
2076 Cave[y-2][x-1] = Yacid_splash_wB;
2077 Next[y][x] = Xblank;
2078 play_sound(x, y, SAMPLE_acid);
2082 case Yacid_splash_eB:
2083 case Yacid_splash_wB:
2084 Cave[y][x] = Yandroid_nB;
2085 Cave[y-1][x] = Yandroid_n;
2086 Next[y][x] = Xblank;
2087 Next[y-1][x] = Xandroid;
2088 play_sound(x, y, SAMPLE_tank);
2096 switch (Cave[y-1][x])
2106 Cave[y][x] = Yandroid_nB;
2107 if (Cave[y-2][x+1] == Xblank)
2108 Cave[y-2][x+1] = Yacid_splash_eB;
2109 if (Cave[y-2][x-1] == Xblank)
2110 Cave[y-2][x-1] = Yacid_splash_wB;
2111 Next[y][x] = Xblank;
2112 play_sound(x, y, SAMPLE_acid);
2116 case Yacid_splash_eB:
2117 case Yacid_splash_wB:
2118 Cave[y][x] = Yandroid_nB;
2119 Cave[y-1][x] = Yandroid_n;
2120 Next[y][x] = Xblank;
2121 Next[y-1][x] = Xandroid_1_n;
2122 play_sound(x, y, SAMPLE_tank);
2129 /* --------------------------------------------------------------------- */
2132 switch (Cave[y][x+1])
2142 Cave[y][x] = Yandroid_eB;
2143 if (Cave[y-1][x+2] == Xblank)
2144 Cave[y-1][x+2] = Yacid_splash_eB;
2145 if (Cave[y-1][x] == Xblank)
2146 Cave[y-1][x] = Yacid_splash_wB;
2147 Next[y][x] = Xblank;
2148 play_sound(x, y, SAMPLE_acid);
2152 case Yacid_splash_eB:
2153 case Yacid_splash_wB:
2154 Cave[y][x] = Yandroid_eB;
2155 Cave[y][x+1] = Yandroid_e;
2156 Next[y][x] = Xblank;
2157 Next[y][x+1] = Xandroid;
2158 play_sound(x, y, SAMPLE_tank);
2166 switch (Cave[y][x+1])
2176 Cave[y][x] = Yandroid_eB;
2177 if (Cave[y-1][x+2] == Xblank)
2178 Cave[y-1][x+2] = Yacid_splash_eB;
2179 if (Cave[y-1][x] == Xblank)
2180 Cave[y-1][x] = Yacid_splash_wB;
2181 Next[y][x] = Xblank;
2182 play_sound(x, y, SAMPLE_acid);
2186 case Yacid_splash_eB:
2187 case Yacid_splash_wB:
2188 Cave[y][x] = Yandroid_eB;
2189 Cave[y][x+1] = Yandroid_e;
2190 Next[y][x] = Xblank;
2191 Next[y][x+1] = Xandroid_1_e;
2192 play_sound(x, y, SAMPLE_tank);
2199 /* --------------------------------------------------------------------- */
2202 switch (Cave[y+1][x])
2212 Cave[y][x] = Yandroid_sB;
2213 if (Cave[y][x+1] == Xblank)
2214 Cave[y][x+1] = Yacid_splash_eB;
2215 if (Cave[y][x-1] == Xblank)
2216 Cave[y][x-1] = Yacid_splash_wB;
2217 Next[y][x] = Xblank;
2218 play_sound(x, y, SAMPLE_acid);
2222 case Yacid_splash_eB:
2223 case Yacid_splash_wB:
2224 Cave[y][x] = Yandroid_sB;
2225 Cave[y+1][x] = Yandroid_s;
2226 Next[y][x] = Xblank;
2227 Next[y+1][x] = Xandroid;
2228 play_sound(x, y, SAMPLE_tank);
2236 switch (Cave[y+1][x])
2246 Cave[y][x] = Yandroid_sB;
2247 if (Cave[y][x+1] == Xblank)
2248 Cave[y][x+1] = Yacid_splash_eB;
2249 if (Cave[y][x-1] == Xblank)
2250 Cave[y][x-1] = Yacid_splash_wB;
2251 Next[y][x] = Xblank;
2252 play_sound(x, y, SAMPLE_acid);
2256 case Yacid_splash_eB:
2257 case Yacid_splash_wB:
2258 Cave[y][x] = Yandroid_sB;
2259 Cave[y+1][x] = Yandroid_s;
2260 Next[y][x] = Xblank;
2261 Next[y+1][x] = Xandroid_1_s;
2262 play_sound(x, y, SAMPLE_tank);
2269 /* --------------------------------------------------------------------- */
2272 switch (Cave[y][x-1])
2282 Cave[y][x] = Yandroid_wB;
2283 if (Cave[y-1][x] == Xblank)
2284 Cave[y-1][x] = Yacid_splash_eB;
2285 if (Cave[y-1][x-2] == Xblank)
2286 Cave[y-1][x-2] = Yacid_splash_wB;
2287 Next[y][x] = Xblank;
2288 play_sound(x, y, SAMPLE_acid);
2292 case Yacid_splash_eB:
2293 case Yacid_splash_wB:
2294 Cave[y][x] = Yandroid_wB;
2295 Cave[y][x-1] = Yandroid_w;
2296 Next[y][x] = Xblank;
2297 Next[y][x-1] = Xandroid;
2298 play_sound(x, y, SAMPLE_tank);
2306 switch (Cave[y][x-1])
2316 Cave[y][x] = Yandroid_wB;
2317 if (Cave[y-1][x] == Xblank)
2318 Cave[y-1][x] = Yacid_splash_eB;
2319 if (Cave[y-1][x-2] == Xblank)
2320 Cave[y-1][x-2] = Yacid_splash_wB;
2321 Next[y][x] = Xblank;
2322 play_sound(x, y, SAMPLE_acid);
2326 case Yacid_splash_eB:
2327 case Yacid_splash_wB:
2328 Cave[y][x] = Yandroid_wB;
2329 Cave[y][x-1] = Yandroid_w;
2330 Next[y][x] = Xblank;
2331 Next[y][x-1] = Xandroid_1_w;
2332 play_sound(x, y, SAMPLE_tank);
2339 /* --------------------------------------------------------------------- */
2342 switch (Cave[y+1][x])
2352 Cave[y][x] = Yspring_sB;
2353 if (Cave[y][x+1] == Xblank)
2354 Cave[y][x+1] = Yacid_splash_eB;
2355 if (Cave[y][x-1] == Xblank)
2356 Cave[y][x-1] = Yacid_splash_wB;
2357 Next[y][x] = Xblank;
2358 play_sound(x, y, SAMPLE_acid);
2362 case Yacid_splash_eB:
2363 case Yacid_splash_wB:
2366 Cave[y][x] = Yspring_sB;
2367 Cave[y+1][x] = Yspring_s;
2368 Next[y][x] = Xblank;
2369 Next[y+1][x] = Xspring_fall;
2388 case Xemerald_pause:
2390 case Xdiamond_pause:
2418 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2420 Cave[y][x] = Yspring_eB;
2421 Cave[y][x+1] = Yspring_e;
2422 if (Cave[y+1][x] == Xbumper)
2423 Cave[y+1][x] = XbumperB;
2424 Next[y][x] = Xblank;
2427 Next[y][x+1] = Xspring_e;
2429 Next[y][x+1] = Xspring_pause;
2435 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2437 Cave[y][x] = Yspring_wB;
2438 Cave[y][x-1] = Yspring_w;
2439 if (Cave[y+1][x] == Xbumper)
2440 Cave[y+1][x] = XbumperB;
2441 Next[y][x] = Xblank;
2444 Next[y][x-1] = Xspring_w;
2446 Next[y][x-1] = Xspring_pause;
2454 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2456 Cave[y][x] = Yspring_wB;
2457 Cave[y][x-1] = Yspring_w;
2458 if (Cave[y+1][x] == Xbumper)
2459 Cave[y+1][x] = XbumperB;
2460 Next[y][x] = Xblank;
2463 Next[y][x-1] = Xspring_w;
2465 Next[y][x-1] = Xspring_pause;
2471 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2473 Cave[y][x] = Yspring_eB;
2474 Cave[y][x+1] = Yspring_e;
2475 if (Cave[y+1][x] == Xbumper)
2476 Cave[y+1][x] = XbumperB;
2477 Next[y][x] = Xblank;
2480 Next[y][x+1] = Xspring_e;
2482 Next[y][x+1] = Xspring_pause;
2493 /* --------------------------------------------------------------------- */
2496 switch (Cave[y+1][x])
2506 Cave[y][x] = Yspring_sB;
2507 if (Cave[y][x+1] == Xblank)
2508 Cave[y][x+1] = Yacid_splash_eB;
2509 if (Cave[y][x-1] == Xblank)
2510 Cave[y][x-1] = Yacid_splash_wB;
2511 Next[y][x] = Xblank;
2512 play_sound(x, y, SAMPLE_acid);
2516 case Yacid_splash_eB:
2517 case Yacid_splash_wB:
2518 Cave[y][x] = Yspring_sB;
2519 Cave[y+1][x] = Yspring_s;
2520 Next[y][x] = Xblank;
2521 Next[y+1][x] = Xspring_fall;
2525 Cave[y][x] = Xspring;
2526 Next[y][x] = Xspring;
2530 /* --------------------------------------------------------------------- */
2533 switch (Cave[y+1][x])
2543 Cave[y][x] = Yspring_sB;
2544 if (Cave[y][x+1] == Xblank)
2545 Cave[y][x+1] = Yacid_splash_eB;
2546 if (Cave[y][x-1] == Xblank)
2547 Cave[y][x-1] = Yacid_splash_wB;
2548 Next[y][x] = Xblank;
2549 play_sound(x, y, SAMPLE_acid);
2553 case Yacid_splash_eB:
2554 case Yacid_splash_wB:
2555 Cave[y][x] = Yspring_sB;
2556 Cave[y+1][x] = Yspring_s;
2557 Next[y][x] = Xblank;
2558 Next[y+1][x] = Xspring_fall;
2562 Cave[y+1][x] = XbumperB;
2565 switch (Cave[y][x+1])
2575 Cave[y][x] = Yspring_eB;
2576 if (Cave[y-1][x+2] == Xblank)
2577 Cave[y-1][x+2] = Yacid_splash_eB;
2578 if (Cave[y-1][x] == Xblank)
2579 Cave[y-1][x] = Yacid_splash_wB;
2580 Next[y][x] = Xblank;
2581 play_sound(x, y, SAMPLE_acid);
2585 case Yacid_splash_eB:
2586 case Yacid_splash_wB:
2591 Cave[y][x] = Yspring_eB;
2592 Cave[y][x+1] = Yspring_e;
2593 Next[y][x] = Xblank;
2594 Next[y][x+1] = Xspring_e;
2603 Cave[y][x] = Yspring_kill_eB;
2604 Cave[y][x+1] = Yspring_kill_e;
2605 Next[y][x] = Xblank;
2606 Next[y][x+1] = Xspring_e;
2607 play_sound(x, y, SAMPLE_slurp);
2608 score += lev.slurp_score;
2613 Cave[y][x+1] = XbumperB;
2614 Next[y][x] = Xspring_w;
2615 play_sound(x, y, SAMPLE_spring);
2619 Cave[y][x] = Xspring;
2620 Next[y][x] = Xspring;
2621 play_sound(x, y, SAMPLE_spring);
2625 /* --------------------------------------------------------------------- */
2628 switch (Cave[y+1][x])
2638 Cave[y][x] = Yspring_sB;
2639 if (Cave[y][x+1] == Xblank)
2640 Cave[y][x+1] = Yacid_splash_eB;
2641 if (Cave[y][x-1] == Xblank)
2642 Cave[y][x-1] = Yacid_splash_wB;
2643 Next[y][x] = Xblank;
2644 play_sound(x, y, SAMPLE_acid);
2648 case Yacid_splash_eB:
2649 case Yacid_splash_wB:
2650 Cave[y][x] = Yspring_sB;
2651 Cave[y+1][x] = Yspring_s;
2652 Next[y][x] = Xblank;
2653 Next[y+1][x] = Xspring_fall;
2657 Cave[y+1][x] = XbumperB;
2660 switch (Cave[y][x-1])
2670 Cave[y][x] = Yspring_wB;
2671 if (Cave[y-1][x] == Xblank)
2672 Cave[y-1][x] = Yacid_splash_eB;
2673 if (Cave[y-1][x-2] == Xblank)
2674 Cave[y-1][x-2] = Yacid_splash_wB;
2675 Next[y][x] = Xblank;
2676 play_sound(x, y, SAMPLE_acid);
2680 case Yacid_splash_eB:
2681 case Yacid_splash_wB:
2686 Cave[y][x] = Yspring_wB;
2687 Cave[y][x-1] = Yspring_w;
2688 Next[y][x] = Xblank;
2689 Next[y][x-1] = Xspring_w;
2698 Cave[y][x] = Yspring_kill_wB;
2699 Cave[y][x-1] = Yspring_kill_w;
2700 Next[y][x] = Xblank;
2701 Next[y][x-1] = Xspring_w;
2702 play_sound(x, y, SAMPLE_slurp);
2703 score += lev.slurp_score;
2708 Cave[y][x-1] = XbumperB;
2709 Next[y][x] = Xspring_e;
2710 play_sound(x, y, SAMPLE_spring);
2714 Cave[y][x] = Xspring;
2715 Next[y][x] = Xspring;
2716 play_sound(x, y, SAMPLE_spring);
2720 /* --------------------------------------------------------------------- */
2723 switch (Cave[y+1][x])
2733 Cave[y][x] = Yspring_sB;
2734 if (Cave[y][x+1] == Xblank)
2735 Cave[y][x+1] = Yacid_splash_eB;
2736 if (Cave[y][x-1] == Xblank)
2737 Cave[y][x-1] = Yacid_splash_wB;
2738 Next[y][x] = Xblank;
2739 play_sound(x, y, SAMPLE_acid);
2743 case Yacid_splash_eB:
2744 case Yacid_splash_wB:
2746 Cave[y][x] = Yspring_sB;
2747 Cave[y+1][x] = Yspring_s;
2748 Next[y][x] = Xblank;
2749 Next[y+1][x] = Xspring_fall;
2754 Cave[y+1][x] = Ybomb_eat;
2755 Next[y+1][x] = Znormal;
2756 Boom[y][x-1] = Xblank;
2757 Boom[y][x] = Xblank;
2758 Boom[y][x+1] = Xblank;
2759 Boom[y+1][x-1] = Xblank;
2760 Boom[y+1][x] = Xblank;
2761 Boom[y+1][x+1] = Xblank;
2762 Boom[y+2][x-1] = Xblank;
2763 Boom[y+2][x] = Xblank;
2764 Boom[y+2][x+1] = Xblank;
2775 Cave[y][x] = Yspring_sB;
2776 Cave[y+1][x] = Ybug_spring;
2777 Next[y+1][x] = Znormal;
2778 Boom[y][x-1] = Xemerald;
2779 Boom[y][x] = Xemerald;
2780 Boom[y][x+1] = Xemerald;
2781 Boom[y+1][x-1] = Xemerald;
2782 Boom[y+1][x] = Xdiamond;
2783 Boom[y+1][x+1] = Xemerald;
2784 Boom[y+2][x-1] = Xemerald;
2785 Boom[y+2][x] = Xemerald;
2786 Boom[y+2][x+1] = Xemerald;
2787 score += lev.bug_score;
2798 Cave[y][x] = Yspring_sB;
2799 Cave[y+1][x] = Ytank_spring;
2800 Next[y+1][x] = Znormal;
2801 Boom[y][x-1] = Xblank;
2802 Boom[y][x] = Xblank;
2803 Boom[y][x+1] = Xblank;
2804 Boom[y+1][x-1] = Xblank;
2805 Boom[y+1][x] = Xblank;
2806 Boom[y+1][x+1] = Xblank;
2807 Boom[y+2][x-1] = Xblank;
2808 Boom[y+2][x] = Xblank;
2809 Boom[y+2][x+1] = Xblank;
2810 score += lev.tank_score;
2817 Cave[y][x] = Yspring_sB;
2818 Cave[y+1][x] = Yeater_spring;
2819 Next[y+1][x] = Znormal;
2820 Boom[y][x-1] = lev.eater_array[lev.eater_pos][0];
2821 Boom[y][x] = lev.eater_array[lev.eater_pos][1];
2822 Boom[y][x+1] = lev.eater_array[lev.eater_pos][2];
2823 Boom[y+1][x-1] = lev.eater_array[lev.eater_pos][3];
2824 Boom[y+1][x] = lev.eater_array[lev.eater_pos][4];
2825 Boom[y+1][x+1] = lev.eater_array[lev.eater_pos][5];
2826 Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
2827 Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
2828 Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
2829 lev.eater_pos = (lev.eater_pos + 1) & 7;
2830 score += lev.eater_score;
2835 Cave[y][x] = Yspring_sB;
2836 Cave[y+1][x] = Yalien_spring;
2837 Next[y+1][x] = Znormal;
2838 Boom[y][x-1] = Xblank;
2839 Boom[y][x] = Xblank;
2840 Boom[y][x+1] = Xblank;
2841 Boom[y+1][x-1] = Xblank;
2842 Boom[y+1][x] = Xblank;
2843 Boom[y+1][x+1] = Xblank;
2844 Boom[y+2][x-1] = Xblank;
2845 Boom[y+2][x] = Xblank;
2846 Boom[y+2][x+1] = Xblank;
2847 score += lev.alien_score;
2851 Cave[y][x] = Xspring;
2852 Next[y][x] = Xspring;
2853 play_sound(x, y, SAMPLE_spring);
2857 /* --------------------------------------------------------------------- */
2860 if (Cave[y][x+1] == Xdiamond)
2862 Cave[y][x+1] = Ydiamond_eat;
2863 Next[y][x+1] = Xblank;
2864 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
2868 if (Cave[y+1][x] == Xdiamond)
2870 Cave[y+1][x] = Ydiamond_eat;
2871 Next[y+1][x] = Xblank;
2872 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
2876 if (Cave[y][x-1] == Xdiamond)
2878 Cave[y][x-1] = Ydiamond_eat;
2879 Next[y][x-1] = Xblank;
2880 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
2884 if (Cave[y-1][x] == Xdiamond)
2886 Cave[y-1][x] = Ydiamond_eat;
2887 Next[y-1][x] = Xblank;
2888 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
2892 switch (Cave[y-1][x])
2902 Cave[y][x] = Yeater_nB;
2903 if (Cave[y-2][x+1] == Xblank)
2904 Cave[y-2][x+1] = Yacid_splash_eB;
2905 if (Cave[y-2][x-1] == Xblank)
2906 Cave[y-2][x-1] = Yacid_splash_wB;
2907 Next[y][x] = Xblank;
2908 play_sound(x, y, SAMPLE_acid);
2912 case Yacid_splash_eB:
2913 case Yacid_splash_wB:
2917 Cave[y][x] = Yeater_nB;
2918 Cave[y-1][x] = Yeater_n;
2919 Next[y][x] = Xblank;
2920 Next[y-1][x] = Xeater_n;
2924 Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
2925 play_sound(x, y, SAMPLE_eater);
2929 /* --------------------------------------------------------------------- */
2932 if (Cave[y+1][x] == Xdiamond)
2934 Cave[y+1][x] = Ydiamond_eat;
2935 Next[y+1][x] = Xblank;
2936 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
2940 if (Cave[y][x-1] == Xdiamond)
2942 Cave[y][x-1] = Ydiamond_eat;
2943 Next[y][x-1] = Xblank;
2944 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
2948 if (Cave[y-1][x] == Xdiamond)
2950 Cave[y-1][x] = Ydiamond_eat;
2951 Next[y-1][x] = Xblank;
2952 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
2956 if (Cave[y][x+1] == Xdiamond)
2958 Cave[y][x+1] = Ydiamond_eat;
2959 Next[y][x+1] = Xblank;
2960 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
2964 switch (Cave[y][x+1])
2974 Cave[y][x] = Yeater_eB;
2975 if (Cave[y-1][x+2] == Xblank)
2976 Cave[y-1][x+2] = Yacid_splash_eB;
2977 if (Cave[y-1][x] == Xblank)
2978 Cave[y-1][x] = Yacid_splash_wB;
2979 Next[y][x] = Xblank;
2980 play_sound(x, y, SAMPLE_acid);
2984 case Yacid_splash_eB:
2985 case Yacid_splash_wB:
2989 Cave[y][x] = Yeater_eB;
2990 Cave[y][x+1] = Yeater_e;
2991 Next[y][x] = Xblank;
2992 Next[y][x+1] = Xeater_e;
2996 Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
2997 play_sound(x, y, SAMPLE_eater);
3001 /* --------------------------------------------------------------------- */
3004 if (Cave[y][x-1] == Xdiamond)
3006 Cave[y][x-1] = Ydiamond_eat;
3007 Next[y][x-1] = Xblank;
3008 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
3012 if (Cave[y-1][x] == Xdiamond)
3014 Cave[y-1][x] = Ydiamond_eat;
3015 Next[y-1][x] = Xblank;
3016 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
3020 if (Cave[y][x+1] == Xdiamond)
3022 Cave[y][x+1] = Ydiamond_eat;
3023 Next[y][x+1] = Xblank;
3024 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
3028 if (Cave[y+1][x] == Xdiamond)
3030 Cave[y+1][x] = Ydiamond_eat;
3031 Next[y+1][x] = Xblank;
3032 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
3036 switch (Cave[y+1][x])
3046 Cave[y][x] = Yeater_sB;
3047 if (Cave[y][x+1] == Xblank)
3048 Cave[y][x+1] = Yacid_splash_eB;
3049 if (Cave[y][x-1] == Xblank)
3050 Cave[y][x-1] = Yacid_splash_wB;
3051 Next[y][x] = Xblank;
3052 play_sound(x, y, SAMPLE_acid);
3056 case Yacid_splash_eB:
3057 case Yacid_splash_wB:
3061 Cave[y][x] = Yeater_sB;
3062 Cave[y+1][x] = Yeater_s;
3063 Next[y][x] = Xblank;
3064 Next[y+1][x] = Xeater_s;
3068 Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
3069 play_sound(x, y, SAMPLE_eater);
3073 /* --------------------------------------------------------------------- */
3076 if (Cave[y-1][x] == Xdiamond)
3078 Cave[y-1][x] = Ydiamond_eat;
3079 Next[y-1][x] = Xblank;
3080 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
3084 if (Cave[y][x+1] == Xdiamond)
3086 Cave[y][x+1] = Ydiamond_eat;
3087 Next[y][x+1] = Xblank;
3088 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
3092 if (Cave[y+1][x] == Xdiamond)
3094 Cave[y+1][x] = Ydiamond_eat;
3095 Next[y+1][x] = Xblank;
3096 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
3100 if (Cave[y][x-1] == Xdiamond)
3102 Cave[y][x-1] = Ydiamond_eat;
3103 Next[y][x-1] = Xblank;
3104 play_element_sound(x, y, SAMPLE_eater, Xdiamond);
3108 switch (Cave[y][x-1])
3118 Cave[y][x] = Yeater_wB;
3119 if (Cave[y-1][x] == Xblank)
3120 Cave[y-1][x] = Yacid_splash_eB;
3121 if (Cave[y-1][x-2] == Xblank)
3122 Cave[y-1][x-2] = Yacid_splash_wB;
3123 Next[y][x] = Xblank;
3124 play_sound(x, y, SAMPLE_acid);
3128 case Yacid_splash_eB:
3129 case Yacid_splash_wB:
3133 Cave[y][x] = Yeater_wB;
3134 Cave[y][x-1] = Yeater_w;
3135 Next[y][x] = Xblank;
3136 Next[y][x-1] = Xeater_w;
3140 Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
3141 play_sound(x, y, SAMPLE_eater);
3145 /* --------------------------------------------------------------------- */
3153 else if (ply1.alive && ply2.alive)
3155 if ((ply1.x > x ? ply1.x - x : x - ply1.x) +
3156 (ply1.y > y ? ply1.y - y : y - ply1.y) <
3157 (ply2.x > x ? ply2.x - x : x - ply2.x) +
3158 (ply2.y > y ? ply2.y - y : y - ply2.y))
3169 else if (ply1.alive)
3174 else if (ply2.alive)
3189 switch (Cave[y-1][x])
3199 Cave[y][x] = Yalien_nB;
3200 if (Cave[y-2][x+1] == Xblank)
3201 Cave[y-2][x+1] = Yacid_splash_eB;
3202 if (Cave[y-2][x-1] == Xblank)
3203 Cave[y-2][x-1] = Yacid_splash_wB;
3204 Next[y][x] = Xblank;
3205 play_sound(x, y, SAMPLE_acid);
3209 case Yacid_splash_eB:
3210 case Yacid_splash_wB:
3214 Cave[y][x] = Yalien_nB;
3215 Cave[y-1][x] = Yalien_n;
3216 Next[y][x] = Xblank;
3217 Next[y-1][x] = Xalien_pause;
3218 play_sound(x, y, SAMPLE_alien);
3224 switch (Cave[y+1][x])
3234 Cave[y][x] = Yalien_sB;
3235 Next[y][x] = Xblank;
3236 if (Cave[y][x+1] == Xblank)
3237 Cave[y][x+1] = Yacid_splash_eB;
3238 if (Cave[y][x-1] == Xblank)
3239 Cave[y][x-1] = Yacid_splash_wB;
3240 play_sound(x, y, SAMPLE_acid);
3244 case Yacid_splash_eB:
3245 case Yacid_splash_wB:
3249 Cave[y][x] = Yalien_sB;
3250 Cave[y+1][x] = Yalien_s;
3251 Next[y][x] = Xblank;
3252 Next[y+1][x] = Xalien_pause;
3253 play_sound(x, y, SAMPLE_alien);
3262 switch (Cave[y][x+1])
3272 Cave[y][x] = Yalien_eB;
3273 if (Cave[y-1][x+2] == Xblank)
3274 Cave[y-1][x+2] = Yacid_splash_eB;
3275 if (Cave[y-1][x] == Xblank)
3276 Cave[y-1][x] = Yacid_splash_wB;
3277 Next[y][x] = Xblank;
3278 play_sound(x, y, SAMPLE_acid);
3282 case Yacid_splash_eB:
3283 case Yacid_splash_wB:
3287 Cave[y][x] = Yalien_eB;
3288 Cave[y][x+1] = Yalien_e;
3289 Next[y][x] = Xblank;
3290 Next[y][x+1] = Xalien_pause;
3291 play_sound(x, y, SAMPLE_alien);
3297 switch (Cave[y][x-1])
3307 Cave[y][x] = Yalien_wB;
3308 if (Cave[y-1][x] == Xblank)
3309 Cave[y-1][x] = Yacid_splash_eB;
3310 if (Cave[y-1][x-2] == Xblank)
3311 Cave[y-1][x-2] = Yacid_splash_wB;
3312 Next[y][x] = Xblank;
3313 play_sound(x, y, SAMPLE_acid);
3317 case Yacid_splash_eB:
3318 case Yacid_splash_wB:
3322 Cave[y][x] = Yalien_wB;
3323 Cave[y][x-1] = Yalien_w;
3324 Next[y][x] = Xblank;
3325 Next[y][x-1] = Xalien_pause;
3326 play_sound(x, y, SAMPLE_alien);
3335 Next[y][x] = Xalien;
3338 /* --------------------------------------------------------------------- */
3341 switch (Cave[y+1][x])
3351 Cave[y][x] = Yemerald_sB;
3352 if (Cave[y][x+1] == Xblank)
3353 Cave[y][x+1] = Yacid_splash_eB;
3354 if (Cave[y][x-1] == Xblank)
3355 Cave[y][x-1] = Yacid_splash_wB;
3356 Next[y][x] = Xblank;
3357 play_sound(x, y, SAMPLE_acid);
3361 case Yacid_splash_eB:
3362 case Yacid_splash_wB:
3363 Cave[y][x] = Yemerald_sB;
3364 Cave[y+1][x] = Yemerald_s;
3365 Next[y][x] = Xblank;
3366 Next[y+1][x] = Xemerald_fall;
3385 case Xemerald_pause:
3387 case Xdiamond_pause:
3424 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3426 Cave[y][x] = Yemerald_eB;
3427 Cave[y][x+1] = Yemerald_e;
3428 Next[y][x] = Xblank;
3429 Next[y][x+1] = Xemerald_pause;
3433 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3435 Cave[y][x] = Yemerald_wB;
3436 Cave[y][x-1] = Yemerald_w;
3437 Next[y][x] = Xblank;
3438 Next[y][x-1] = Xemerald_pause;
3444 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3446 Cave[y][x] = Yemerald_wB;
3447 Cave[y][x-1] = Yemerald_w;
3448 Next[y][x] = Xblank;
3449 Next[y][x-1] = Xemerald_pause;
3453 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3455 Cave[y][x] = Yemerald_eB;
3456 Cave[y][x+1] = Yemerald_e;
3457 Next[y][x] = Xblank;
3458 Next[y][x+1] = Xemerald_pause;
3464 if (++lev.shine_cnt > 50)
3466 lev.shine_cnt = RANDOM & 7;
3467 Cave[y][x] = Xemerald_shine;
3473 /* --------------------------------------------------------------------- */
3475 case Xemerald_pause:
3476 switch (Cave[y+1][x])
3486 Cave[y][x] = Yemerald_sB;
3487 if (Cave[y][x+1] == Xblank)
3488 Cave[y][x+1] = Yacid_splash_eB;
3489 if (Cave[y][x-1] == Xblank)
3490 Cave[y][x-1] = Yacid_splash_wB;
3491 Next[y][x] = Xblank;
3492 play_sound(x, y, SAMPLE_acid);
3496 case Yacid_splash_eB:
3497 case Yacid_splash_wB:
3498 Cave[y][x] = Yemerald_sB;
3499 Cave[y+1][x] = Yemerald_s;
3500 Next[y][x] = Xblank;
3501 Next[y+1][x] = Xemerald_fall;
3505 Cave[y][x] = Xemerald;
3506 Next[y][x] = Xemerald;
3510 /* --------------------------------------------------------------------- */
3513 switch (Cave[y+1][x])
3523 Cave[y][x] = Yemerald_sB;
3524 if (Cave[y][x+1] == Xblank)
3525 Cave[y][x+1] = Yacid_splash_eB;
3526 if (Cave[y][x-1] == Xblank)
3527 Cave[y][x-1] = Yacid_splash_wB;
3528 Next[y][x] = Xblank;
3529 play_sound(x, y, SAMPLE_acid);
3533 case Yacid_splash_eB:
3534 case Yacid_splash_wB:
3536 Cave[y][x] = Yemerald_sB;
3537 Cave[y+1][x] = Yemerald_s;
3538 Next[y][x] = Xblank;
3539 Next[y+1][x] = Xemerald_fall;
3543 if (lev.wonderwall_time)
3545 lev.wonderwall_state = 1;
3546 Cave[y][x] = Yemerald_sB;
3547 if (tab_blank[Cave[y+2][x]])
3549 Cave[y+2][x] = Ydiamond_s;
3550 Next[y+2][x] = Xdiamond_fall;
3553 Next[y][x] = Xblank;
3554 play_element_sound(x, y, SAMPLE_wonderfall, Xemerald);
3559 Cave[y][x] = Xemerald;
3560 Next[y][x] = Xemerald;
3561 play_element_sound(x, y, SAMPLE_diamond, Xemerald);
3565 /* --------------------------------------------------------------------- */
3568 switch (Cave[y+1][x])
3578 Cave[y][x] = Ydiamond_sB;
3579 if (Cave[y][x+1] == Xblank)
3580 Cave[y][x+1] = Yacid_splash_eB;
3581 if (Cave[y][x-1] == Xblank)
3582 Cave[y][x-1] = Yacid_splash_wB;
3583 Next[y][x] = Xblank;
3584 play_sound(x, y, SAMPLE_acid);
3588 case Yacid_splash_eB:
3589 case Yacid_splash_wB:
3590 Cave[y][x] = Ydiamond_sB;
3591 Cave[y+1][x] = Ydiamond_s;
3592 Next[y][x] = Xblank;
3593 Next[y+1][x] = Xdiamond_fall;
3612 case Xemerald_pause:
3614 case Xdiamond_pause:
3651 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3653 Cave[y][x] = Ydiamond_eB;
3654 Cave[y][x+1] = Ydiamond_e;
3655 Next[y][x] = Xblank;
3656 Next[y][x+1] = Xdiamond_pause;
3660 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3662 Cave[y][x] = Ydiamond_wB;
3663 Cave[y][x-1] = Ydiamond_w;
3664 Next[y][x] = Xblank;
3665 Next[y][x-1] = Xdiamond_pause;
3671 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3673 Cave[y][x] = Ydiamond_wB;
3674 Cave[y][x-1] = Ydiamond_w;
3675 Next[y][x] = Xblank;
3676 Next[y][x-1] = Xdiamond_pause;
3680 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3682 Cave[y][x] = Ydiamond_eB;
3683 Cave[y][x+1] = Ydiamond_e;
3684 Next[y][x] = Xblank;
3685 Next[y][x+1] = Xdiamond_pause;
3691 if (++lev.shine_cnt > 50)
3693 lev.shine_cnt = RANDOM & 7;
3694 Cave[y][x] = Xdiamond_shine;
3700 /* --------------------------------------------------------------------- */
3702 case Xdiamond_pause:
3703 switch (Cave[y+1][x])
3713 Cave[y][x] = Ydiamond_sB;
3714 if (Cave[y][x+1] == Xblank)
3715 Cave[y][x+1] = Yacid_splash_eB;
3716 if (Cave[y][x-1] == Xblank)
3717 Cave[y][x-1] = Yacid_splash_wB;
3718 Next[y][x] = Xblank;
3719 play_sound(x, y, SAMPLE_acid);
3723 case Yacid_splash_eB:
3724 case Yacid_splash_wB:
3725 Cave[y][x] = Ydiamond_sB;
3726 Cave[y+1][x] = Ydiamond_s;
3727 Next[y][x] = Xblank;
3728 Next[y+1][x] = Xdiamond_fall;
3732 Cave[y][x] = Xdiamond;
3733 Next[y][x] = Xdiamond;
3737 /* --------------------------------------------------------------------- */
3740 switch (Cave[y+1][x])
3750 Cave[y][x] = Ydiamond_sB;
3751 if (Cave[y][x+1] == Xblank)
3752 Cave[y][x+1] = Yacid_splash_eB;
3753 if (Cave[y][x-1] == Xblank)
3754 Cave[y][x-1] = Yacid_splash_wB;
3755 Next[y][x] = Xblank;
3756 play_sound(x, y, SAMPLE_acid);
3760 case Yacid_splash_eB:
3761 case Yacid_splash_wB:
3763 Cave[y][x] = Ydiamond_sB;
3764 Cave[y+1][x] = Ydiamond_s;
3765 Next[y][x] = Xblank;
3766 Next[y+1][x] = Xdiamond_fall;
3770 if (lev.wonderwall_time)
3772 lev.wonderwall_state = 1;
3773 Cave[y][x] = Ydiamond_sB;
3774 if (tab_blank[Cave[y+2][x]])
3776 Cave[y+2][x] = Ystone_s;
3777 Next[y+2][x] = Xstone_fall;
3780 Next[y][x] = Xblank;
3781 play_element_sound(x, y, SAMPLE_wonderfall, Xdiamond);
3786 Cave[y][x] = Xdiamond;
3787 Next[y][x] = Xdiamond;
3788 play_element_sound(x, y, SAMPLE_diamond, Xdiamond);
3792 /* --------------------------------------------------------------------- */
3795 switch (Cave[y+1][x])
3805 Cave[y][x] = Ydrip_s1B;
3806 if (Cave[y][x+1] == Xblank)
3807 Cave[y][x+1] = Yacid_splash_eB;
3808 if (Cave[y][x-1] == Xblank)
3809 Cave[y][x-1] = Yacid_splash_wB;
3810 Next[y][x] = Xdrip_stretchB;
3811 play_sound(x, y, SAMPLE_acid);
3815 case Yacid_splash_eB:
3816 case Yacid_splash_wB:
3820 Cave[y][x] = Ydrip_s1B;
3821 Cave[y+1][x] = Ydrip_s1;
3822 Next[y][x] = Xdrip_stretchB;
3823 Next[y+1][x] = Xdrip_stretch;
3864 play_sound(x, y, SAMPLE_drip);
3868 /* --------------------------------------------------------------------- */
3871 Cave[y][x] = Ydrip_s2;
3872 Next[y][x] = Xdrip_fall;
3875 case Xdrip_stretchB:
3876 Cave[y][x] = Ydrip_s2B;
3877 Next[y][x] = Xblank;
3881 Next[y][x] = Xdrip_fall;
3884 /* --------------------------------------------------------------------- */
3887 switch (Cave[y+1][x])
3897 Cave[y][x] = Ybomb_sB;
3898 if (Cave[y][x+1] == Xblank)
3899 Cave[y][x+1] = Yacid_splash_eB;
3900 if (Cave[y][x-1] == Xblank)
3901 Cave[y][x-1] = Yacid_splash_wB;
3902 Next[y][x] = Xblank;
3903 play_sound(x, y, SAMPLE_acid);
3907 case Yacid_splash_eB:
3908 case Yacid_splash_wB:
3909 Cave[y][x] = Ybomb_sB;
3910 Cave[y+1][x] = Ybomb_s;
3911 Next[y][x] = Xblank;
3912 Next[y+1][x] = Xbomb_fall;
3931 case Xemerald_pause:
3933 case Xdiamond_pause:
3961 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3963 Cave[y][x] = Ybomb_eB;
3964 Cave[y][x+1] = Ybomb_e;
3965 Next[y][x] = Xblank;
3966 Next[y][x+1] = Xbomb_pause;
3970 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3972 Cave[y][x] = Ybomb_wB;
3973 Cave[y][x-1] = Ybomb_w;
3974 Next[y][x] = Xblank;
3975 Next[y][x-1] = Xbomb_pause;
3981 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3983 Cave[y][x] = Ybomb_wB;
3984 Cave[y][x-1] = Ybomb_w;
3985 Next[y][x] = Xblank;
3986 Next[y][x-1] = Xbomb_pause;
3990 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3992 Cave[y][x] = Ybomb_eB;
3993 Cave[y][x+1] = Ybomb_e;
3994 Next[y][x] = Xblank;
3995 Next[y][x+1] = Xbomb_pause;
4004 /* --------------------------------------------------------------------- */
4007 switch (Cave[y+1][x])
4017 Cave[y][x] = Ybomb_sB;
4018 if (Cave[y][x+1] == Xblank)
4019 Cave[y][x+1] = Yacid_splash_eB;
4020 if (Cave[y][x-1] == Xblank)
4021 Cave[y][x-1] = Yacid_splash_wB;
4022 Next[y][x] = Xblank;
4023 play_sound(x, y, SAMPLE_acid);
4027 case Yacid_splash_eB:
4028 case Yacid_splash_wB:
4029 Cave[y][x] = Ybomb_sB;
4030 Cave[y+1][x] = Ybomb_s;
4031 Next[y][x] = Xblank;
4032 Next[y+1][x] = Xbomb_fall;
4041 /* --------------------------------------------------------------------- */
4044 switch (Cave[y+1][x])
4054 Cave[y][x] = Ybomb_sB;
4055 if (Cave[y][x+1] == Xblank)
4056 Cave[y][x+1] = Yacid_splash_eB;
4057 if (Cave[y][x-1] == Xblank)
4058 Cave[y][x-1] = Yacid_splash_wB;
4059 Next[y][x] = Xblank;
4060 play_sound(x, y, SAMPLE_acid);
4064 case Yacid_splash_eB:
4065 case Yacid_splash_wB:
4066 Cave[y][x] = Ybomb_sB;
4067 Cave[y+1][x] = Ybomb_s;
4068 Next[y][x] = Xblank;
4069 Next[y+1][x] = Xbomb_fall;
4073 Cave[y][x] = Ybomb_eat;
4074 Next[y][x] = Znormal;
4075 Boom[y-1][x-1] = Xblank;
4076 Boom[y-1][x] = Xblank;
4077 Boom[y-1][x+1] = Xblank;
4078 Boom[y][x-1] = Xblank;
4079 Boom[y][x] = Xblank;
4080 Boom[y][x+1] = Xblank;
4081 Boom[y+1][x-1] = Xblank;
4082 Boom[y+1][x] = Xblank;
4083 Boom[y+1][x+1] = Xblank;
4087 /* --------------------------------------------------------------------- */
4090 if (lev.wind_cnt == 0)
4093 switch (lev.wind_direction)
4096 switch (Cave[y-1][x])
4106 Cave[y][x] = Yballoon_nB;
4107 if (Cave[y-2][x+1] == Xblank)
4108 Cave[y-2][x+1] = Yacid_splash_eB;
4109 if (Cave[y-2][x-1] == Xblank)
4110 Cave[y-2][x-1] = Yacid_splash_wB;
4111 Next[y][x] = Xblank;
4112 play_sound(x, y, SAMPLE_acid);
4116 case Yacid_splash_eB:
4117 case Yacid_splash_wB:
4118 Cave[y][x] = Yballoon_nB;
4119 Cave[y-1][x] = Yballoon_n;
4120 Next[y][x] = Xblank;
4121 Next[y-1][x] = Xballoon;
4129 switch (Cave[y][x+1])
4139 Cave[y][x] = Yballoon_eB;
4140 if (Cave[y-1][x+2] == Xblank)
4141 Cave[y-1][x+2] = Yacid_splash_eB;
4142 if (Cave[y-1][x] == Xblank)
4143 Cave[y-1][x] = Yacid_splash_wB;
4144 Next[y][x] = Xblank;
4145 play_sound(x, y, SAMPLE_acid);
4149 case Yacid_splash_eB:
4150 case Yacid_splash_wB:
4151 Cave[y][x] = Yballoon_eB;
4152 Cave[y][x+1] = Yballoon_e;
4153 Next[y][x] = Xblank;
4154 Next[y][x+1] = Xballoon;
4162 switch (Cave[y+1][x])
4172 Cave[y][x] = Yballoon_sB;
4173 if (Cave[y][x+1] == Xblank)
4174 Cave[y][x+1] = Yacid_splash_eB;
4175 if (Cave[y][x-1] == Xblank)
4176 Cave[y][x-1] = Yacid_splash_wB;
4177 Next[y][x] = Xblank;
4178 play_sound(x, y, SAMPLE_acid);
4182 case Yacid_splash_eB:
4183 case Yacid_splash_wB:
4184 Cave[y][x] = Yballoon_sB;
4185 Cave[y+1][x] = Yballoon_s;
4186 Next[y][x] = Xblank;
4187 Next[y+1][x] = Xballoon;
4195 switch (Cave[y][x-1])
4205 Cave[y][x] = Yballoon_wB;
4206 if (Cave[y-1][x] == Xblank)
4207 Cave[y-1][x] = Yacid_splash_eB;
4208 if (Cave[y-1][x-2] == Xblank)
4209 Cave[y-1][x-2] = Yacid_splash_wB;
4210 Next[y][x] = Xblank;
4211 play_sound(x, y, SAMPLE_acid);
4215 case Yacid_splash_eB:
4216 case Yacid_splash_wB:
4217 Cave[y][x] = Yballoon_wB;
4218 Cave[y][x-1] = Yballoon_w;
4219 Next[y][x] = Xblank;
4220 Next[y][x-1] = Xballoon;
4228 /* --------------------------------------------------------------------- */
4231 Next[y][x] = Xacid_2;
4235 Next[y][x] = Xacid_3;
4239 Next[y][x] = Xacid_4;
4243 Next[y][x] = Xacid_5;
4247 Next[y][x] = Xacid_6;
4251 Next[y][x] = Xacid_7;
4255 Next[y][x] = Xacid_8;
4259 Next[y][x] = Xacid_1;
4262 /* --------------------------------------------------------------------- */
4265 if (lev.ball_state == 0)
4268 Cave[y][x] = Xball_1B;
4269 Next[y][x] = Xball_2;
4276 if (lev.ball_state == 0)
4279 Cave[y][x] = Xball_2B;
4280 Next[y][x] = Xball_1;
4288 play_element_sound(x, y, SAMPLE_ball, element);
4289 if (lev.ball_random)
4294 if (lev.ball_array[lev.ball_pos][0] != Xblank &&
4295 tab_blank[Cave[y-1][x-1]])
4297 Cave[y-1][x-1] = Yball_eat;
4298 Next[y-1][x-1] = lev.ball_array[lev.ball_pos][0];
4303 if (lev.ball_array[lev.ball_pos][1] != Xblank &&
4304 tab_blank[Cave[y-1][x]])
4306 Cave[y-1][x] = Yball_eat;
4307 Next[y-1][x] = lev.ball_array[lev.ball_pos][1];
4312 if (lev.ball_array[lev.ball_pos][2] != Xblank &&
4313 tab_blank[Cave[y-1][x+1]])
4315 Cave[y-1][x+1] = Yball_eat;
4316 Next[y-1][x+1] = lev.ball_array[lev.ball_pos][2];
4321 if (lev.ball_array[lev.ball_pos][3] != Xblank &&
4322 tab_blank[Cave[y][x-1]])
4324 Cave[y][x-1] = Yball_eat;
4325 Next[y][x-1] = lev.ball_array[lev.ball_pos][3];
4330 if (lev.ball_array[lev.ball_pos][4] != Xblank &&
4331 tab_blank[Cave[y][x+1]])
4333 Cave[y][x+1] = Yball_eat;
4334 Next[y][x+1] = lev.ball_array[lev.ball_pos][4];
4339 if (lev.ball_array[lev.ball_pos][5] != Xblank &&
4340 tab_blank[Cave[y+1][x-1]])
4342 Cave[y+1][x-1] = Yball_eat;
4343 Next[y+1][x-1] = lev.ball_array[lev.ball_pos][5];
4348 if (lev.ball_array[lev.ball_pos][6] != Xblank &&
4349 tab_blank[Cave[y+1][x]])
4351 Cave[y+1][x] = Yball_eat;
4352 Next[y+1][x] = lev.ball_array[lev.ball_pos][6];
4357 if (lev.ball_array[lev.ball_pos][7] != Xblank &&
4358 tab_blank[Cave[y+1][x+1]])
4360 Cave[y+1][x+1] = Yball_eat;
4361 Next[y+1][x+1] = lev.ball_array[lev.ball_pos][7];
4368 if (lev.ball_array[lev.ball_pos][0] != Xblank &&
4369 tab_blank[Cave[y-1][x-1]])
4371 Cave[y-1][x-1] = Yball_eat;
4372 Next[y-1][x-1] = lev.ball_array[lev.ball_pos][0];
4375 if (lev.ball_array[lev.ball_pos][1] != Xblank &&
4376 tab_blank[Cave[y-1][x]])
4378 Cave[y-1][x] = Yball_eat;
4379 Next[y-1][x] = lev.ball_array[lev.ball_pos][1];
4382 if (lev.ball_array[lev.ball_pos][2] != Xblank &&
4383 tab_blank[Cave[y-1][x+1]])
4385 Cave[y-1][x+1] = Yball_eat;
4386 Next[y-1][x+1] = lev.ball_array[lev.ball_pos][2];
4389 if (lev.ball_array[lev.ball_pos][3] != Xblank &&
4390 tab_blank[Cave[y][x-1]])
4392 Cave[y][x-1] = Yball_eat;
4393 Next[y][x-1] = lev.ball_array[lev.ball_pos][3];
4396 if (lev.ball_array[lev.ball_pos][4] != Xblank &&
4397 tab_blank[Cave[y][x+1]])
4399 Cave[y][x+1] = Yball_eat;
4400 Next[y][x+1] = lev.ball_array[lev.ball_pos][4];
4403 if (lev.ball_array[lev.ball_pos][5] != Xblank &&
4404 tab_blank[Cave[y+1][x-1]])
4406 Cave[y+1][x-1] = Yball_eat;
4407 Next[y+1][x-1] = lev.ball_array[lev.ball_pos][5];
4410 if (lev.ball_array[lev.ball_pos][6] != Xblank &&
4411 tab_blank[Cave[y+1][x]])
4413 Cave[y+1][x] = Yball_eat;
4414 Next[y+1][x] = lev.ball_array[lev.ball_pos][6];
4417 if (lev.ball_array[lev.ball_pos][7] != Xblank &&
4418 tab_blank[Cave[y+1][x+1]])
4420 Cave[y+1][x+1] = Yball_eat;
4421 Next[y+1][x+1] = lev.ball_array[lev.ball_pos][7];
4425 lev.ball_pos = (lev.ball_pos + 1) & 7;
4428 /* --------------------------------------------------------------------- */
4431 if (tab_blank[Cave[y-1][x]])
4433 Cave[y-1][x] = Ygrow_ns_eat;
4434 Next[y-1][x] = Xgrow_ns;
4435 play_sound(x, y, SAMPLE_grow);
4438 if (tab_blank[Cave[y+1][x]])
4440 Cave[y+1][x] = Ygrow_ns_eat;
4441 Next[y+1][x] = Xgrow_ns;
4442 play_sound(x, y, SAMPLE_grow);
4448 if (tab_blank[Cave[y][x+1]])
4450 Cave[y][x+1] = Ygrow_ew_eat;
4451 Next[y][x+1] = Xgrow_ew;
4452 play_sound(x, y, SAMPLE_grow);
4455 if (tab_blank[Cave[y][x-1]])
4457 Cave[y][x-1] = Ygrow_ew_eat;
4458 Next[y][x-1] = Xgrow_ew;
4459 play_sound(x, y, SAMPLE_grow);
4464 /* --------------------------------------------------------------------- */
4467 if (lev.wonderwall_time && lev.wonderwall_state)
4469 Cave[y][x] = XwonderwallB;
4470 play_sound(x, y, SAMPLE_wonder);
4475 /* --------------------------------------------------------------------- */
4478 if (lev.required > 0)
4484 Cave[y][x] = Xexit_1;
4485 Next[y][x] = Xexit_2;
4489 Cave[y][x] = Xexit_2;
4490 Next[y][x] = Xexit_3;
4494 Cave[y][x] = Xexit_3;
4495 Next[y][x] = Xexit_1;
4501 Next[y][x] = Xexit_2;
4505 Next[y][x] = Xexit_3;
4509 Next[y][x] = Xexit_1;
4512 /* --------------------------------------------------------------------- */
4515 play_sound(x, y, SAMPLE_tick);
4516 Next[y][x] = Xdynamite_2;
4520 play_sound(x, y, SAMPLE_tick);
4521 Next[y][x] = Xdynamite_3;
4525 play_sound(x, y, SAMPLE_tick);
4526 Next[y][x] = Xdynamite_4;
4530 play_sound(x, y, SAMPLE_tick);
4531 Next[y][x] = Zdynamite;
4532 Boom[y-1][x-1] = Xblank;
4533 Boom[y-1][x] = Xblank;
4534 Boom[y-1][x+1] = Xblank;
4535 Boom[y][x-1] = Xblank;
4536 Boom[y][x] = Xblank;
4537 Boom[y][x+1] = Xblank;
4538 Boom[y+1][x-1] = Xblank;
4539 Boom[y+1][x] = Xblank;
4540 Boom[y+1][x+1] = Xblank;
4543 /* --------------------------------------------------------------------- */
4546 if (lev.wheel_cnt && x == lev.wheel_x && y == lev.wheel_y)
4547 Cave[y][x] = XwheelB;
4550 /* --------------------------------------------------------------------- */
4554 Cave[y][x] = XswitchB;
4557 /* --------------------------------------------------------------------- */
4560 switch (Cave[y+1][x])
4570 Cave[y][x] = Xsand_stonesand_3;
4571 if (Cave[y][x+1] == Xblank)
4572 Cave[y][x+1] = Yacid_splash_eB;
4573 if (Cave[y][x-1] == Xblank)
4574 Cave[y][x-1] = Yacid_splash_wB;
4575 Next[y][x] = Xsand_stonesand_4;
4576 play_sound(x, y, SAMPLE_acid);
4580 case Yacid_splash_eB:
4581 case Yacid_splash_wB:
4582 Cave[y][x] = Xsand_stonesand_3;
4583 Cave[y+1][x] = Xsand_stoneout_1;
4584 Next[y][x] = Xsand_stonesand_4;
4585 Next[y+1][x] = Xsand_stoneout_2;
4589 Cave[y][x] = Xsand_stonesand_1;
4590 Cave[y+1][x] = Xsand_sandstone_1;
4591 Next[y][x] = Xsand_stonesand_2;
4592 Next[y+1][x] = Xsand_sandstone_2;
4599 case Xsand_stonein_1:
4600 Next[y][x] = Xsand_stonein_2;
4603 case Xsand_stonein_2:
4604 Next[y][x] = Xsand_stonein_3;
4607 case Xsand_stonein_3:
4608 Next[y][x] = Xsand_stonein_4;
4611 case Xsand_stonein_4:
4612 Next[y][x] = Xblank;
4615 case Xsand_stonesand_1:
4616 Next[y][x] = Xsand_stonesand_2;
4619 case Xsand_stonesand_2:
4620 Next[y][x] = Xsand_stonesand_3;
4623 case Xsand_stonesand_3:
4624 Next[y][x] = Xsand_stonesand_4;
4627 case Xsand_stonesand_4:
4631 case Xsand_stoneout_1:
4632 Next[y][x] = Xsand_stoneout_2;
4635 case Xsand_stoneout_2:
4636 Next[y][x] = Xstone_fall;
4639 case Xsand_sandstone_1:
4640 Next[y][x] = Xsand_sandstone_2;
4643 case Xsand_sandstone_2:
4644 Next[y][x] = Xsand_sandstone_3;
4647 case Xsand_sandstone_3:
4648 Next[y][x] = Xsand_sandstone_4;
4651 case Xsand_sandstone_4:
4652 Next[y][x] = Xsand_stone;
4655 /* --------------------------------------------------------------------- */
4659 Cave[y][x] = XdripperB;
4662 /* --------------------------------------------------------------------- */
4666 Cave[y][x] = Xfake_blankB;
4669 /* --------------------------------------------------------------------- */
4672 if (lev.magnify_cnt)
4673 Cave[y][x] = Xfake_grassB;
4676 /* --------------------------------------------------------------------- */
4679 if (lev.magnify_cnt)
4680 Cave[y][x] = Xdoor_1;
4684 if (lev.magnify_cnt)
4685 Cave[y][x] = Xdoor_2;
4689 if (lev.magnify_cnt)
4690 Cave[y][x] = Xdoor_3;
4694 if (lev.magnify_cnt)
4695 Cave[y][x] = Xdoor_4;
4699 if (lev.magnify_cnt)
4700 Cave[y][x] = Xdoor_5;
4704 if (lev.magnify_cnt)
4705 Cave[y][x] = Xdoor_6;
4709 if (lev.magnify_cnt)
4710 Cave[y][x] = Xdoor_7;
4714 if (lev.magnify_cnt)
4715 Cave[y][x] = Xdoor_8;
4718 /* --------------------------------------------------------------------- */
4722 Next[y][x] = Znormal;
4723 Boom[y-1][x-1] = Xemerald;
4724 Boom[y-1][x] = Xemerald;
4725 Boom[y-1][x+1] = Xemerald;
4726 Boom[y][x-1] = Xemerald;
4727 Boom[y][x] = Xdiamond;
4728 Boom[y][x+1] = Xemerald;
4729 Boom[y+1][x-1] = Xemerald;
4730 Boom[y+1][x] = Xemerald;
4731 Boom[y+1][x+1] = Xemerald;
4738 Next[y][x] = Znormal;
4739 Boom[y-1][x-1] = Xblank;
4740 Boom[y-1][x] = Xblank;
4741 Boom[y-1][x+1] = Xblank;
4742 Boom[y][x-1] = Xblank;
4743 Boom[y][x] = Xblank;
4744 Boom[y][x+1] = Xblank;
4745 Boom[y+1][x-1] = Xblank;
4746 Boom[y+1][x] = Xblank;
4747 Boom[y+1][x+1] = Xblank;
4752 Next[y][x] = Xboom_2;
4753 play_sound(x, y, SAMPLE_boom);
4757 Next[y][x] = Boom[y][x];
4760 /* --------------------------------------------------------------------- */
4763 if (++y < HEIGHT - 1)
4766 cave_cache = Cave[y];
4779 if (ply1.alive || ply2.alive)
4780 lev.score += score; /* only get a score if someone is alive */
4787 /* triple buffering */