1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
8 static void subDrawSnikSnakFromAbove(int, int);
9 static void subDrawSnikSnakFromBelow(int, int);
10 static void subDrawSnikSnakFromLeft(int, int);
11 static void subDrawSnikSnakFromRight(int, int);
12 static void subDrawSnikSnakTurnLeft(int, int);
13 static void subDrawSnikSnakTurnRight(int, int);
14 static void subSnikSnakFromAbove(int, int);
15 static void subSnikSnakFromBelow(int, int);
16 static void subSnikSnakFromLeft(int, int);
17 static void subSnikSnakFromRight(int, int);
18 static void subSnikSnakTurnLeft(int, int);
19 static void subSnikSnakTurnRight(int, int);
21 // static char *VB_Name = "modSnikSnak";
23 // --- Option Explicit
24 // ==========================================================================
26 // Animate/move Snik-Snaks
27 // ==========================================================================
29 void subAnimateSnikSnaks(int si)
33 if (SnikSnaksElectronsFrozen == 1)
36 /* (not sure why this was removed -- this broke several level solutions) */
37 if (LowByte(PlayField16[si]) != fiSnikSnak)
40 // If LowByte(PlayField16(si)) <> fiSnikSnak Then Exit Function
41 // Debug.Assert (LowByte(PlayField16[si]) == fiSnikSnak);
43 bx = HighByte(PlayField16[si]);
48 subSnikSnakTurnLeft(si, bx); // turning, bx=0 -> point N, bx = 1 -> point NW etc.
52 subSnikSnakTurnRight(si, bx); // turn right
56 subSnikSnakFromBelow(si, bx); // access si from below
60 subSnikSnakFromRight(si, bx); // access si from right
64 subSnikSnakFromAbove(si, bx); // access si from above
68 subSnikSnakFromLeft(si, bx); // access si from left
72 // Debug.Assert(False);
77 void subDrawAnimatedSnikSnaks(int si)
81 // If SnikSnaksElectronsFrozen = 1 Then Exit Function
83 if (LowByte(PlayField16[si]) != fiSnikSnak)
86 bx = HighByte(PlayField16[si]);
91 subDrawSnikSnakTurnLeft(si, bx); // turning, bx=0 -> point N, bx = 1 -> point NW etc.
95 subDrawSnikSnakTurnRight(si, bx); // turn right
99 subDrawSnikSnakFromBelow(si, bx); // access si from below
103 subDrawSnikSnakFromRight(si, bx); // access si from right
107 subDrawSnikSnakFromAbove(si, bx); // access si from above
111 subDrawSnikSnakFromLeft(si, bx); // access si from left
116 static void subSnikSnakTurnLeft(int si, int bx)
129 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
130 subDrawSnikSnakTurnLeft(si, bx);
131 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
134 MovHighByte(&PlayField16[si], bx);
152 ExplodeFieldSP(si); // Explode
157 bl = HighByte(PlayField16[si]);
172 loc_g_763B: // pointing up
173 ax = PlayField16[si - FieldWidth];
174 if (ax == 0) // above is empty -> go up
177 if (LowByte(ax) == fiMurphy) // above is murphy -> explode
178 goto locMayExplode760A;
182 loc_g_764E: // above is empty -> go up
183 PlayField16[si] = 0x1BB;
184 si = si - FieldWidth;
185 PlayField16[si] = 0x1011;
189 loc_g_765E: // pointing left
190 ax = PlayField16[si - 1];
191 if (ax == 0) // left is empty -> go there
194 if (LowByte(ax) == fiMurphy) // left is murphy -> explode
195 goto locMayExplode760A;
199 loc_g_7671: // left is empty -> go there
200 PlayField16[si] = 0x2BB;
202 PlayField16[si] = 0x1811;
206 loc_g_7681: // pointing down
207 ax = PlayField16[si + FieldWidth];
208 if (ax == 0) // below is empty -> go down
211 if (LowByte(ax) == fiMurphy) // below is murphy -> explode
212 goto locMayExplode760A;
216 loc_g_7697: // below is empty -> go down
217 PlayField16[si] = 0x3BB;
218 si = si + FieldWidth;
219 PlayField16[si] = 0x2011;
223 loc_g_76A7: // pointing Right
224 ax = PlayField16[si + 1];
225 if (ax == 0) // right is empty -> go there
228 if (LowByte(ax) == fiMurphy) // right is murphy -> explode
229 goto locMayExplode760A;
233 loc_g_76BD: // right is empty -> go there
234 PlayField16[si] = 0x4BB;
236 PlayField16[si] = 0x2811;
239 static void subSnikSnakTurnRight(int si, int bx)
252 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
253 subDrawSnikSnakTurnRight(si, bx);
254 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
256 bx = ((bx + 1) & 0x7) | 8;
257 MovHighByte(&PlayField16[si], bx);
275 ExplodeFieldSP(si); // Explode
280 bl = HighByte(PlayField16[si]);
295 loc_g_7738: // pointing up
296 ax = PlayField16[si - FieldWidth];
297 if (ax == 0) // above is empty -> go up
300 if (LowByte(ax) == fiMurphy) // above is murphy -> explode
301 goto locMayExplode7707;
305 loc_g_774B: // above is empty -> go up
306 PlayField16[si] = 0x1BB;
307 si = si - FieldWidth;
308 PlayField16[si] = 0x1011;
312 loc_g_775B: // pointing left
313 ax = PlayField16[si - 1];
314 if (ax == 0) // left is empty -> go there
317 if (LowByte(ax) == fiMurphy) // left is murphy -> explode
318 goto locMayExplode7707;
322 loc_g_776E: // left is empty -> go there
323 PlayField16[si] = 0x2BB;
325 PlayField16[si] = 0x1811;
329 loc_g_777E: // pointing down
330 ax = PlayField16[si + FieldWidth];
331 if (ax == 0) // below is empty -> go down
334 if (LowByte(ax) == fiMurphy) // below is murphy -> explode
335 goto locMayExplode7707;
339 loc_g_7794: // below is empty -> go down
340 PlayField16[si] = 0x3BB;
341 si = si + FieldWidth;
342 PlayField16[si] = 0x2011;
346 loc_g_77A4: // pointing Right
347 ax = PlayField16[si + 1];
348 if (ax == 0) // right is empty -> go there
351 if (LowByte(ax) == fiMurphy) // right is murphy -> explode
352 goto locMayExplode7707;
356 loc_g_77BA: // right is empty -> go there
357 PlayField16[si] = 0x4BB;
359 PlayField16[si] = 0x2811;
362 static void subSnikSnakFromBelow(int si, int bx)
366 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
367 subDrawSnikSnakFromBelow(si, bx);
368 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
369 bx = bx - 0xF; // get and increment sequence#
372 if (bl == 7 && LowByte(PlayField16[si + FieldWidth]) != fiExplosion)
374 PlayField16[si + FieldWidth] = 0; // sniknak left that field
377 if (bl < 8) // sniksnak still goes up
380 MovHighByte(&PlayField16[si], bl);
385 PlayField16[si] = 0x11; // sequence#=8 -> arrived at the new field
386 ax = PlayField16[si - 1]; // check left field
387 if (ax == 0 || LowByte(ax) == fiMurphy) // check for empty or murphy
389 MovHighByte(&PlayField16[si], 1); // start to turn left
392 } // loc_g_7826: and 'loc_g_7833:
394 ax = PlayField16[si - FieldWidth]; // cannot turn left -> check above
395 if (ax == 0) // check if empty
397 PlayField16[si] = 0x1BB; // mark as "sniksnak leaving"
398 si = si - FieldWidth; // go up!
399 PlayField16[si] = 0x1011;
404 if (LowByte(ax) == fiMurphy) // check for murphy above
406 ExplodeFieldSP(si); // Explode
411 ax = PlayField16[si + 1]; // check right field
412 if (ax == 0 || LowByte(ax) == fiMurphy) // check for empty or murphy
414 MovHighByte(&PlayField16[si], 9); // start to turn right
417 } // loc_g_7862: and 'loc_g_786F:
419 // else: no way to go, start turning around
420 MovHighByte(&PlayField16[si], 1);
423 static void subSnikSnakFromRight(int si, int bx)
427 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
428 subDrawSnikSnakFromRight(si, bx);
429 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
430 bx = bx - 0x17; // get and increment sequence#
433 if (bl == 7 && LowByte(PlayField16[si + 1]) != fiExplosion)
435 PlayField16[si + 1] = 0; // sniknak left that field
438 if (bl < 8) // sniksnak still goes left
441 MovHighByte(&PlayField16[si], bl);
446 PlayField16[si] = 0x11; // sequence#=8 -> arrived at the new field
447 ax = PlayField16[si + FieldWidth]; // check below
448 if (ax == 0 || LowByte(ax) == fiMurphy) // empty or murphy?
450 MovHighByte(&PlayField16[si], 3); // yes -> turn left down
453 } // loc_g_78CC: and 'loc_g_78D9:
455 ax = PlayField16[si - 1]; // check left, etc ... see the comments on subSnikSnakFromBelow()
458 PlayField16[si] = 0x2BB;
459 si = si - 1; // 1 field left
460 PlayField16[si] = 0x1811;
465 if (LowByte(ax) == fiMurphy)
467 ExplodeFieldSP(si); // Explode
472 ax = PlayField16[si - FieldWidth]; // check above
473 if (ax == 0 || LowByte(ax) == fiMurphy)
475 MovHighByte(&PlayField16[si], 0xF);
478 } // loc_g_7908:loc_g_7915:
480 MovHighByte(&PlayField16[si], 3);
483 static void subSnikSnakFromAbove(int si, int bx)
487 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
488 subDrawSnikSnakFromAbove(si, bx);
489 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
490 bx = bx - 0x1F; // get and increment sequence#
493 if (bl == 7 && LowByte(PlayField16[si - FieldWidth]) != fiExplosion)
495 PlayField16[si - FieldWidth] = 0; // sniknak left that field
498 if (bl < 8) // sniksnak still goes down
501 MovHighByte(&PlayField16[si], bl);
506 PlayField16[si] = 0x11; // sequence#=8 -> arrived at the new field
507 ax = PlayField16[si + 1]; // check right
508 if (ax == 0 || LowByte(ax) == fiMurphy)
510 MovHighByte(&PlayField16[si], 5);
515 ax = PlayField16[si + FieldWidth]; // check below
518 PlayField16[si] = 0x3BB;
519 si = si + FieldWidth; // 1 field down
520 PlayField16[si] = 0x2011;
525 if (LowByte(ax) == fiMurphy)
527 ExplodeFieldSP(si); // Explode
532 ax = PlayField16[si - 1]; // check left
533 if (ax == 0 || LowByte(ax) == fiMurphy)
535 MovHighByte(&PlayField16[si], 0xD);
540 MovHighByte(&PlayField16[si], 5);
543 static void subSnikSnakFromLeft(int si, int bx)
547 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
548 subDrawSnikSnakFromLeft(si, bx);
549 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
550 bx = bx - 0x27; // get and increment sequence#
553 if (bl == 7 && LowByte(PlayField16[si - 1]) != fiExplosion)
555 PlayField16[si - 1] = 0; // sniknak left that field
558 if (bl < 8) // sniksnak still goes right
561 MovHighByte(&PlayField16[si], bl);
566 PlayField16[si] = 0x11; // sequence#=8 -> arrived at the new field
567 ax = PlayField16[si - FieldWidth]; // check above
568 if (ax == 0 || LowByte(ax) == fiMurphy)
570 MovHighByte(&PlayField16[si], 7);
575 ax = PlayField16[si + 1]; // check right(straight on)
578 PlayField16[si] = 0x4BB;
579 si = si + 1; // 1 field right
580 PlayField16[si] = 0x2811;
585 if (LowByte(ax) == fiMurphy)
587 ExplodeFieldSP(si); // Explode
592 ax = PlayField16[si + FieldWidth]; // check below
593 if (ax == 0 || LowByte(ax) == fiMurphy)
595 MovHighByte(&PlayField16[si], 0xB);
600 MovHighByte(&PlayField16[si], 7);
603 static void subDrawSnikSnakTurnLeft(int si, int bx)
605 int pos = ((bx + 7) % 8) / 2;
607 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
608 GfxGraphic[GetX(si)][GetY(si)] = aniSnikSnakTurningLeft[pos];
609 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
612 static void subDrawSnikSnakTurnRight(int si, int bx)
614 int pos = ((bx - 1) % 8) / 2;
616 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
617 GfxGraphic[GetX(si)][GetY(si)] = aniSnikSnakTurningRight[pos];
618 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
621 static void subDrawSnikSnakFromBelow(int si, int bx)
625 bx = bx - 0xF; // get and anti-increment sequence#
627 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
629 Y = GetStretchY(si + FieldWidth);
630 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
631 DDSpriteBuffer_BltImg(X, Y - bx * TwoPixels, aniSnikSnakUp, bx);
632 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
635 static void subDrawSnikSnakFromRight(int si, int bx)
639 bx = bx - 0x17; // get and increment sequence#
641 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
642 X = GetStretchX(si + 1);
644 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
645 DDSpriteBuffer_BltImg(X - bx * TwoPixels, Y, aniSnikSnakLeft, bx);
646 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
649 static void subDrawSnikSnakFromAbove(int si, int bx)
653 bx = bx - 0x1F; // get and increment sequence#
655 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
657 Y = GetStretchY(si - FieldWidth);
658 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
659 DDSpriteBuffer_BltImg(X, Y + bx * TwoPixels, aniSnikSnakDown, bx);
660 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
663 static void subDrawSnikSnakFromLeft(int si, int bx)
667 bx = bx - 0x27; // get and increment sequence#
669 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
670 X = GetStretchX(si - 1);
672 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
673 DDSpriteBuffer_BltImg(X + bx * TwoPixels, Y, aniSnikSnakRight, bx);
674 // +++++++++++++++++++++++++++++++++++++++++++++++++++++