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 = RandomEM;
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_element_sound(x, y, SAMPLE_acid, Xacid_1);
355 case Yacid_splash_eB:
356 case Yacid_splash_wB:
369 Cave[y][x] = Ystone_sB;
370 Cave[y+1][x] = Ystone_s;
372 Next[y+1][x] = Xstone_fall;
376 Cave[y][x] = Xsand_stonein_1;
377 Cave[y+1][x] = Xsand_sandstone_1;
378 Next[y][x] = Xsand_stonein_2;
379 Next[y+1][x] = Xsand_sandstone_2;
430 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
432 Cave[y][x] = Ystone_eB;
433 Cave[y][x+1] = Ystone_e;
435 Next[y][x+1] = Xstone_pause;
439 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
441 Cave[y][x] = Ystone_wB;
442 Cave[y][x-1] = Ystone_w;
444 Next[y][x-1] = Xstone_pause;
450 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
452 Cave[y][x] = Ystone_wB;
453 Cave[y][x-1] = Ystone_w;
455 Next[y][x-1] = Xstone_pause;
459 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
461 Cave[y][x] = Ystone_eB;
462 Cave[y][x+1] = Ystone_e;
464 Next[y][x+1] = Xstone_pause;
473 /* --------------------------------------------------------------------- */
476 switch (Cave[y+1][x])
486 Cave[y][x] = Ystone_sB;
487 if (Cave[y][x+1] == Xblank)
488 Cave[y][x+1] = Yacid_splash_eB;
489 if (Cave[y][x-1] == Xblank)
490 Cave[y][x-1] = Yacid_splash_wB;
492 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
496 case Yacid_splash_eB:
497 case Yacid_splash_wB:
508 Cave[y][x] = Ystone_sB;
509 Cave[y+1][x] = Ystone_s;
511 Next[y+1][x] = Xstone_fall;
520 /* --------------------------------------------------------------------- */
523 switch (Cave[y+1][x])
533 Cave[y][x] = Ystone_sB;
534 if (Cave[y][x+1] == Xblank)
535 Cave[y][x+1] = Yacid_splash_eB;
536 if (Cave[y][x-1] == Xblank)
537 Cave[y][x-1] = Yacid_splash_wB;
539 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
543 case Yacid_splash_eB:
544 case Yacid_splash_wB:
556 Cave[y][x] = Ystone_sB;
557 Cave[y+1][x] = Ystone_s;
559 Next[y+1][x] = Xstone_fall;
564 Cave[y+1][x] = Yemerald_stone;
566 Next[y+1][x] = Xemerald;
567 play_element_sound(x, y, SAMPLE_crack, Xnut);
568 score += lev.nut_score;
579 Cave[y][x] = Ystone_sB;
580 Cave[y+1][x] = Ybug_stone;
581 Next[y+1][x] = Znormal;
582 Boom[y][x-1] = Xemerald;
583 Boom[y][x] = Xemerald;
584 Boom[y][x+1] = Xemerald;
585 Boom[y+1][x-1] = Xemerald;
586 Boom[y+1][x] = Xdiamond;
587 Boom[y+1][x+1] = Xemerald;
588 Boom[y+2][x-1] = Xemerald;
589 Boom[y+2][x] = Xemerald;
590 Boom[y+2][x+1] = Xemerald;
592 play_element_sound(x, y, SAMPLE_boom, element);
594 score += lev.bug_score;
605 Cave[y][x] = Ystone_sB;
606 Cave[y+1][x] = Ytank_stone;
607 Next[y+1][x] = Znormal;
608 Boom[y][x-1] = Xblank;
610 Boom[y][x+1] = Xblank;
611 Boom[y+1][x-1] = Xblank;
612 Boom[y+1][x] = Xblank;
613 Boom[y+1][x+1] = Xblank;
614 Boom[y+2][x-1] = Xblank;
615 Boom[y+2][x] = Xblank;
616 Boom[y+2][x+1] = Xblank;
618 play_element_sound(x, y, SAMPLE_boom, element);
620 score += lev.tank_score;
626 switch (Cave[y+1][x+1])
629 case Yacid_splash_eB:
630 case Yacid_splash_wB:
633 Cave[y+1][x] = Xspring_e;
637 Cave[y+1][x] = Xspring_w;
643 switch (Cave[y+1][x-1])
646 case Yacid_splash_eB:
647 case Yacid_splash_wB:
650 Cave[y+1][x] = Xspring_w;
653 Cave[y+1][x] = Xspring_e;
665 Cave[y][x] = Ystone_sB;
666 Cave[y+1][x] = Yeater_stone;
667 Next[y+1][x] = Znormal;
668 Boom[y][x-1] = lev.eater_array[lev.eater_pos][0];
669 Boom[y][x] = lev.eater_array[lev.eater_pos][1];
670 Boom[y][x+1] = lev.eater_array[lev.eater_pos][2];
671 Boom[y+1][x-1] = lev.eater_array[lev.eater_pos][3];
672 Boom[y+1][x] = lev.eater_array[lev.eater_pos][4];
673 Boom[y+1][x+1] = lev.eater_array[lev.eater_pos][5];
674 Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
675 Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
676 Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
678 play_element_sound(x, y, SAMPLE_boom, element);
680 lev.eater_pos = (lev.eater_pos + 1) & 7;
681 score += lev.eater_score;
686 Cave[y][x] = Ystone_sB;
687 Cave[y+1][x] = Yalien_stone;
688 Next[y+1][x] = Znormal;
689 Boom[y][x-1] = Xblank;
691 Boom[y][x+1] = Xblank;
692 Boom[y+1][x-1] = Xblank;
693 Boom[y+1][x] = Xblank;
694 Boom[y+1][x+1] = Xblank;
695 Boom[y+2][x-1] = Xblank;
696 Boom[y+2][x] = Xblank;
697 Boom[y+2][x+1] = Xblank;
699 play_element_sound(x, y, SAMPLE_boom, element);
701 score += lev.alien_score;
706 switch (Cave[y+2][x])
709 case Yacid_splash_eB:
710 case Yacid_splash_wB:
755 play_element_sound(x, y, SAMPLE_stone, Xstone);
759 Cave[y][x] = Ystone_sB;
760 Cave[y+1][x] = Ydiamond_stone;
762 Next[y+1][x] = Xstone_pause;
763 play_element_sound(x, y, SAMPLE_squash, Xdiamond);
768 Cave[y+1][x] = Ybomb_eat;
769 Next[y+1][x] = Znormal;
770 Boom[y][x-1] = Xblank;
772 Boom[y][x+1] = Xblank;
773 Boom[y+1][x-1] = Xblank;
774 Boom[y+1][x] = Xblank;
775 Boom[y+1][x+1] = Xblank;
776 Boom[y+2][x-1] = Xblank;
777 Boom[y+2][x] = Xblank;
778 Boom[y+2][x+1] = Xblank;
780 play_element_sound(x, y, SAMPLE_boom, element);
785 if (lev.wonderwall_time)
787 lev.wonderwall_state = 1;
788 Cave[y][x] = Ystone_sB;
790 if (tab_blank[Cave[y+2][x]])
792 Cave[y+2][x] = Yemerald_s;
793 Next[y+2][x] = Xemerald_fall;
797 play_element_sound(x, y, SAMPLE_wonderfall, Xwonderwall);
804 play_element_sound(x, y, SAMPLE_stone, Xstone);
808 /* --------------------------------------------------------------------- */
811 switch (Cave[y+1][x])
821 Cave[y][x] = Ynut_sB;
822 if (Cave[y][x+1] == Xblank)
823 Cave[y][x+1] = Yacid_splash_eB;
824 if (Cave[y][x-1] == Xblank)
825 Cave[y][x-1] = Yacid_splash_wB;
827 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
831 case Yacid_splash_eB:
832 case Yacid_splash_wB:
833 Cave[y][x] = Ynut_sB;
834 Cave[y+1][x] = Ynut_s;
836 Next[y+1][x] = Xnut_fall;
885 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
887 Cave[y][x] = Ynut_eB;
888 Cave[y][x+1] = Ynut_e;
890 Next[y][x+1] = Xnut_pause;
894 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
896 Cave[y][x] = Ynut_wB;
897 Cave[y][x-1] = Ynut_w;
899 Next[y][x-1] = Xnut_pause;
905 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
907 Cave[y][x] = Ynut_wB;
908 Cave[y][x-1] = Ynut_w;
910 Next[y][x-1] = Xnut_pause;
914 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
916 Cave[y][x] = Ynut_eB;
917 Cave[y][x+1] = Ynut_e;
919 Next[y][x+1] = Xnut_pause;
928 /* --------------------------------------------------------------------- */
932 switch (Cave[y+1][x])
942 Cave[y][x] = Ynut_sB;
943 if (Cave[y][x+1] == Xblank)
944 Cave[y][x+1] = Yacid_splash_eB;
945 if (Cave[y][x-1] == Xblank)
946 Cave[y][x-1] = Yacid_splash_wB;
948 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
952 case Yacid_splash_eB:
953 case Yacid_splash_wB:
954 Cave[y][x] = Ynut_sB;
955 Cave[y+1][x] = Ynut_s;
957 Next[y+1][x] = Xnut_fall;
966 /* --------------------------------------------------------------------- */
969 switch (Cave[y+1][x])
979 Cave[y][x] = Ynut_sB;
980 if (Cave[y][x+1] == Xblank)
981 Cave[y][x+1] = Yacid_splash_eB;
982 if (Cave[y][x-1] == Xblank)
983 Cave[y][x-1] = Yacid_splash_wB;
985 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
989 case Yacid_splash_eB:
990 case Yacid_splash_wB:
992 Cave[y][x] = Ynut_sB;
993 Cave[y+1][x] = Ynut_s;
995 Next[y+1][x] = Xnut_fall;
1001 play_element_sound(x, y, SAMPLE_nut, Xnut);
1005 /* --------------------------------------------------------------------- */
1008 if (tab_amoeba[Cave[y-1][x]] ||
1009 tab_amoeba[Cave[y][x+1]] ||
1010 tab_amoeba[Cave[y+1][x]] ||
1011 tab_amoeba[Cave[y][x-1]])
1014 switch (Cave[y][x+1])
1017 case Yacid_splash_eB:
1018 case Yacid_splash_wB:
1030 Cave[y][x] = Ybug_n_e;
1031 Next[y][x] = Xbug_goe;
1032 play_element_sound(x, y, SAMPLE_bug, element);
1040 if (tab_amoeba[Cave[y-1][x]] ||
1041 tab_amoeba[Cave[y][x+1]] ||
1042 tab_amoeba[Cave[y+1][x]] ||
1043 tab_amoeba[Cave[y][x-1]])
1048 switch (Cave[y-1][x])
1058 Cave[y][x] = Ybug_nB;
1059 if (Cave[y-2][x+1] == Xblank)
1060 Cave[y-2][x+1] = Yacid_splash_eB;
1061 if (Cave[y-2][x-1] == Xblank)
1062 Cave[y-2][x-1] = Yacid_splash_wB;
1063 Next[y][x] = Xblank;
1064 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
1068 case Yacid_splash_eB:
1069 case Yacid_splash_wB:
1073 Cave[y][x] = Ybug_nB;
1074 Cave[y-1][x] = Ybug_n;
1075 Next[y][x] = Xblank;
1076 Next[y-1][x] = Xbug_n;
1077 play_element_sound(x, y, SAMPLE_bug, element);
1081 Cave[y][x] = Ybug_n_w;
1082 Next[y][x] = Xbug_gow;
1083 play_element_sound(x, y, SAMPLE_bug, element);
1087 /* --------------------------------------------------------------------- */
1090 if (tab_amoeba[Cave[y-1][x]] ||
1091 tab_amoeba[Cave[y][x+1]] ||
1092 tab_amoeba[Cave[y+1][x]] ||
1093 tab_amoeba[Cave[y][x-1]])
1096 switch (Cave[y+1][x])
1099 case Yacid_splash_eB:
1100 case Yacid_splash_wB:
1112 Cave[y][x] = Ybug_e_s;
1113 Next[y][x] = Xbug_gos;
1114 play_element_sound(x, y, SAMPLE_bug, element);
1122 if (tab_amoeba[Cave[y-1][x]] ||
1123 tab_amoeba[Cave[y][x+1]] ||
1124 tab_amoeba[Cave[y+1][x]] ||
1125 tab_amoeba[Cave[y][x-1]])
1130 switch (Cave[y][x+1])
1140 Cave[y][x] = Ybug_eB;
1141 if (Cave[y-1][x+2] == Xblank)
1142 Cave[y-1][x+2] = Yacid_splash_eB;
1143 if (Cave[y-1][x] == Xblank)
1144 Cave[y-1][x] = Yacid_splash_wB;
1145 Next[y][x] = Xblank;
1146 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
1150 case Yacid_splash_eB:
1151 case Yacid_splash_wB:
1155 Cave[y][x] = Ybug_eB;
1156 Cave[y][x+1] = Ybug_e;
1157 Next[y][x] = Xblank;
1158 Next[y][x+1] = Xbug_e;
1159 play_element_sound(x, y, SAMPLE_bug, element);
1163 Cave[y][x] = Ybug_e_n;
1164 Next[y][x] = Xbug_gon;
1165 play_element_sound(x, y, SAMPLE_bug, element);
1169 /* --------------------------------------------------------------------- */
1172 if (tab_amoeba[Cave[y-1][x]] ||
1173 tab_amoeba[Cave[y][x+1]] ||
1174 tab_amoeba[Cave[y+1][x]] ||
1175 tab_amoeba[Cave[y][x-1]])
1178 switch (Cave[y][x-1])
1181 case Yacid_splash_eB:
1182 case Yacid_splash_wB:
1194 Cave[y][x] = Ybug_s_w;
1195 Next[y][x] = Xbug_gow;
1196 play_element_sound(x, y, SAMPLE_bug, element);
1204 if (tab_amoeba[Cave[y-1][x]] ||
1205 tab_amoeba[Cave[y][x+1]] ||
1206 tab_amoeba[Cave[y+1][x]] ||
1207 tab_amoeba[Cave[y][x-1]])
1212 switch (Cave[y+1][x])
1222 Cave[y][x] = Ybug_sB;
1223 if (Cave[y][x+1] == Xblank)
1224 Cave[y][x+1] = Yacid_splash_eB;
1225 if (Cave[y][x-1] == Xblank)
1226 Cave[y][x-1] = Yacid_splash_wB;
1227 Next[y][x] = Xblank;
1228 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
1232 case Yacid_splash_eB:
1233 case Yacid_splash_wB:
1237 Cave[y][x] = Ybug_sB;
1238 Cave[y+1][x] = Ybug_s;
1239 Next[y][x] = Xblank;
1240 Next[y+1][x] = Xbug_s;
1241 play_element_sound(x, y, SAMPLE_bug, element);
1245 Cave[y][x] = Ybug_s_e;
1246 Next[y][x] = Xbug_goe;
1247 play_element_sound(x, y, SAMPLE_bug, element);
1251 /* --------------------------------------------------------------------- */
1254 if (tab_amoeba[Cave[y-1][x]] ||
1255 tab_amoeba[Cave[y][x+1]] ||
1256 tab_amoeba[Cave[y+1][x]] ||
1257 tab_amoeba[Cave[y][x-1]])
1260 switch (Cave[y-1][x])
1263 case Yacid_splash_eB:
1264 case Yacid_splash_wB:
1276 Cave[y][x] = Ybug_w_n;
1277 Next[y][x] = Xbug_gon;
1278 play_element_sound(x, y, SAMPLE_bug, element);
1286 if (tab_amoeba[Cave[y-1][x]] ||
1287 tab_amoeba[Cave[y][x+1]] ||
1288 tab_amoeba[Cave[y+1][x]] ||
1289 tab_amoeba[Cave[y][x-1]])
1294 switch (Cave[y][x-1])
1304 Cave[y][x] = Ybug_wB;
1305 if (Cave[y-1][x] == Xblank)
1306 Cave[y-1][x] = Yacid_splash_eB;
1307 if (Cave[y-1][x-2] == Xblank)
1308 Cave[y-1][x-2] = Yacid_splash_wB;
1309 Next[y][x] = Xblank;
1310 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
1314 case Yacid_splash_eB:
1315 case Yacid_splash_wB:
1319 Cave[y][x] = Ybug_wB;
1320 Cave[y][x-1] = Ybug_w;
1321 Next[y][x] = Xblank;
1322 Next[y][x-1] = Xbug_w;
1323 play_element_sound(x, y, SAMPLE_bug, element);
1327 Cave[y][x] = Ybug_w_s;
1328 Next[y][x] = Xbug_gos;
1329 play_element_sound(x, y, SAMPLE_bug, element);
1333 /* --------------------------------------------------------------------- */
1336 if (tab_amoeba[Cave[y-1][x]] ||
1337 tab_amoeba[Cave[y][x+1]] ||
1338 tab_amoeba[Cave[y+1][x]] ||
1339 tab_amoeba[Cave[y][x-1]])
1342 switch (Cave[y][x-1])
1345 case Yacid_splash_eB:
1346 case Yacid_splash_wB:
1358 Cave[y][x] = Ytank_n_w;
1359 Next[y][x] = Xtank_gow;
1360 play_element_sound(x, y, SAMPLE_tank, element);
1368 if (tab_amoeba[Cave[y-1][x]] ||
1369 tab_amoeba[Cave[y][x+1]] ||
1370 tab_amoeba[Cave[y+1][x]] ||
1371 tab_amoeba[Cave[y][x-1]])
1376 switch (Cave[y-1][x])
1386 Cave[y][x] = Ytank_nB;
1387 if (Cave[y-2][x+1] == Xblank)
1388 Cave[y-2][x+1] = Yacid_splash_eB;
1389 if (Cave[y-2][x-1] == Xblank)
1390 Cave[y-2][x-1] = Yacid_splash_wB;
1391 Next[y][x] = Xblank;
1392 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
1396 case Yacid_splash_eB:
1397 case Yacid_splash_wB:
1401 Cave[y][x] = Ytank_nB;
1402 Cave[y-1][x] = Ytank_n;
1403 Next[y][x] = Xblank;
1404 Next[y-1][x] = Xtank_n;
1405 play_element_sound(x, y, SAMPLE_tank, element);
1409 Cave[y][x] = Ytank_n_e;
1410 Next[y][x] = Xtank_goe;
1411 play_element_sound(x, y, SAMPLE_tank, element);
1415 /* --------------------------------------------------------------------- */
1418 if (tab_amoeba[Cave[y-1][x]] ||
1419 tab_amoeba[Cave[y][x+1]] ||
1420 tab_amoeba[Cave[y+1][x]] ||
1421 tab_amoeba[Cave[y][x-1]])
1424 switch (Cave[y-1][x])
1427 case Yacid_splash_eB:
1428 case Yacid_splash_wB:
1440 Cave[y][x] = Ytank_e_n;
1441 Next[y][x] = Xtank_gon;
1442 play_element_sound(x, y, SAMPLE_tank, element);
1450 if (tab_amoeba[Cave[y-1][x]] ||
1451 tab_amoeba[Cave[y][x+1]] ||
1452 tab_amoeba[Cave[y+1][x]] ||
1453 tab_amoeba[Cave[y][x-1]])
1458 switch (Cave[y][x+1])
1468 Cave[y][x] = Ytank_eB;
1469 if (Cave[y-1][x+2] == Xblank)
1470 Cave[y-1][x+2] = Yacid_splash_eB;
1471 if (Cave[y-1][x] == Xblank)
1472 Cave[y-1][x] = Yacid_splash_wB;
1473 Next[y][x] = Xblank;
1474 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
1478 case Yacid_splash_eB:
1479 case Yacid_splash_wB:
1483 Cave[y][x] = Ytank_eB;
1484 Cave[y][x+1] = Ytank_e;
1485 Next[y][x] = Xblank;
1486 Next[y][x+1] = Xtank_e;
1487 play_element_sound(x, y, SAMPLE_tank, element);
1491 Cave[y][x] = Ytank_e_s;
1492 Next[y][x] = Xtank_gos;
1493 play_element_sound(x, y, SAMPLE_tank, element);
1497 /* --------------------------------------------------------------------- */
1500 if (tab_amoeba[Cave[y-1][x]] ||
1501 tab_amoeba[Cave[y][x+1]] ||
1502 tab_amoeba[Cave[y+1][x]] ||
1503 tab_amoeba[Cave[y][x-1]])
1506 switch (Cave[y][x+1])
1509 case Yacid_splash_eB:
1510 case Yacid_splash_wB:
1522 Cave[y][x] = Ytank_s_e;
1523 Next[y][x] = Xtank_goe;
1524 play_element_sound(x, y, SAMPLE_tank, element);
1532 if (tab_amoeba[Cave[y-1][x]] ||
1533 tab_amoeba[Cave[y][x+1]] ||
1534 tab_amoeba[Cave[y+1][x]] ||
1535 tab_amoeba[Cave[y][x-1]])
1540 switch (Cave[y+1][x])
1550 Cave[y][x] = Ytank_sB;
1551 if (Cave[y][x+1] == Xblank)
1552 Cave[y][x+1] = Yacid_splash_eB;
1553 if (Cave[y][x-1] == Xblank)
1554 Cave[y][x-1] = Yacid_splash_wB;
1555 Next[y][x] = Xblank;
1556 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
1560 case Yacid_splash_eB:
1561 case Yacid_splash_wB:
1565 Cave[y][x] = Ytank_sB;
1566 Cave[y+1][x] = Ytank_s;
1567 Next[y][x] = Xblank;
1568 Next[y+1][x] = Xtank_s;
1569 play_element_sound(x, y, SAMPLE_tank, element);
1573 Cave[y][x] = Ytank_s_w;
1574 Next[y][x] = Xtank_gow;
1575 play_element_sound(x, y, SAMPLE_tank, element);
1579 /* --------------------------------------------------------------------- */
1582 if (tab_amoeba[Cave[y-1][x]] ||
1583 tab_amoeba[Cave[y][x+1]] ||
1584 tab_amoeba[Cave[y+1][x]] ||
1585 tab_amoeba[Cave[y][x-1]])
1588 switch (Cave[y+1][x])
1591 case Yacid_splash_eB:
1592 case Yacid_splash_wB:
1604 Cave[y][x] = Ytank_w_s;
1605 Next[y][x] = Xtank_gos;
1606 play_element_sound(x, y, SAMPLE_tank, element);
1614 if (tab_amoeba[Cave[y-1][x]] ||
1615 tab_amoeba[Cave[y][x+1]] ||
1616 tab_amoeba[Cave[y+1][x]] ||
1617 tab_amoeba[Cave[y][x-1]])
1622 switch (Cave[y][x-1])
1632 Cave[y][x] = Ytank_wB;
1633 if (Cave[y-1][x] == Xblank)
1634 Cave[y-1][x] = Yacid_splash_eB;
1635 if (Cave[y-1][x-2] == Xblank)
1636 Cave[y-1][x-2] = Yacid_splash_wB;
1637 Next[y][x] = Xblank;
1638 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
1642 case Yacid_splash_eB:
1643 case Yacid_splash_wB:
1647 Cave[y][x] = Ytank_wB;
1648 Cave[y][x-1] = Ytank_w;
1649 Next[y][x] = Xblank;
1650 Next[y][x-1] = Xtank_w;
1651 play_element_sound(x, y, SAMPLE_tank, element);
1655 Cave[y][x] = Ytank_w_n;
1656 Next[y][x] = Xtank_gon;
1657 play_element_sound(x, y, SAMPLE_tank, element);
1661 /* --------------------------------------------------------------------- */
1667 if (lev.android_clone_cnt == 0)
1669 if (Cave[y-1][x-1] != Xblank &&
1670 Cave[y-1][x] != Xblank &&
1671 Cave[y-1][x+1] != Xblank &&
1672 Cave[y][x-1] != Xblank &&
1673 Cave[y][x+1] != Xblank &&
1674 Cave[y+1][x-1] != Xblank &&
1675 Cave[y+1][x] != Xblank &&
1676 Cave[y+1][x+1] != Xblank)
1681 /* randomly find an object to clone */
1683 case 0: /* S,NE,W,NW,SE,E,SW,N */
1684 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1685 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1686 temp= lev.android_array[Cave[y][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+1][x+1]]; if (temp != Xblank) break;
1689 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1690 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1691 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1694 case 1: /* NW,SE,N,S,NE,SW,E,W */
1695 temp= lev.android_array[Cave[y-1][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]]; 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+1]]; if (temp != Xblank) break;
1700 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1701 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1702 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1705 case 2: /* SW,E,S,W,N,NW,SE,NE */
1706 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1707 temp= lev.android_array[Cave[y][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][x-1]]; if (temp != Xblank) break;
1710 temp= lev.android_array[Cave[y-1][x]]; 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+1][x+1]]; if (temp != Xblank) break;
1713 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1716 case 3: /* N,SE,NE,E,W,S,NW,SW */
1717 temp= lev.android_array[Cave[y-1][x]]; 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+1]]; if (temp != Xblank) break;
1720 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1721 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1722 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1723 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1724 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1727 case 4: /* SE,NW,E,NE,SW,W,N,S */
1728 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1729 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1730 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1731 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1732 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1733 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1734 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1735 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1738 case 5: /* NE,W,SE,SW,S,N,E,NW */
1739 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1740 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1741 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1742 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1743 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1744 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1745 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1746 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1749 case 6: /* E,N,SW,S,NW,NE,SE,W */
1750 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1751 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1752 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1753 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1754 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1755 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1756 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1757 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1760 case 7: /* W,SW,NW,N,E,SE,NE,S */
1761 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1762 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1763 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1764 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1765 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1766 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1767 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1768 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1772 Next[y][x] = temp; /* the item we chose to clone */
1773 play_element_sound(x, y, SAMPLE_android_clone, temp);
1777 /* randomly find a direction to move */
1779 case 0: /* S,NE,W,NW,SE,E,SW,N */
1780 if (Cave[y+1][x] == Xblank) goto android_s;
1781 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1782 if (Cave[y][x-1] == Xblank) goto android_w;
1783 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1784 if (Cave[y+1][x+1] == Xblank) goto android_se;
1785 if (Cave[y][x+1] == Xblank) goto android_e;
1786 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1787 if (Cave[y-1][x] == Xblank) goto android_n;
1790 case 1: /* NW,SE,N,S,NE,SW,E,W */
1791 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1792 if (Cave[y+1][x+1] == Xblank) goto android_se;
1793 if (Cave[y-1][x] == Xblank) goto android_n;
1794 if (Cave[y+1][x] == Xblank) goto android_s;
1795 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1796 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1797 if (Cave[y][x+1] == Xblank) goto android_e;
1798 if (Cave[y][x-1] == Xblank) goto android_w;
1801 case 2: /* SW,E,S,W,N,NW,SE,NE */
1802 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1803 if (Cave[y][x+1] == Xblank) goto android_e;
1804 if (Cave[y+1][x] == Xblank) goto android_s;
1805 if (Cave[y][x-1] == Xblank) goto android_w;
1806 if (Cave[y-1][x] == Xblank) goto android_n;
1807 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1808 if (Cave[y+1][x+1] == Xblank) goto android_se;
1809 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1812 case 3: /* N,SE,NE,E,W,S,NW,SW */
1813 if (Cave[y-1][x] == Xblank) goto android_n;
1814 if (Cave[y+1][x+1] == Xblank) goto android_se;
1815 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1816 if (Cave[y][x+1] == Xblank) goto android_e;
1817 if (Cave[y][x-1] == Xblank) goto android_w;
1818 if (Cave[y+1][x] == Xblank) goto android_s;
1819 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1820 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1823 case 4: /* SE,NW,E,NE,SW,W,N,S */
1824 if (Cave[y+1][x+1] == Xblank) goto android_se;
1825 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1826 if (Cave[y][x+1] == Xblank) goto android_e;
1827 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1828 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1829 if (Cave[y][x-1] == Xblank) goto android_w;
1830 if (Cave[y-1][x] == Xblank) goto android_n;
1831 if (Cave[y+1][x] == Xblank) goto android_s;
1834 case 5: /* NE,W,SE,SW,S,N,E,NW */
1835 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1836 if (Cave[y][x-1] == Xblank) goto android_w;
1837 if (Cave[y+1][x+1] == Xblank) goto android_se;
1838 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1839 if (Cave[y+1][x] == Xblank) goto android_s;
1840 if (Cave[y-1][x] == Xblank) goto android_n;
1841 if (Cave[y][x+1] == Xblank) goto android_e;
1842 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1845 case 6: /* E,N,SW,S,NW,NE,SE,W */
1846 if (Cave[y][x+1] == Xblank) goto android_e;
1847 if (Cave[y-1][x] == Xblank) goto android_n;
1848 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1849 if (Cave[y+1][x] == Xblank) goto android_s;
1850 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1851 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1852 if (Cave[y+1][x+1] == Xblank) goto android_se;
1853 if (Cave[y][x-1] == Xblank) goto android_w;
1856 case 7: /* W,SW,NW,N,E,SE,NE,S */
1857 if (Cave[y][x-1] == Xblank) goto android_w;
1858 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1859 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1860 if (Cave[y-1][x] == Xblank) goto android_n;
1861 if (Cave[y][x+1] == Xblank) goto android_e;
1862 if (Cave[y+1][x+1] == Xblank) goto android_se;
1863 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1864 if (Cave[y+1][x] == Xblank) goto android_s;
1870 if (lev.android_move_cnt == 0)
1872 if (Cave[y-1][x-1] == Zplayer ||
1873 Cave[y-1][x] == Zplayer ||
1874 Cave[y-1][x+1] == Zplayer ||
1875 Cave[y][x-1] == Zplayer ||
1876 Cave[y][x+1] == Zplayer ||
1877 Cave[y+1][x-1] == Zplayer ||
1878 Cave[y+1][x] == Zplayer ||
1879 Cave[y+1][x+1] == Zplayer)
1882 if (ply1.alive && ply2.alive)
1884 if ((ply1.x > x ? ply1.x - x : x - ply1.x) +
1885 (ply1.y > y ? ply1.y - y : y - ply1.y) <
1886 (ply2.x > x ? ply2.x - x : x - ply2.x) +
1887 (ply2.y > y ? ply2.y - y : y - ply2.y))
1898 else if (ply1.alive)
1903 else if (ply2.alive)
1914 Next[y][x] = Xblank; /* assume we will move */
1915 temp = ((x < dx) + 1 - (x > dx)) + ((y < dy) + 1 - (y > dy)) * 3;
1921 /* attempt clockwise move first if direct path is blocked */
1923 case 0: /* north west */
1924 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1925 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1926 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1930 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1931 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1932 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1935 case 2: /* north east */
1936 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1937 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1938 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1942 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1943 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1944 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1947 case 4: /* nowhere */
1951 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1952 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1953 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1956 case 6: /* south west */
1957 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1958 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1959 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1963 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1964 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1965 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1968 case 8: /* south east */
1969 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1970 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1971 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1979 /* attempt counterclockwise move first if direct path is blocked */
1981 case 0: /* north west */
1982 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1983 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1984 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1988 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1989 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1990 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1993 case 2: /* north east */
1994 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1995 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1996 if (tab_android_move[Cave[y][x+1]]) goto android_e;
2000 if (tab_android_move[Cave[y][x-1]]) goto android_w;
2001 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
2002 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
2005 case 4: /* nowhere */
2009 if (tab_android_move[Cave[y][x+1]]) goto android_e;
2010 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
2011 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
2014 case 6: /* south west */
2015 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
2016 if (tab_android_move[Cave[y+1][x]]) goto android_s;
2017 if (tab_android_move[Cave[y][x-1]]) goto android_w;
2021 if (tab_android_move[Cave[y+1][x]]) goto android_s;
2022 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
2023 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
2026 case 8: /* south east */
2027 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
2028 if (tab_android_move[Cave[y][x+1]]) goto android_e;
2029 if (tab_android_move[Cave[y+1][x]]) goto android_s;
2037 Next[y][x] = Xandroid;
2042 Cave[y][x] = Yandroid_nB;
2043 Cave[y-1][x] = Yandroid_n;
2044 Next[y-1][x] = Xandroid;
2045 play_element_sound(x, y, SAMPLE_android_move, element);
2050 Cave[y][x] = Yandroid_neB;
2051 Cave[y-1][x+1] = Yandroid_ne;
2052 Next[y-1][x+1] = Xandroid;
2053 play_element_sound(x, y, SAMPLE_android_move, element);
2058 Cave[y][x] = Yandroid_eB;
2059 Cave[y][x+1] = Yandroid_e;
2060 Next[y][x+1] = Xandroid;
2061 play_element_sound(x, y, SAMPLE_android_move, element);
2066 Cave[y][x] = Yandroid_seB;
2067 Cave[y+1][x+1] = Yandroid_se;
2068 Next[y+1][x+1] = Xandroid;
2069 play_element_sound(x, y, SAMPLE_android_move, element);
2074 Cave[y][x] = Yandroid_sB;
2075 Cave[y+1][x] = Yandroid_s;
2076 Next[y+1][x] = Xandroid;
2077 play_element_sound(x, y, SAMPLE_android_move, element);
2082 Cave[y][x] = Yandroid_swB;
2083 Cave[y+1][x-1] = Yandroid_sw;
2084 Next[y+1][x-1] = Xandroid;
2085 play_element_sound(x, y, SAMPLE_android_move, element);
2090 Cave[y][x] = Yandroid_wB;
2091 Cave[y][x-1] = Yandroid_w;
2092 Next[y][x-1] = Xandroid;
2093 play_element_sound(x, y, SAMPLE_android_move, element);
2098 Cave[y][x] = Yandroid_nwB;
2099 Cave[y-1][x-1] = Yandroid_nw;
2100 Next[y-1][x-1] = Xandroid;
2101 play_element_sound(x, y, SAMPLE_android_move, element);
2104 /* --------------------------------------------------------------------- */
2107 switch (Cave[y-1][x])
2117 Cave[y][x] = Yandroid_nB;
2118 if (Cave[y-2][x+1] == Xblank)
2119 Cave[y-2][x+1] = Yacid_splash_eB;
2120 if (Cave[y-2][x-1] == Xblank)
2121 Cave[y-2][x-1] = Yacid_splash_wB;
2122 Next[y][x] = Xblank;
2123 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2127 case Yacid_splash_eB:
2128 case Yacid_splash_wB:
2129 Cave[y][x] = Yandroid_nB;
2130 Cave[y-1][x] = Yandroid_n;
2131 Next[y][x] = Xblank;
2132 Next[y-1][x] = Xandroid;
2133 play_element_sound(x, y, SAMPLE_android_move, element);
2141 switch (Cave[y-1][x])
2151 Cave[y][x] = Yandroid_nB;
2152 if (Cave[y-2][x+1] == Xblank)
2153 Cave[y-2][x+1] = Yacid_splash_eB;
2154 if (Cave[y-2][x-1] == Xblank)
2155 Cave[y-2][x-1] = Yacid_splash_wB;
2156 Next[y][x] = Xblank;
2157 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2161 case Yacid_splash_eB:
2162 case Yacid_splash_wB:
2163 Cave[y][x] = Yandroid_nB;
2164 Cave[y-1][x] = Yandroid_n;
2165 Next[y][x] = Xblank;
2166 Next[y-1][x] = Xandroid_1_n;
2167 play_element_sound(x, y, SAMPLE_android_move, element);
2174 /* --------------------------------------------------------------------- */
2177 switch (Cave[y][x+1])
2187 Cave[y][x] = Yandroid_eB;
2188 if (Cave[y-1][x+2] == Xblank)
2189 Cave[y-1][x+2] = Yacid_splash_eB;
2190 if (Cave[y-1][x] == Xblank)
2191 Cave[y-1][x] = Yacid_splash_wB;
2192 Next[y][x] = Xblank;
2193 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2197 case Yacid_splash_eB:
2198 case Yacid_splash_wB:
2199 Cave[y][x] = Yandroid_eB;
2200 Cave[y][x+1] = Yandroid_e;
2201 Next[y][x] = Xblank;
2202 Next[y][x+1] = Xandroid;
2203 play_element_sound(x, y, SAMPLE_android_move, element);
2211 switch (Cave[y][x+1])
2221 Cave[y][x] = Yandroid_eB;
2222 if (Cave[y-1][x+2] == Xblank)
2223 Cave[y-1][x+2] = Yacid_splash_eB;
2224 if (Cave[y-1][x] == Xblank)
2225 Cave[y-1][x] = Yacid_splash_wB;
2226 Next[y][x] = Xblank;
2227 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2231 case Yacid_splash_eB:
2232 case Yacid_splash_wB:
2233 Cave[y][x] = Yandroid_eB;
2234 Cave[y][x+1] = Yandroid_e;
2235 Next[y][x] = Xblank;
2236 Next[y][x+1] = Xandroid_1_e;
2237 play_element_sound(x, y, SAMPLE_android_move, element);
2244 /* --------------------------------------------------------------------- */
2247 switch (Cave[y+1][x])
2257 Cave[y][x] = Yandroid_sB;
2258 if (Cave[y][x+1] == Xblank)
2259 Cave[y][x+1] = Yacid_splash_eB;
2260 if (Cave[y][x-1] == Xblank)
2261 Cave[y][x-1] = Yacid_splash_wB;
2262 Next[y][x] = Xblank;
2263 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2267 case Yacid_splash_eB:
2268 case Yacid_splash_wB:
2269 Cave[y][x] = Yandroid_sB;
2270 Cave[y+1][x] = Yandroid_s;
2271 Next[y][x] = Xblank;
2272 Next[y+1][x] = Xandroid;
2273 play_element_sound(x, y, SAMPLE_android_move, element);
2281 switch (Cave[y+1][x])
2291 Cave[y][x] = Yandroid_sB;
2292 if (Cave[y][x+1] == Xblank)
2293 Cave[y][x+1] = Yacid_splash_eB;
2294 if (Cave[y][x-1] == Xblank)
2295 Cave[y][x-1] = Yacid_splash_wB;
2296 Next[y][x] = Xblank;
2297 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2301 case Yacid_splash_eB:
2302 case Yacid_splash_wB:
2303 Cave[y][x] = Yandroid_sB;
2304 Cave[y+1][x] = Yandroid_s;
2305 Next[y][x] = Xblank;
2306 Next[y+1][x] = Xandroid_1_s;
2307 play_element_sound(x, y, SAMPLE_android_move, element);
2314 /* --------------------------------------------------------------------- */
2317 switch (Cave[y][x-1])
2327 Cave[y][x] = Yandroid_wB;
2328 if (Cave[y-1][x] == Xblank)
2329 Cave[y-1][x] = Yacid_splash_eB;
2330 if (Cave[y-1][x-2] == Xblank)
2331 Cave[y-1][x-2] = Yacid_splash_wB;
2332 Next[y][x] = Xblank;
2333 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2337 case Yacid_splash_eB:
2338 case Yacid_splash_wB:
2339 Cave[y][x] = Yandroid_wB;
2340 Cave[y][x-1] = Yandroid_w;
2341 Next[y][x] = Xblank;
2342 Next[y][x-1] = Xandroid;
2343 play_element_sound(x, y, SAMPLE_android_move, element);
2351 switch (Cave[y][x-1])
2361 Cave[y][x] = Yandroid_wB;
2362 if (Cave[y-1][x] == Xblank)
2363 Cave[y-1][x] = Yacid_splash_eB;
2364 if (Cave[y-1][x-2] == Xblank)
2365 Cave[y-1][x-2] = Yacid_splash_wB;
2366 Next[y][x] = Xblank;
2367 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2371 case Yacid_splash_eB:
2372 case Yacid_splash_wB:
2373 Cave[y][x] = Yandroid_wB;
2374 Cave[y][x-1] = Yandroid_w;
2375 Next[y][x] = Xblank;
2376 Next[y][x-1] = Xandroid_1_w;
2377 play_element_sound(x, y, SAMPLE_android_move, element);
2384 /* --------------------------------------------------------------------- */
2387 switch (Cave[y+1][x])
2397 Cave[y][x] = Yspring_sB;
2398 if (Cave[y][x+1] == Xblank)
2399 Cave[y][x+1] = Yacid_splash_eB;
2400 if (Cave[y][x-1] == Xblank)
2401 Cave[y][x-1] = Yacid_splash_wB;
2402 Next[y][x] = Xblank;
2403 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2407 case Yacid_splash_eB:
2408 case Yacid_splash_wB:
2411 Cave[y][x] = Yspring_sB;
2412 Cave[y+1][x] = Yspring_s;
2413 Next[y][x] = Xblank;
2414 Next[y+1][x] = Xspring_fall;
2433 case Xemerald_pause:
2435 case Xdiamond_pause:
2463 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2465 Cave[y][x] = Yspring_eB;
2466 Cave[y][x+1] = Yspring_e;
2467 if (Cave[y+1][x] == Xbumper)
2468 Cave[y+1][x] = XbumperB;
2469 Next[y][x] = Xblank;
2472 Next[y][x+1] = Xspring_e;
2474 Next[y][x+1] = Xspring_pause;
2480 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2482 Cave[y][x] = Yspring_wB;
2483 Cave[y][x-1] = Yspring_w;
2484 if (Cave[y+1][x] == Xbumper)
2485 Cave[y+1][x] = XbumperB;
2486 Next[y][x] = Xblank;
2489 Next[y][x-1] = Xspring_w;
2491 Next[y][x-1] = Xspring_pause;
2499 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2501 Cave[y][x] = Yspring_wB;
2502 Cave[y][x-1] = Yspring_w;
2503 if (Cave[y+1][x] == Xbumper)
2504 Cave[y+1][x] = XbumperB;
2505 Next[y][x] = Xblank;
2508 Next[y][x-1] = Xspring_w;
2510 Next[y][x-1] = Xspring_pause;
2516 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2518 Cave[y][x] = Yspring_eB;
2519 Cave[y][x+1] = Yspring_e;
2520 if (Cave[y+1][x] == Xbumper)
2521 Cave[y+1][x] = XbumperB;
2522 Next[y][x] = Xblank;
2525 Next[y][x+1] = Xspring_e;
2527 Next[y][x+1] = Xspring_pause;
2538 /* --------------------------------------------------------------------- */
2541 switch (Cave[y+1][x])
2551 Cave[y][x] = Yspring_sB;
2552 if (Cave[y][x+1] == Xblank)
2553 Cave[y][x+1] = Yacid_splash_eB;
2554 if (Cave[y][x-1] == Xblank)
2555 Cave[y][x-1] = Yacid_splash_wB;
2556 Next[y][x] = Xblank;
2557 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2561 case Yacid_splash_eB:
2562 case Yacid_splash_wB:
2563 Cave[y][x] = Yspring_sB;
2564 Cave[y+1][x] = Yspring_s;
2565 Next[y][x] = Xblank;
2566 Next[y+1][x] = Xspring_fall;
2570 Cave[y][x] = Xspring;
2571 Next[y][x] = Xspring;
2575 /* --------------------------------------------------------------------- */
2578 switch (Cave[y+1][x])
2588 Cave[y][x] = Yspring_sB;
2589 if (Cave[y][x+1] == Xblank)
2590 Cave[y][x+1] = Yacid_splash_eB;
2591 if (Cave[y][x-1] == Xblank)
2592 Cave[y][x-1] = Yacid_splash_wB;
2593 Next[y][x] = Xblank;
2594 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2598 case Yacid_splash_eB:
2599 case Yacid_splash_wB:
2600 Cave[y][x] = Yspring_sB;
2601 Cave[y+1][x] = Yspring_s;
2602 Next[y][x] = Xblank;
2603 Next[y+1][x] = Xspring_fall;
2607 Cave[y+1][x] = XbumperB;
2610 switch (Cave[y][x+1])
2620 Cave[y][x] = Yspring_eB;
2621 if (Cave[y-1][x+2] == Xblank)
2622 Cave[y-1][x+2] = Yacid_splash_eB;
2623 if (Cave[y-1][x] == Xblank)
2624 Cave[y-1][x] = Yacid_splash_wB;
2625 Next[y][x] = Xblank;
2626 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2630 case Yacid_splash_eB:
2631 case Yacid_splash_wB:
2636 Cave[y][x] = Yspring_eB;
2637 Cave[y][x+1] = Yspring_e;
2638 Next[y][x] = Xblank;
2639 Next[y][x+1] = Xspring_e;
2648 Cave[y][x] = Yspring_kill_eB;
2649 Cave[y][x+1] = Yspring_kill_e;
2650 Next[y][x] = Xblank;
2651 Next[y][x+1] = Xspring_e;
2652 play_element_sound(x, y, SAMPLE_slurp, Xalien);
2653 score += lev.slurp_score;
2658 Cave[y][x+1] = XbumperB;
2659 Next[y][x] = Xspring_w;
2660 play_element_sound(x, y, SAMPLE_spring, Xspring);
2664 Cave[y][x] = Xspring;
2665 Next[y][x] = Xspring;
2666 play_element_sound(x, y, SAMPLE_spring, Xspring);
2670 /* --------------------------------------------------------------------- */
2673 switch (Cave[y+1][x])
2683 Cave[y][x] = Yspring_sB;
2684 if (Cave[y][x+1] == Xblank)
2685 Cave[y][x+1] = Yacid_splash_eB;
2686 if (Cave[y][x-1] == Xblank)
2687 Cave[y][x-1] = Yacid_splash_wB;
2688 Next[y][x] = Xblank;
2689 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2693 case Yacid_splash_eB:
2694 case Yacid_splash_wB:
2695 Cave[y][x] = Yspring_sB;
2696 Cave[y+1][x] = Yspring_s;
2697 Next[y][x] = Xblank;
2698 Next[y+1][x] = Xspring_fall;
2702 Cave[y+1][x] = XbumperB;
2705 switch (Cave[y][x-1])
2715 Cave[y][x] = Yspring_wB;
2716 if (Cave[y-1][x] == Xblank)
2717 Cave[y-1][x] = Yacid_splash_eB;
2718 if (Cave[y-1][x-2] == Xblank)
2719 Cave[y-1][x-2] = Yacid_splash_wB;
2720 Next[y][x] = Xblank;
2721 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2725 case Yacid_splash_eB:
2726 case Yacid_splash_wB:
2731 Cave[y][x] = Yspring_wB;
2732 Cave[y][x-1] = Yspring_w;
2733 Next[y][x] = Xblank;
2734 Next[y][x-1] = Xspring_w;
2743 Cave[y][x] = Yspring_kill_wB;
2744 Cave[y][x-1] = Yspring_kill_w;
2745 Next[y][x] = Xblank;
2746 Next[y][x-1] = Xspring_w;
2747 play_element_sound(x, y, SAMPLE_slurp, Xalien);
2748 score += lev.slurp_score;
2753 Cave[y][x-1] = XbumperB;
2754 Next[y][x] = Xspring_e;
2755 play_element_sound(x, y, SAMPLE_spring, Xspring);
2759 Cave[y][x] = Xspring;
2760 Next[y][x] = Xspring;
2761 play_element_sound(x, y, SAMPLE_spring, Xspring);
2765 /* --------------------------------------------------------------------- */
2768 switch (Cave[y+1][x])
2778 Cave[y][x] = Yspring_sB;
2779 if (Cave[y][x+1] == Xblank)
2780 Cave[y][x+1] = Yacid_splash_eB;
2781 if (Cave[y][x-1] == Xblank)
2782 Cave[y][x-1] = Yacid_splash_wB;
2783 Next[y][x] = Xblank;
2784 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2788 case Yacid_splash_eB:
2789 case Yacid_splash_wB:
2791 Cave[y][x] = Yspring_sB;
2792 Cave[y+1][x] = Yspring_s;
2793 Next[y][x] = Xblank;
2794 Next[y+1][x] = Xspring_fall;
2799 Cave[y+1][x] = Ybomb_eat;
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;
2811 play_element_sound(x, y, SAMPLE_boom, element);
2823 Cave[y][x] = Yspring_sB;
2824 Cave[y+1][x] = Ybug_spring;
2825 Next[y+1][x] = Znormal;
2826 Boom[y][x-1] = Xemerald;
2827 Boom[y][x] = Xemerald;
2828 Boom[y][x+1] = Xemerald;
2829 Boom[y+1][x-1] = Xemerald;
2830 Boom[y+1][x] = Xdiamond;
2831 Boom[y+1][x+1] = Xemerald;
2832 Boom[y+2][x-1] = Xemerald;
2833 Boom[y+2][x] = Xemerald;
2834 Boom[y+2][x+1] = Xemerald;
2836 play_element_sound(x, y, SAMPLE_boom, element);
2838 score += lev.bug_score;
2849 Cave[y][x] = Yspring_sB;
2850 Cave[y+1][x] = Ytank_spring;
2851 Next[y+1][x] = Znormal;
2852 Boom[y][x-1] = Xblank;
2853 Boom[y][x] = Xblank;
2854 Boom[y][x+1] = Xblank;
2855 Boom[y+1][x-1] = Xblank;
2856 Boom[y+1][x] = Xblank;
2857 Boom[y+1][x+1] = Xblank;
2858 Boom[y+2][x-1] = Xblank;
2859 Boom[y+2][x] = Xblank;
2860 Boom[y+2][x+1] = Xblank;
2862 play_element_sound(x, y, SAMPLE_boom, element);
2864 score += lev.tank_score;
2871 Cave[y][x] = Yspring_sB;
2872 Cave[y+1][x] = Yeater_spring;
2873 Next[y+1][x] = Znormal;
2874 Boom[y][x-1] = lev.eater_array[lev.eater_pos][0];
2875 Boom[y][x] = lev.eater_array[lev.eater_pos][1];
2876 Boom[y][x+1] = lev.eater_array[lev.eater_pos][2];
2877 Boom[y+1][x-1] = lev.eater_array[lev.eater_pos][3];
2878 Boom[y+1][x] = lev.eater_array[lev.eater_pos][4];
2879 Boom[y+1][x+1] = lev.eater_array[lev.eater_pos][5];
2880 Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
2881 Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
2882 Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
2884 play_element_sound(x, y, SAMPLE_boom, element);
2886 lev.eater_pos = (lev.eater_pos + 1) & 7;
2887 score += lev.eater_score;
2892 Cave[y][x] = Yspring_sB;
2893 Cave[y+1][x] = Yalien_spring;
2894 Next[y+1][x] = Znormal;
2895 Boom[y][x-1] = Xblank;
2896 Boom[y][x] = Xblank;
2897 Boom[y][x+1] = Xblank;
2898 Boom[y+1][x-1] = Xblank;
2899 Boom[y+1][x] = Xblank;
2900 Boom[y+1][x+1] = Xblank;
2901 Boom[y+2][x-1] = Xblank;
2902 Boom[y+2][x] = Xblank;
2903 Boom[y+2][x+1] = Xblank;
2905 play_element_sound(x, y, SAMPLE_boom, element);
2907 score += lev.alien_score;
2911 Cave[y][x] = Xspring;
2912 Next[y][x] = Xspring;
2913 play_element_sound(x, y, SAMPLE_spring, Xspring);
2917 /* --------------------------------------------------------------------- */
2920 if (Cave[y][x+1] == Xdiamond)
2922 Cave[y][x+1] = Ydiamond_eat;
2923 Next[y][x+1] = Xblank;
2924 play_element_sound(x, y, SAMPLE_eater_eat, element);
2928 if (Cave[y+1][x] == Xdiamond)
2930 Cave[y+1][x] = Ydiamond_eat;
2931 Next[y+1][x] = Xblank;
2932 play_element_sound(x, y, SAMPLE_eater_eat, element);
2936 if (Cave[y][x-1] == Xdiamond)
2938 Cave[y][x-1] = Ydiamond_eat;
2939 Next[y][x-1] = Xblank;
2940 play_element_sound(x, y, SAMPLE_eater_eat, element);
2944 if (Cave[y-1][x] == Xdiamond)
2946 Cave[y-1][x] = Ydiamond_eat;
2947 Next[y-1][x] = Xblank;
2948 play_element_sound(x, y, SAMPLE_eater_eat, element);
2952 switch (Cave[y-1][x])
2962 Cave[y][x] = Yeater_nB;
2963 if (Cave[y-2][x+1] == Xblank)
2964 Cave[y-2][x+1] = Yacid_splash_eB;
2965 if (Cave[y-2][x-1] == Xblank)
2966 Cave[y-2][x-1] = Yacid_splash_wB;
2967 Next[y][x] = Xblank;
2968 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
2972 case Yacid_splash_eB:
2973 case Yacid_splash_wB:
2977 Cave[y][x] = Yeater_nB;
2978 Cave[y-1][x] = Yeater_n;
2979 Next[y][x] = Xblank;
2980 Next[y-1][x] = Xeater_n;
2984 Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
2985 play_element_sound(x, y, SAMPLE_eater, element);
2989 /* --------------------------------------------------------------------- */
2992 if (Cave[y+1][x] == Xdiamond)
2994 Cave[y+1][x] = Ydiamond_eat;
2995 Next[y+1][x] = Xblank;
2996 play_element_sound(x, y, SAMPLE_eater_eat, element);
3000 if (Cave[y][x-1] == Xdiamond)
3002 Cave[y][x-1] = Ydiamond_eat;
3003 Next[y][x-1] = Xblank;
3004 play_element_sound(x, y, SAMPLE_eater_eat, element);
3008 if (Cave[y-1][x] == Xdiamond)
3010 Cave[y-1][x] = Ydiamond_eat;
3011 Next[y-1][x] = Xblank;
3012 play_element_sound(x, y, SAMPLE_eater_eat, element);
3016 if (Cave[y][x+1] == Xdiamond)
3018 Cave[y][x+1] = Ydiamond_eat;
3019 Next[y][x+1] = Xblank;
3020 play_element_sound(x, y, SAMPLE_eater_eat, element);
3024 switch (Cave[y][x+1])
3034 Cave[y][x] = Yeater_eB;
3035 if (Cave[y-1][x+2] == Xblank)
3036 Cave[y-1][x+2] = Yacid_splash_eB;
3037 if (Cave[y-1][x] == Xblank)
3038 Cave[y-1][x] = Yacid_splash_wB;
3039 Next[y][x] = Xblank;
3040 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3044 case Yacid_splash_eB:
3045 case Yacid_splash_wB:
3049 Cave[y][x] = Yeater_eB;
3050 Cave[y][x+1] = Yeater_e;
3051 Next[y][x] = Xblank;
3052 Next[y][x+1] = Xeater_e;
3056 Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
3057 play_element_sound(x, y, SAMPLE_eater, element);
3061 /* --------------------------------------------------------------------- */
3064 if (Cave[y][x-1] == Xdiamond)
3066 Cave[y][x-1] = Ydiamond_eat;
3067 Next[y][x-1] = Xblank;
3068 play_element_sound(x, y, SAMPLE_eater_eat, element);
3072 if (Cave[y-1][x] == Xdiamond)
3074 Cave[y-1][x] = Ydiamond_eat;
3075 Next[y-1][x] = Xblank;
3076 play_element_sound(x, y, SAMPLE_eater_eat, element);
3080 if (Cave[y][x+1] == Xdiamond)
3082 Cave[y][x+1] = Ydiamond_eat;
3083 Next[y][x+1] = Xblank;
3084 play_element_sound(x, y, SAMPLE_eater_eat, element);
3088 if (Cave[y+1][x] == Xdiamond)
3090 Cave[y+1][x] = Ydiamond_eat;
3091 Next[y+1][x] = Xblank;
3092 play_element_sound(x, y, SAMPLE_eater_eat, element);
3096 switch (Cave[y+1][x])
3106 Cave[y][x] = Yeater_sB;
3107 if (Cave[y][x+1] == Xblank)
3108 Cave[y][x+1] = Yacid_splash_eB;
3109 if (Cave[y][x-1] == Xblank)
3110 Cave[y][x-1] = Yacid_splash_wB;
3111 Next[y][x] = Xblank;
3112 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3116 case Yacid_splash_eB:
3117 case Yacid_splash_wB:
3121 Cave[y][x] = Yeater_sB;
3122 Cave[y+1][x] = Yeater_s;
3123 Next[y][x] = Xblank;
3124 Next[y+1][x] = Xeater_s;
3128 Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
3129 play_element_sound(x, y, SAMPLE_eater, element);
3133 /* --------------------------------------------------------------------- */
3136 if (Cave[y-1][x] == Xdiamond)
3138 Cave[y-1][x] = Ydiamond_eat;
3139 Next[y-1][x] = Xblank;
3140 play_element_sound(x, y, SAMPLE_eater_eat, element);
3144 if (Cave[y][x+1] == Xdiamond)
3146 Cave[y][x+1] = Ydiamond_eat;
3147 Next[y][x+1] = Xblank;
3148 play_element_sound(x, y, SAMPLE_eater_eat, element);
3152 if (Cave[y+1][x] == Xdiamond)
3154 Cave[y+1][x] = Ydiamond_eat;
3155 Next[y+1][x] = Xblank;
3156 play_element_sound(x, y, SAMPLE_eater_eat, element);
3160 if (Cave[y][x-1] == Xdiamond)
3162 Cave[y][x-1] = Ydiamond_eat;
3163 Next[y][x-1] = Xblank;
3164 play_element_sound(x, y, SAMPLE_eater_eat, element);
3168 switch (Cave[y][x-1])
3178 Cave[y][x] = Yeater_wB;
3179 if (Cave[y-1][x] == Xblank)
3180 Cave[y-1][x] = Yacid_splash_eB;
3181 if (Cave[y-1][x-2] == Xblank)
3182 Cave[y-1][x-2] = Yacid_splash_wB;
3183 Next[y][x] = Xblank;
3184 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3188 case Yacid_splash_eB:
3189 case Yacid_splash_wB:
3193 Cave[y][x] = Yeater_wB;
3194 Cave[y][x-1] = Yeater_w;
3195 Next[y][x] = Xblank;
3196 Next[y][x-1] = Xeater_w;
3200 Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
3201 play_element_sound(x, y, SAMPLE_eater, element);
3205 /* --------------------------------------------------------------------- */
3213 else if (ply1.alive && ply2.alive)
3215 if ((ply1.x > x ? ply1.x - x : x - ply1.x) +
3216 (ply1.y > y ? ply1.y - y : y - ply1.y) <
3217 (ply2.x > x ? ply2.x - x : x - ply2.x) +
3218 (ply2.y > y ? ply2.y - y : y - ply2.y))
3229 else if (ply1.alive)
3234 else if (ply2.alive)
3249 switch (Cave[y-1][x])
3259 Cave[y][x] = Yalien_nB;
3260 if (Cave[y-2][x+1] == Xblank)
3261 Cave[y-2][x+1] = Yacid_splash_eB;
3262 if (Cave[y-2][x-1] == Xblank)
3263 Cave[y-2][x-1] = Yacid_splash_wB;
3264 Next[y][x] = Xblank;
3265 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3269 case Yacid_splash_eB:
3270 case Yacid_splash_wB:
3274 Cave[y][x] = Yalien_nB;
3275 Cave[y-1][x] = Yalien_n;
3276 Next[y][x] = Xblank;
3277 Next[y-1][x] = Xalien_pause;
3278 play_element_sound(x, y, SAMPLE_alien, Xalien);
3284 switch (Cave[y+1][x])
3294 Cave[y][x] = Yalien_sB;
3295 Next[y][x] = Xblank;
3296 if (Cave[y][x+1] == Xblank)
3297 Cave[y][x+1] = Yacid_splash_eB;
3298 if (Cave[y][x-1] == Xblank)
3299 Cave[y][x-1] = Yacid_splash_wB;
3300 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3304 case Yacid_splash_eB:
3305 case Yacid_splash_wB:
3309 Cave[y][x] = Yalien_sB;
3310 Cave[y+1][x] = Yalien_s;
3311 Next[y][x] = Xblank;
3312 Next[y+1][x] = Xalien_pause;
3313 play_element_sound(x, y, SAMPLE_alien, Xalien);
3322 switch (Cave[y][x+1])
3332 Cave[y][x] = Yalien_eB;
3333 if (Cave[y-1][x+2] == Xblank)
3334 Cave[y-1][x+2] = Yacid_splash_eB;
3335 if (Cave[y-1][x] == Xblank)
3336 Cave[y-1][x] = Yacid_splash_wB;
3337 Next[y][x] = Xblank;
3338 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3342 case Yacid_splash_eB:
3343 case Yacid_splash_wB:
3347 Cave[y][x] = Yalien_eB;
3348 Cave[y][x+1] = Yalien_e;
3349 Next[y][x] = Xblank;
3350 Next[y][x+1] = Xalien_pause;
3351 play_element_sound(x, y, SAMPLE_alien, Xalien);
3357 switch (Cave[y][x-1])
3367 Cave[y][x] = Yalien_wB;
3368 if (Cave[y-1][x] == Xblank)
3369 Cave[y-1][x] = Yacid_splash_eB;
3370 if (Cave[y-1][x-2] == Xblank)
3371 Cave[y-1][x-2] = Yacid_splash_wB;
3372 Next[y][x] = Xblank;
3373 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3377 case Yacid_splash_eB:
3378 case Yacid_splash_wB:
3382 Cave[y][x] = Yalien_wB;
3383 Cave[y][x-1] = Yalien_w;
3384 Next[y][x] = Xblank;
3385 Next[y][x-1] = Xalien_pause;
3386 play_element_sound(x, y, SAMPLE_alien, Xalien);
3395 Next[y][x] = Xalien;
3398 /* --------------------------------------------------------------------- */
3401 switch (Cave[y+1][x])
3411 Cave[y][x] = Yemerald_sB;
3412 if (Cave[y][x+1] == Xblank)
3413 Cave[y][x+1] = Yacid_splash_eB;
3414 if (Cave[y][x-1] == Xblank)
3415 Cave[y][x-1] = Yacid_splash_wB;
3416 Next[y][x] = Xblank;
3417 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3421 case Yacid_splash_eB:
3422 case Yacid_splash_wB:
3423 Cave[y][x] = Yemerald_sB;
3424 Cave[y+1][x] = Yemerald_s;
3425 Next[y][x] = Xblank;
3426 Next[y+1][x] = Xemerald_fall;
3445 case Xemerald_pause:
3447 case Xdiamond_pause:
3484 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3486 Cave[y][x] = Yemerald_eB;
3487 Cave[y][x+1] = Yemerald_e;
3488 Next[y][x] = Xblank;
3489 Next[y][x+1] = Xemerald_pause;
3493 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3495 Cave[y][x] = Yemerald_wB;
3496 Cave[y][x-1] = Yemerald_w;
3497 Next[y][x] = Xblank;
3498 Next[y][x-1] = Xemerald_pause;
3504 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3506 Cave[y][x] = Yemerald_wB;
3507 Cave[y][x-1] = Yemerald_w;
3508 Next[y][x] = Xblank;
3509 Next[y][x-1] = Xemerald_pause;
3513 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3515 Cave[y][x] = Yemerald_eB;
3516 Cave[y][x+1] = Yemerald_e;
3517 Next[y][x] = Xblank;
3518 Next[y][x+1] = Xemerald_pause;
3524 if (++lev.shine_cnt > 50)
3526 lev.shine_cnt = RANDOM & 7;
3527 Cave[y][x] = Xemerald_shine;
3533 /* --------------------------------------------------------------------- */
3535 case Xemerald_pause:
3536 switch (Cave[y+1][x])
3546 Cave[y][x] = Yemerald_sB;
3547 if (Cave[y][x+1] == Xblank)
3548 Cave[y][x+1] = Yacid_splash_eB;
3549 if (Cave[y][x-1] == Xblank)
3550 Cave[y][x-1] = Yacid_splash_wB;
3551 Next[y][x] = Xblank;
3552 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3556 case Yacid_splash_eB:
3557 case Yacid_splash_wB:
3558 Cave[y][x] = Yemerald_sB;
3559 Cave[y+1][x] = Yemerald_s;
3560 Next[y][x] = Xblank;
3561 Next[y+1][x] = Xemerald_fall;
3565 Cave[y][x] = Xemerald;
3566 Next[y][x] = Xemerald;
3570 /* --------------------------------------------------------------------- */
3573 switch (Cave[y+1][x])
3583 Cave[y][x] = Yemerald_sB;
3584 if (Cave[y][x+1] == Xblank)
3585 Cave[y][x+1] = Yacid_splash_eB;
3586 if (Cave[y][x-1] == Xblank)
3587 Cave[y][x-1] = Yacid_splash_wB;
3588 Next[y][x] = Xblank;
3589 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3593 case Yacid_splash_eB:
3594 case Yacid_splash_wB:
3596 Cave[y][x] = Yemerald_sB;
3597 Cave[y+1][x] = Yemerald_s;
3598 Next[y][x] = Xblank;
3599 Next[y+1][x] = Xemerald_fall;
3603 if (lev.wonderwall_time)
3605 lev.wonderwall_state = 1;
3606 Cave[y][x] = Yemerald_sB;
3607 if (tab_blank[Cave[y+2][x]])
3609 Cave[y+2][x] = Ydiamond_s;
3610 Next[y+2][x] = Xdiamond_fall;
3613 Next[y][x] = Xblank;
3614 play_element_sound(x, y, SAMPLE_wonderfall, Xwonderwall);
3619 Cave[y][x] = Xemerald;
3620 Next[y][x] = Xemerald;
3621 play_element_sound(x, y, SAMPLE_diamond, Xemerald);
3625 /* --------------------------------------------------------------------- */
3628 switch (Cave[y+1][x])
3638 Cave[y][x] = Ydiamond_sB;
3639 if (Cave[y][x+1] == Xblank)
3640 Cave[y][x+1] = Yacid_splash_eB;
3641 if (Cave[y][x-1] == Xblank)
3642 Cave[y][x-1] = Yacid_splash_wB;
3643 Next[y][x] = Xblank;
3644 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3648 case Yacid_splash_eB:
3649 case Yacid_splash_wB:
3650 Cave[y][x] = Ydiamond_sB;
3651 Cave[y+1][x] = Ydiamond_s;
3652 Next[y][x] = Xblank;
3653 Next[y+1][x] = Xdiamond_fall;
3672 case Xemerald_pause:
3674 case Xdiamond_pause:
3711 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3713 Cave[y][x] = Ydiamond_eB;
3714 Cave[y][x+1] = Ydiamond_e;
3715 Next[y][x] = Xblank;
3716 Next[y][x+1] = Xdiamond_pause;
3720 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3722 Cave[y][x] = Ydiamond_wB;
3723 Cave[y][x-1] = Ydiamond_w;
3724 Next[y][x] = Xblank;
3725 Next[y][x-1] = Xdiamond_pause;
3731 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3733 Cave[y][x] = Ydiamond_wB;
3734 Cave[y][x-1] = Ydiamond_w;
3735 Next[y][x] = Xblank;
3736 Next[y][x-1] = Xdiamond_pause;
3740 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3742 Cave[y][x] = Ydiamond_eB;
3743 Cave[y][x+1] = Ydiamond_e;
3744 Next[y][x] = Xblank;
3745 Next[y][x+1] = Xdiamond_pause;
3751 if (++lev.shine_cnt > 50)
3753 lev.shine_cnt = RANDOM & 7;
3754 Cave[y][x] = Xdiamond_shine;
3760 /* --------------------------------------------------------------------- */
3762 case Xdiamond_pause:
3763 switch (Cave[y+1][x])
3773 Cave[y][x] = Ydiamond_sB;
3774 if (Cave[y][x+1] == Xblank)
3775 Cave[y][x+1] = Yacid_splash_eB;
3776 if (Cave[y][x-1] == Xblank)
3777 Cave[y][x-1] = Yacid_splash_wB;
3778 Next[y][x] = Xblank;
3779 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3783 case Yacid_splash_eB:
3784 case Yacid_splash_wB:
3785 Cave[y][x] = Ydiamond_sB;
3786 Cave[y+1][x] = Ydiamond_s;
3787 Next[y][x] = Xblank;
3788 Next[y+1][x] = Xdiamond_fall;
3792 Cave[y][x] = Xdiamond;
3793 Next[y][x] = Xdiamond;
3797 /* --------------------------------------------------------------------- */
3800 switch (Cave[y+1][x])
3810 Cave[y][x] = Ydiamond_sB;
3811 if (Cave[y][x+1] == Xblank)
3812 Cave[y][x+1] = Yacid_splash_eB;
3813 if (Cave[y][x-1] == Xblank)
3814 Cave[y][x-1] = Yacid_splash_wB;
3815 Next[y][x] = Xblank;
3816 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3820 case Yacid_splash_eB:
3821 case Yacid_splash_wB:
3823 Cave[y][x] = Ydiamond_sB;
3824 Cave[y+1][x] = Ydiamond_s;
3825 Next[y][x] = Xblank;
3826 Next[y+1][x] = Xdiamond_fall;
3830 if (lev.wonderwall_time)
3832 lev.wonderwall_state = 1;
3833 Cave[y][x] = Ydiamond_sB;
3834 if (tab_blank[Cave[y+2][x]])
3836 Cave[y+2][x] = Ystone_s;
3837 Next[y+2][x] = Xstone_fall;
3840 Next[y][x] = Xblank;
3841 play_element_sound(x, y, SAMPLE_wonderfall, Xwonderwall);
3846 Cave[y][x] = Xdiamond;
3847 Next[y][x] = Xdiamond;
3848 play_element_sound(x, y, SAMPLE_diamond, Xdiamond);
3852 /* --------------------------------------------------------------------- */
3855 switch (Cave[y+1][x])
3865 Cave[y][x] = Ydrip_s1B;
3866 if (Cave[y][x+1] == Xblank)
3867 Cave[y][x+1] = Yacid_splash_eB;
3868 if (Cave[y][x-1] == Xblank)
3869 Cave[y][x-1] = Yacid_splash_wB;
3870 Next[y][x] = Xdrip_stretchB;
3871 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3875 case Yacid_splash_eB:
3876 case Yacid_splash_wB:
3880 Cave[y][x] = Ydrip_s1B;
3881 Cave[y+1][x] = Ydrip_s1;
3882 Next[y][x] = Xdrip_stretchB;
3883 Next[y+1][x] = Xdrip_stretch;
3924 play_element_sound(x, y, SAMPLE_drip, Xdrip_fall);
3928 /* --------------------------------------------------------------------- */
3931 Cave[y][x] = Ydrip_s2;
3932 Next[y][x] = Xdrip_fall;
3935 case Xdrip_stretchB:
3936 Cave[y][x] = Ydrip_s2B;
3937 Next[y][x] = Xblank;
3941 Next[y][x] = Xdrip_fall;
3944 /* --------------------------------------------------------------------- */
3947 switch (Cave[y+1][x])
3957 Cave[y][x] = Ybomb_sB;
3958 if (Cave[y][x+1] == Xblank)
3959 Cave[y][x+1] = Yacid_splash_eB;
3960 if (Cave[y][x-1] == Xblank)
3961 Cave[y][x-1] = Yacid_splash_wB;
3962 Next[y][x] = Xblank;
3963 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
3967 case Yacid_splash_eB:
3968 case Yacid_splash_wB:
3969 Cave[y][x] = Ybomb_sB;
3970 Cave[y+1][x] = Ybomb_s;
3971 Next[y][x] = Xblank;
3972 Next[y+1][x] = Xbomb_fall;
3991 case Xemerald_pause:
3993 case Xdiamond_pause:
4021 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
4023 Cave[y][x] = Ybomb_eB;
4024 Cave[y][x+1] = Ybomb_e;
4025 Next[y][x] = Xblank;
4026 Next[y][x+1] = Xbomb_pause;
4030 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
4032 Cave[y][x] = Ybomb_wB;
4033 Cave[y][x-1] = Ybomb_w;
4034 Next[y][x] = Xblank;
4035 Next[y][x-1] = Xbomb_pause;
4041 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
4043 Cave[y][x] = Ybomb_wB;
4044 Cave[y][x-1] = Ybomb_w;
4045 Next[y][x] = Xblank;
4046 Next[y][x-1] = Xbomb_pause;
4050 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
4052 Cave[y][x] = Ybomb_eB;
4053 Cave[y][x+1] = Ybomb_e;
4054 Next[y][x] = Xblank;
4055 Next[y][x+1] = Xbomb_pause;
4064 /* --------------------------------------------------------------------- */
4067 switch (Cave[y+1][x])
4077 Cave[y][x] = Ybomb_sB;
4078 if (Cave[y][x+1] == Xblank)
4079 Cave[y][x+1] = Yacid_splash_eB;
4080 if (Cave[y][x-1] == Xblank)
4081 Cave[y][x-1] = Yacid_splash_wB;
4082 Next[y][x] = Xblank;
4083 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
4087 case Yacid_splash_eB:
4088 case Yacid_splash_wB:
4089 Cave[y][x] = Ybomb_sB;
4090 Cave[y+1][x] = Ybomb_s;
4091 Next[y][x] = Xblank;
4092 Next[y+1][x] = Xbomb_fall;
4101 /* --------------------------------------------------------------------- */
4104 switch (Cave[y+1][x])
4114 Cave[y][x] = Ybomb_sB;
4115 if (Cave[y][x+1] == Xblank)
4116 Cave[y][x+1] = Yacid_splash_eB;
4117 if (Cave[y][x-1] == Xblank)
4118 Cave[y][x-1] = Yacid_splash_wB;
4119 Next[y][x] = Xblank;
4120 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
4124 case Yacid_splash_eB:
4125 case Yacid_splash_wB:
4126 Cave[y][x] = Ybomb_sB;
4127 Cave[y+1][x] = Ybomb_s;
4128 Next[y][x] = Xblank;
4129 Next[y+1][x] = Xbomb_fall;
4133 Cave[y][x] = Ybomb_eat;
4134 Next[y][x] = Znormal;
4135 Boom[y-1][x-1] = Xblank;
4136 Boom[y-1][x] = Xblank;
4137 Boom[y-1][x+1] = Xblank;
4138 Boom[y][x-1] = Xblank;
4139 Boom[y][x] = Xblank;
4140 Boom[y][x+1] = Xblank;
4141 Boom[y+1][x-1] = Xblank;
4142 Boom[y+1][x] = Xblank;
4143 Boom[y+1][x+1] = Xblank;
4145 play_element_sound(x, y, SAMPLE_boom, element);
4150 /* --------------------------------------------------------------------- */
4153 if (lev.wind_cnt == 0)
4156 switch (lev.wind_direction)
4159 switch (Cave[y-1][x])
4169 Cave[y][x] = Yballoon_nB;
4170 if (Cave[y-2][x+1] == Xblank)
4171 Cave[y-2][x+1] = Yacid_splash_eB;
4172 if (Cave[y-2][x-1] == Xblank)
4173 Cave[y-2][x-1] = Yacid_splash_wB;
4174 Next[y][x] = Xblank;
4175 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
4179 case Yacid_splash_eB:
4180 case Yacid_splash_wB:
4181 Cave[y][x] = Yballoon_nB;
4182 Cave[y-1][x] = Yballoon_n;
4183 Next[y][x] = Xblank;
4184 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] = Yacid_splash_eB;
4205 if (Cave[y-1][x] == Xblank)
4206 Cave[y-1][x] = Yacid_splash_wB;
4207 Next[y][x] = Xblank;
4208 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
4212 case Yacid_splash_eB:
4213 case Yacid_splash_wB:
4214 Cave[y][x] = Yballoon_eB;
4215 Cave[y][x+1] = Yballoon_e;
4216 Next[y][x] = Xblank;
4217 Next[y][x+1] = Xballoon;
4225 switch (Cave[y+1][x])
4235 Cave[y][x] = Yballoon_sB;
4236 if (Cave[y][x+1] == Xblank)
4237 Cave[y][x+1] = Yacid_splash_eB;
4238 if (Cave[y][x-1] == Xblank)
4239 Cave[y][x-1] = Yacid_splash_wB;
4240 Next[y][x] = Xblank;
4241 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
4245 case Yacid_splash_eB:
4246 case Yacid_splash_wB:
4247 Cave[y][x] = Yballoon_sB;
4248 Cave[y+1][x] = Yballoon_s;
4249 Next[y][x] = Xblank;
4250 Next[y+1][x] = Xballoon;
4258 switch (Cave[y][x-1])
4268 Cave[y][x] = Yballoon_wB;
4269 if (Cave[y-1][x] == Xblank)
4270 Cave[y-1][x] = Yacid_splash_eB;
4271 if (Cave[y-1][x-2] == Xblank)
4272 Cave[y-1][x-2] = Yacid_splash_wB;
4273 Next[y][x] = Xblank;
4274 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
4278 case Yacid_splash_eB:
4279 case Yacid_splash_wB:
4280 Cave[y][x] = Yballoon_wB;
4281 Cave[y][x-1] = Yballoon_w;
4282 Next[y][x] = Xblank;
4283 Next[y][x-1] = Xballoon;
4291 /* --------------------------------------------------------------------- */
4294 Next[y][x] = Xacid_2;
4298 Next[y][x] = Xacid_3;
4302 Next[y][x] = Xacid_4;
4306 Next[y][x] = Xacid_5;
4310 Next[y][x] = Xacid_6;
4314 Next[y][x] = Xacid_7;
4318 Next[y][x] = Xacid_8;
4322 Next[y][x] = Xacid_1;
4326 Next[y][x] = Xfake_acid_2;
4330 Next[y][x] = Xfake_acid_3;
4334 Next[y][x] = Xfake_acid_4;
4338 Next[y][x] = Xfake_acid_5;
4342 Next[y][x] = Xfake_acid_6;
4346 Next[y][x] = Xfake_acid_7;
4350 Next[y][x] = Xfake_acid_8;
4354 Next[y][x] = Xfake_acid_1;
4357 /* --------------------------------------------------------------------- */
4360 if (lev.ball_state == 0)
4363 Cave[y][x] = Xball_1B;
4364 Next[y][x] = Xball_2;
4371 if (lev.ball_state == 0)
4374 Cave[y][x] = Xball_2B;
4375 Next[y][x] = Xball_1;
4383 play_element_sound(x, y, SAMPLE_ball, element);
4384 if (lev.ball_random)
4389 if (lev.ball_array[lev.ball_pos][0] != Xblank &&
4390 tab_blank[Cave[y-1][x-1]])
4392 Cave[y-1][x-1] = Yball_eat;
4393 Next[y-1][x-1] = lev.ball_array[lev.ball_pos][0];
4398 if (lev.ball_array[lev.ball_pos][1] != Xblank &&
4399 tab_blank[Cave[y-1][x]])
4401 Cave[y-1][x] = Yball_eat;
4402 Next[y-1][x] = lev.ball_array[lev.ball_pos][1];
4407 if (lev.ball_array[lev.ball_pos][2] != Xblank &&
4408 tab_blank[Cave[y-1][x+1]])
4410 Cave[y-1][x+1] = Yball_eat;
4411 Next[y-1][x+1] = lev.ball_array[lev.ball_pos][2];
4416 if (lev.ball_array[lev.ball_pos][3] != Xblank &&
4417 tab_blank[Cave[y][x-1]])
4419 Cave[y][x-1] = Yball_eat;
4420 Next[y][x-1] = lev.ball_array[lev.ball_pos][3];
4425 if (lev.ball_array[lev.ball_pos][4] != Xblank &&
4426 tab_blank[Cave[y][x+1]])
4428 Cave[y][x+1] = Yball_eat;
4429 Next[y][x+1] = lev.ball_array[lev.ball_pos][4];
4434 if (lev.ball_array[lev.ball_pos][5] != Xblank &&
4435 tab_blank[Cave[y+1][x-1]])
4437 Cave[y+1][x-1] = Yball_eat;
4438 Next[y+1][x-1] = lev.ball_array[lev.ball_pos][5];
4443 if (lev.ball_array[lev.ball_pos][6] != Xblank &&
4444 tab_blank[Cave[y+1][x]])
4446 Cave[y+1][x] = Yball_eat;
4447 Next[y+1][x] = lev.ball_array[lev.ball_pos][6];
4452 if (lev.ball_array[lev.ball_pos][7] != Xblank &&
4453 tab_blank[Cave[y+1][x+1]])
4455 Cave[y+1][x+1] = Yball_eat;
4456 Next[y+1][x+1] = lev.ball_array[lev.ball_pos][7];
4463 if (lev.ball_array[lev.ball_pos][0] != Xblank &&
4464 tab_blank[Cave[y-1][x-1]])
4466 Cave[y-1][x-1] = Yball_eat;
4467 Next[y-1][x-1] = lev.ball_array[lev.ball_pos][0];
4470 if (lev.ball_array[lev.ball_pos][1] != Xblank &&
4471 tab_blank[Cave[y-1][x]])
4473 Cave[y-1][x] = Yball_eat;
4474 Next[y-1][x] = lev.ball_array[lev.ball_pos][1];
4477 if (lev.ball_array[lev.ball_pos][2] != Xblank &&
4478 tab_blank[Cave[y-1][x+1]])
4480 Cave[y-1][x+1] = Yball_eat;
4481 Next[y-1][x+1] = lev.ball_array[lev.ball_pos][2];
4484 if (lev.ball_array[lev.ball_pos][3] != Xblank &&
4485 tab_blank[Cave[y][x-1]])
4487 Cave[y][x-1] = Yball_eat;
4488 Next[y][x-1] = lev.ball_array[lev.ball_pos][3];
4491 if (lev.ball_array[lev.ball_pos][4] != Xblank &&
4492 tab_blank[Cave[y][x+1]])
4494 Cave[y][x+1] = Yball_eat;
4495 Next[y][x+1] = lev.ball_array[lev.ball_pos][4];
4498 if (lev.ball_array[lev.ball_pos][5] != Xblank &&
4499 tab_blank[Cave[y+1][x-1]])
4501 Cave[y+1][x-1] = Yball_eat;
4502 Next[y+1][x-1] = lev.ball_array[lev.ball_pos][5];
4505 if (lev.ball_array[lev.ball_pos][6] != Xblank &&
4506 tab_blank[Cave[y+1][x]])
4508 Cave[y+1][x] = Yball_eat;
4509 Next[y+1][x] = lev.ball_array[lev.ball_pos][6];
4512 if (lev.ball_array[lev.ball_pos][7] != Xblank &&
4513 tab_blank[Cave[y+1][x+1]])
4515 Cave[y+1][x+1] = Yball_eat;
4516 Next[y+1][x+1] = lev.ball_array[lev.ball_pos][7];
4520 lev.ball_pos = (lev.ball_pos + 1) & 7;
4523 /* --------------------------------------------------------------------- */
4526 if (tab_blank[Cave[y-1][x]])
4528 Cave[y-1][x] = Ygrow_ns_eat;
4529 Next[y-1][x] = Xgrow_ns;
4530 play_element_sound(x, y, SAMPLE_grow, Xgrow_ns);
4533 if (tab_blank[Cave[y+1][x]])
4535 Cave[y+1][x] = Ygrow_ns_eat;
4536 Next[y+1][x] = Xgrow_ns;
4537 play_element_sound(x, y, SAMPLE_grow, Xgrow_ns);
4543 if (tab_blank[Cave[y][x+1]])
4545 Cave[y][x+1] = Ygrow_ew_eat;
4546 Next[y][x+1] = Xgrow_ew;
4547 play_element_sound(x, y, SAMPLE_grow, Xgrow_ew);
4550 if (tab_blank[Cave[y][x-1]])
4552 Cave[y][x-1] = Ygrow_ew_eat;
4553 Next[y][x-1] = Xgrow_ew;
4554 play_element_sound(x, y, SAMPLE_grow, Xgrow_ew);
4559 /* --------------------------------------------------------------------- */
4562 if (lev.wonderwall_time && lev.wonderwall_state)
4564 Cave[y][x] = XwonderwallB;
4565 play_element_sound(x, y, SAMPLE_wonder, Xwonderwall);
4570 /* --------------------------------------------------------------------- */
4573 if (lev.required > 0)
4579 Cave[y][x] = Xexit_1;
4580 Next[y][x] = Xexit_2;
4584 Cave[y][x] = Xexit_2;
4585 Next[y][x] = Xexit_3;
4589 Cave[y][x] = Xexit_3;
4590 Next[y][x] = Xexit_1;
4593 play_element_sound(x, y, SAMPLE_exit_open, Xexit);
4598 Next[y][x] = Xexit_2;
4602 Next[y][x] = Xexit_3;
4606 Next[y][x] = Xexit_1;
4609 /* --------------------------------------------------------------------- */
4612 play_element_sound(x, y, SAMPLE_tick, Xdynamite_1);
4613 Next[y][x] = Xdynamite_2;
4617 play_element_sound(x, y, SAMPLE_tick, Xdynamite_2);
4618 Next[y][x] = Xdynamite_3;
4622 play_element_sound(x, y, SAMPLE_tick, Xdynamite_3);
4623 Next[y][x] = Xdynamite_4;
4627 play_element_sound(x, y, SAMPLE_tick, Xdynamite_4);
4628 Next[y][x] = Zdynamite;
4629 Boom[y-1][x-1] = Xblank;
4630 Boom[y-1][x] = Xblank;
4631 Boom[y-1][x+1] = Xblank;
4632 Boom[y][x-1] = Xblank;
4633 Boom[y][x] = Xblank;
4634 Boom[y][x+1] = Xblank;
4635 Boom[y+1][x-1] = Xblank;
4636 Boom[y+1][x] = Xblank;
4637 Boom[y+1][x+1] = Xblank;
4640 /* --------------------------------------------------------------------- */
4643 if (lev.wheel_cnt && x == lev.wheel_x && y == lev.wheel_y)
4644 Cave[y][x] = XwheelB;
4647 /* --------------------------------------------------------------------- */
4651 Cave[y][x] = XswitchB;
4654 /* --------------------------------------------------------------------- */
4657 switch (Cave[y+1][x])
4667 Cave[y][x] = Xsand_stonesand_3;
4668 if (Cave[y][x+1] == Xblank)
4669 Cave[y][x+1] = Yacid_splash_eB;
4670 if (Cave[y][x-1] == Xblank)
4671 Cave[y][x-1] = Yacid_splash_wB;
4672 Next[y][x] = Xsand_stonesand_4;
4673 play_element_sound(x, y, SAMPLE_acid, Xacid_1);
4677 case Yacid_splash_eB:
4678 case Yacid_splash_wB:
4679 Cave[y][x] = Xsand_stonesand_3;
4680 Cave[y+1][x] = Xsand_stoneout_1;
4681 Next[y][x] = Xsand_stonesand_4;
4682 Next[y+1][x] = Xsand_stoneout_2;
4686 Cave[y][x] = Xsand_stonesand_1;
4687 Cave[y+1][x] = Xsand_sandstone_1;
4688 Next[y][x] = Xsand_stonesand_2;
4689 Next[y+1][x] = Xsand_sandstone_2;
4696 case Xsand_stonein_1:
4697 Next[y][x] = Xsand_stonein_2;
4700 case Xsand_stonein_2:
4701 Next[y][x] = Xsand_stonein_3;
4704 case Xsand_stonein_3:
4705 Next[y][x] = Xsand_stonein_4;
4708 case Xsand_stonein_4:
4709 Next[y][x] = Xblank;
4712 case Xsand_stonesand_1:
4713 Next[y][x] = Xsand_stonesand_2;
4716 case Xsand_stonesand_2:
4717 Next[y][x] = Xsand_stonesand_3;
4720 case Xsand_stonesand_3:
4721 Next[y][x] = Xsand_stonesand_4;
4724 case Xsand_stonesand_4:
4728 case Xsand_stoneout_1:
4729 Next[y][x] = Xsand_stoneout_2;
4732 case Xsand_stoneout_2:
4733 Next[y][x] = Xstone_fall;
4736 case Xsand_sandstone_1:
4737 Next[y][x] = Xsand_sandstone_2;
4740 case Xsand_sandstone_2:
4741 Next[y][x] = Xsand_sandstone_3;
4744 case Xsand_sandstone_3:
4745 Next[y][x] = Xsand_sandstone_4;
4748 case Xsand_sandstone_4:
4749 Next[y][x] = Xsand_stone;
4752 /* --------------------------------------------------------------------- */
4756 Cave[y][x] = XdripperB;
4759 /* --------------------------------------------------------------------- */
4763 Cave[y][x] = Xfake_blankB;
4766 /* --------------------------------------------------------------------- */
4769 if (lev.magnify_cnt)
4770 Cave[y][x] = Xfake_grassB;
4773 /* --------------------------------------------------------------------- */
4776 if (lev.magnify_cnt)
4777 Cave[y][x] = Xdoor_1;
4781 if (lev.magnify_cnt)
4782 Cave[y][x] = Xdoor_2;
4786 if (lev.magnify_cnt)
4787 Cave[y][x] = Xdoor_3;
4791 if (lev.magnify_cnt)
4792 Cave[y][x] = Xdoor_4;
4796 if (lev.magnify_cnt)
4797 Cave[y][x] = Xdoor_5;
4801 if (lev.magnify_cnt)
4802 Cave[y][x] = Xdoor_6;
4806 if (lev.magnify_cnt)
4807 Cave[y][x] = Xdoor_7;
4811 if (lev.magnify_cnt)
4812 Cave[y][x] = Xdoor_8;
4815 /* --------------------------------------------------------------------- */
4819 Next[y][x] = Znormal;
4820 Boom[y-1][x-1] = Xemerald;
4821 Boom[y-1][x] = Xemerald;
4822 Boom[y-1][x+1] = Xemerald;
4823 Boom[y][x-1] = Xemerald;
4824 Boom[y][x] = Xdiamond;
4825 Boom[y][x+1] = Xemerald;
4826 Boom[y+1][x-1] = Xemerald;
4827 Boom[y+1][x] = Xemerald;
4828 Boom[y+1][x+1] = Xemerald;
4830 play_element_sound(x, y, SAMPLE_boom, element);
4838 Next[y][x] = Znormal;
4839 Boom[y-1][x-1] = Xblank;
4840 Boom[y-1][x] = Xblank;
4841 Boom[y-1][x+1] = Xblank;
4842 Boom[y][x-1] = Xblank;
4843 Boom[y][x] = Xblank;
4844 Boom[y][x+1] = Xblank;
4845 Boom[y+1][x-1] = Xblank;
4846 Boom[y+1][x] = Xblank;
4847 Boom[y+1][x+1] = Xblank;
4849 play_element_sound(x, y, SAMPLE_boom, element);
4855 play_element_sound(x, y, SAMPLE_boom, Xandroid);
4858 Next[y][x] = Xboom_2;
4860 play_sound(x, y, SAMPLE_boom);
4865 Next[y][x] = Boom[y][x];
4868 /* --------------------------------------------------------------------- */
4871 if (++y < HEIGHT - 1)
4874 cave_cache = Cave[y];
4887 if (ply1.alive || ply2.alive)
4888 lev.score += score; /* only get a score if someone is alive */
4895 /* triple buffering */