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 */
33 switch (cave_cache[++x])
38 /* --------------------------------------------------------------------- */
57 Cave[y][x] = Ystone_eB;
58 Cave[y][x+1] = Ystone_e;
60 Next[y][x+1] = Xstone_pause;
80 Cave[y][x] = Ystone_wB;
81 Cave[y][x-1] = Ystone_w;
83 Next[y][x-1] = Xstone_pause;
103 Cave[y][x] = Ynut_eB;
104 Cave[y][x+1] = Ynut_e;
106 Next[y][x+1] = Xnut_pause;
111 switch (Cave[y][x-1])
126 Cave[y][x] = Ynut_wB;
127 Cave[y][x-1] = Ynut_w;
129 Next[y][x-1] = Xnut_pause;
133 case Xspring_force_e:
134 switch (Cave[y][x+1])
144 Cave[y][x] = Xspring;
145 Next[y][x] = Xspring;
149 Cave[y][x] = Yspring_eB;
150 Cave[y][x+1] = Yspring_e;
154 Next[y][x+1] = Xspring_e;
156 Next[y][x+1] = Xspring_pause;
162 case Xspring_force_w:
163 switch (Cave[y][x-1])
173 Cave[y][x] = Xspring;
174 Next[y][x] = Xspring;
178 Cave[y][x] = Yspring_wB;
179 Cave[y][x-1] = Yspring_w;
183 Next[y][x-1] = Xspring_w;
185 Next[y][x-1] = Xspring_pause;
190 case Xemerald_force_e:
191 switch (Cave[y][x+1])
201 Cave[y][x] = Xemerald;
202 Next[y][x] = Xemerald;
206 Cave[y][x] = Yemerald_eB;
207 Cave[y][x+1] = Yemerald_e;
209 Next[y][x+1] = Xemerald_pause;
213 case Xemerald_force_w:
214 switch (Cave[y][x-1])
224 Cave[y][x] = Xemerald;
225 Next[y][x] = Xemerald;
229 Cave[y][x] = Yemerald_wB;
230 Cave[y][x-1] = Yemerald_w;
232 Next[y][x-1] = Xemerald_pause;
236 case Xdiamond_force_e:
237 switch (Cave[y][x+1])
247 Cave[y][x] = Xdiamond;
248 Next[y][x] = Xdiamond;
252 Cave[y][x] = Ydiamond_eB;
253 Cave[y][x+1] = Ydiamond_e;
255 Next[y][x+1] = Xdiamond_pause;
259 case Xdiamond_force_w:
260 switch (Cave[y][x-1])
270 Cave[y][x] = Xdiamond;
271 Next[y][x] = Xdiamond;
275 Cave[y][x] = Ydiamond_wB;
276 Cave[y][x-1] = Ydiamond_w;
278 Next[y][x-1] = Xdiamond_pause;
283 switch (Cave[y][x+1])
298 Cave[y][x] = Ybomb_eB;
299 Cave[y][x+1] = Ybomb_e;
301 Next[y][x+1] = Xbomb_pause;
306 switch (Cave[y][x-1])
321 Cave[y][x] = Ybomb_wB;
322 Cave[y][x-1] = Ybomb_w;
324 Next[y][x-1] = Xbomb_pause;
327 #endif /* BAD_ROLL */
329 /* --------------------------------------------------------------------- */
332 switch (Cave[y+1][x])
342 Cave[y][x] = Ystone_sB;
343 if (Cave[y][x+1] == Xblank)
344 Cave[y][x+1] = Yacid_splash_eB;
345 if (Cave[y][x-1] == Xblank)
346 Cave[y][x-1] = Yacid_splash_wB;
348 play_sound(x, y, SAMPLE_acid);
352 case Yacid_splash_eB:
353 case Yacid_splash_wB:
356 Cave[y][x] = Ystone_sB;
357 Cave[y+1][x] = Ystone_s;
359 Next[y+1][x] = Xstone_fall;
363 Cave[y][x] = Xsand_stonein_1;
364 Cave[y+1][x] = Xsand_sandstone_1;
365 Next[y][x] = Xsand_stonein_2;
366 Next[y+1][x] = Xsand_sandstone_2;
417 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
419 Cave[y][x] = Ystone_eB;
420 Cave[y][x+1] = Ystone_e;
422 Next[y][x+1] = Xstone_pause;
426 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
428 Cave[y][x] = Ystone_wB;
429 Cave[y][x-1] = Ystone_w;
431 Next[y][x-1] = Xstone_pause;
437 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
439 Cave[y][x] = Ystone_wB;
440 Cave[y][x-1] = Ystone_w;
442 Next[y][x-1] = Xstone_pause;
446 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
448 Cave[y][x] = Ystone_eB;
449 Cave[y][x+1] = Ystone_e;
451 Next[y][x+1] = Xstone_pause;
460 /* --------------------------------------------------------------------- */
463 switch (Cave[y+1][x])
473 Cave[y][x] = Ystone_sB;
474 if (Cave[y][x+1] == Xblank)
475 Cave[y][x+1] = Yacid_splash_eB;
476 if (Cave[y][x-1] == Xblank)
477 Cave[y][x-1] = Yacid_splash_wB;
479 play_sound(x, y, SAMPLE_acid);
483 case Yacid_splash_eB:
484 case Yacid_splash_wB:
485 Cave[y][x] = Ystone_sB;
486 Cave[y+1][x] = Ystone_s;
488 Next[y+1][x] = Xstone_fall;
497 /* --------------------------------------------------------------------- */
500 switch (Cave[y+1][x])
510 Cave[y][x] = Ystone_sB;
511 if (Cave[y][x+1] == Xblank)
512 Cave[y][x+1] = Yacid_splash_eB;
513 if (Cave[y][x-1] == Xblank)
514 Cave[y][x-1] = Yacid_splash_wB;
516 play_sound(x, y, SAMPLE_acid);
520 case Yacid_splash_eB:
521 case Yacid_splash_wB:
523 Cave[y][x] = Ystone_sB;
524 Cave[y+1][x] = Ystone_s;
526 Next[y+1][x] = Xstone_fall;
531 Cave[y+1][x] = Yemerald_stone;
533 Next[y+1][x] = Xemerald;
534 play_sound(x, y, SAMPLE_crack);
535 score += lev.nut_score;
546 Cave[y][x] = Ystone_sB;
547 Cave[y+1][x] = Ybug_stone;
548 Next[y+1][x] = Znormal;
549 Boom[y][x-1] = Xemerald;
550 Boom[y][x] = Xemerald;
551 Boom[y][x+1] = Xemerald;
552 Boom[y+1][x-1] = Xemerald;
553 Boom[y+1][x] = Xdiamond;
554 Boom[y+1][x+1] = Xemerald;
555 Boom[y+2][x-1] = Xemerald;
556 Boom[y+2][x] = Xemerald;
557 Boom[y+2][x+1] = Xemerald;
558 score += lev.bug_score;
569 Cave[y][x] = Ystone_sB;
570 Cave[y+1][x] = Ytank_stone;
571 Next[y+1][x] = Znormal;
572 Boom[y][x-1] = Xblank;
574 Boom[y][x+1] = Xblank;
575 Boom[y+1][x-1] = Xblank;
576 Boom[y+1][x] = Xblank;
577 Boom[y+1][x+1] = Xblank;
578 Boom[y+2][x-1] = Xblank;
579 Boom[y+2][x] = Xblank;
580 Boom[y+2][x+1] = Xblank;
581 score += lev.tank_score;
587 switch (Cave[y+1][x+1])
590 case Yacid_splash_eB:
591 case Yacid_splash_wB:
594 Cave[y+1][x] = Xspring_e;
598 Cave[y+1][x] = Xspring_w;
604 switch (Cave[y+1][x-1])
607 case Yacid_splash_eB:
608 case Yacid_splash_wB:
611 Cave[y+1][x] = Xspring_w;
614 Cave[y+1][x] = Xspring_e;
626 Cave[y][x] = Ystone_sB;
627 Cave[y+1][x] = Yeater_stone;
628 Next[y+1][x] = Znormal;
629 Boom[y][x-1] = lev.eater_array[lev.eater_pos][0];
630 Boom[y][x] = lev.eater_array[lev.eater_pos][1];
631 Boom[y][x+1] = lev.eater_array[lev.eater_pos][2];
632 Boom[y+1][x-1] = lev.eater_array[lev.eater_pos][3];
633 Boom[y+1][x] = lev.eater_array[lev.eater_pos][4];
634 Boom[y+1][x+1] = lev.eater_array[lev.eater_pos][5];
635 Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
636 Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
637 Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
638 lev.eater_pos = (lev.eater_pos + 1) & 7;
639 score += lev.eater_score;
644 Cave[y][x] = Ystone_sB;
645 Cave[y+1][x] = Yalien_stone;
646 Next[y+1][x] = Znormal;
647 Boom[y][x-1] = Xblank;
649 Boom[y][x+1] = Xblank;
650 Boom[y+1][x-1] = Xblank;
651 Boom[y+1][x] = Xblank;
652 Boom[y+1][x+1] = Xblank;
653 Boom[y+2][x-1] = Xblank;
654 Boom[y+2][x] = Xblank;
655 Boom[y+2][x+1] = Xblank;
656 score += lev.alien_score;
661 switch (Cave[y+2][x])
664 case Yacid_splash_eB:
665 case Yacid_splash_wB:
710 play_sound(x, y, SAMPLE_stone);
714 Cave[y][x] = Ystone_sB;
715 Cave[y+1][x] = Ydiamond_stone;
717 Next[y+1][x] = Xstone_pause;
718 play_sound(x, y, SAMPLE_squash);
723 Cave[y+1][x] = Ybomb_eat;
724 Next[y+1][x] = Znormal;
725 Boom[y][x-1] = Xblank;
727 Boom[y][x+1] = Xblank;
728 Boom[y+1][x-1] = Xblank;
729 Boom[y+1][x] = Xblank;
730 Boom[y+1][x+1] = Xblank;
731 Boom[y+2][x-1] = Xblank;
732 Boom[y+2][x] = Xblank;
733 Boom[y+2][x+1] = Xblank;
737 if (lev.wonderwall_time)
739 lev.wonderwall_state = 1;
740 Cave[y][x] = Ystone_sB;
742 if (tab_blank[Cave[y+2][x]])
744 Cave[y+2][x] = Yemerald_s;
745 Next[y+2][x] = Xemerald_fall;
749 play_sound(x, y, SAMPLE_squash);
756 play_sound(x, y, SAMPLE_stone);
760 /* --------------------------------------------------------------------- */
763 switch (Cave[y+1][x])
773 Cave[y][x] = Ynut_sB;
774 if (Cave[y][x+1] == Xblank)
775 Cave[y][x+1] = Yacid_splash_eB;
776 if (Cave[y][x-1] == Xblank)
777 Cave[y][x-1] = Yacid_splash_wB;
779 play_sound(x, y, SAMPLE_acid);
783 case Yacid_splash_eB:
784 case Yacid_splash_wB:
785 Cave[y][x] = Ynut_sB;
786 Cave[y+1][x] = Ynut_s;
788 Next[y+1][x] = Xnut_fall;
837 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
839 Cave[y][x] = Ynut_eB;
840 Cave[y][x+1] = Ynut_e;
842 Next[y][x+1] = Xnut_pause;
846 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
848 Cave[y][x] = Ynut_wB;
849 Cave[y][x-1] = Ynut_w;
851 Next[y][x-1] = Xnut_pause;
857 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
859 Cave[y][x] = Ynut_wB;
860 Cave[y][x-1] = Ynut_w;
862 Next[y][x-1] = Xnut_pause;
866 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
868 Cave[y][x] = Ynut_eB;
869 Cave[y][x+1] = Ynut_e;
871 Next[y][x+1] = Xnut_pause;
880 /* --------------------------------------------------------------------- */
884 switch (Cave[y+1][x])
894 Cave[y][x] = Ynut_sB;
895 if (Cave[y][x+1] == Xblank)
896 Cave[y][x+1] = Yacid_splash_eB;
897 if (Cave[y][x-1] == Xblank)
898 Cave[y][x-1] = Yacid_splash_wB;
900 play_sound(x, y, SAMPLE_acid);
904 case Yacid_splash_eB:
905 case Yacid_splash_wB:
906 Cave[y][x] = Ynut_sB;
907 Cave[y+1][x] = Ynut_s;
909 Next[y+1][x] = Xnut_fall;
918 /* --------------------------------------------------------------------- */
921 switch (Cave[y+1][x])
931 Cave[y][x] = Ynut_sB;
932 if (Cave[y][x+1] == Xblank)
933 Cave[y][x+1] = Yacid_splash_eB;
934 if (Cave[y][x-1] == Xblank)
935 Cave[y][x-1] = Yacid_splash_wB;
937 play_sound(x, y, SAMPLE_acid);
941 case Yacid_splash_eB:
942 case Yacid_splash_wB:
944 Cave[y][x] = Ynut_sB;
945 Cave[y+1][x] = Ynut_s;
947 Next[y+1][x] = Xnut_fall;
953 play_sound(x, y, SAMPLE_nut);
957 /* --------------------------------------------------------------------- */
960 if (tab_amoeba[Cave[y-1][x]] ||
961 tab_amoeba[Cave[y][x+1]] ||
962 tab_amoeba[Cave[y+1][x]] ||
963 tab_amoeba[Cave[y][x-1]])
966 switch (Cave[y][x+1])
969 case Yacid_splash_eB:
970 case Yacid_splash_wB:
982 Cave[y][x] = Ybug_n_e;
983 Next[y][x] = Xbug_goe;
984 play_sound(x, y, SAMPLE_bug);
992 if (tab_amoeba[Cave[y-1][x]] ||
993 tab_amoeba[Cave[y][x+1]] ||
994 tab_amoeba[Cave[y+1][x]] ||
995 tab_amoeba[Cave[y][x-1]])
1000 switch (Cave[y-1][x])
1010 Cave[y][x] = Ybug_nB;
1011 if (Cave[y-2][x+1] == Xblank)
1012 Cave[y-2][x+1] = Yacid_splash_eB;
1013 if (Cave[y-2][x-1] == Xblank)
1014 Cave[y-2][x-1] = Yacid_splash_wB;
1015 Next[y][x] = Xblank;
1016 play_sound(x, y, SAMPLE_acid);
1020 case Yacid_splash_eB:
1021 case Yacid_splash_wB:
1025 Cave[y][x] = Ybug_nB;
1026 Cave[y-1][x] = Ybug_n;
1027 Next[y][x] = Xblank;
1028 Next[y-1][x] = Xbug_n;
1029 play_sound(x, y, SAMPLE_bug);
1033 Cave[y][x] = Ybug_n_w;
1034 Next[y][x] = Xbug_gow;
1035 play_sound(x, y, SAMPLE_bug);
1039 /* --------------------------------------------------------------------- */
1042 if (tab_amoeba[Cave[y-1][x]] ||
1043 tab_amoeba[Cave[y][x+1]] ||
1044 tab_amoeba[Cave[y+1][x]] ||
1045 tab_amoeba[Cave[y][x-1]])
1048 switch (Cave[y+1][x])
1051 case Yacid_splash_eB:
1052 case Yacid_splash_wB:
1064 Cave[y][x] = Ybug_e_s;
1065 Next[y][x] = Xbug_gos;
1066 play_sound(x, y, SAMPLE_bug);
1074 if (tab_amoeba[Cave[y-1][x]] ||
1075 tab_amoeba[Cave[y][x+1]] ||
1076 tab_amoeba[Cave[y+1][x]] ||
1077 tab_amoeba[Cave[y][x-1]])
1082 switch (Cave[y][x+1])
1092 Cave[y][x] = Ybug_eB;
1093 if (Cave[y-1][x+2] == Xblank)
1094 Cave[y-1][x+2] = Yacid_splash_eB;
1095 if (Cave[y-1][x] == Xblank)
1096 Cave[y-1][x] = Yacid_splash_wB;
1097 Next[y][x] = Xblank;
1098 play_sound(x, y, SAMPLE_acid);
1102 case Yacid_splash_eB:
1103 case Yacid_splash_wB:
1107 Cave[y][x] = Ybug_eB;
1108 Cave[y][x+1] = Ybug_e;
1109 Next[y][x] = Xblank;
1110 Next[y][x+1] = Xbug_e;
1111 play_sound(x, y, SAMPLE_bug);
1115 Cave[y][x] = Ybug_e_n;
1116 Next[y][x] = Xbug_gon;
1117 play_sound(x, y, SAMPLE_bug);
1121 /* --------------------------------------------------------------------- */
1124 if (tab_amoeba[Cave[y-1][x]] ||
1125 tab_amoeba[Cave[y][x+1]] ||
1126 tab_amoeba[Cave[y+1][x]] ||
1127 tab_amoeba[Cave[y][x-1]])
1130 switch (Cave[y][x-1])
1133 case Yacid_splash_eB:
1134 case Yacid_splash_wB:
1146 Cave[y][x] = Ybug_s_w;
1147 Next[y][x] = Xbug_gow;
1148 play_sound(x, y, SAMPLE_bug);
1156 if (tab_amoeba[Cave[y-1][x]] ||
1157 tab_amoeba[Cave[y][x+1]] ||
1158 tab_amoeba[Cave[y+1][x]] ||
1159 tab_amoeba[Cave[y][x-1]])
1164 switch (Cave[y+1][x])
1174 Cave[y][x] = Ybug_sB;
1175 if (Cave[y][x+1] == Xblank)
1176 Cave[y][x+1] = Yacid_splash_eB;
1177 if (Cave[y][x-1] == Xblank)
1178 Cave[y][x-1] = Yacid_splash_wB;
1179 Next[y][x] = Xblank;
1180 play_sound(x, y, SAMPLE_acid);
1184 case Yacid_splash_eB:
1185 case Yacid_splash_wB:
1189 Cave[y][x] = Ybug_sB;
1190 Cave[y+1][x] = Ybug_s;
1191 Next[y][x] = Xblank;
1192 Next[y+1][x] = Xbug_s;
1193 play_sound(x, y, SAMPLE_bug);
1197 Cave[y][x] = Ybug_s_e;
1198 Next[y][x] = Xbug_goe;
1199 play_sound(x, y, SAMPLE_bug);
1203 /* --------------------------------------------------------------------- */
1206 if (tab_amoeba[Cave[y-1][x]] ||
1207 tab_amoeba[Cave[y][x+1]] ||
1208 tab_amoeba[Cave[y+1][x]] ||
1209 tab_amoeba[Cave[y][x-1]])
1212 switch (Cave[y-1][x])
1215 case Yacid_splash_eB:
1216 case Yacid_splash_wB:
1228 Cave[y][x] = Ybug_w_n;
1229 Next[y][x] = Xbug_gon;
1230 play_sound(x, y, SAMPLE_bug);
1238 if (tab_amoeba[Cave[y-1][x]] ||
1239 tab_amoeba[Cave[y][x+1]] ||
1240 tab_amoeba[Cave[y+1][x]] ||
1241 tab_amoeba[Cave[y][x-1]])
1246 switch (Cave[y][x-1])
1256 Cave[y][x] = Ybug_wB;
1257 if (Cave[y-1][x] == Xblank)
1258 Cave[y-1][x] = Yacid_splash_eB;
1259 if (Cave[y-1][x-2] == Xblank)
1260 Cave[y-1][x-2] = Yacid_splash_wB;
1261 Next[y][x] = Xblank;
1262 play_sound(x, y, SAMPLE_acid);
1266 case Yacid_splash_eB:
1267 case Yacid_splash_wB:
1271 Cave[y][x] = Ybug_wB;
1272 Cave[y][x-1] = Ybug_w;
1273 Next[y][x] = Xblank;
1274 Next[y][x-1] = Xbug_w;
1275 play_sound(x, y, SAMPLE_bug);
1279 Cave[y][x] = Ybug_w_s;
1280 Next[y][x] = Xbug_gos;
1281 play_sound(x, y, SAMPLE_bug);
1285 /* --------------------------------------------------------------------- */
1288 if (tab_amoeba[Cave[y-1][x]] ||
1289 tab_amoeba[Cave[y][x+1]] ||
1290 tab_amoeba[Cave[y+1][x]] ||
1291 tab_amoeba[Cave[y][x-1]])
1294 switch (Cave[y][x-1])
1297 case Yacid_splash_eB:
1298 case Yacid_splash_wB:
1310 Cave[y][x] = Ytank_n_w;
1311 Next[y][x] = Xtank_gow;
1312 play_sound(x, y, SAMPLE_tank);
1320 if (tab_amoeba[Cave[y-1][x]] ||
1321 tab_amoeba[Cave[y][x+1]] ||
1322 tab_amoeba[Cave[y+1][x]] ||
1323 tab_amoeba[Cave[y][x-1]])
1328 switch (Cave[y-1][x])
1338 Cave[y][x] = Ytank_nB;
1339 if (Cave[y-2][x+1] == Xblank)
1340 Cave[y-2][x+1] = Yacid_splash_eB;
1341 if (Cave[y-2][x-1] == Xblank)
1342 Cave[y-2][x-1] = Yacid_splash_wB;
1343 Next[y][x] = Xblank;
1344 play_sound(x, y, SAMPLE_acid);
1348 case Yacid_splash_eB:
1349 case Yacid_splash_wB:
1353 Cave[y][x] = Ytank_nB;
1354 Cave[y-1][x] = Ytank_n;
1355 Next[y][x] = Xblank;
1356 Next[y-1][x] = Xtank_n;
1357 play_sound(x, y, SAMPLE_tank);
1361 Cave[y][x] = Ytank_n_e;
1362 Next[y][x] = Xtank_goe;
1363 play_sound(x, y, SAMPLE_tank);
1367 /* --------------------------------------------------------------------- */
1370 if (tab_amoeba[Cave[y-1][x]] ||
1371 tab_amoeba[Cave[y][x+1]] ||
1372 tab_amoeba[Cave[y+1][x]] ||
1373 tab_amoeba[Cave[y][x-1]])
1376 switch (Cave[y-1][x])
1379 case Yacid_splash_eB:
1380 case Yacid_splash_wB:
1392 Cave[y][x] = Ytank_e_n;
1393 Next[y][x] = Xtank_gon;
1394 play_sound(x, y, SAMPLE_tank);
1402 if (tab_amoeba[Cave[y-1][x]] ||
1403 tab_amoeba[Cave[y][x+1]] ||
1404 tab_amoeba[Cave[y+1][x]] ||
1405 tab_amoeba[Cave[y][x-1]])
1410 switch (Cave[y][x+1])
1420 Cave[y][x] = Ytank_eB;
1421 if (Cave[y-1][x+2] == Xblank)
1422 Cave[y-1][x+2] = Yacid_splash_eB;
1423 if (Cave[y-1][x] == Xblank)
1424 Cave[y-1][x] = Yacid_splash_wB;
1425 Next[y][x] = Xblank;
1426 play_sound(x, y, SAMPLE_acid);
1430 case Yacid_splash_eB:
1431 case Yacid_splash_wB:
1435 Cave[y][x] = Ytank_eB;
1436 Cave[y][x+1] = Ytank_e;
1437 Next[y][x] = Xblank;
1438 Next[y][x+1] = Xtank_e;
1439 play_sound(x, y, SAMPLE_tank);
1443 Cave[y][x] = Ytank_e_s;
1444 Next[y][x] = Xtank_gos;
1445 play_sound(x, y, SAMPLE_tank);
1449 /* --------------------------------------------------------------------- */
1452 if (tab_amoeba[Cave[y-1][x]] ||
1453 tab_amoeba[Cave[y][x+1]] ||
1454 tab_amoeba[Cave[y+1][x]] ||
1455 tab_amoeba[Cave[y][x-1]])
1458 switch (Cave[y][x+1])
1461 case Yacid_splash_eB:
1462 case Yacid_splash_wB:
1474 Cave[y][x] = Ytank_s_e;
1475 Next[y][x] = Xtank_goe;
1476 play_sound(x, y, SAMPLE_tank);
1484 if (tab_amoeba[Cave[y-1][x]] ||
1485 tab_amoeba[Cave[y][x+1]] ||
1486 tab_amoeba[Cave[y+1][x]] ||
1487 tab_amoeba[Cave[y][x-1]])
1492 switch (Cave[y+1][x])
1502 Cave[y][x] = Ytank_sB;
1503 if (Cave[y][x+1] == Xblank)
1504 Cave[y][x+1] = Yacid_splash_eB;
1505 if (Cave[y][x-1] == Xblank)
1506 Cave[y][x-1] = Yacid_splash_wB;
1507 Next[y][x] = Xblank;
1508 play_sound(x, y, SAMPLE_acid);
1512 case Yacid_splash_eB:
1513 case Yacid_splash_wB:
1517 Cave[y][x] = Ytank_sB;
1518 Cave[y+1][x] = Ytank_s;
1519 Next[y][x] = Xblank;
1520 Next[y+1][x] = Xtank_s;
1521 play_sound(x, y, SAMPLE_tank);
1525 Cave[y][x] = Ytank_s_w;
1526 Next[y][x] = Xtank_gow;
1527 play_sound(x, y, SAMPLE_tank);
1531 /* --------------------------------------------------------------------- */
1534 if (tab_amoeba[Cave[y-1][x]] ||
1535 tab_amoeba[Cave[y][x+1]] ||
1536 tab_amoeba[Cave[y+1][x]] ||
1537 tab_amoeba[Cave[y][x-1]])
1540 switch (Cave[y+1][x])
1543 case Yacid_splash_eB:
1544 case Yacid_splash_wB:
1556 Cave[y][x] = Ytank_w_s;
1557 Next[y][x] = Xtank_gos;
1558 play_sound(x, y, SAMPLE_tank);
1566 if (tab_amoeba[Cave[y-1][x]] ||
1567 tab_amoeba[Cave[y][x+1]] ||
1568 tab_amoeba[Cave[y+1][x]] ||
1569 tab_amoeba[Cave[y][x-1]])
1574 switch (Cave[y][x-1])
1584 Cave[y][x] = Ytank_wB;
1585 if (Cave[y-1][x] == Xblank)
1586 Cave[y-1][x] = Yacid_splash_eB;
1587 if (Cave[y-1][x-2] == Xblank)
1588 Cave[y-1][x-2] = Yacid_splash_wB;
1589 Next[y][x] = Xblank;
1590 play_sound(x, y, SAMPLE_acid);
1594 case Yacid_splash_eB:
1595 case Yacid_splash_wB:
1599 Cave[y][x] = Ytank_wB;
1600 Cave[y][x-1] = Ytank_w;
1601 Next[y][x] = Xblank;
1602 Next[y][x-1] = Xtank_w;
1603 play_sound(x, y, SAMPLE_tank);
1607 Cave[y][x] = Ytank_w_n;
1608 Next[y][x] = Xtank_gon;
1609 play_sound(x, y, SAMPLE_tank);
1613 /* --------------------------------------------------------------------- */
1619 if (lev.android_clone_cnt == 0)
1621 if (Cave[y-1][x-1] != Xblank &&
1622 Cave[y-1][x] != Xblank &&
1623 Cave[y-1][x+1] != Xblank &&
1624 Cave[y][x-1] != Xblank &&
1625 Cave[y][x+1] != Xblank &&
1626 Cave[y+1][x-1] != Xblank &&
1627 Cave[y+1][x] != Xblank &&
1628 Cave[y+1][x+1] != Xblank)
1633 /* randomly find an object to clone */
1635 case 0: /* S,NE,W,NW,SE,E,SW,N */
1636 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1637 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1638 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1639 temp= lev.android_array[Cave[y-1][x-1]]; 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]]; if (temp != Xblank) break;
1646 case 1: /* NW,SE,N,S,NE,SW,E,W */
1647 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1648 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1649 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1650 temp= lev.android_array[Cave[y+1][x]]; 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-1]]; if (temp != Xblank) break;
1653 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1654 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1657 case 2: /* SW,E,S,W,N,NW,SE,NE */
1658 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1659 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1660 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1661 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1662 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1663 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1664 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1665 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1668 case 3: /* N,SE,NE,E,W,S,NW,SW */
1669 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1670 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1671 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1672 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1673 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1674 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1675 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1676 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1679 case 4: /* SE,NW,E,NE,SW,W,N,S */
1680 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1681 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1682 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
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]]; if (temp != Xblank) break;
1687 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1690 case 5: /* NE,W,SE,SW,S,N,E,NW */
1691 temp= lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
1692 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1693 temp= lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
1694 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1695 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1696 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1697 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1698 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1701 case 6: /* E,N,SW,S,NW,NE,SE,W */
1702 temp= lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
1703 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1704 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1705 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1706 temp= lev.android_array[Cave[y-1][x-1]]; 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+1]]; if (temp != Xblank) break;
1709 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1712 case 7: /* W,SW,NW,N,E,SE,NE,S */
1713 temp= lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
1714 temp= lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
1715 temp= lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
1716 temp= lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
1717 temp= lev.android_array[Cave[y][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+1]]; if (temp != Xblank) break;
1720 temp= lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
1724 Next[y][x] = temp; /* the item we chose to clone */
1725 play_sound(x, y, SAMPLE_android);
1729 /* randomly find a direction to move */
1731 case 0: /* S,NE,W,NW,SE,E,SW,N */
1732 if (Cave[y+1][x] == Xblank) goto android_s;
1733 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1734 if (Cave[y][x-1] == Xblank) goto android_w;
1735 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1736 if (Cave[y+1][x+1] == Xblank) goto android_se;
1737 if (Cave[y][x+1] == Xblank) goto android_e;
1738 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1739 if (Cave[y-1][x] == Xblank) goto android_n;
1742 case 1: /* NW,SE,N,S,NE,SW,E,W */
1743 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1744 if (Cave[y+1][x+1] == Xblank) goto android_se;
1745 if (Cave[y-1][x] == Xblank) goto android_n;
1746 if (Cave[y+1][x] == Xblank) goto android_s;
1747 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1748 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1749 if (Cave[y][x+1] == Xblank) goto android_e;
1750 if (Cave[y][x-1] == Xblank) goto android_w;
1753 case 2: /* SW,E,S,W,N,NW,SE,NE */
1754 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1755 if (Cave[y][x+1] == Xblank) goto android_e;
1756 if (Cave[y+1][x] == Xblank) goto android_s;
1757 if (Cave[y][x-1] == Xblank) goto android_w;
1758 if (Cave[y-1][x] == Xblank) goto android_n;
1759 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1760 if (Cave[y+1][x+1] == Xblank) goto android_se;
1761 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1764 case 3: /* N,SE,NE,E,W,S,NW,SW */
1765 if (Cave[y-1][x] == Xblank) goto android_n;
1766 if (Cave[y+1][x+1] == Xblank) goto android_se;
1767 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1768 if (Cave[y][x+1] == Xblank) goto android_e;
1769 if (Cave[y][x-1] == Xblank) goto android_w;
1770 if (Cave[y+1][x] == Xblank) goto android_s;
1771 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1772 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1775 case 4: /* SE,NW,E,NE,SW,W,N,S */
1776 if (Cave[y+1][x+1] == Xblank) goto android_se;
1777 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1778 if (Cave[y][x+1] == Xblank) goto android_e;
1779 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1780 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1781 if (Cave[y][x-1] == Xblank) goto android_w;
1782 if (Cave[y-1][x] == Xblank) goto android_n;
1783 if (Cave[y+1][x] == Xblank) goto android_s;
1786 case 5: /* NE,W,SE,SW,S,N,E,NW */
1787 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1788 if (Cave[y][x-1] == Xblank) goto android_w;
1789 if (Cave[y+1][x+1] == Xblank) goto android_se;
1790 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1791 if (Cave[y+1][x] == Xblank) goto android_s;
1792 if (Cave[y-1][x] == Xblank) goto android_n;
1793 if (Cave[y][x+1] == Xblank) goto android_e;
1794 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1797 case 6: /* E,N,SW,S,NW,NE,SE,W */
1798 if (Cave[y][x+1] == Xblank) goto android_e;
1799 if (Cave[y-1][x] == Xblank) goto android_n;
1800 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1801 if (Cave[y+1][x] == Xblank) goto android_s;
1802 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1803 if (Cave[y-1][x+1] == Xblank) goto android_ne;
1804 if (Cave[y+1][x+1] == Xblank) goto android_se;
1805 if (Cave[y][x-1] == Xblank) goto android_w;
1808 case 7: /* W,SW,NW,N,E,SE,NE,S */
1809 if (Cave[y][x-1] == Xblank) goto android_w;
1810 if (Cave[y+1][x-1] == Xblank) goto android_sw;
1811 if (Cave[y-1][x-1] == Xblank) goto android_nw;
1812 if (Cave[y-1][x] == Xblank) goto android_n;
1813 if (Cave[y][x+1] == Xblank) goto android_e;
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+1][x] == Xblank) goto android_s;
1822 if (lev.android_move_cnt == 0)
1824 if (Cave[y-1][x-1] == Zplayer ||
1825 Cave[y-1][x] == Zplayer ||
1826 Cave[y-1][x+1] == Zplayer ||
1827 Cave[y][x-1] == Zplayer ||
1828 Cave[y][x+1] == Zplayer ||
1829 Cave[y+1][x-1] == Zplayer ||
1830 Cave[y+1][x] == Zplayer ||
1831 Cave[y+1][x+1] == Zplayer)
1834 if (ply1.alive && ply2.alive)
1836 if ((ply1.x > x ? ply1.x - x : x - ply1.x) +
1837 (ply1.y > y ? ply1.y - y : y - ply1.y) <
1838 (ply2.x > x ? ply2.x - x : x - ply2.x) +
1839 (ply2.y > y ? ply2.y - y : y - ply2.y))
1850 else if (ply1.alive)
1855 else if (ply2.alive)
1866 Next[y][x] = Xblank; /* assume we will move */
1867 temp = ((x < dx) + 1 - (x > dx)) + ((y < dy) + 1 - (y > dy)) * 3;
1873 /* attempt clockwise move first if direct path is blocked */
1875 case 0: /* north west */
1876 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1877 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1878 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1882 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1883 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1884 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1887 case 2: /* north east */
1888 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1889 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1890 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1894 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1895 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1896 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1899 case 4: /* nowhere */
1903 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1904 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1905 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1908 case 6: /* south west */
1909 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1910 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1911 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1915 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1916 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1917 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1920 case 8: /* south east */
1921 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1922 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1923 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1931 /* attempt counterclockwise move first if direct path is blocked */
1933 case 0: /* north west */
1934 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1935 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1936 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1940 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1941 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1942 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1945 case 2: /* north east */
1946 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1947 if (tab_android_move[Cave[y-1][x]]) goto android_n;
1948 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1952 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1953 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1954 if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
1957 case 4: /* nowhere */
1961 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1962 if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
1963 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1966 case 6: /* south west */
1967 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1968 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1969 if (tab_android_move[Cave[y][x-1]]) goto android_w;
1973 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1974 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1975 if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
1978 case 8: /* south east */
1979 if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
1980 if (tab_android_move[Cave[y][x+1]]) goto android_e;
1981 if (tab_android_move[Cave[y+1][x]]) goto android_s;
1989 Next[y][x] = Xandroid;
1994 Cave[y][x] = Yandroid_nB;
1995 Cave[y-1][x] = Yandroid_n;
1996 Next[y-1][x] = Xandroid;
1997 play_sound(x, y, SAMPLE_tank);
2002 Cave[y][x] = Yandroid_neB;
2003 Cave[y-1][x+1] = Yandroid_ne;
2004 Next[y-1][x+1] = Xandroid;
2005 play_sound(x, y, SAMPLE_tank);
2010 Cave[y][x] = Yandroid_eB;
2011 Cave[y][x+1] = Yandroid_e;
2012 Next[y][x+1] = Xandroid;
2013 play_sound(x, y, SAMPLE_tank);
2018 Cave[y][x] = Yandroid_seB;
2019 Cave[y+1][x+1] = Yandroid_se;
2020 Next[y+1][x+1] = Xandroid;
2021 play_sound(x, y, SAMPLE_tank);
2026 Cave[y][x] = Yandroid_sB;
2027 Cave[y+1][x] = Yandroid_s;
2028 Next[y+1][x] = Xandroid;
2029 play_sound(x, y, SAMPLE_tank);
2034 Cave[y][x] = Yandroid_swB;
2035 Cave[y+1][x-1] = Yandroid_sw;
2036 Next[y+1][x-1] = Xandroid;
2037 play_sound(x, y, SAMPLE_tank);
2042 Cave[y][x] = Yandroid_wB;
2043 Cave[y][x-1] = Yandroid_w;
2044 Next[y][x-1] = Xandroid;
2045 play_sound(x, y, SAMPLE_tank);
2050 Cave[y][x] = Yandroid_nwB;
2051 Cave[y-1][x-1] = Yandroid_nw;
2052 Next[y-1][x-1] = Xandroid;
2053 play_sound(x, y, SAMPLE_tank);
2056 /* --------------------------------------------------------------------- */
2059 switch (Cave[y-1][x])
2069 Cave[y][x] = Yandroid_nB;
2070 if (Cave[y-2][x+1] == Xblank)
2071 Cave[y-2][x+1] = Yacid_splash_eB;
2072 if (Cave[y-2][x-1] == Xblank)
2073 Cave[y-2][x-1] = Yacid_splash_wB;
2074 Next[y][x] = Xblank;
2075 play_sound(x, y, SAMPLE_acid);
2079 case Yacid_splash_eB:
2080 case Yacid_splash_wB:
2081 Cave[y][x] = Yandroid_nB;
2082 Cave[y-1][x] = Yandroid_n;
2083 Next[y][x] = Xblank;
2084 Next[y-1][x] = Xandroid;
2085 play_sound(x, y, SAMPLE_tank);
2093 switch (Cave[y-1][x])
2103 Cave[y][x] = Yandroid_nB;
2104 if (Cave[y-2][x+1] == Xblank)
2105 Cave[y-2][x+1] = Yacid_splash_eB;
2106 if (Cave[y-2][x-1] == Xblank)
2107 Cave[y-2][x-1] = Yacid_splash_wB;
2108 Next[y][x] = Xblank;
2109 play_sound(x, y, SAMPLE_acid);
2113 case Yacid_splash_eB:
2114 case Yacid_splash_wB:
2115 Cave[y][x] = Yandroid_nB;
2116 Cave[y-1][x] = Yandroid_n;
2117 Next[y][x] = Xblank;
2118 Next[y-1][x] = Xandroid_1_n;
2119 play_sound(x, y, SAMPLE_tank);
2126 /* --------------------------------------------------------------------- */
2129 switch (Cave[y][x+1])
2139 Cave[y][x] = Yandroid_eB;
2140 if (Cave[y-1][x+2] == Xblank)
2141 Cave[y-1][x+2] = Yacid_splash_eB;
2142 if (Cave[y-1][x] == Xblank)
2143 Cave[y-1][x] = Yacid_splash_wB;
2144 Next[y][x] = Xblank;
2145 play_sound(x, y, SAMPLE_acid);
2149 case Yacid_splash_eB:
2150 case Yacid_splash_wB:
2151 Cave[y][x] = Yandroid_eB;
2152 Cave[y][x+1] = Yandroid_e;
2153 Next[y][x] = Xblank;
2154 Next[y][x+1] = Xandroid;
2155 play_sound(x, y, SAMPLE_tank);
2163 switch (Cave[y][x+1])
2173 Cave[y][x] = Yandroid_eB;
2174 if (Cave[y-1][x+2] == Xblank)
2175 Cave[y-1][x+2] = Yacid_splash_eB;
2176 if (Cave[y-1][x] == Xblank)
2177 Cave[y-1][x] = Yacid_splash_wB;
2178 Next[y][x] = Xblank;
2179 play_sound(x, y, SAMPLE_acid);
2183 case Yacid_splash_eB:
2184 case Yacid_splash_wB:
2185 Cave[y][x] = Yandroid_eB;
2186 Cave[y][x+1] = Yandroid_e;
2187 Next[y][x] = Xblank;
2188 Next[y][x+1] = Xandroid_1_e;
2189 play_sound(x, y, SAMPLE_tank);
2196 /* --------------------------------------------------------------------- */
2199 switch (Cave[y+1][x])
2209 Cave[y][x] = Yandroid_sB;
2210 if (Cave[y][x+1] == Xblank)
2211 Cave[y][x+1] = Yacid_splash_eB;
2212 if (Cave[y][x-1] == Xblank)
2213 Cave[y][x-1] = Yacid_splash_wB;
2214 Next[y][x] = Xblank;
2215 play_sound(x, y, SAMPLE_acid);
2219 case Yacid_splash_eB:
2220 case Yacid_splash_wB:
2221 Cave[y][x] = Yandroid_sB;
2222 Cave[y+1][x] = Yandroid_s;
2223 Next[y][x] = Xblank;
2224 Next[y+1][x] = Xandroid;
2225 play_sound(x, y, SAMPLE_tank);
2233 switch (Cave[y+1][x])
2243 Cave[y][x] = Yandroid_sB;
2244 if (Cave[y][x+1] == Xblank)
2245 Cave[y][x+1] = Yacid_splash_eB;
2246 if (Cave[y][x-1] == Xblank)
2247 Cave[y][x-1] = Yacid_splash_wB;
2248 Next[y][x] = Xblank;
2249 play_sound(x, y, SAMPLE_acid);
2253 case Yacid_splash_eB:
2254 case Yacid_splash_wB:
2255 Cave[y][x] = Yandroid_sB;
2256 Cave[y+1][x] = Yandroid_s;
2257 Next[y][x] = Xblank;
2258 Next[y+1][x] = Xandroid_1_s;
2259 play_sound(x, y, SAMPLE_tank);
2266 /* --------------------------------------------------------------------- */
2269 switch (Cave[y][x-1])
2279 Cave[y][x] = Yandroid_wB;
2280 if (Cave[y-1][x] == Xblank)
2281 Cave[y-1][x] = Yacid_splash_eB;
2282 if (Cave[y-1][x-2] == Xblank)
2283 Cave[y-1][x-2] = Yacid_splash_wB;
2284 Next[y][x] = Xblank;
2285 play_sound(x, y, SAMPLE_acid);
2289 case Yacid_splash_eB:
2290 case Yacid_splash_wB:
2291 Cave[y][x] = Yandroid_wB;
2292 Cave[y][x-1] = Yandroid_w;
2293 Next[y][x] = Xblank;
2294 Next[y][x-1] = Xandroid;
2295 play_sound(x, y, SAMPLE_tank);
2303 switch (Cave[y][x-1])
2313 Cave[y][x] = Yandroid_wB;
2314 if (Cave[y-1][x] == Xblank)
2315 Cave[y-1][x] = Yacid_splash_eB;
2316 if (Cave[y-1][x-2] == Xblank)
2317 Cave[y-1][x-2] = Yacid_splash_wB;
2318 Next[y][x] = Xblank;
2319 play_sound(x, y, SAMPLE_acid);
2323 case Yacid_splash_eB:
2324 case Yacid_splash_wB:
2325 Cave[y][x] = Yandroid_wB;
2326 Cave[y][x-1] = Yandroid_w;
2327 Next[y][x] = Xblank;
2328 Next[y][x-1] = Xandroid_1_w;
2329 play_sound(x, y, SAMPLE_tank);
2336 /* --------------------------------------------------------------------- */
2339 switch (Cave[y+1][x])
2349 Cave[y][x] = Yspring_sB;
2350 if (Cave[y][x+1] == Xblank)
2351 Cave[y][x+1] = Yacid_splash_eB;
2352 if (Cave[y][x-1] == Xblank)
2353 Cave[y][x-1] = Yacid_splash_wB;
2354 Next[y][x] = Xblank;
2355 play_sound(x, y, SAMPLE_acid);
2359 case Yacid_splash_eB:
2360 case Yacid_splash_wB:
2363 Cave[y][x] = Yspring_sB;
2364 Cave[y+1][x] = Yspring_s;
2365 Next[y][x] = Xblank;
2366 Next[y+1][x] = Xspring_fall;
2385 case Xemerald_pause:
2387 case Xdiamond_pause:
2415 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2417 Cave[y][x] = Yspring_eB;
2418 Cave[y][x+1] = Yspring_e;
2419 if (Cave[y+1][x] == Xbumper)
2420 Cave[y+1][x] = XbumperB;
2421 Next[y][x] = Xblank;
2424 Next[y][x+1] = Xspring_e;
2426 Next[y][x+1] = Xspring_pause;
2432 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2434 Cave[y][x] = Yspring_wB;
2435 Cave[y][x-1] = Yspring_w;
2436 if (Cave[y+1][x] == Xbumper)
2437 Cave[y+1][x] = XbumperB;
2438 Next[y][x] = Xblank;
2441 Next[y][x-1] = Xspring_w;
2443 Next[y][x-1] = Xspring_pause;
2451 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
2453 Cave[y][x] = Yspring_wB;
2454 Cave[y][x-1] = Yspring_w;
2455 if (Cave[y+1][x] == Xbumper)
2456 Cave[y+1][x] = XbumperB;
2457 Next[y][x] = Xblank;
2460 Next[y][x-1] = Xspring_w;
2462 Next[y][x-1] = Xspring_pause;
2468 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
2470 Cave[y][x] = Yspring_eB;
2471 Cave[y][x+1] = Yspring_e;
2472 if (Cave[y+1][x] == Xbumper)
2473 Cave[y+1][x] = XbumperB;
2474 Next[y][x] = Xblank;
2477 Next[y][x+1] = Xspring_e;
2479 Next[y][x+1] = Xspring_pause;
2490 /* --------------------------------------------------------------------- */
2493 switch (Cave[y+1][x])
2503 Cave[y][x] = Yspring_sB;
2504 if (Cave[y][x+1] == Xblank)
2505 Cave[y][x+1] = Yacid_splash_eB;
2506 if (Cave[y][x-1] == Xblank)
2507 Cave[y][x-1] = Yacid_splash_wB;
2508 Next[y][x] = Xblank;
2509 play_sound(x, y, SAMPLE_acid);
2513 case Yacid_splash_eB:
2514 case Yacid_splash_wB:
2515 Cave[y][x] = Yspring_sB;
2516 Cave[y+1][x] = Yspring_s;
2517 Next[y][x] = Xblank;
2518 Next[y+1][x] = Xspring_fall;
2522 Cave[y][x] = Xspring;
2523 Next[y][x] = Xspring;
2527 /* --------------------------------------------------------------------- */
2530 switch (Cave[y+1][x])
2540 Cave[y][x] = Yspring_sB;
2541 if (Cave[y][x+1] == Xblank)
2542 Cave[y][x+1] = Yacid_splash_eB;
2543 if (Cave[y][x-1] == Xblank)
2544 Cave[y][x-1] = Yacid_splash_wB;
2545 Next[y][x] = Xblank;
2546 play_sound(x, y, SAMPLE_acid);
2550 case Yacid_splash_eB:
2551 case Yacid_splash_wB:
2552 Cave[y][x] = Yspring_sB;
2553 Cave[y+1][x] = Yspring_s;
2554 Next[y][x] = Xblank;
2555 Next[y+1][x] = Xspring_fall;
2559 Cave[y+1][x] = XbumperB;
2562 switch (Cave[y][x+1])
2572 Cave[y][x] = Yspring_eB;
2573 if (Cave[y-1][x+2] == Xblank)
2574 Cave[y-1][x+2] = Yacid_splash_eB;
2575 if (Cave[y-1][x] == Xblank)
2576 Cave[y-1][x] = Yacid_splash_wB;
2577 Next[y][x] = Xblank;
2578 play_sound(x, y, SAMPLE_acid);
2582 case Yacid_splash_eB:
2583 case Yacid_splash_wB:
2588 Cave[y][x] = Yspring_eB;
2589 Cave[y][x+1] = Yspring_e;
2590 Next[y][x] = Xblank;
2591 Next[y][x+1] = Xspring_e;
2600 Cave[y][x] = Yspring_kill_eB;
2601 Cave[y][x+1] = Yspring_kill_e;
2602 Next[y][x] = Xblank;
2603 Next[y][x+1] = Xspring_e;
2604 play_sound(x, y, SAMPLE_slurp);
2605 score += lev.slurp_score;
2610 Cave[y][x+1] = XbumperB;
2611 Next[y][x] = Xspring_w;
2612 play_sound(x, y, SAMPLE_spring);
2616 Cave[y][x] = Xspring;
2617 Next[y][x] = Xspring;
2618 play_sound(x, y, SAMPLE_spring);
2622 /* --------------------------------------------------------------------- */
2625 switch (Cave[y+1][x])
2635 Cave[y][x] = Yspring_sB;
2636 if (Cave[y][x+1] == Xblank)
2637 Cave[y][x+1] = Yacid_splash_eB;
2638 if (Cave[y][x-1] == Xblank)
2639 Cave[y][x-1] = Yacid_splash_wB;
2640 Next[y][x] = Xblank;
2641 play_sound(x, y, SAMPLE_acid);
2645 case Yacid_splash_eB:
2646 case Yacid_splash_wB:
2647 Cave[y][x] = Yspring_sB;
2648 Cave[y+1][x] = Yspring_s;
2649 Next[y][x] = Xblank;
2650 Next[y+1][x] = Xspring_fall;
2654 Cave[y+1][x] = XbumperB;
2657 switch (Cave[y][x-1])
2667 Cave[y][x] = Yspring_wB;
2668 if (Cave[y-1][x] == Xblank)
2669 Cave[y-1][x] = Yacid_splash_eB;
2670 if (Cave[y-1][x-2] == Xblank)
2671 Cave[y-1][x-2] = Yacid_splash_wB;
2672 Next[y][x] = Xblank;
2673 play_sound(x, y, SAMPLE_acid);
2677 case Yacid_splash_eB:
2678 case Yacid_splash_wB:
2683 Cave[y][x] = Yspring_wB;
2684 Cave[y][x-1] = Yspring_w;
2685 Next[y][x] = Xblank;
2686 Next[y][x-1] = Xspring_w;
2695 Cave[y][x] = Yspring_kill_wB;
2696 Cave[y][x-1] = Yspring_kill_w;
2697 Next[y][x] = Xblank;
2698 Next[y][x-1] = Xspring_w;
2699 play_sound(x, y, SAMPLE_slurp);
2700 score += lev.slurp_score;
2705 Cave[y][x-1] = XbumperB;
2706 Next[y][x] = Xspring_e;
2707 play_sound(x, y, SAMPLE_spring);
2711 Cave[y][x] = Xspring;
2712 Next[y][x] = Xspring;
2713 play_sound(x, y, SAMPLE_spring);
2717 /* --------------------------------------------------------------------- */
2720 switch (Cave[y+1][x])
2730 Cave[y][x] = Yspring_sB;
2731 if (Cave[y][x+1] == Xblank)
2732 Cave[y][x+1] = Yacid_splash_eB;
2733 if (Cave[y][x-1] == Xblank)
2734 Cave[y][x-1] = Yacid_splash_wB;
2735 Next[y][x] = Xblank;
2736 play_sound(x, y, SAMPLE_acid);
2740 case Yacid_splash_eB:
2741 case Yacid_splash_wB:
2743 Cave[y][x] = Yspring_sB;
2744 Cave[y+1][x] = Yspring_s;
2745 Next[y][x] = Xblank;
2746 Next[y+1][x] = Xspring_fall;
2751 Cave[y+1][x] = Ybomb_eat;
2752 Next[y+1][x] = Znormal;
2753 Boom[y][x-1] = Xblank;
2754 Boom[y][x] = Xblank;
2755 Boom[y][x+1] = Xblank;
2756 Boom[y+1][x-1] = Xblank;
2757 Boom[y+1][x] = Xblank;
2758 Boom[y+1][x+1] = Xblank;
2759 Boom[y+2][x-1] = Xblank;
2760 Boom[y+2][x] = Xblank;
2761 Boom[y+2][x+1] = Xblank;
2772 Cave[y][x] = Yspring_sB;
2773 Cave[y+1][x] = Ybug_spring;
2774 Next[y+1][x] = Znormal;
2775 Boom[y][x-1] = Xemerald;
2776 Boom[y][x] = Xemerald;
2777 Boom[y][x+1] = Xemerald;
2778 Boom[y+1][x-1] = Xemerald;
2779 Boom[y+1][x] = Xdiamond;
2780 Boom[y+1][x+1] = Xemerald;
2781 Boom[y+2][x-1] = Xemerald;
2782 Boom[y+2][x] = Xemerald;
2783 Boom[y+2][x+1] = Xemerald;
2784 score += lev.bug_score;
2795 Cave[y][x] = Yspring_sB;
2796 Cave[y+1][x] = Ytank_spring;
2797 Next[y+1][x] = Znormal;
2798 Boom[y][x-1] = Xblank;
2799 Boom[y][x] = Xblank;
2800 Boom[y][x+1] = Xblank;
2801 Boom[y+1][x-1] = Xblank;
2802 Boom[y+1][x] = Xblank;
2803 Boom[y+1][x+1] = Xblank;
2804 Boom[y+2][x-1] = Xblank;
2805 Boom[y+2][x] = Xblank;
2806 Boom[y+2][x+1] = Xblank;
2807 score += lev.tank_score;
2814 Cave[y][x] = Yspring_sB;
2815 Cave[y+1][x] = Yeater_spring;
2816 Next[y+1][x] = Znormal;
2817 Boom[y][x-1] = lev.eater_array[lev.eater_pos][0];
2818 Boom[y][x] = lev.eater_array[lev.eater_pos][1];
2819 Boom[y][x+1] = lev.eater_array[lev.eater_pos][2];
2820 Boom[y+1][x-1] = lev.eater_array[lev.eater_pos][3];
2821 Boom[y+1][x] = lev.eater_array[lev.eater_pos][4];
2822 Boom[y+1][x+1] = lev.eater_array[lev.eater_pos][5];
2823 Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
2824 Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
2825 Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
2826 lev.eater_pos = (lev.eater_pos + 1) & 7;
2827 score += lev.eater_score;
2832 Cave[y][x] = Yspring_sB;
2833 Cave[y+1][x] = Yalien_spring;
2834 Next[y+1][x] = Znormal;
2835 Boom[y][x-1] = Xblank;
2836 Boom[y][x] = Xblank;
2837 Boom[y][x+1] = Xblank;
2838 Boom[y+1][x-1] = Xblank;
2839 Boom[y+1][x] = Xblank;
2840 Boom[y+1][x+1] = Xblank;
2841 Boom[y+2][x-1] = Xblank;
2842 Boom[y+2][x] = Xblank;
2843 Boom[y+2][x+1] = Xblank;
2844 score += lev.alien_score;
2848 Cave[y][x] = Xspring;
2849 Next[y][x] = Xspring;
2850 play_sound(x, y, SAMPLE_spring);
2854 /* --------------------------------------------------------------------- */
2857 if (Cave[y][x+1] == Xdiamond)
2859 Cave[y][x+1] = Ydiamond_eat;
2860 Next[y][x+1] = Xblank;
2861 play_sound(x, y, SAMPLE_eater);
2865 if (Cave[y+1][x] == Xdiamond)
2867 Cave[y+1][x] = Ydiamond_eat;
2868 Next[y+1][x] = Xblank;
2869 play_sound(x, y, SAMPLE_eater);
2873 if (Cave[y][x-1] == Xdiamond)
2875 Cave[y][x-1] = Ydiamond_eat;
2876 Next[y][x-1] = Xblank;
2877 play_sound(x, y, SAMPLE_eater);
2881 if (Cave[y-1][x] == Xdiamond)
2883 Cave[y-1][x] = Ydiamond_eat;
2884 Next[y-1][x] = Xblank;
2885 play_sound(x, y, SAMPLE_eater);
2889 switch (Cave[y-1][x])
2899 Cave[y][x] = Yeater_nB;
2900 if (Cave[y-2][x+1] == Xblank)
2901 Cave[y-2][x+1] = Yacid_splash_eB;
2902 if (Cave[y-2][x-1] == Xblank)
2903 Cave[y-2][x-1] = Yacid_splash_wB;
2904 Next[y][x] = Xblank;
2905 play_sound(x, y, SAMPLE_acid);
2909 case Yacid_splash_eB:
2910 case Yacid_splash_wB:
2914 Cave[y][x] = Yeater_nB;
2915 Cave[y-1][x] = Yeater_n;
2916 Next[y][x] = Xblank;
2917 Next[y-1][x] = Xeater_n;
2921 Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
2922 play_sound(x, y, SAMPLE_eater);
2926 /* --------------------------------------------------------------------- */
2929 if (Cave[y+1][x] == Xdiamond)
2931 Cave[y+1][x] = Ydiamond_eat;
2932 Next[y+1][x] = Xblank;
2933 play_sound(x, y, SAMPLE_eater);
2937 if (Cave[y][x-1] == Xdiamond)
2939 Cave[y][x-1] = Ydiamond_eat;
2940 Next[y][x-1] = Xblank;
2941 play_sound(x, y, SAMPLE_eater);
2945 if (Cave[y-1][x] == Xdiamond)
2947 Cave[y-1][x] = Ydiamond_eat;
2948 Next[y-1][x] = Xblank;
2949 play_sound(x, y, SAMPLE_eater);
2953 if (Cave[y][x+1] == Xdiamond)
2955 Cave[y][x+1] = Ydiamond_eat;
2956 Next[y][x+1] = Xblank;
2957 play_sound(x, y, SAMPLE_eater);
2961 switch (Cave[y][x+1])
2971 Cave[y][x] = Yeater_eB;
2972 if (Cave[y-1][x+2] == Xblank)
2973 Cave[y-1][x+2] = Yacid_splash_eB;
2974 if (Cave[y-1][x] == Xblank)
2975 Cave[y-1][x] = Yacid_splash_wB;
2976 Next[y][x] = Xblank;
2977 play_sound(x, y, SAMPLE_acid);
2981 case Yacid_splash_eB:
2982 case Yacid_splash_wB:
2986 Cave[y][x] = Yeater_eB;
2987 Cave[y][x+1] = Yeater_e;
2988 Next[y][x] = Xblank;
2989 Next[y][x+1] = Xeater_e;
2993 Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
2994 play_sound(x, y, SAMPLE_eater);
2998 /* --------------------------------------------------------------------- */
3001 if (Cave[y][x-1] == Xdiamond)
3003 Cave[y][x-1] = Ydiamond_eat;
3004 Next[y][x-1] = Xblank;
3005 play_sound(x, y, SAMPLE_eater);
3009 if (Cave[y-1][x] == Xdiamond)
3011 Cave[y-1][x] = Ydiamond_eat;
3012 Next[y-1][x] = Xblank;
3013 play_sound(x, y, SAMPLE_eater);
3017 if (Cave[y][x+1] == Xdiamond)
3019 Cave[y][x+1] = Ydiamond_eat;
3020 Next[y][x+1] = Xblank;
3021 play_sound(x, y, SAMPLE_eater);
3025 if (Cave[y+1][x] == Xdiamond)
3027 Cave[y+1][x] = Ydiamond_eat;
3028 Next[y+1][x] = Xblank;
3029 play_sound(x, y, SAMPLE_eater);
3033 switch (Cave[y+1][x])
3043 Cave[y][x] = Yeater_sB;
3044 if (Cave[y][x+1] == Xblank)
3045 Cave[y][x+1] = Yacid_splash_eB;
3046 if (Cave[y][x-1] == Xblank)
3047 Cave[y][x-1] = Yacid_splash_wB;
3048 Next[y][x] = Xblank;
3049 play_sound(x, y, SAMPLE_acid);
3053 case Yacid_splash_eB:
3054 case Yacid_splash_wB:
3058 Cave[y][x] = Yeater_sB;
3059 Cave[y+1][x] = Yeater_s;
3060 Next[y][x] = Xblank;
3061 Next[y+1][x] = Xeater_s;
3065 Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
3066 play_sound(x, y, SAMPLE_eater);
3070 /* --------------------------------------------------------------------- */
3073 if (Cave[y-1][x] == Xdiamond)
3075 Cave[y-1][x] = Ydiamond_eat;
3076 Next[y-1][x] = Xblank;
3077 play_sound(x, y, SAMPLE_eater);
3081 if (Cave[y][x+1] == Xdiamond)
3083 Cave[y][x+1] = Ydiamond_eat;
3084 Next[y][x+1] = Xblank;
3085 play_sound(x, y, SAMPLE_eater);
3089 if (Cave[y+1][x] == Xdiamond)
3091 Cave[y+1][x] = Ydiamond_eat;
3092 Next[y+1][x] = Xblank;
3093 play_sound(x, y, SAMPLE_eater);
3097 if (Cave[y][x-1] == Xdiamond)
3099 Cave[y][x-1] = Ydiamond_eat;
3100 Next[y][x-1] = Xblank;
3101 play_sound(x, y, SAMPLE_eater);
3105 switch (Cave[y][x-1])
3115 Cave[y][x] = Yeater_wB;
3116 if (Cave[y-1][x] == Xblank)
3117 Cave[y-1][x] = Yacid_splash_eB;
3118 if (Cave[y-1][x-2] == Xblank)
3119 Cave[y-1][x-2] = Yacid_splash_wB;
3120 Next[y][x] = Xblank;
3121 play_sound(x, y, SAMPLE_acid);
3125 case Yacid_splash_eB:
3126 case Yacid_splash_wB:
3130 Cave[y][x] = Yeater_wB;
3131 Cave[y][x-1] = Yeater_w;
3132 Next[y][x] = Xblank;
3133 Next[y][x-1] = Xeater_w;
3137 Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
3138 play_sound(x, y, SAMPLE_eater);
3142 /* --------------------------------------------------------------------- */
3150 else if (ply1.alive && ply2.alive)
3152 if ((ply1.x > x ? ply1.x - x : x - ply1.x) +
3153 (ply1.y > y ? ply1.y - y : y - ply1.y) <
3154 (ply2.x > x ? ply2.x - x : x - ply2.x) +
3155 (ply2.y > y ? ply2.y - y : y - ply2.y))
3166 else if (ply1.alive)
3171 else if (ply2.alive)
3186 switch (Cave[y-1][x])
3196 Cave[y][x] = Yalien_nB;
3197 if (Cave[y-2][x+1] == Xblank)
3198 Cave[y-2][x+1] = Yacid_splash_eB;
3199 if (Cave[y-2][x-1] == Xblank)
3200 Cave[y-2][x-1] = Yacid_splash_wB;
3201 Next[y][x] = Xblank;
3202 play_sound(x, y, SAMPLE_acid);
3206 case Yacid_splash_eB:
3207 case Yacid_splash_wB:
3211 Cave[y][x] = Yalien_nB;
3212 Cave[y-1][x] = Yalien_n;
3213 Next[y][x] = Xblank;
3214 Next[y-1][x] = Xalien_pause;
3215 play_sound(x, y, SAMPLE_alien);
3221 switch (Cave[y+1][x])
3231 Cave[y][x] = Yalien_sB;
3232 Next[y][x] = Xblank;
3233 if (Cave[y][x+1] == Xblank)
3234 Cave[y][x+1] = Yacid_splash_eB;
3235 if (Cave[y][x-1] == Xblank)
3236 Cave[y][x-1] = Yacid_splash_wB;
3237 play_sound(x, y, SAMPLE_acid);
3241 case Yacid_splash_eB:
3242 case Yacid_splash_wB:
3246 Cave[y][x] = Yalien_sB;
3247 Cave[y+1][x] = Yalien_s;
3248 Next[y][x] = Xblank;
3249 Next[y+1][x] = Xalien_pause;
3250 play_sound(x, y, SAMPLE_alien);
3259 switch (Cave[y][x+1])
3269 Cave[y][x] = Yalien_eB;
3270 if (Cave[y-1][x+2] == Xblank)
3271 Cave[y-1][x+2] = Yacid_splash_eB;
3272 if (Cave[y-1][x] == Xblank)
3273 Cave[y-1][x] = Yacid_splash_wB;
3274 Next[y][x] = Xblank;
3275 play_sound(x, y, SAMPLE_acid);
3279 case Yacid_splash_eB:
3280 case Yacid_splash_wB:
3284 Cave[y][x] = Yalien_eB;
3285 Cave[y][x+1] = Yalien_e;
3286 Next[y][x] = Xblank;
3287 Next[y][x+1] = Xalien_pause;
3288 play_sound(x, y, SAMPLE_alien);
3294 switch (Cave[y][x-1])
3304 Cave[y][x] = Yalien_wB;
3305 if (Cave[y-1][x] == Xblank)
3306 Cave[y-1][x] = Yacid_splash_eB;
3307 if (Cave[y-1][x-2] == Xblank)
3308 Cave[y-1][x-2] = Yacid_splash_wB;
3309 Next[y][x] = Xblank;
3310 play_sound(x, y, SAMPLE_acid);
3314 case Yacid_splash_eB:
3315 case Yacid_splash_wB:
3319 Cave[y][x] = Yalien_wB;
3320 Cave[y][x-1] = Yalien_w;
3321 Next[y][x] = Xblank;
3322 Next[y][x-1] = Xalien_pause;
3323 play_sound(x, y, SAMPLE_alien);
3332 Next[y][x] = Xalien;
3335 /* --------------------------------------------------------------------- */
3338 switch (Cave[y+1][x])
3348 Cave[y][x] = Yemerald_sB;
3349 if (Cave[y][x+1] == Xblank)
3350 Cave[y][x+1] = Yacid_splash_eB;
3351 if (Cave[y][x-1] == Xblank)
3352 Cave[y][x-1] = Yacid_splash_wB;
3353 Next[y][x] = Xblank;
3354 play_sound(x, y, SAMPLE_acid);
3358 case Yacid_splash_eB:
3359 case Yacid_splash_wB:
3360 Cave[y][x] = Yemerald_sB;
3361 Cave[y+1][x] = Yemerald_s;
3362 Next[y][x] = Xblank;
3363 Next[y+1][x] = Xemerald_fall;
3382 case Xemerald_pause:
3384 case Xdiamond_pause:
3421 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3423 Cave[y][x] = Yemerald_eB;
3424 Cave[y][x+1] = Yemerald_e;
3425 Next[y][x] = Xblank;
3426 Next[y][x+1] = Xemerald_pause;
3430 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3432 Cave[y][x] = Yemerald_wB;
3433 Cave[y][x-1] = Yemerald_w;
3434 Next[y][x] = Xblank;
3435 Next[y][x-1] = Xemerald_pause;
3441 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3443 Cave[y][x] = Yemerald_wB;
3444 Cave[y][x-1] = Yemerald_w;
3445 Next[y][x] = Xblank;
3446 Next[y][x-1] = Xemerald_pause;
3450 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3452 Cave[y][x] = Yemerald_eB;
3453 Cave[y][x+1] = Yemerald_e;
3454 Next[y][x] = Xblank;
3455 Next[y][x+1] = Xemerald_pause;
3461 if (++lev.shine_cnt > 50)
3463 lev.shine_cnt = RANDOM & 7;
3464 Cave[y][x] = Xemerald_shine;
3470 /* --------------------------------------------------------------------- */
3472 case Xemerald_pause:
3473 switch (Cave[y+1][x])
3483 Cave[y][x] = Yemerald_sB;
3484 if (Cave[y][x+1] == Xblank)
3485 Cave[y][x+1] = Yacid_splash_eB;
3486 if (Cave[y][x-1] == Xblank)
3487 Cave[y][x-1] = Yacid_splash_wB;
3488 Next[y][x] = Xblank;
3489 play_sound(x, y, SAMPLE_acid);
3493 case Yacid_splash_eB:
3494 case Yacid_splash_wB:
3495 Cave[y][x] = Yemerald_sB;
3496 Cave[y+1][x] = Yemerald_s;
3497 Next[y][x] = Xblank;
3498 Next[y+1][x] = Xemerald_fall;
3502 Cave[y][x] = Xemerald;
3503 Next[y][x] = Xemerald;
3507 /* --------------------------------------------------------------------- */
3510 switch (Cave[y+1][x])
3520 Cave[y][x] = Yemerald_sB;
3521 if (Cave[y][x+1] == Xblank)
3522 Cave[y][x+1] = Yacid_splash_eB;
3523 if (Cave[y][x-1] == Xblank)
3524 Cave[y][x-1] = Yacid_splash_wB;
3525 Next[y][x] = Xblank;
3526 play_sound(x, y, SAMPLE_acid);
3530 case Yacid_splash_eB:
3531 case Yacid_splash_wB:
3533 Cave[y][x] = Yemerald_sB;
3534 Cave[y+1][x] = Yemerald_s;
3535 Next[y][x] = Xblank;
3536 Next[y+1][x] = Xemerald_fall;
3540 if (lev.wonderwall_time)
3542 lev.wonderwall_state = 1;
3543 Cave[y][x] = Yemerald_sB;
3544 if (tab_blank[Cave[y+2][x]])
3546 Cave[y+2][x] = Ydiamond_s;
3547 Next[y+2][x] = Xdiamond_fall;
3550 Next[y][x] = Xblank;
3551 play_sound(x, y, SAMPLE_squash);
3556 Cave[y][x] = Xemerald;
3557 Next[y][x] = Xemerald;
3558 play_sound(x, y, SAMPLE_diamond);
3562 /* --------------------------------------------------------------------- */
3565 switch (Cave[y+1][x])
3575 Cave[y][x] = Ydiamond_sB;
3576 if (Cave[y][x+1] == Xblank)
3577 Cave[y][x+1] = Yacid_splash_eB;
3578 if (Cave[y][x-1] == Xblank)
3579 Cave[y][x-1] = Yacid_splash_wB;
3580 Next[y][x] = Xblank;
3581 play_sound(x, y, SAMPLE_acid);
3585 case Yacid_splash_eB:
3586 case Yacid_splash_wB:
3587 Cave[y][x] = Ydiamond_sB;
3588 Cave[y+1][x] = Ydiamond_s;
3589 Next[y][x] = Xblank;
3590 Next[y+1][x] = Xdiamond_fall;
3609 case Xemerald_pause:
3611 case Xdiamond_pause:
3648 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3650 Cave[y][x] = Ydiamond_eB;
3651 Cave[y][x+1] = Ydiamond_e;
3652 Next[y][x] = Xblank;
3653 Next[y][x+1] = Xdiamond_pause;
3657 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3659 Cave[y][x] = Ydiamond_wB;
3660 Cave[y][x-1] = Ydiamond_w;
3661 Next[y][x] = Xblank;
3662 Next[y][x-1] = Xdiamond_pause;
3668 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3670 Cave[y][x] = Ydiamond_wB;
3671 Cave[y][x-1] = Ydiamond_w;
3672 Next[y][x] = Xblank;
3673 Next[y][x-1] = Xdiamond_pause;
3677 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3679 Cave[y][x] = Ydiamond_eB;
3680 Cave[y][x+1] = Ydiamond_e;
3681 Next[y][x] = Xblank;
3682 Next[y][x+1] = Xdiamond_pause;
3688 if (++lev.shine_cnt > 50)
3690 lev.shine_cnt = RANDOM & 7;
3691 Cave[y][x] = Xdiamond_shine;
3697 /* --------------------------------------------------------------------- */
3699 case Xdiamond_pause:
3700 switch (Cave[y+1][x])
3710 Cave[y][x] = Ydiamond_sB;
3711 if (Cave[y][x+1] == Xblank)
3712 Cave[y][x+1] = Yacid_splash_eB;
3713 if (Cave[y][x-1] == Xblank)
3714 Cave[y][x-1] = Yacid_splash_wB;
3715 Next[y][x] = Xblank;
3716 play_sound(x, y, SAMPLE_acid);
3720 case Yacid_splash_eB:
3721 case Yacid_splash_wB:
3722 Cave[y][x] = Ydiamond_sB;
3723 Cave[y+1][x] = Ydiamond_s;
3724 Next[y][x] = Xblank;
3725 Next[y+1][x] = Xdiamond_fall;
3729 Cave[y][x] = Xdiamond;
3730 Next[y][x] = Xdiamond;
3734 /* --------------------------------------------------------------------- */
3737 switch (Cave[y+1][x])
3747 Cave[y][x] = Ydiamond_sB;
3748 if (Cave[y][x+1] == Xblank)
3749 Cave[y][x+1] = Yacid_splash_eB;
3750 if (Cave[y][x-1] == Xblank)
3751 Cave[y][x-1] = Yacid_splash_wB;
3752 Next[y][x] = Xblank;
3753 play_sound(x, y, SAMPLE_acid);
3757 case Yacid_splash_eB:
3758 case Yacid_splash_wB:
3760 Cave[y][x] = Ydiamond_sB;
3761 Cave[y+1][x] = Ydiamond_s;
3762 Next[y][x] = Xblank;
3763 Next[y+1][x] = Xdiamond_fall;
3767 if (lev.wonderwall_time)
3769 lev.wonderwall_state = 1;
3770 Cave[y][x] = Ydiamond_sB;
3771 if (tab_blank[Cave[y+2][x]])
3773 Cave[y+2][x] = Ystone_s;
3774 Next[y+2][x] = Xstone_fall;
3777 Next[y][x] = Xblank;
3778 play_sound(x, y, SAMPLE_squash);
3783 Cave[y][x] = Xdiamond;
3784 Next[y][x] = Xdiamond;
3785 play_sound(x, y, SAMPLE_diamond);
3789 /* --------------------------------------------------------------------- */
3792 switch (Cave[y+1][x])
3802 Cave[y][x] = Ydrip_s1B;
3803 if (Cave[y][x+1] == Xblank)
3804 Cave[y][x+1] = Yacid_splash_eB;
3805 if (Cave[y][x-1] == Xblank)
3806 Cave[y][x-1] = Yacid_splash_wB;
3807 Next[y][x] = Xdrip_stretchB;
3808 play_sound(x, y, SAMPLE_acid);
3812 case Yacid_splash_eB:
3813 case Yacid_splash_wB:
3817 Cave[y][x] = Ydrip_s1B;
3818 Cave[y+1][x] = Ydrip_s1;
3819 Next[y][x] = Xdrip_stretchB;
3820 Next[y+1][x] = Xdrip_stretch;
3861 play_sound(x, y, SAMPLE_drip);
3865 /* --------------------------------------------------------------------- */
3868 Cave[y][x] = Ydrip_s2;
3869 Next[y][x] = Xdrip_fall;
3872 case Xdrip_stretchB:
3873 Cave[y][x] = Ydrip_s2B;
3874 Next[y][x] = Xblank;
3878 Next[y][x] = Xdrip_fall;
3881 /* --------------------------------------------------------------------- */
3884 switch (Cave[y+1][x])
3894 Cave[y][x] = Ybomb_sB;
3895 if (Cave[y][x+1] == Xblank)
3896 Cave[y][x+1] = Yacid_splash_eB;
3897 if (Cave[y][x-1] == Xblank)
3898 Cave[y][x-1] = Yacid_splash_wB;
3899 Next[y][x] = Xblank;
3900 play_sound(x, y, SAMPLE_acid);
3904 case Yacid_splash_eB:
3905 case Yacid_splash_wB:
3906 Cave[y][x] = Ybomb_sB;
3907 Cave[y+1][x] = Ybomb_s;
3908 Next[y][x] = Xblank;
3909 Next[y+1][x] = Xbomb_fall;
3928 case Xemerald_pause:
3930 case Xdiamond_pause:
3958 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3960 Cave[y][x] = Ybomb_eB;
3961 Cave[y][x+1] = Ybomb_e;
3962 Next[y][x] = Xblank;
3963 Next[y][x+1] = Xbomb_pause;
3967 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3969 Cave[y][x] = Ybomb_wB;
3970 Cave[y][x-1] = Ybomb_w;
3971 Next[y][x] = Xblank;
3972 Next[y][x-1] = Xbomb_pause;
3978 if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
3980 Cave[y][x] = Ybomb_wB;
3981 Cave[y][x-1] = Ybomb_w;
3982 Next[y][x] = Xblank;
3983 Next[y][x-1] = Xbomb_pause;
3987 if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
3989 Cave[y][x] = Ybomb_eB;
3990 Cave[y][x+1] = Ybomb_e;
3991 Next[y][x] = Xblank;
3992 Next[y][x+1] = Xbomb_pause;
4001 /* --------------------------------------------------------------------- */
4004 switch (Cave[y+1][x])
4014 Cave[y][x] = Ybomb_sB;
4015 if (Cave[y][x+1] == Xblank)
4016 Cave[y][x+1] = Yacid_splash_eB;
4017 if (Cave[y][x-1] == Xblank)
4018 Cave[y][x-1] = Yacid_splash_wB;
4019 Next[y][x] = Xblank;
4020 play_sound(x, y, SAMPLE_acid);
4024 case Yacid_splash_eB:
4025 case Yacid_splash_wB:
4026 Cave[y][x] = Ybomb_sB;
4027 Cave[y+1][x] = Ybomb_s;
4028 Next[y][x] = Xblank;
4029 Next[y+1][x] = Xbomb_fall;
4038 /* --------------------------------------------------------------------- */
4041 switch (Cave[y+1][x])
4051 Cave[y][x] = Ybomb_sB;
4052 if (Cave[y][x+1] == Xblank)
4053 Cave[y][x+1] = Yacid_splash_eB;
4054 if (Cave[y][x-1] == Xblank)
4055 Cave[y][x-1] = Yacid_splash_wB;
4056 Next[y][x] = Xblank;
4057 play_sound(x, y, SAMPLE_acid);
4061 case Yacid_splash_eB:
4062 case Yacid_splash_wB:
4063 Cave[y][x] = Ybomb_sB;
4064 Cave[y+1][x] = Ybomb_s;
4065 Next[y][x] = Xblank;
4066 Next[y+1][x] = Xbomb_fall;
4070 Cave[y][x] = Ybomb_eat;
4071 Next[y][x] = Znormal;
4072 Boom[y-1][x-1] = Xblank;
4073 Boom[y-1][x] = Xblank;
4074 Boom[y-1][x+1] = Xblank;
4075 Boom[y][x-1] = Xblank;
4076 Boom[y][x] = Xblank;
4077 Boom[y][x+1] = Xblank;
4078 Boom[y+1][x-1] = Xblank;
4079 Boom[y+1][x] = Xblank;
4080 Boom[y+1][x+1] = Xblank;
4084 /* --------------------------------------------------------------------- */
4087 if (lev.wind_cnt == 0)
4090 switch (lev.wind_direction)
4093 switch (Cave[y-1][x])
4103 Cave[y][x] = Yballoon_nB;
4104 if (Cave[y-2][x+1] == Xblank)
4105 Cave[y-2][x+1] = Yacid_splash_eB;
4106 if (Cave[y-2][x-1] == Xblank)
4107 Cave[y-2][x-1] = Yacid_splash_wB;
4108 Next[y][x] = Xblank;
4109 play_sound(x, y, SAMPLE_acid);
4113 case Yacid_splash_eB:
4114 case Yacid_splash_wB:
4115 Cave[y][x] = Yballoon_nB;
4116 Cave[y-1][x] = Yballoon_n;
4117 Next[y][x] = Xblank;
4118 Next[y-1][x] = Xballoon;
4126 switch (Cave[y][x+1])
4136 Cave[y][x] = Yballoon_eB;
4137 if (Cave[y-1][x+2] == Xblank)
4138 Cave[y-1][x+2] = Yacid_splash_eB;
4139 if (Cave[y-1][x] == Xblank)
4140 Cave[y-1][x] = Yacid_splash_wB;
4141 Next[y][x] = Xblank;
4142 play_sound(x, y, SAMPLE_acid);
4146 case Yacid_splash_eB:
4147 case Yacid_splash_wB:
4148 Cave[y][x] = Yballoon_eB;
4149 Cave[y][x+1] = Yballoon_e;
4150 Next[y][x] = Xblank;
4151 Next[y][x+1] = Xballoon;
4159 switch (Cave[y+1][x])
4169 Cave[y][x] = Yballoon_sB;
4170 if (Cave[y][x+1] == Xblank)
4171 Cave[y][x+1] = Yacid_splash_eB;
4172 if (Cave[y][x-1] == Xblank)
4173 Cave[y][x-1] = Yacid_splash_wB;
4174 Next[y][x] = Xblank;
4175 play_sound(x, y, SAMPLE_acid);
4179 case Yacid_splash_eB:
4180 case Yacid_splash_wB:
4181 Cave[y][x] = Yballoon_sB;
4182 Cave[y+1][x] = Yballoon_s;
4183 Next[y][x] = Xblank;
4184 Next[y+1][x] = Xballoon;
4192 switch (Cave[y][x-1])
4202 Cave[y][x] = Yballoon_wB;
4203 if (Cave[y-1][x] == Xblank)
4204 Cave[y-1][x] = Yacid_splash_eB;
4205 if (Cave[y-1][x-2] == Xblank)
4206 Cave[y-1][x-2] = Yacid_splash_wB;
4207 Next[y][x] = Xblank;
4208 play_sound(x, y, SAMPLE_acid);
4212 case Yacid_splash_eB:
4213 case Yacid_splash_wB:
4214 Cave[y][x] = Yballoon_wB;
4215 Cave[y][x-1] = Yballoon_w;
4216 Next[y][x] = Xblank;
4217 Next[y][x-1] = Xballoon;
4225 /* --------------------------------------------------------------------- */
4228 Next[y][x] = Xacid_2;
4232 Next[y][x] = Xacid_3;
4236 Next[y][x] = Xacid_4;
4240 Next[y][x] = Xacid_5;
4244 Next[y][x] = Xacid_6;
4248 Next[y][x] = Xacid_7;
4252 Next[y][x] = Xacid_8;
4256 Next[y][x] = Xacid_1;
4259 /* --------------------------------------------------------------------- */
4262 if (lev.ball_state == 0)
4265 Cave[y][x] = Xball_1B;
4266 Next[y][x] = Xball_2;
4273 if (lev.ball_state == 0)
4276 Cave[y][x] = Xball_2B;
4277 Next[y][x] = Xball_1;
4285 play_sound(x, y, SAMPLE_ball);
4286 if (lev.ball_random)
4291 if (lev.ball_array[lev.ball_pos][0] != Xblank &&
4292 tab_blank[Cave[y-1][x-1]])
4294 Cave[y-1][x-1] = Yball_eat;
4295 Next[y-1][x-1] = lev.ball_array[lev.ball_pos][0];
4300 if (lev.ball_array[lev.ball_pos][1] != Xblank &&
4301 tab_blank[Cave[y-1][x]])
4303 Cave[y-1][x] = Yball_eat;
4304 Next[y-1][x] = lev.ball_array[lev.ball_pos][1];
4309 if (lev.ball_array[lev.ball_pos][2] != Xblank &&
4310 tab_blank[Cave[y-1][x+1]])
4312 Cave[y-1][x+1] = Yball_eat;
4313 Next[y-1][x+1] = lev.ball_array[lev.ball_pos][2];
4318 if (lev.ball_array[lev.ball_pos][3] != Xblank &&
4319 tab_blank[Cave[y][x-1]])
4321 Cave[y][x-1] = Yball_eat;
4322 Next[y][x-1] = lev.ball_array[lev.ball_pos][3];
4327 if (lev.ball_array[lev.ball_pos][4] != Xblank &&
4328 tab_blank[Cave[y][x+1]])
4330 Cave[y][x+1] = Yball_eat;
4331 Next[y][x+1] = lev.ball_array[lev.ball_pos][4];
4336 if (lev.ball_array[lev.ball_pos][5] != Xblank &&
4337 tab_blank[Cave[y+1][x-1]])
4339 Cave[y+1][x-1] = Yball_eat;
4340 Next[y+1][x-1] = lev.ball_array[lev.ball_pos][5];
4345 if (lev.ball_array[lev.ball_pos][6] != Xblank &&
4346 tab_blank[Cave[y+1][x]])
4348 Cave[y+1][x] = Yball_eat;
4349 Next[y+1][x] = lev.ball_array[lev.ball_pos][6];
4354 if (lev.ball_array[lev.ball_pos][7] != Xblank &&
4355 tab_blank[Cave[y+1][x+1]])
4357 Cave[y+1][x+1] = Yball_eat;
4358 Next[y+1][x+1] = lev.ball_array[lev.ball_pos][7];
4365 if (lev.ball_array[lev.ball_pos][0] != Xblank &&
4366 tab_blank[Cave[y-1][x-1]])
4368 Cave[y-1][x-1] = Yball_eat;
4369 Next[y-1][x-1] = lev.ball_array[lev.ball_pos][0];
4372 if (lev.ball_array[lev.ball_pos][1] != Xblank &&
4373 tab_blank[Cave[y-1][x]])
4375 Cave[y-1][x] = Yball_eat;
4376 Next[y-1][x] = lev.ball_array[lev.ball_pos][1];
4379 if (lev.ball_array[lev.ball_pos][2] != Xblank &&
4380 tab_blank[Cave[y-1][x+1]])
4382 Cave[y-1][x+1] = Yball_eat;
4383 Next[y-1][x+1] = lev.ball_array[lev.ball_pos][2];
4386 if (lev.ball_array[lev.ball_pos][3] != Xblank &&
4387 tab_blank[Cave[y][x-1]])
4389 Cave[y][x-1] = Yball_eat;
4390 Next[y][x-1] = lev.ball_array[lev.ball_pos][3];
4393 if (lev.ball_array[lev.ball_pos][4] != Xblank &&
4394 tab_blank[Cave[y][x+1]])
4396 Cave[y][x+1] = Yball_eat;
4397 Next[y][x+1] = lev.ball_array[lev.ball_pos][4];
4400 if (lev.ball_array[lev.ball_pos][5] != Xblank &&
4401 tab_blank[Cave[y+1][x-1]])
4403 Cave[y+1][x-1] = Yball_eat;
4404 Next[y+1][x-1] = lev.ball_array[lev.ball_pos][5];
4407 if (lev.ball_array[lev.ball_pos][6] != Xblank &&
4408 tab_blank[Cave[y+1][x]])
4410 Cave[y+1][x] = Yball_eat;
4411 Next[y+1][x] = lev.ball_array[lev.ball_pos][6];
4414 if (lev.ball_array[lev.ball_pos][7] != Xblank &&
4415 tab_blank[Cave[y+1][x+1]])
4417 Cave[y+1][x+1] = Yball_eat;
4418 Next[y+1][x+1] = lev.ball_array[lev.ball_pos][7];
4422 lev.ball_pos = (lev.ball_pos + 1) & 7;
4425 /* --------------------------------------------------------------------- */
4428 if (tab_blank[Cave[y-1][x]])
4430 Cave[y-1][x] = Ygrow_ns_eat;
4431 Next[y-1][x] = Xgrow_ns;
4432 play_sound(x, y, SAMPLE_grow);
4435 if (tab_blank[Cave[y+1][x]])
4437 Cave[y+1][x] = Ygrow_ns_eat;
4438 Next[y+1][x] = Xgrow_ns;
4439 play_sound(x, y, SAMPLE_grow);
4445 if (tab_blank[Cave[y][x+1]])
4447 Cave[y][x+1] = Ygrow_ew_eat;
4448 Next[y][x+1] = Xgrow_ew;
4449 play_sound(x, y, SAMPLE_grow);
4452 if (tab_blank[Cave[y][x-1]])
4454 Cave[y][x-1] = Ygrow_ew_eat;
4455 Next[y][x-1] = Xgrow_ew;
4456 play_sound(x, y, SAMPLE_grow);
4461 /* --------------------------------------------------------------------- */
4464 if (lev.wonderwall_time && lev.wonderwall_state)
4466 Cave[y][x] = XwonderwallB;
4467 play_sound(x, y, SAMPLE_wonder);
4472 /* --------------------------------------------------------------------- */
4475 if (lev.required > 0)
4481 Cave[y][x] = Xexit_1;
4482 Next[y][x] = Xexit_2;
4486 Cave[y][x] = Xexit_2;
4487 Next[y][x] = Xexit_3;
4491 Cave[y][x] = Xexit_3;
4492 Next[y][x] = Xexit_1;
4498 Next[y][x] = Xexit_2;
4502 Next[y][x] = Xexit_3;
4506 Next[y][x] = Xexit_1;
4509 /* --------------------------------------------------------------------- */
4512 play_sound(x, y, SAMPLE_tick);
4513 Next[y][x] = Xdynamite_2;
4517 play_sound(x, y, SAMPLE_tick);
4518 Next[y][x] = Xdynamite_3;
4522 play_sound(x, y, SAMPLE_tick);
4523 Next[y][x] = Xdynamite_4;
4527 play_sound(x, y, SAMPLE_tick);
4528 Next[y][x] = Zdynamite;
4529 Boom[y-1][x-1] = Xblank;
4530 Boom[y-1][x] = Xblank;
4531 Boom[y-1][x+1] = Xblank;
4532 Boom[y][x-1] = Xblank;
4533 Boom[y][x] = Xblank;
4534 Boom[y][x+1] = Xblank;
4535 Boom[y+1][x-1] = Xblank;
4536 Boom[y+1][x] = Xblank;
4537 Boom[y+1][x+1] = Xblank;
4540 /* --------------------------------------------------------------------- */
4543 if (lev.wheel_cnt && x == lev.wheel_x && y == lev.wheel_y)
4544 Cave[y][x] = XwheelB;
4547 /* --------------------------------------------------------------------- */
4551 Cave[y][x] = XswitchB;
4554 /* --------------------------------------------------------------------- */
4557 switch (Cave[y+1][x])
4567 Cave[y][x] = Xsand_stonesand_3;
4568 if (Cave[y][x+1] == Xblank)
4569 Cave[y][x+1] = Yacid_splash_eB;
4570 if (Cave[y][x-1] == Xblank)
4571 Cave[y][x-1] = Yacid_splash_wB;
4572 Next[y][x] = Xsand_stonesand_4;
4573 play_sound(x, y, SAMPLE_acid);
4577 case Yacid_splash_eB:
4578 case Yacid_splash_wB:
4579 Cave[y][x] = Xsand_stonesand_3;
4580 Cave[y+1][x] = Xsand_stoneout_1;
4581 Next[y][x] = Xsand_stonesand_4;
4582 Next[y+1][x] = Xsand_stoneout_2;
4586 Cave[y][x] = Xsand_stonesand_1;
4587 Cave[y+1][x] = Xsand_sandstone_1;
4588 Next[y][x] = Xsand_stonesand_2;
4589 Next[y+1][x] = Xsand_sandstone_2;
4596 case Xsand_stonein_1:
4597 Next[y][x] = Xsand_stonein_2;
4600 case Xsand_stonein_2:
4601 Next[y][x] = Xsand_stonein_3;
4604 case Xsand_stonein_3:
4605 Next[y][x] = Xsand_stonein_4;
4608 case Xsand_stonein_4:
4609 Next[y][x] = Xblank;
4612 case Xsand_stonesand_1:
4613 Next[y][x] = Xsand_stonesand_2;
4616 case Xsand_stonesand_2:
4617 Next[y][x] = Xsand_stonesand_3;
4620 case Xsand_stonesand_3:
4621 Next[y][x] = Xsand_stonesand_4;
4624 case Xsand_stonesand_4:
4628 case Xsand_stoneout_1:
4629 Next[y][x] = Xsand_stoneout_2;
4632 case Xsand_stoneout_2:
4633 Next[y][x] = Xstone_fall;
4636 case Xsand_sandstone_1:
4637 Next[y][x] = Xsand_sandstone_2;
4640 case Xsand_sandstone_2:
4641 Next[y][x] = Xsand_sandstone_3;
4644 case Xsand_sandstone_3:
4645 Next[y][x] = Xsand_sandstone_4;
4648 case Xsand_sandstone_4:
4649 Next[y][x] = Xsand_stone;
4652 /* --------------------------------------------------------------------- */
4656 Cave[y][x] = XdripperB;
4659 /* --------------------------------------------------------------------- */
4663 Cave[y][x] = Xfake_blankB;
4666 /* --------------------------------------------------------------------- */
4669 if (lev.magnify_cnt)
4670 Cave[y][x] = Xfake_grassB;
4673 /* --------------------------------------------------------------------- */
4676 if (lev.magnify_cnt)
4677 Cave[y][x] = Xdoor_1;
4681 if (lev.magnify_cnt)
4682 Cave[y][x] = Xdoor_2;
4686 if (lev.magnify_cnt)
4687 Cave[y][x] = Xdoor_3;
4691 if (lev.magnify_cnt)
4692 Cave[y][x] = Xdoor_4;
4696 if (lev.magnify_cnt)
4697 Cave[y][x] = Xdoor_5;
4701 if (lev.magnify_cnt)
4702 Cave[y][x] = Xdoor_6;
4706 if (lev.magnify_cnt)
4707 Cave[y][x] = Xdoor_7;
4711 if (lev.magnify_cnt)
4712 Cave[y][x] = Xdoor_8;
4715 /* --------------------------------------------------------------------- */
4719 Next[y][x] = Znormal;
4720 Boom[y-1][x-1] = Xemerald;
4721 Boom[y-1][x] = Xemerald;
4722 Boom[y-1][x+1] = Xemerald;
4723 Boom[y][x-1] = Xemerald;
4724 Boom[y][x] = Xdiamond;
4725 Boom[y][x+1] = Xemerald;
4726 Boom[y+1][x-1] = Xemerald;
4727 Boom[y+1][x] = Xemerald;
4728 Boom[y+1][x+1] = Xemerald;
4735 Next[y][x] = Znormal;
4736 Boom[y-1][x-1] = Xblank;
4737 Boom[y-1][x] = Xblank;
4738 Boom[y-1][x+1] = Xblank;
4739 Boom[y][x-1] = Xblank;
4740 Boom[y][x] = Xblank;
4741 Boom[y][x+1] = Xblank;
4742 Boom[y+1][x-1] = Xblank;
4743 Boom[y+1][x] = Xblank;
4744 Boom[y+1][x+1] = Xblank;
4749 Next[y][x] = Xboom_2;
4750 play_sound(x, y, SAMPLE_boom);
4754 Next[y][x] = Boom[y][x];
4757 /* --------------------------------------------------------------------- */
4760 if (++y < HEIGHT - 1)
4763 cave_cache = Cave[y];
4776 if (ply1.alive || ply2.alive)
4777 lev.score += score; /* only get a score if someone is alive */
4784 /* triple buffering */