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)
37 /* (not sure why this was removed -- this broke several level solutions) */
38 if (LowByte(PlayField16[si]) != fiSnikSnak)
42 // If LowByte(PlayField16(si)) <> fiSnikSnak Then Exit Function
43 // Debug.Assert (LowByte(PlayField16[si]) == fiSnikSnak);
45 bx = HighByte(PlayField16[si]);
50 subSnikSnakTurnLeft(si, bx); // turning, bx=0 -> point N, bx = 1 -> point NW etc.
54 subSnikSnakTurnRight(si, bx); // turn right
58 subSnikSnakFromBelow(si, bx); // access si from below
62 subSnikSnakFromRight(si, bx); // access si from right
66 subSnikSnakFromAbove(si, bx); // access si from above
70 subSnikSnakFromLeft(si, bx); // access si from left
74 // Debug.Assert(False);
79 void subDrawAnimatedSnikSnaks(int si)
83 // If SnikSnaksElectronsFrozen = 1 Then Exit Function
85 if (LowByte(PlayField16[si]) != fiSnikSnak)
88 bx = HighByte(PlayField16[si]);
93 subDrawSnikSnakTurnLeft(si, bx); // turning, bx=0 -> point N, bx = 1 -> point NW etc.
97 subDrawSnikSnakTurnRight(si, bx); // turn right
101 subDrawSnikSnakFromBelow(si, bx); // access si from below
105 subDrawSnikSnakFromRight(si, bx); // access si from right
109 subDrawSnikSnakFromAbove(si, bx); // access si from above
113 subDrawSnikSnakFromLeft(si, bx); // access si from left
118 static void subSnikSnakTurnLeft(int si, int bx)
131 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
132 subDrawSnikSnakTurnLeft(si, bx);
133 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
136 MovHighByte(&PlayField16[si], bx);
154 ExplodeFieldSP(si); // Explode
159 bl = HighByte(PlayField16[si]);
174 loc_g_763B: // pointing up
175 ax = PlayField16[si - FieldWidth];
176 if (ax == 0) // above is empty -> go up
179 if (LowByte(ax) == fiMurphy) // above is murphy -> explode
180 goto locMayExplode760A;
184 loc_g_764E: // above is empty -> go up
185 PlayField16[si] = 0x1BB;
186 si = si - FieldWidth;
187 PlayField16[si] = 0x1011;
191 loc_g_765E: // pointing left
192 ax = PlayField16[si - 1];
193 if (ax == 0) // left is empty -> go there
196 if (LowByte(ax) == fiMurphy) // left is murphy -> explode
197 goto locMayExplode760A;
201 loc_g_7671: // left is empty -> go there
202 PlayField16[si] = 0x2BB;
204 PlayField16[si] = 0x1811;
208 loc_g_7681: // pointing down
209 ax = PlayField16[si + FieldWidth];
210 if (ax == 0) // below is empty -> go down
213 if (LowByte(ax) == fiMurphy) // below is murphy -> explode
214 goto locMayExplode760A;
218 loc_g_7697: // below is empty -> go down
219 PlayField16[si] = 0x3BB;
220 si = si + FieldWidth;
221 PlayField16[si] = 0x2011;
225 loc_g_76A7: // pointing Right
226 ax = PlayField16[si + 1];
227 if (ax == 0) // right is empty -> go there
230 if (LowByte(ax) == fiMurphy) // right is murphy -> explode
231 goto locMayExplode760A;
235 loc_g_76BD: // right is empty -> go there
236 PlayField16[si] = 0x4BB;
238 PlayField16[si] = 0x2811;
241 static void subSnikSnakTurnRight(int si, int bx)
254 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
255 subDrawSnikSnakTurnRight(si, bx);
256 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
258 bx = ((bx + 1) & 0x7) | 8;
259 MovHighByte(&PlayField16[si], bx);
277 ExplodeFieldSP(si); // Explode
282 bl = HighByte(PlayField16[si]);
297 loc_g_7738: // pointing up
298 ax = PlayField16[si - FieldWidth];
299 if (ax == 0) // above is empty -> go up
302 if (LowByte(ax) == fiMurphy) // above is murphy -> explode
303 goto locMayExplode7707;
307 loc_g_774B: // above is empty -> go up
308 PlayField16[si] = 0x1BB;
309 si = si - FieldWidth;
310 PlayField16[si] = 0x1011;
314 loc_g_775B: // pointing left
315 ax = PlayField16[si - 1];
316 if (ax == 0) // left is empty -> go there
319 if (LowByte(ax) == fiMurphy) // left is murphy -> explode
320 goto locMayExplode7707;
324 loc_g_776E: // left is empty -> go there
325 PlayField16[si] = 0x2BB;
327 PlayField16[si] = 0x1811;
331 loc_g_777E: // pointing down
332 ax = PlayField16[si + FieldWidth];
333 if (ax == 0) // below is empty -> go down
336 if (LowByte(ax) == fiMurphy) // below is murphy -> explode
337 goto locMayExplode7707;
341 loc_g_7794: // below is empty -> go down
342 PlayField16[si] = 0x3BB;
343 si = si + FieldWidth;
344 PlayField16[si] = 0x2011;
348 loc_g_77A4: // pointing Right
349 ax = PlayField16[si + 1];
350 if (ax == 0) // right is empty -> go there
353 if (LowByte(ax) == fiMurphy) // right is murphy -> explode
354 goto locMayExplode7707;
358 loc_g_77BA: // right is empty -> go there
359 PlayField16[si] = 0x4BB;
361 PlayField16[si] = 0x2811;
364 static void subSnikSnakFromBelow(int si, int bx)
368 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
369 subDrawSnikSnakFromBelow(si, bx);
370 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
371 bx = bx - 0xF; // get and increment sequence#
374 if (bl == 7 && LowByte(PlayField16[si + FieldWidth]) != fiExplosion)
376 PlayField16[si + FieldWidth] = 0; // sniknak left that field
379 if (bl < 8) // sniksnak still goes up
382 MovHighByte(&PlayField16[si], bl);
387 PlayField16[si] = 0x11; // sequence#=8 -> arrived at the new field
388 ax = PlayField16[si - 1]; // check left field
389 if (ax == 0 || LowByte(ax) == fiMurphy) // check for empty or murphy
391 MovHighByte(&PlayField16[si], 1); // start to turn left
394 } // loc_g_7826: and 'loc_g_7833:
396 ax = PlayField16[si - FieldWidth]; // cannot turn left -> check above
397 if (ax == 0) // check if empty
399 PlayField16[si] = 0x1BB; // mark as "sniksnak leaving"
400 si = si - FieldWidth; // go up!
401 PlayField16[si] = 0x1011;
406 if (LowByte(ax) == fiMurphy) // check for murphy above
408 ExplodeFieldSP(si); // Explode
413 ax = PlayField16[si + 1]; // check right field
414 if (ax == 0 || LowByte(ax) == fiMurphy) // check for empty or murphy
416 MovHighByte(&PlayField16[si], 9); // start to turn right
419 } // loc_g_7862: and 'loc_g_786F:
421 // else: no way to go, start turning around
422 MovHighByte(&PlayField16[si], 1);
425 static void subSnikSnakFromRight(int si, int bx)
429 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
430 subDrawSnikSnakFromRight(si, bx);
431 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
432 bx = bx - 0x17; // get and increment sequence#
435 if (bl == 7 && LowByte(PlayField16[si + 1]) != fiExplosion)
437 PlayField16[si + 1] = 0; // sniknak left that field
440 if (bl < 8) // sniksnak still goes left
443 MovHighByte(&PlayField16[si], bl);
448 PlayField16[si] = 0x11; // sequence#=8 -> arrived at the new field
449 ax = PlayField16[si + FieldWidth]; // check below
450 if (ax == 0 || LowByte(ax) == fiMurphy) // empty or murphy?
452 MovHighByte(&PlayField16[si], 3); // yes -> turn left down
455 } // loc_g_78CC: and 'loc_g_78D9:
457 ax = PlayField16[si - 1]; // check left, etc ... see the comments on subSnikSnakFromBelow()
460 PlayField16[si] = 0x2BB;
461 si = si - 1; // 1 field left
462 PlayField16[si] = 0x1811;
467 if (LowByte(ax) == fiMurphy)
469 ExplodeFieldSP(si); // Explode
474 ax = PlayField16[si - FieldWidth]; // check above
475 if (ax == 0 || LowByte(ax) == fiMurphy)
477 MovHighByte(&PlayField16[si], 0xF);
480 } // loc_g_7908:loc_g_7915:
482 MovHighByte(&PlayField16[si], 3);
485 static void subSnikSnakFromAbove(int si, int bx)
489 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
490 subDrawSnikSnakFromAbove(si, bx);
491 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
492 bx = bx - 0x1F; // get and increment sequence#
495 if (bl == 7 && LowByte(PlayField16[si - FieldWidth]) != fiExplosion)
497 PlayField16[si - FieldWidth] = 0; // sniknak left that field
500 if (bl < 8) // sniksnak still goes down
503 MovHighByte(&PlayField16[si], bl);
508 PlayField16[si] = 0x11; // sequence#=8 -> arrived at the new field
509 ax = PlayField16[si + 1]; // check right
510 if (ax == 0 || LowByte(ax) == fiMurphy)
512 MovHighByte(&PlayField16[si], 5);
517 ax = PlayField16[si + FieldWidth]; // check below
520 PlayField16[si] = 0x3BB;
521 si = si + FieldWidth; // 1 field down
522 PlayField16[si] = 0x2011;
527 if (LowByte(ax) == fiMurphy)
529 ExplodeFieldSP(si); // Explode
534 ax = PlayField16[si - 1]; // check left
535 if (ax == 0 || LowByte(ax) == fiMurphy)
537 MovHighByte(&PlayField16[si], 0xD);
542 MovHighByte(&PlayField16[si], 5);
545 static void subSnikSnakFromLeft(int si, int bx)
549 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
550 subDrawSnikSnakFromLeft(si, bx);
551 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
552 bx = bx - 0x27; // get and increment sequence#
555 if (bl == 7 && LowByte(PlayField16[si - 1]) != fiExplosion)
557 PlayField16[si - 1] = 0; // sniknak left that field
560 if (bl < 8) // sniksnak still goes right
563 MovHighByte(&PlayField16[si], bl);
568 PlayField16[si] = 0x11; // sequence#=8 -> arrived at the new field
569 ax = PlayField16[si - FieldWidth]; // check above
570 if (ax == 0 || LowByte(ax) == fiMurphy)
572 MovHighByte(&PlayField16[si], 7);
577 ax = PlayField16[si + 1]; // check right(straight on)
580 PlayField16[si] = 0x4BB;
581 si = si + 1; // 1 field right
582 PlayField16[si] = 0x2811;
587 if (LowByte(ax) == fiMurphy)
589 ExplodeFieldSP(si); // Explode
594 ax = PlayField16[si + FieldWidth]; // check below
595 if (ax == 0 || LowByte(ax) == fiMurphy)
597 MovHighByte(&PlayField16[si], 0xB);
602 MovHighByte(&PlayField16[si], 7);
605 static void subDrawSnikSnakTurnLeft(int si, int bx)
607 int pos = ((bx + 7) % 8) / 2;
609 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
610 GfxGraphic[GetX(si)][GetY(si)] = aniSnikSnakTurningLeft[pos];
611 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
614 static void subDrawSnikSnakTurnRight(int si, int bx)
616 int pos = ((bx - 1) % 8) / 2;
618 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
619 GfxGraphic[GetX(si)][GetY(si)] = aniSnikSnakTurningRight[pos];
620 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
623 static void subDrawSnikSnakFromBelow(int si, int bx)
627 bx = bx - 0xF; // get and anti-increment sequence#
629 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
631 Y = GetStretchY(si + FieldWidth);
632 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
633 DDSpriteBuffer_BltImg(X, Y - bx * TwoPixels, aniSnikSnakUp, bx);
634 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
637 static void subDrawSnikSnakFromRight(int si, int bx)
641 bx = bx - 0x17; // get and increment sequence#
643 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
644 X = GetStretchX(si + 1);
646 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
647 DDSpriteBuffer_BltImg(X - bx * TwoPixels, Y, aniSnikSnakLeft, bx);
648 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
651 static void subDrawSnikSnakFromAbove(int si, int bx)
655 bx = bx - 0x1F; // get and increment sequence#
657 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
659 Y = GetStretchY(si - FieldWidth);
660 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
661 DDSpriteBuffer_BltImg(X, Y + bx * TwoPixels, aniSnikSnakDown, bx);
662 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
665 static void subDrawSnikSnakFromLeft(int si, int bx)
669 bx = bx - 0x27; // get and increment sequence#
671 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
672 X = GetStretchX(si - 1);
674 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
675 DDSpriteBuffer_BltImg(X + bx * TwoPixels, Y, aniSnikSnakRight, bx);
676 // +++++++++++++++++++++++++++++++++++++++++++++++++++++