85e6e1121425779bc4025d534384e79ff6d80215
[rocksndiamonds.git] / src / game_sp / Murphy.c
1 // ----------------------------------------------------------------------------
2 // Murphy.c
3 // ----------------------------------------------------------------------------
4
5 #include "Murphy.h"
6
7
8 static void subEatRedDisk(int si);
9 static boolean subMoveKillsMurphy(int si, int ax, int bl);
10
11 #if 1
12
13 #define LocalStretch                    (2)
14 #define MurphyZoomFactor                (ZoomFactor)
15
16 #else
17
18 #define LocalStretch                    (1)
19 #define MurphyZoomFactor                (1)
20
21 #endif
22
23 // ==========================================================================
24 //                              SUBROUTINE
25 // Move Murphy in any direction
26 // ==========================================================================
27
28 void subAnimateMurphy(int *si)
29 {
30   int ax, al, bl, i, X, Y;
31   int time1, time2;
32   int tDeltaX, tDeltaY, tPos, Tmp;
33
34   // Variables that hold information about the animation sequence
35   static int dx1 = 0; // image/animation token
36   static int dx2 = 0; // an additional image position of a second sprite, for instance: yellow disk if pushed
37   static int MurphyDX = 0, MurphyDY = 0; // murphys move steps
38   static int SeqPos = 0; // index into dx()
39   static int ClearPos = 0; // Position to clear before blitting sprites, none=-1
40   static int dxPos = 0; // field-position  to draw dx(SeqPos)
41   static int dx2Step = 0; // position of dx2 relative to dx-position
42   static int dx1SequenceLength = 0;
43
44   ax = PlayField16[*si];
45   al = LowByte(ax);
46
47   if (al != fiMurphy)
48   {
49     MurphyMoveCounter = 0;             // We have no Murphy! Exit!
50
51     return;
52   }
53
54   MurphyMoveCounter = 1;             // We have a Murphy!
55   MurphyExplodePos = *si;
56
57   // (check if high byte of PlayField16 has stored movement information)
58   if (ax != fiMurphy) // yes--go proceed moving murphy?
59     goto locProceedMovingMurphy;
60
61   // FS: reset moving sequence variables
62   MurphyDX = 0;
63   MurphyDY = 0;
64   ClearPos = *si;
65   dxPos = *si;
66   dx1 = -1;
67   dx2 = -1;
68   SeqPos = 0;
69   // end of FS
70
71   ScratchGravity = 0; // scratch gravity off
72   if (GravityFlag != 0) // Gravity? (1=gravity on)
73   {
74     bl = LowByte(PlayField16[*si - FieldWidth]); // check above
75     if (! (bl == fiPortUp ||
76            bl == fiPortUpAndDown ||
77            bl == fiPortAllDirections))
78     {
79       if (PlayField16[*si + FieldWidth] == 0) // gravity on and space below!
80         ScratchGravity = 1;
81     }
82   } // loc_g_5E8B:
83
84   bl = DemoKeyCode;
85   if (bl != 0) // a key was pressed!
86     goto locKeyPressed5FCF;
87
88   RedDiskReleaseFlag = 1;
89   if (ScratchGravity != 0) // gravity pulls & space below?'-> force Space up to down
90   {
91     MurphyDY = 2;
92     goto loc_g_6364;
93   }
94
95 #if 1
96
97 #if 0
98   ax = (TimerVar & 3);
99   if (ax != 0)
100     return;
101 #endif
102
103   // ------------------------------------------------------------------
104   // Murphy's YAWN & SLEEP sequence, counted down by YawnSleepCounter:
105
106   YawnSleepCounter = YawnSleepCounter + 1;
107
108   if (YawnSleepCounter < 16)
109     return;
110
111   if (YawnSleepCounter < 2000)
112   {
113     // normal grin
114     // (default: single graphic, no animation)
115     subCopyAnimToScreen(*si, aniMurphy, YawnSleepCounter - 16);
116
117     return;
118   }
119
120   if (YawnSleepCounter < 4000)
121   {
122     // yawn! and look depressed afterwards...
123     // (default: 12 animation frames with delay of 8)
124     subCopyAnimToScreen(*si, aniMurphyYawn, YawnSleepCounter - 2000);
125
126     return;
127   }
128
129   if (YawnSleepCounter < 6400)
130   {
131     // yawn again!
132     // (default: 12 animation frames with delay of 8)
133     subCopyAnimToScreen(*si, aniMurphyYawn, YawnSleepCounter - 4000);
134
135     return;
136   }
137
138   // time1 = 6400 + 12 * 8;     // (default: 6496 == 6400 + 12 * 8)
139   time1 = 6400 + 12 * 10;
140
141   if (YawnSleepCounter < time1)
142   {
143     // yawn again! - third time
144     // (default: 12 animation frames with delay of 8)
145     subCopyAnimToScreen(*si, aniMurphyYawn, YawnSleepCounter - 6400);
146
147     return;
148   }
149
150   // time2 = 6496 + 3 * 64;     // (default: 6688 == 6496 + 3 * 64)
151   time2 = 6496 + 3 * 100;
152
153   if (YawnSleepCounter > time2)         // Murphy already went to sleep
154     return;
155
156   if (PlayField16[*si - 1] == 0)
157   {
158     if (PlayField16[*si + 1] == 0)
159     {
160       // no sleep -- go back to "wait and start yawning" phase
161       YawnSleepCounter = 144;
162
163       return;
164     }
165     else
166     {
167       // go to sleep (right side)
168       // (default: 3 animation frames with delay of 64)
169       subCopyAnimToScreen(*si, aniMurphySleepRight, YawnSleepCounter - time1);
170
171       return;
172     }
173   }
174
175   // go to sleep (left side)
176   // (default: 3 animation frames with delay of 64)
177   subCopyAnimToScreen(*si, aniMurphySleepLeft, YawnSleepCounter - time1);
178
179   return;
180
181   // end of YAWN-SLEEP-Sequence
182
183 #else
184
185   ax = (TimerVar & 3);
186   if (ax != 0)
187     return;
188
189   // ------------------------------------------------------------------
190   // Murphy's YAWN & SLEEP sequence, counted down by YawnSleepCounter:
191   YawnSleepCounter = YawnSleepCounter + 1;
192   if (YawnSleepCounter == 4)
193   {
194     subCopyFieldToScreen(*si, fiMurphy); // normal grin
195     return;
196   } // loc_g_5ECE:
197
198   if (YawnSleepCounter <= 500) // loc_g_5ED7:
199     return;
200
201   if (YawnSleepCounter <= 522)
202   {
203     bx = (YawnSleepCounter - 500) / 2;
204     subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn! and look depressed afterwards...
205     return;
206   } // loc_g_5F00:
207
208   if (YawnSleepCounter <= 1000)
209     return;
210
211   if (YawnSleepCounter <= 1022)
212   {
213     bx = (YawnSleepCounter - 1000) / 2;
214     subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn again!
215     return;
216   } // loc_g_5F32:
217
218   if (YawnSleepCounter <= 1600) // loc_g_5F3B:
219     return;
220
221   if (YawnSleepCounter <= 1622)
222   {
223     bx = (YawnSleepCounter - 1600) / 2;
224     subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn again! - third time
225     return;
226   } // loc_g_5F64:
227
228   if (YawnSleepCounter > 1654)
229     return;
230
231   if (PlayField16[*si - 1] == 0)
232   {
233     if (PlayField16[*si + 1] == 0)
234     {
235       YawnSleepCounter = 36;
236       return;
237
238     }
239     else
240     {
241       bx = (YawnSleepCounter - 1622) / 16;
242       subCopyFieldToScreen(*si, aniMurphySleepRight + bx); // go to sleep
243       return;
244     }
245   } // loc_g_5F81:
246
247   bx = (YawnSleepCounter - 1622) / 16;
248   subCopyFieldToScreen(*si, aniMurphySleepLeft + bx); // go to sleep
249
250   return;
251
252   // end of YAWN-SLEEP-Sequence
253
254 #endif
255
256   // ------------------------------------------------------------------
257   // ==========================================================================
258   //                       (Direct Jump) a key was pressed
259   // ==========================================================================
260
261 locKeyPressed5FCF:
262   if (ScratchGravity == 0)
263     goto loc_g_6003;
264
265   if (PlayField16[*si + FieldWidth] != 0)
266     goto loc_g_6003;
267
268   if (bl == keyUp)
269   {
270     if (PlayField16[*si - FieldWidth] == fiBase)
271       goto loc_g_6003;
272
273   }
274   else if (bl == keyLeft)
275   {
276     if (PlayField16[*si - 1] == fiBase)
277       goto loc_g_6003;
278
279   }
280   else if (bl == keyRight)
281   {
282     if (PlayField16[*si + 1] == fiBase)
283       goto loc_g_6003;
284   } // loc_g_6001:
285
286   bl = keyDown;                      // force moving down!
287 loc_g_6003:
288   switch (bl)
289   {
290     case keyUp: // 1
291       RedDiskReleaseFlag = 0; // moving down to up ...
292       goto loc_g_6078;
293
294       break;
295
296     case keyLeft: // 2
297       RedDiskReleaseFlag = 0; // moving right to left ...
298       goto loc_g_60DA;
299
300       break;
301
302     case keyDown: // 3
303       RedDiskReleaseFlag = 0; // moving up to down ...
304       goto loc_g_6154;
305
306       break;
307
308     case keyRight: // 4
309       RedDiskReleaseFlag = 0; // moving left to right ...
310       goto loc_g_61B6;
311
312       break;
313
314     case keySpaceUp: // 5
315       RedDiskReleaseFlag = 0; // touching down to up ...
316       goto loc_g_622E;
317
318       break;
319
320     case keySpaceLeft: // 6
321       RedDiskReleaseFlag = 0; // touching right to left ...
322       goto loc_g_6258;
323
324       break;
325
326     case keySpaceDown: // 7
327       RedDiskReleaseFlag = 0; // touching up to down ...
328       goto loc_g_6288;
329
330       break;
331
332     case keySpaceRight: // 8
333       RedDiskReleaseFlag = 0; // touching left to right ...
334       goto loc_g_62B2;
335
336       break;
337
338     case keySpace: // 9
339       goto loc_g_62E2;                         // no move ...
340
341       break;
342
343     default:
344       RedDiskReleaseFlag = 0;
345       return;
346       break;
347   }
348
349   // ==========================================================================
350   // moving down to up ...
351   // ==========================================================================
352
353 loc_g_6078:
354   // FS:
355   MurphyDY = -2;
356   // end of FS
357   ax = PlayField16[*si - FieldWidth];
358   al = LowByte(ax);
359   if (ax == fiSpace)
360     goto loc_g_6312;
361
362   if (ax == fiBase)
363     goto loc_g_63D3;
364
365   if (al == fiBug)
366     goto loc_g_63C2;
367
368   if (ax == fiInfotron)
369     goto loc_g_65C6;
370
371   if (ax == fiExit)
372     goto loc_g_6756;
373
374   if (al == fiTerminal)
375     goto loc_g_6817;
376
377   if (al == fiPortUp || al == fiPortUpAndDown || al == fiPortAllDirections)
378     goto loc_g_6916;
379
380   if (al == fiRedDisk)
381     goto loc_g_69A6;
382
383   if (al == fiYellowDisk)
384     goto loc_g_6AB8;
385
386   if (! subMoveKillsMurphy(*si - FieldWidth, ax, bl))
387     goto loc_g_6078;
388
389   return;
390
391   // ==========================================================================
392   // moving right to left ...
393   // ==========================================================================
394
395 loc_g_60DA:
396   // FS:
397   MurphyDX = -2;
398   // end of FS
399   MurphyVarFaceLeft = 1;
400   ax = PlayField16[*si - 1];
401   al = LowByte(ax);
402   if (ax == fiSpace)
403     goto loc_g_6341;
404
405   if (ax == fiBase)
406     goto loc_g_641C;
407
408   if (al == fiBug)
409     goto loc_g_640B;
410
411   if (ax == fiInfotron)
412     goto loc_g_65FE;
413
414   if (ax == fiExit)
415     goto loc_g_6756;
416
417   if (ax == fiZonk)
418     goto loc_g_679B;
419
420   if (al == fiTerminal)
421     goto loc_g_684E;
422
423   if (al == fiPortLeft || al == fiPortLeftAndRight || al == fiPortAllDirections)
424     goto loc_g_693A;
425
426   if (ax == fiRedDisk)
427     goto loc_g_69CE;
428
429   if (ax == fiYellowDisk)
430     goto loc_g_6AF1;
431
432   if (ax == fiOrangeDisk)
433     goto loc_g_6B9B;
434
435   if (! subMoveKillsMurphy(*si - 1, ax, bl))
436     goto loc_g_60DA;
437
438   return;
439
440   // ==========================================================================
441   // moving up to down ...
442   // ==========================================================================
443
444 loc_g_6154:
445   // FS:
446   MurphyDY = 2;
447   // end of FS
448   ax = PlayField16[*si + FieldWidth];
449   al = LowByte(ax);
450   if (ax == fiSpace)
451     goto loc_g_6364;
452
453   if (ax == fiBase)
454     goto loc_g_6459;
455
456   if (al == fiBug)
457     goto loc_g_6448;
458
459   if (ax == fiInfotron)
460     goto loc_g_662A;
461
462   if (ax == fiExit)
463     goto loc_g_6756;
464
465   if (al == fiTerminal)
466     goto loc_g_6884;
467
468   if (al == fiPortDown || al == fiPortUpAndDown || al == fiPortAllDirections)
469     goto loc_g_695E;
470
471   if (al == fiRedDisk)
472     goto loc_g_69F7;
473
474   if (al == fiYellowDisk)
475     goto loc_g_6B2A;
476
477   if (! subMoveKillsMurphy(*si + FieldWidth, ax, bl))
478     goto loc_g_6154;
479
480   return;
481
482   // ==========================================================================
483   // moving left to right ...
484   // ==========================================================================
485
486 loc_g_61B6:
487   // FS:
488   MurphyDX = 2;
489   // end of FS
490   MurphyVarFaceLeft = 0;
491   ax = PlayField16[*si + 1];
492   al = LowByte(ax);
493   if (ax == fiSpace)
494     goto loc_g_6399;
495
496   if (ax == fiBase)
497     goto loc_g_64A2;
498
499   if (al == fiBug)
500     goto loc_g_6491;
501
502   if (ax == fiInfotron)
503     goto loc_g_6662;
504
505   if (ax == fiExit)
506     goto loc_g_6756;
507
508   if (ax == fiZonk)
509     goto loc_g_67D4;
510
511   if (al == fiTerminal)
512     goto loc_g_68BA;
513
514   if (al == fiPortRight || al == fiPortLeftAndRight || al == fiPortAllDirections)
515     goto loc_g_6982;
516
517   if (al == fiRedDisk)
518     goto loc_g_6A1F;
519
520   if (al == fiYellowDisk)
521     goto loc_g_6B63;
522
523   if (ax == fiOrangeDisk)
524     goto loc_g_6BD3;
525
526   if (! subMoveKillsMurphy(*si + 1, ax, bl))
527     goto loc_g_61B6;
528
529   return;
530
531   // ==========================================================================
532   // touching down to up ...
533   // ==========================================================================
534
535 loc_g_622E:
536   // FS:
537   ClearPos = -1;
538   dxPos = *si - FieldWidth;
539   // end of FS
540   ax = PlayField16[*si - FieldWidth];
541   al = LowByte(ax);
542   al = LowByte(ax);
543   if (ax == fiBase)
544     goto loc_g_64DF;
545
546   if (al == fiBug)
547     goto loc_g_64CE;
548
549   if (ax == fiInfotron)
550     goto loc_g_668E;
551
552   if (al == fiTerminal)
553     goto loc_g_6817;
554
555   if (al == fiRedDisk)
556     goto loc_g_6A48;
557
558   return;
559
560   // ==========================================================================
561   // touching right to left ...
562   // ==========================================================================
563
564 loc_g_6258:
565   // FS:
566   ClearPos = -1;
567   dxPos = *si - 1;
568   // end of FS
569   MurphyVarFaceLeft = 1;
570   ax = PlayField16[*si - 1];
571   al = LowByte(ax);
572   if (ax == fiBase)
573     goto loc_g_651D;
574
575   if (al == fiBug)
576     goto loc_g_650C;
577
578   if (ax == fiInfotron)
579     goto loc_g_66C0;
580
581   if (al == fiTerminal)
582     goto loc_g_684E;
583
584   if (al == fiRedDisk)
585     goto loc_g_6A64;
586
587   return;
588
589   // ==========================================================================
590   // touching up to down ...
591   // ==========================================================================
592
593 loc_g_6288:
594   // FS:
595   ClearPos = -1;
596   dxPos = *si + FieldWidth;
597   // end of FS
598   ax = PlayField16[*si + FieldWidth];
599   al = LowByte(ax);
600   if (ax == fiBase)
601     goto loc_g_655B;
602
603   if (al == fiBug)
604     goto loc_g_654A;
605
606   if (ax == fiInfotron)
607     goto loc_g_66F2;
608
609   if (al == fiTerminal)
610     goto loc_g_6884;
611
612   if (al == fiRedDisk)
613     goto loc_g_6A80;
614
615   return;
616
617   // ==========================================================================
618   // touching left to right ...
619   // ==========================================================================
620
621 loc_g_62B2:
622   // FS:
623   ClearPos = -1;
624   dxPos = *si + 1;
625   // end of FS
626   MurphyVarFaceLeft = 0;
627   ax = PlayField16[*si + 1];
628   al = LowByte(ax);
629   if (ax == fiBase)
630     goto loc_g_6599;
631
632   if (al == fiBug)
633     goto loc_g_6588;
634
635   if (ax == fiInfotron)
636     goto loc_g_6724;
637
638   if (al == fiTerminal)
639     goto loc_g_68BA;
640
641   if (al == fiRedDisk)
642     goto loc_g_6A9C;
643
644   return;
645
646   // ==========================================================================
647   // Release Red disk: no move ...
648   // ==========================================================================
649
650 loc_g_62E2:
651   // FS:
652   ClearPos = -1;
653   // end of FS
654   if (LowByte(RedDiskCount) == 0)
655     return;
656
657   if (LowByte(RedDiskReleasePhase) != 0)
658     return;
659
660   if (LowByte(RedDiskReleaseFlag) != 1)
661     return;
662
663   MovHighByte(&PlayField16[*si], 0x2A);
664   MovingPictureSequencePhase = 0x40; // init picture move sequence
665   dx1 = aniRedDisk;
666   MovLowByte(&RedDiskReleasePhase, 1);
667   RedDiskReleaseMurphyPos = *si;             // remember Murphy's location
668   goto loc_Split;
669
670   // ==========================================================================
671   // SPACE moving down to up
672   // ==========================================================================
673
674 loc_g_6312:
675   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyMoveUpRight : aniMurphyMoveUpLeft);
676   PlayField16[*si - FieldWidth] = 0x103;
677   PlayField16[*si] = 0x300;
678   *si = *si - FieldWidth;
679   goto loc_StopNoSplit;
680
681   // ==========================================================================
682   // SPACE moving right to left
683   // ==========================================================================
684
685 loc_g_6341:
686   dx1 = aniMurphyMoveLeft;
687   PlayField16[*si - 1] = 0x203;
688   PlayField16[*si] = 0x300;
689   *si = *si - 1;
690   goto loc_StopNoSplit;
691
692   // ==========================================================================
693   // SPACE moving up to down, and when gravity is pulling!
694   // ==========================================================================
695
696 loc_g_6364:
697   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyMoveUpRight : aniMurphyMoveUpLeft);
698   PlayField16[*si + FieldWidth] = 0x303;
699   PlayField16[*si] = 0x300;
700   *si = *si + FieldWidth;
701   goto loc_StopNoSplit;
702
703   // ==========================================================================
704   // SPACE moving left to right
705   // ==========================================================================
706
707 loc_g_6399:
708   dx1 = aniMurphyMoveRight;
709   PlayField16[*si + 1] = 0x403;
710   PlayField16[*si] = 0x300;
711   *si = *si + 1;
712   goto loc_StopNoSplit;
713
714   // ==========================================================================
715   // BUG moving down to up
716   // ==========================================================================
717
718 loc_g_63C2:
719   if (SgnHighByte(PlayField16[*si - FieldWidth]) >= 0)
720   {
721     ExplodeFieldSP(*si);                 // Explode
722
723     return;
724   }
725
726   PlayField16[*si - FieldWidth] = fiBase;
727   // ==========================================================================
728   // BASE moving down to up
729   // ==========================================================================
730
731 loc_g_63D3:
732   subSoundFX(*si, fiBase, actDigging);
733
734   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
735   PlayField16[*si - FieldWidth] = 0x503;
736   PlayField16[*si] = 0x300;
737   *si = *si - FieldWidth;
738   goto loc_StopNoSplit;
739
740   // ==========================================================================
741   // BUG moving right to left
742   // ==========================================================================
743
744 loc_g_640B:
745   if (SgnHighByte(PlayField16[*si - 1]) >= 0)
746   {
747     ExplodeFieldSP(*si);                 // Explode
748
749     return;
750   }
751
752   PlayField16[*si - 1] = fiBase;
753   // ==========================================================================
754   // BASE moving right to left
755   // ==========================================================================
756
757 loc_g_641C:
758   subSoundFX(*si, fiBase, actDigging);
759
760   dx1 = aniMurphyDigLeft;
761   PlayField16[*si - 1] = 0x203;
762   PlayField16[*si] = 0x300;
763   *si = *si - 1;
764   goto loc_StopNoSplit;
765
766   // ==========================================================================
767   // BUG moving up to down
768   // ==========================================================================
769
770 loc_g_6448:
771   if (SgnHighByte(PlayField16[*si + FieldWidth]) >= 0)
772   {
773     ExplodeFieldSP(*si);                 // Explode
774
775     return;
776   }
777
778   PlayField16[*si + FieldWidth] = fiBase;
779   // ==========================================================================
780   // BASE moving up to down
781   // ==========================================================================
782
783 loc_g_6459:
784   subSoundFX(*si, fiBase, actDigging);
785
786   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
787   PlayField16[*si + FieldWidth] = 0x703;
788   PlayField16[*si] = 0x300;
789   *si = *si + FieldWidth;
790   goto loc_StopNoSplit;
791
792   // ==========================================================================
793   // BUG moving left to right
794   // ==========================================================================
795
796 loc_g_6491:
797   if (SgnHighByte(PlayField16[*si + 1]) >= 0)
798   {
799     ExplodeFieldSP(*si);                 // Explode
800
801     return;
802   }
803
804   PlayField16[*si + 1] = fiBase;
805   // ==========================================================================
806   // BASE moving left to right
807   // ==========================================================================
808
809 loc_g_64A2:
810   subSoundFX(*si, fiBase, actDigging);
811
812   dx1 = aniMurphyDigRight;
813   PlayField16[*si + 1] = 0x803;
814   PlayField16[*si] = 0x300;
815   *si = *si + 1;
816   goto loc_StopNoSplit;
817
818   // ==========================================================================
819   // BUG touching down to up
820   // ==========================================================================
821
822 loc_g_64CE:
823   if (SgnHighByte(PlayField16[*si - FieldWidth]) >= 0)
824   {
825     ExplodeFieldSP(*si);                 // Explode
826
827     return;
828   }
829
830   PlayField16[*si - FieldWidth] = fiBase;
831   // ==========================================================================
832   // BASE touching down to up
833   // ==========================================================================
834
835 loc_g_64DF:
836   subCopyImageToScreen(*si, aniMurphyTouchUp);
837   subSoundFX(*si, fiBase, actDigging);
838
839   dx1 = aniTouchBase;
840   dxPos = *si - FieldWidth;
841   MovHighByte(&PlayField16[*si], 0x10);
842   goto loc_StopNoSplit;
843
844   // ==========================================================================
845   // BUG touching right to left
846   // ==========================================================================
847
848 loc_g_650C:
849   if (SgnHighByte(PlayField16[*si - 1]) >= 0)
850   {
851     ExplodeFieldSP(*si);                 // Explode
852
853     return;
854   }
855
856   PlayField16[*si - 1] = fiBase;
857   // ==========================================================================
858   // BASE touching right to left
859   // ==========================================================================
860
861 loc_g_651D:
862   subCopyImageToScreen(*si, aniMurphyTouchLeft);
863   subSoundFX(*si, fiBase, actDigging);
864
865   dx1 = aniTouchBase;
866   dxPos = *si - 1;
867   MovHighByte(&PlayField16[*si], 0x11);
868   goto loc_StopNoSplit;
869
870   // ==========================================================================
871   // BUG touching up to down
872   // ==========================================================================
873
874 loc_g_654A:
875   if (SgnHighByte(PlayField16[*si + FieldWidth]) >= 0)
876   {
877     ExplodeFieldSP(*si);                 // Explode
878
879     return;
880   }
881
882   PlayField16[*si + FieldWidth] = fiBase;
883   // ==========================================================================
884   // BASE touching up to down
885   // ==========================================================================
886
887 loc_g_655B:
888   subCopyImageToScreen(*si, aniMurphyTouchDown);
889   subSoundFX(*si, fiBase, actDigging);
890
891   dx1 = aniTouchBase;
892   dxPos = *si + FieldWidth;
893   MovHighByte(&PlayField16[*si], 0x12);
894   goto loc_StopNoSplit;
895
896   // ==========================================================================
897   // BUG touching left to right
898   // ==========================================================================
899
900 loc_g_6588:
901   if (SgnHighByte(PlayField16[*si + 1]) >= 0)
902   {
903     ExplodeFieldSP(*si);                 // Explode
904
905     return;
906   }
907
908   PlayField16[*si + 1] = fiBase;
909   // ==========================================================================
910   // BASE touching left to right
911   // ==========================================================================
912
913 loc_g_6599:
914   subCopyImageToScreen(*si, aniMurphyTouchRight);
915   subSoundFX(*si, fiBase, actDigging);
916
917   dx1 = aniTouchBase;
918   dxPos = *si + 1;
919   MovHighByte(&PlayField16[*si], 0x13);
920   goto loc_StopNoSplit;
921
922   // ==========================================================================
923   // INFOTRON moving down to up
924   // ==========================================================================
925
926 loc_g_65C6:
927   subSoundFX(*si, fiInfotron, actCollecting);
928
929   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
930   PlayField16[*si - FieldWidth] = 0x903;
931   PlayField16[*si] = 0x300;
932   *si = *si - FieldWidth;
933   goto loc_StopNoSplit;
934
935   // ==========================================================================
936   // INFOTRON moving right to left
937   // ==========================================================================
938
939 loc_g_65FE:
940   subSoundFX(*si, fiInfotron, actCollecting);
941
942   dx1 = aniEatInfotronLeft;
943 #if 0
944   dx2 = fiInfotron;
945   dx2Step = -1;
946   ClearPos = -1;
947 #endif
948   PlayField16[*si - 1] = 0xA03;
949   PlayField16[*si] = 0x300;
950   *si = *si - 1;
951   goto loc_StopNoSplit;
952
953   // ==========================================================================
954   // INFOTRON moving up to down
955   // ==========================================================================
956
957 loc_g_662A:
958   subSoundFX(*si, fiInfotron, actCollecting);
959
960   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
961   PlayField16[*si + FieldWidth] = 0xB03;
962   PlayField16[*si] = 0x300;
963   *si = *si + FieldWidth;
964   goto loc_StopNoSplit;
965
966   // ==========================================================================
967   // INFOTRON moving left to right
968   // ==========================================================================
969
970 loc_g_6662:
971   subSoundFX(*si, fiInfotron, actCollecting);
972
973   dx1 = aniEatInfotronRight;
974 #if 0
975   dx2 = fiInfotron;
976   dx2Step = 1;
977   ClearPos = -1;
978 #endif
979   PlayField16[*si + 1] = 0xC03;
980   PlayField16[*si] = 0x300;
981   *si = *si + 1;
982   goto loc_StopNoSplit;
983
984   // ==========================================================================
985   // INFOTRON touching down to up
986   // ==========================================================================
987
988 loc_g_668E:
989   subCopyImageToScreen(*si, aniMurphyTouchUp);
990   subSoundFX(*si, fiInfotron, actCollecting);
991
992   dx1 = aniTouchInfotron;
993   MovHighByte(&PlayField16[*si], 0x14);
994   MovHighByte(&PlayField16[*si - FieldWidth], 0xFF);
995   goto loc_StopNoSplit;
996
997   // ==========================================================================
998   // INFOTRON touching right to left
999   // ==========================================================================
1000
1001 loc_g_66C0:
1002   subCopyImageToScreen(*si, aniMurphyTouchLeft);
1003   subSoundFX(*si, fiInfotron, actCollecting);
1004
1005   dx1 = aniTouchInfotron;
1006   MovHighByte(&PlayField16[*si], 0x15);
1007   MovHighByte(&PlayField16[*si - 1], 0xFF);
1008   goto loc_StopNoSplit;
1009
1010   // ==========================================================================
1011   // INFOTRON touching up to down
1012   // ==========================================================================
1013
1014 loc_g_66F2:
1015   subCopyImageToScreen(*si, aniMurphyTouchDown);
1016   subSoundFX(*si, fiInfotron, actCollecting);
1017
1018   dx1 = aniTouchInfotron;
1019   MovHighByte(&PlayField16[*si], 0x16);
1020   MovHighByte(&PlayField16[*si + FieldWidth], 0xFF);
1021   goto loc_StopNoSplit;
1022
1023   // ==========================================================================
1024   // INFOTRON touching left to right
1025   // ==========================================================================
1026
1027 loc_g_6724:
1028   subCopyImageToScreen(*si, aniMurphyTouchRight);
1029   subSoundFX(*si, fiInfotron, actCollecting);
1030
1031   dx1 = aniTouchInfotron;
1032   MovHighByte(&PlayField16[*si], 0x17);
1033   MovHighByte(&PlayField16[*si + 1], 0xFF);
1034   goto loc_StopNoSplit;
1035
1036   // ==========================================================================
1037   // EXIT pressed from any direction
1038   // ==========================================================================
1039
1040 loc_g_6756:
1041   // FS
1042   ClearPos = -1;
1043   MurphyDX = 0;
1044   MurphyDY = 0;
1045   // end of FS
1046   if (LowByte(InfotronsNeeded) != 0)
1047     return;
1048
1049 #if 1
1050   if (!game_sp.LevelSolved)
1051     printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n", level_nr);
1052 #endif
1053
1054 #if 1
1055   game_sp.LevelSolved = TRUE;
1056 #endif
1057
1058   subSoundFX(*si, fiExit, actPassing);
1059
1060   LeadOutCounter = 0x40;          // quit: start lead-out
1061   dx1 = aniMurphyExit;
1062   MovHighByte(&PlayField16[*si], 0xD);
1063   goto loc_StopNoSplit;
1064
1065   // ==========================================================================
1066   // ZONK moving right to left
1067   // ==========================================================================
1068
1069 loc_g_679B:
1070   ax = PlayField16[*si - 2];
1071   if (ax != 0)
1072     return;
1073
1074   MovHighByte(&PlayField16[*si - 2], 1);
1075   subCopyImageToScreen(*si, aniPushLeft); // draw pushing murphy
1076   dx1 = aniZonkRollLeft;
1077   dxPos = *si - 1;
1078   dx2 = aniPushLeft;
1079   dx2Step = 1;
1080   MovHighByte(&PlayField16[*si], 0xE);
1081   goto loc_MoveNoSplit;
1082
1083   // ==========================================================================
1084   // ZONK moving left to right
1085   // ==========================================================================
1086
1087 loc_g_67D4:
1088   ax = PlayField16[*si + 2];
1089   if (ax != 0)
1090     return;
1091
1092   ax = PlayField16[*si + FieldWidth + 1];
1093   if (ax == 0) // zonk falls
1094     return;
1095
1096   MovHighByte(&PlayField16[*si + 2], 1);
1097   subCopyImageToScreen(*si, aniPushRight); // draw pushing murphy
1098   dx1 = aniZonkRollRight;
1099   dxPos = *si + 1;
1100   dx2 = aniPushRight;
1101   dx2Step = -1;
1102   MovHighByte(&PlayField16[*si], 0xF);
1103   goto loc_MoveNoSplit;
1104
1105   // ==========================================================================
1106   // TERMINAL moving/touching down to up
1107   // ==========================================================================
1108
1109 loc_g_6817:
1110   subCopyImageToScreen(*si, aniMurphyTouchUp);
1111   if (YellowDisksExploded != 0)
1112   {
1113     YawnSleepCounter = 40; // stay hypnotized
1114
1115     return;
1116   } // loc_g_6838:
1117
1118 #if 1
1119   // draw new terminal type
1120 #if 1
1121   GfxGraphic[GetX(*si - FieldWidth)][GetY(*si - FieldWidth)] = aniTerminalActive;
1122 #else
1123   subCopyImageToScreen(*si - FieldWidth, aniTerminalActive);
1124 #endif
1125 #else
1126   subCopyFieldToScreen(*si - FieldWidth, 0x88); // draw new terminal type
1127 #endif
1128   TerminalState[*si - FieldWidth] = 8;
1129   goto loc_g_68F0;
1130
1131   // ==========================================================================
1132   // TERMINAL moving/touching right to left
1133   // ==========================================================================
1134
1135 loc_g_684E:
1136   subCopyImageToScreen(*si, aniMurphyTouchLeft);
1137   if (YellowDisksExploded != 0)
1138   {
1139     YawnSleepCounter = 40; // stay hypnotized
1140
1141     return;
1142   } // loc_g_6838:
1143
1144 #if 1
1145   // draw new terminal type
1146 #if 1
1147   GfxGraphic[GetX(*si - 1)][GetY(*si - 1)] = aniTerminalActive;
1148 #else
1149   subCopyImageToScreen(*si - 1, aniTerminalActive);
1150 #endif
1151 #else
1152   subCopyFieldToScreen(*si - 1, 0x88); // draw new terminal type
1153 #endif
1154   TerminalState[*si - 1] = 8;
1155   goto loc_g_68F0;
1156
1157   // ==========================================================================
1158   // TERMINAL moving/touching up to down
1159   // ==========================================================================
1160
1161 loc_g_6884:
1162   subCopyImageToScreen(*si, aniMurphyTouchDown);
1163   if (YellowDisksExploded != 0)
1164   {
1165     YawnSleepCounter = 40; // stay hypnotized
1166
1167     return;
1168   } // loc_g_6838:
1169
1170 #if 1
1171   // draw new terminal type
1172 #if 1
1173   GfxGraphic[GetX(*si + FieldWidth)][GetY(*si + FieldWidth)] = aniTerminalActive;
1174 #else
1175   subCopyImageToScreen(*si + FieldWidth, aniTerminalActive);
1176 #endif
1177 #else
1178   subCopyFieldToScreen(*si + FieldWidth, 0x88); // draw new terminal type
1179 #endif
1180   TerminalState[*si + FieldWidth] = 8;
1181   goto loc_g_68F0;
1182
1183   // ==========================================================================
1184   // TERMINAL moving/touching left to right
1185   // ==========================================================================
1186
1187 loc_g_68BA:
1188   subCopyImageToScreen(*si, aniMurphyTouchRight);
1189   if (YellowDisksExploded != 0)
1190   {
1191     YawnSleepCounter = 40; // stay hypnotized
1192
1193     return;
1194   } // loc_g_6838:
1195
1196 #if 1
1197   // draw new terminal type
1198 #if 1
1199   GfxGraphic[GetX(*si + 1)][GetY(*si + 1)] = aniTerminalActive;
1200 #else
1201   subCopyImageToScreen(*si + 1, aniTerminalActive);
1202 #endif
1203 #else
1204   subCopyFieldToScreen(*si + 1, 0x88); // draw new terminal type
1205 #endif
1206   TerminalState[*si + 1] = 8;
1207   // ==========================================================================
1208   // common TERMINAL stuff moving/touching from all directions
1209   // ==========================================================================
1210
1211 loc_g_68F0:
1212   TerminalMaxCycles = 7;
1213   YellowDisksExploded = 1;
1214   for (i = 0; i <= LevelMax; i++)
1215   {
1216     if (PlayField16[i] == fiYellowDisk)
1217       ExplodeFieldSP (i);
1218   }
1219
1220   return;
1221
1222   // ==========================================================================
1223   // PORT down to up, VERTICAL PORT, CROSS PORT all moving down to up
1224   // ==========================================================================
1225
1226 loc_g_6916:
1227   if (PlayField16[*si - 2 * FieldWidth] != 0)
1228     return;
1229
1230   dx1 = aniSplitUpDown;
1231   dx2Step = -FieldWidth;
1232   PlayField16[*si] = 0x1803;
1233   PlayField16[*si - 2 * FieldWidth] = 0x300;
1234   goto loc_StopSplit;
1235
1236   // ==========================================================================
1237   // PORT right to left, HORIZONTAL PORT, CROSS PORT all moving right to left
1238   // ==========================================================================
1239
1240 loc_g_693A:
1241   if (PlayField16[*si - 2] != 0)
1242     return;
1243
1244   dx1 = aniMurphyMoveLeft;
1245   dx2Step = -1;
1246   PlayField16[*si] = 0x1903;
1247   PlayField16[*si - 2] = 0x300;
1248   goto loc_StopSplit;
1249
1250   // ==========================================================================
1251   // PORT up to down, VERTICAL PORT, CROSS PORT all moving up to down
1252   // ==========================================================================
1253
1254 loc_g_695E:
1255   if (PlayField16[*si + 2 * FieldWidth] != 0)
1256     return;
1257
1258   dx1 = aniSplitUpDown;
1259   dx2Step = FieldWidth;
1260   PlayField16[*si] = 0x1A03;
1261   PlayField16[*si + 2 * FieldWidth] = 0x300;
1262   goto loc_StopSplit;
1263
1264   // ==========================================================================
1265   // PORT left to right, HORIZONTAL PORT, CROSS PORT all moving left to right
1266   // ==========================================================================
1267
1268 loc_g_6982:
1269   if (PlayField16[*si + 2] != 0)
1270     return;
1271
1272   dx1 = aniMurphyMoveRight;
1273   dx2Step = 1;
1274   PlayField16[*si] = 0x1B03;
1275   PlayField16[*si + 2] = 0x300;
1276
1277 loc_StopSplit:
1278   MovingPictureSequencePhase = 0; // stop picture move sequence
1279   SplitMoveFlag = 1; // port: split movement
1280   goto loc_Split;
1281
1282   // ==========================================================================
1283   // RED DISK moving down to up
1284   // ==========================================================================
1285
1286 loc_g_69A6:
1287   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
1288   PlayField16[*si] = 0x1C03;
1289   PlayField16[*si - FieldWidth] = 0x300;
1290   goto loc_StopNoSplit;
1291
1292   // ==========================================================================
1293   // RED DISK moving right to left
1294   // ==========================================================================
1295
1296 loc_g_69CE:
1297   dx1 = aniMurphyEatLeft;
1298   PlayField16[*si] = 0x300; // !!!!!! this time we move murphy at sequence-start!
1299   PlayField16[*si - 1] = 0x1D03;
1300   *si = *si - 1;
1301   goto loc_StopNoSplit;
1302
1303   // ==========================================================================
1304   // RED DISK moving up to down
1305   // ==========================================================================
1306
1307 loc_g_69F7:
1308   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
1309   PlayField16[*si] = 0x1E03;
1310   PlayField16[*si + FieldWidth] = 0x300;
1311   goto loc_StopNoSplit;
1312
1313   // ==========================================================================
1314   // RED DISK moving left to right
1315   // ==========================================================================
1316
1317 loc_g_6A1F:
1318   //  dx = aniMurphyEatRightRedDisk 'this sequence is 9 steps long!
1319   dx1 = aniMurphyEatRight;
1320   // --------------------------------------------------------------------------
1321   // BugFix
1322   // Table data_h_145A, pointed to by table data_h_105E, has a severe bug:
1323   // The Red Disk sequence is 8 pictures long, but 9 are displayed, because it
1324   // has 1 extra entry, which causes Murphy to end slightly shifted to the left!
1325   // We may not fix the table, because then the timing of the game changes
1326   // and several existing demo's do not run properly anymore.
1327   // We only correct Murphies x-location here, when the sequence starts.
1328   // Remember that this is not the real bug-fix, but we must live with
1329   // this existing bug and correct for the consequences of it.
1330
1331   if (AllowEatRightRedDiskBug == 0) // Murphy's screen x-position
1332     MurphyScreenXPos = MurphyScreenXPos - 2 * MurphyZoomFactor;
1333
1334   SeqPos = -1;
1335   // FS: for me this means to blit the first animation frame twice
1336   // end of BugFix
1337   // --------------------------------------------------------------------------
1338   PlayField16[*si] = 0x300; // !!!!!! this time we move murphy at sequence-start!
1339   PlayField16[*si + 1] = 0x1F03;
1340   *si = *si + 1;
1341   goto loc_StopNoSplit;
1342
1343   // ==========================================================================
1344   // RED DISK touching down to up
1345   // ==========================================================================
1346
1347 loc_g_6A48:
1348   dx1 = aniTouchRedDisk;
1349   MovHighByte(&PlayField16[*si], 0x20);
1350   MovHighByte(&PlayField16[*si - FieldWidth], 3);
1351   goto loc_StopNoSplit;
1352
1353   // ==========================================================================
1354   // RED DISK touching right to left
1355   // ==========================================================================
1356
1357 loc_g_6A64:
1358   dx1 = aniTouchRedDisk;
1359   MovHighByte(&PlayField16[*si], 0x21);
1360   MovHighByte(&PlayField16[*si - 1], 3);
1361   goto loc_StopNoSplit;
1362
1363   // ==========================================================================
1364   // RED DISK touching up to down
1365   // ==========================================================================
1366
1367 loc_g_6A80:
1368   dx1 = aniTouchRedDisk;
1369   MovHighByte(&PlayField16[*si], 0x22);
1370   MovHighByte(&PlayField16[*si + FieldWidth], 3);
1371   goto loc_StopNoSplit;
1372
1373   // ==========================================================================
1374   // RED DISK touching left to right
1375   // ==========================================================================
1376
1377 loc_g_6A9C:
1378   dx1 = aniTouchRedDisk;
1379   MovHighByte(&PlayField16[*si], 0x23);
1380   MovHighByte(&PlayField16[*si + 1], 3);
1381
1382 loc_StopNoSplit:
1383   MovingPictureSequencePhase = 0; // stop picture move sequence
1384   goto loc_NoSplit;
1385
1386   // ==========================================================================
1387   // YELLOW DISK moving down to up
1388   // ==========================================================================
1389
1390 loc_g_6AB8:
1391   if (PlayField16[*si - 2 * FieldWidth] != 0)
1392     return;
1393
1394   PlayField16[*si - 2 * FieldWidth] = 0x1200;
1395   dx1 = aniYellowDisk;
1396   dxPos = *si - FieldWidth;
1397   dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
1398   dx2Step = FieldWidth;
1399   PlayField16[*si] = 0x2403;
1400   subCopyImageToScreen(*si, dx2);
1401   goto loc_MoveNoSplit;
1402
1403   // ==========================================================================
1404   // YELLOW DISK moving right to left
1405   // ==========================================================================
1406
1407 loc_g_6AF1:
1408   if (PlayField16[*si - 2] != 0)
1409     return;
1410
1411   PlayField16[*si - 2] = 0x1200;
1412   subCopyImageToScreen(*si, aniPushLeft);
1413   dx1 = aniYellowDisk;
1414   dxPos = *si - 1;
1415   dx2 = aniPushLeft;
1416   dx2Step = 1;
1417   PlayField16[*si] = 0x2503;
1418   goto loc_MoveNoSplit;
1419
1420   // ==========================================================================
1421   // YELLOW DISK moving up to down
1422   // ==========================================================================
1423
1424 loc_g_6B2A:
1425   if (PlayField16[*si + 2 * FieldWidth] != 0)
1426     return;
1427
1428   PlayField16[*si + 2 * FieldWidth] = 0x1200;
1429   dx1 = aniYellowDisk;
1430   dxPos = *si + FieldWidth;
1431   dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
1432   dx2Step = -FieldWidth;
1433   PlayField16[*si] = 0x2703;
1434   subCopyImageToScreen(*si, dx2);
1435   goto loc_MoveNoSplit;
1436
1437   // ==========================================================================
1438   // YELLOW DISK moving left to right
1439   // ==========================================================================
1440
1441 loc_g_6B63:
1442   if (PlayField16[*si + 2] != 0)
1443     return;
1444
1445   PlayField16[*si + 2] = 0x1200;
1446   subCopyImageToScreen(*si, aniPushRight);
1447   dx1 = aniYellowDisk;
1448   dxPos = *si + 1;
1449   dx2 = aniPushRight;
1450   dx2Step = -1;
1451   PlayField16[*si] = 0x2603;
1452   goto loc_MoveNoSplit;
1453
1454   // ==========================================================================
1455   // ORANGE DISK moving right to left
1456   // ==========================================================================
1457
1458 loc_g_6B9B:
1459   if (PlayField16[*si - 2] != 0)
1460     return;
1461
1462   PlayField16[*si - 2] = 0x800;
1463   subCopyImageToScreen(*si, aniPushLeft);
1464   dx1 = aniOrangeDisk;
1465   dxPos = *si - 1;
1466   dx2 = aniPushLeft;
1467   dx2Step = 1;
1468   PlayField16[*si] = 0x2803;
1469   goto loc_MoveNoSplit;
1470
1471   // ==========================================================================
1472   // ORANGE DISK moving left to right
1473   // ==========================================================================
1474
1475 loc_g_6BD3:
1476   if (PlayField16[*si + 2] != 0)
1477     return;
1478
1479   if (PlayField16[*si + FieldWidth + 1] == 0) // falling goes before pushing
1480     return;
1481
1482   PlayField16[*si + 2] = 0x100;
1483   subCopyImageToScreen(*si, aniPushRight);
1484   dx1 = aniOrangeDisk;
1485   dxPos = *si + 1;
1486   dx2 = aniPushRight;
1487   dx2Step = -1;
1488   PlayField16[*si] = 0x2903;
1489   // ==========================================================================
1490   // Copy screen animation action table to action work space
1491   // (To paint sequence: Push Zonk/Disk / release red disk / Port passing)
1492   // ==========================================================================
1493
1494 loc_MoveNoSplit:
1495   MovingPictureSequencePhase = 8; // init picture move sequence
1496
1497 loc_NoSplit:
1498   SplitMoveFlag = 0; // no port: no split movement
1499
1500 loc_Split:
1501   //  copy/store global move sequence info????????????????????????????????????
1502   //  ... dont think so ...(FS)
1503   // ==========================================================================
1504   // Proceed with all movements
1505   // ==========================================================================
1506
1507 locProceedMovingMurphy: // proceed moving murphy
1508   YawnSleepCounter = 0; // Wake up sleeping Murphy
1509   ax = MovingPictureSequencePhase;            // sequence busy?
1510   if (ax == 0)             // no -- start sequence!
1511     goto loc_g_6C8F;
1512
1513   ax = ax - 1;   // next picture of sequence
1514   MovingPictureSequencePhase = ax;            // store for later
1515
1516   if (ax == 0) // Sound effects
1517   {
1518     switch (HighByte(PlayField16[*si]))
1519     {
1520       case 0xE:
1521       case 0xF:
1522         subSoundFX(*si, fiZonk, actPushing);
1523         break;
1524
1525       case 0x28:
1526       case 0x29:
1527         subSoundFX(*si, fiOrangeDisk, actPushing);
1528         break;
1529
1530       case 0x24:
1531       case 0x25:
1532       case 0x26:
1533       case 0x27:
1534         subSoundFX(*si, fiYellowDisk, actPushing);
1535         break;
1536
1537       default:
1538         break;
1539     }
1540   }
1541
1542   bl = HighByte(PlayField16[*si]);
1543   if (bl == 0xE)        // Push Zonk to left
1544     goto loc_g_6F7E;
1545
1546   if (bl == 0xF)        // Push Zonk to right
1547     goto loc_g_6FBC;
1548
1549   if (bl == 0x28)       // Push orange disk to left
1550     goto loc_g_6FFA;
1551
1552   if (bl == 0x29)       // Push orange disk to right
1553     goto loc_g_7038;
1554
1555   if (bl == 0x24)       // Push yellow disk up
1556     goto loc_g_7076;
1557
1558   if (bl == 0x25)       // Push yellow disk to left
1559     goto loc_g_70B4;
1560
1561   if (bl == 0x27)       // Push yellow disk down
1562     goto loc_g_70F2;
1563
1564   if (bl == 0x26)       // Push yellow disk to right
1565     goto loc_g_7130;
1566
1567   if (bl == 0x2A)       // Red disk release timer
1568     goto loc_g_716E;
1569
1570   return;
1571
1572   // ==========================================================================
1573   // Paint frame of MOVING.DAT sequence
1574   // ==========================================================================
1575
1576 loc_g_6C8F:
1577
1578 #if 1
1579   if (SeqPos <= 0)
1580     dx1SequenceLength = getSequenceLength(dx1);
1581 #endif
1582
1583   if (SplitMoveFlag == 0)
1584   {
1585     // ++++++++++++++++++++++++++
1586     // Begin of normal movement
1587     MurphyScreenXPos = MurphyScreenXPos + MurphyDX * MurphyZoomFactor;
1588     MurphyScreenYPos = MurphyScreenYPos + MurphyDY * MurphyZoomFactor;
1589
1590     if (!(ClearPos < 0)) // clear field that murphy is leaving
1591       subCopyImageToScreen(ClearPos, aniSpace);
1592
1593 #if 0
1594     // !!! special two-tile animation currently not used !!!
1595     if (dx2 == fiInfotron) // special case of infotron moving left or right
1596     {
1597       tDeltaX = 0;
1598       tDeltaY = 0;
1599     }
1600     else
1601 #endif
1602     {
1603       tDeltaX = MurphyDX * LocalStretch * (SeqPos + 1);
1604       tDeltaY = MurphyDY * LocalStretch * (SeqPos + 1);
1605     }
1606
1607     X = GetStretchX(dxPos) + tDeltaX;
1608     Y = GetStretchY(dxPos) + tDeltaY;
1609     Tmp = (SeqPos < 0 ? 0 : SeqPos); // 9StepBugFix!(red disk move right)
1610
1611 #if 1
1612     if (isSnappingSequence(dx1) && SeqPos == dx1SequenceLength - 1)
1613       dx1 = aniSpace;
1614 #endif
1615
1616 #if 1
1617     DDSpriteBuffer_BltImg(X, Y, dx1, Tmp);
1618     GfxGraphic[GetX(*si)][GetY(*si)] = -1;      // (Murphy's position)
1619     GfxGraphic[GetX(dxPos)][GetY(dxPos)] = -1;  // (snapping position)
1620     // printf("::: Tmp: %d\n", Tmp);
1621 #else
1622     StretchedSprites.BltEx(X, Y, dx[Tmp]);
1623 #endif
1624
1625     if (!(dx2 < 0))
1626     {
1627       tPos = dxPos + dx2Step;
1628       X = GetStretchX(tPos);
1629       Y = GetStretchY(tPos);
1630 #if 0
1631     // !!! special two-tile animation currently not used !!!
1632       if (dx2 == fiInfotron) // special case of infotron moving left or right
1633       {
1634         StretchedSprites.BltEx(X, Y, dx[SeqPos] + dx2Step);
1635       }
1636       else // pushing something
1637 #endif
1638       {
1639         // (SeqPos iterates from 0 to 7 while pushing)
1640         DDSpriteBuffer_BltImg(X + tDeltaX, Y + tDeltaY, dx2, SeqPos);
1641       }
1642     }
1643
1644     // End of normal movement
1645     // ------------------------
1646   }
1647   else
1648   {
1649     // ++++++++++++++++++++++++++++++++
1650     // Begin of split movement (port)
1651     MurphyScreenXPos = MurphyScreenXPos + 2 * MurphyDX * MurphyZoomFactor;
1652     MurphyScreenYPos = MurphyScreenYPos + 2 * MurphyDY * MurphyZoomFactor;
1653     subCopyImageToScreen(ClearPos, aniSpace); // clear the field that murphy leaves
1654     tDeltaX = MurphyDX * LocalStretch * (SeqPos + 1);
1655     tDeltaY = MurphyDY * LocalStretch * (SeqPos + 1);
1656     X = GetStretchX(dxPos) + tDeltaX;
1657     Y = GetStretchY(dxPos) + tDeltaY;
1658     DDSpriteBuffer_BltImg(X, Y, dx1, SeqPos); // plot first murphy
1659
1660     tPos = dxPos + dx2Step;
1661     X = GetStretchX(tPos);
1662     Y = GetStretchY(tPos);
1663     DDSpriteBuffer_BltImg(X + tDeltaX, Y + tDeltaY, dx1, SeqPos); // plot second murphy
1664     DDSpriteBuffer_BltImg(X, Y, fiGraphic[LowByte(PlayField16[tPos])], 0); // replot the port on top
1665     // End of split movement (port)
1666     // ------------------------------
1667   } // loc_g_6D1E:'loc_g_6D28:
1668
1669   SeqPos = SeqPos + 1;
1670 #if 1
1671   if (SeqPos < dx1SequenceLength)
1672     return;
1673 #else
1674   if (dx[SeqPos] > -1)
1675     return;
1676 #endif
1677
1678   // Follow-up after movement completed     'loc_g_6D35:
1679   MurphyXPos = MurphyXPos + MurphyDX;
1680   MurphyYPos = MurphyYPos + MurphyDY;
1681   bl = HighByte(PlayField16[*si]);  // animation phase
1682   MovHighByte(&PlayField16[*si], 0);
1683
1684   if (bl == 0x1)    // space, moving up
1685     goto loc_g_6EC8;
1686
1687   if (bl == 0x2)    // space, moving left
1688     goto loc_g_6EE6;
1689
1690   if (bl == 0x3)    // space, moving down
1691     goto loc_g_6F04;
1692
1693   if (bl == 0x4)    // space, moving right
1694     goto loc_g_71C4;
1695
1696   if (bl == 0x5)    // base , moving up
1697     goto loc_g_6EC8;
1698
1699   if (bl == 0x6)    // base , moving left -> 6 is not used, value is set to 2 instead of 6!
1700     goto loc_g_6EE6;
1701
1702   if (bl == 0x7)    // base , moving down
1703     goto loc_g_6F04;
1704
1705   if (bl == 0x8)    // base , moving right
1706     goto loc_g_71C4;
1707
1708   if (bl == 0x9)    // infotron, moving up
1709     goto loc_g_6EBA;
1710
1711   if (bl == 0xA)      // infotron, moving left
1712     goto loc_g_6ED8;
1713
1714   if (bl == 0xB)    // infotron, moving down
1715     goto loc_g_6EF6;
1716
1717   if (bl == 0xC)      // infotron, moving right
1718     goto loc_g_71B6;
1719
1720   if (bl == 0xD)      // exit
1721     goto loc_g_6F77;
1722
1723   if (bl == 0xE)      // zonk, pushing left
1724     goto loc_g_6F18;
1725
1726   if (bl == 0xF)      // zonk, pushing right
1727     goto loc_g_6F3B;
1728
1729   if (bl == 0x10)   // base , touching up
1730     goto loc_g_71E2;
1731
1732   if (bl == 0x11)   // base , touching left
1733     goto loc_g_71FE;
1734
1735   if (bl == 0x12)   // base , touching down
1736     goto loc_g_721A;
1737
1738   if (bl == 0x13)   // base , touching right
1739     goto loc_g_7236;
1740
1741   if (bl == 0x14)   // infotron touching up
1742     goto loc_g_71D4;
1743
1744   if (bl == 0x15)   // infotron touching left
1745     goto loc_g_71F0;
1746
1747   if (bl == 0x16)   // infotron touching down
1748     goto loc_g_720C;
1749
1750   if (bl == 0x17)   // infotron touching right
1751     goto loc_g_7228;
1752
1753   if (bl == 0x18)     // port up
1754     goto loc_g_7244;
1755
1756   if (bl == 0x19)     // port left
1757     goto loc_g_7272;
1758
1759   if (bl == 0x1A)     // port down
1760     goto loc_g_729F;
1761
1762   if (bl == 0x1B)     // port right
1763     goto loc_g_72CD;
1764
1765   if (bl == 0x1C)   // red disk, moving up
1766     goto loc_g_72FA;
1767
1768   if (bl == 0x1D)   // red disk, moving left
1769     goto loc_g_7318;
1770
1771   if (bl == 0x1E)   // red disk, moving down
1772     goto loc_g_7333;
1773
1774   if (bl == 0x1F)   // red disk, moving right -> 9-Step-Bug!
1775     goto loc_g_7351;
1776
1777   if (bl == 0x20)   // red disk, touching up
1778     goto loc_g_736C;
1779
1780   if (bl == 0x21)   // red disk, touching left
1781     goto loc_g_7381;
1782
1783   if (bl == 0x22)   // red disk, touching down
1784     goto loc_g_7396;
1785
1786   if (bl == 0x23)   // red disk, touching right
1787     goto loc_g_73AB;
1788
1789   if (bl == 0x24)     // yellow disk, pushing up
1790     goto loc_g_73C0;
1791
1792   if (bl == 0x25)     // yellow disk, pushing left
1793     goto loc_g_73DD;
1794
1795   if (bl == 0x26)     // yellow disk, pushing right -> order of "down" exchanged with "right"!
1796     goto loc_g_7417;
1797
1798   if (bl == 0x27)     // yellow disk, pushing down  -> order of "down" exchanged with "right"!
1799     goto loc_g_73FA;
1800
1801   if (bl == 0x28)     // orange disk, pushing left
1802     goto loc_g_7434;
1803
1804   if (bl == 0x29)     // orange disk, pushing right
1805     goto loc_g_7451;
1806
1807   if (bl == 0x2A)   // red disk, release
1808     goto loc_g_747F;
1809
1810   ExitToMenuFlag = 1;
1811
1812   return;
1813
1814   // ==========================================================================
1815   //                       infotron, moving up
1816   // ==========================================================================
1817
1818 loc_g_6EBA:
1819   if (0 < LowByte(InfotronsNeeded))
1820     InfotronsNeeded = InfotronsNeeded - 1;
1821
1822 loc_g_6EC8: // space, base
1823   PlayField16[*si] = fiMurphy;
1824   subAdjustZonksInfotronsAboveMurphy(*si + FieldWidth);
1825
1826   return;
1827
1828   // ==========================================================================
1829   //                       infotron, moving left
1830   // ==========================================================================
1831
1832 loc_g_6ED8:
1833   if (0 < LowByte(InfotronsNeeded))
1834     InfotronsNeeded = InfotronsNeeded - 1;
1835
1836 loc_g_6EE6: // space, base
1837   PlayField16[*si] = fiMurphy;
1838   subAdjustZonksInfotronsAboveMurphy(*si + 1);
1839
1840   return;
1841
1842   // ==========================================================================
1843   //                       infotron, moving down
1844   // ==========================================================================
1845
1846 loc_g_6EF6:
1847   if (0 < LowByte(InfotronsNeeded))
1848     InfotronsNeeded = InfotronsNeeded - 1;
1849
1850 loc_g_6F04: // space, base
1851   if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
1852     PlayField16[*si - FieldWidth] = 0;
1853
1854   PlayField16[*si] = fiMurphy;
1855
1856   return;
1857
1858   // ==========================================================================
1859   //                       infotron, moving right
1860   // ==========================================================================
1861
1862 loc_g_71B6:
1863   if (0 < LowByte(InfotronsNeeded))
1864     InfotronsNeeded = InfotronsNeeded - 1;
1865
1866 loc_g_71C4: // space, base
1867   subAdjustZonksInfotronsAboveMurphy(*si - 1);
1868   PlayField16[*si] = fiMurphy;
1869
1870   return;
1871
1872   // ==========================================================================
1873   //                       infotron, touching up
1874   // ==========================================================================
1875
1876 loc_g_71D4:
1877   if (0 < LowByte(InfotronsNeeded))
1878     InfotronsNeeded = InfotronsNeeded - 1;
1879
1880 loc_g_71E2: // base
1881   if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
1882     PlayField16[*si - FieldWidth] = 0;
1883
1884   return;
1885
1886   // ==========================================================================
1887   //                       infotron, touching left
1888   // ==========================================================================
1889
1890 loc_g_71F0:
1891   if (0 < LowByte(InfotronsNeeded))
1892     InfotronsNeeded = InfotronsNeeded - 1;
1893
1894 loc_g_71FE: // base
1895   if (LowByte(PlayField16[*si - 1]) != fiExplosion)
1896     PlayField16[*si - 1] = 0;
1897
1898   return;
1899
1900   // ==========================================================================
1901   //                       infotron, touching down
1902   // ==========================================================================
1903
1904 loc_g_720C:
1905   if (0 < LowByte(InfotronsNeeded))
1906     InfotronsNeeded = InfotronsNeeded - 1;
1907
1908 loc_g_721A: // base
1909   if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion)
1910     PlayField16[*si + FieldWidth] = 0;
1911
1912   return;
1913
1914   // ==========================================================================
1915   //                       infotron, touching right
1916   // ==========================================================================
1917
1918 loc_g_7228:
1919   if (0 < LowByte(InfotronsNeeded))
1920     InfotronsNeeded = InfotronsNeeded - 1;
1921
1922 loc_g_7236: // base
1923   if (LowByte(PlayField16[*si + 1]) != fiExplosion)
1924     PlayField16[*si + 1] = 0;
1925
1926   return;
1927
1928   // ==========================================================================
1929   //                       zonk, pushing left
1930   // ==========================================================================
1931
1932 loc_g_6F18:
1933   if (LowByte(PlayField16[*si]) != fiExplosion)
1934     PlayField16[*si] = 0;
1935
1936   PlayField16[*si - 1] = fiMurphy;
1937   PlayField16[*si - 2] = fiZonk;
1938   subExplodeSnikSnaksBelow(*si - 2);
1939   *si = *si - 1;
1940
1941   return;
1942
1943   // ==========================================================================
1944   //                       zonk, pushing right
1945   // ==========================================================================
1946
1947 loc_g_6F3B:
1948   if (LowByte(PlayField16[*si]) != fiExplosion)
1949     PlayField16[*si] = 0;
1950
1951   PlayField16[*si + 1] = fiMurphy;
1952   PlayField16[*si + 2] = fiZonk;
1953   subExplodeSnikSnaksBelow(*si + 2);
1954   *si = *si + 1;
1955
1956   return;
1957
1958   // ==========================================================================
1959   //                       exit
1960   // ==========================================================================
1961
1962 loc_g_6F77:
1963   ExitToMenuFlag = 1;
1964
1965 #if 1
1966   PlayField16[*si] = fiSpace;   // remove Murphy from playfield after exiting
1967 #endif
1968
1969   return;
1970
1971   // ==========================================================================
1972   //               Push Zonk from right to left
1973   // ==========================================================================
1974
1975 loc_g_6F7E:
1976   if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiZonk)
1977     return;
1978
1979   PlayField16[*si] = fiMurphy; // else restore - no more zonk pushing!
1980   PlayField16[*si - 1] = fiZonk;
1981   if (LowByte(PlayField16[*si - 2]) != fiExplosion)
1982     PlayField16[*si - 2] = 0;
1983
1984   subCopyImageToScreen(*si, aniMurphy);
1985
1986   return;
1987
1988   // ==========================================================================
1989   //                       Push Zonk from left to right
1990   // ==========================================================================
1991
1992 loc_g_6FBC:
1993   if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiZonk)
1994     return;
1995
1996   PlayField16[*si] = fiMurphy; // else restore - no more zonk pushing!
1997   PlayField16[*si + 1] = fiZonk;
1998   if (LowByte(PlayField16[*si + 2]) != fiExplosion)
1999     PlayField16[*si + 2] = 0;
2000
2001   subCopyImageToScreen(*si, aniMurphy);
2002
2003   return;
2004
2005   // ==========================================================================
2006   //               Push orange disk from right to left
2007   // ==========================================================================
2008
2009 loc_g_6FFA:
2010   if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiOrangeDisk)
2011     return;
2012
2013   PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2014   PlayField16[*si - 1] = fiOrangeDisk;
2015   if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2016     PlayField16[*si - 2] = 0;
2017
2018   subCopyImageToScreen(*si, aniMurphy);
2019
2020   return;
2021
2022   // ==========================================================================
2023   //               Push orange disk from left to right
2024   // ==========================================================================
2025
2026 loc_g_7038:
2027   if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiOrangeDisk)
2028     return;
2029
2030   PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2031   PlayField16[*si + 1] = fiOrangeDisk;
2032   if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2033     PlayField16[*si + 2] = 0;
2034
2035   subCopyImageToScreen(*si, aniMurphy);
2036
2037   return;
2038
2039   // ==========================================================================
2040   //               Push yellow disk from down to up
2041   // ==========================================================================
2042
2043 loc_g_7076:
2044   if (DemoKeyCode == keyUp && PlayField16[*si - FieldWidth] == fiYellowDisk)
2045     return;
2046
2047   PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2048   PlayField16[*si - FieldWidth] = fiYellowDisk;
2049   if (LowByte(PlayField16[*si - 2 * FieldWidth]) != fiExplosion)
2050     PlayField16[*si - 2 * FieldWidth] = 0;
2051
2052   subCopyImageToScreen(*si, aniMurphy);
2053
2054   return;
2055
2056   // ==========================================================================
2057   //               Push yellow disk from right to left
2058   // ==========================================================================
2059
2060 loc_g_70B4:
2061   if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiYellowDisk)
2062     return;
2063
2064   PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2065   PlayField16[*si - 1] = fiYellowDisk;
2066   if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2067     PlayField16[*si - 2] = 0;
2068
2069   subCopyImageToScreen(*si, aniMurphy);
2070
2071   return;
2072
2073   // ==========================================================================
2074   //               Push yellow disk from up to down
2075   // ==========================================================================
2076
2077 loc_g_70F2:
2078   if (DemoKeyCode == keyDown && PlayField16[*si + FieldWidth] == fiYellowDisk)
2079     return;
2080
2081   PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2082   PlayField16[*si + FieldWidth] = fiYellowDisk;
2083   if (LowByte(PlayField16[*si + 2 * FieldWidth]) != fiExplosion)
2084     PlayField16[*si + 2 * FieldWidth] = 0;
2085
2086   subCopyImageToScreen(*si, aniMurphy);
2087
2088   return;
2089
2090   // ==========================================================================
2091   //               Push yellow disk from left to right
2092   // ==========================================================================
2093
2094 loc_g_7130:
2095   if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiYellowDisk)
2096     return;
2097
2098   PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2099   PlayField16[*si + 1] = fiYellowDisk;
2100   if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2101     PlayField16[*si + 2] = 0;
2102
2103   subCopyImageToScreen(*si, aniMurphy);
2104
2105   return;
2106
2107   // ==========================================================================
2108   //               time red disk release (space)
2109   // ==========================================================================
2110
2111 loc_g_716E:
2112   if (DemoKeyCode != keySpace)
2113   {
2114     PlayField16[*si] = fiMurphy;
2115     subCopyImageToScreen(*si, aniMurphy);
2116     RedDiskReleasePhase = 0;
2117   }
2118   else if (MovingPictureSequencePhase == 0x20)
2119   {
2120     // anxious murphy, dropping red disk
2121     subCopyImageToScreen(*si, aniMurphyDropping);
2122     RedDiskReleasePhase = 1;
2123   }
2124
2125   return;
2126
2127   // ==========================================================================
2128   // Special port down to up
2129   // ==========================================================================
2130
2131 loc_g_7244:
2132   if (LowByte(PlayField16[*si]) != fiExplosion)
2133     PlayField16[*si] = 0;
2134
2135   PlayField16[*si - 2 * FieldWidth] = fiMurphy;
2136   SplitMoveFlag = 0;
2137   *si = *si - FieldWidth;
2138   if (HighByte(PlayField16[*si]) == 1)
2139     subSpPortTest(*si);
2140
2141   *si = *si - FieldWidth;
2142
2143   return;
2144
2145   // ==========================================================================
2146   // Special port right to left
2147   // ==========================================================================
2148
2149 loc_g_7272:
2150   if (LowByte(PlayField16[*si]) != fiExplosion)
2151     PlayField16[*si] = 0;
2152
2153   PlayField16[*si - 2] = fiMurphy;
2154   SplitMoveFlag = 0;
2155   *si = *si - 1;
2156   if (HighByte(PlayField16[*si]) == 1)
2157     subSpPortTest(*si);
2158
2159   *si = *si - 1;
2160
2161   return;
2162
2163   // ==========================================================================
2164   // Special port up to down
2165   // ==========================================================================
2166
2167 loc_g_729F:
2168   if (LowByte(PlayField16[*si]) != fiExplosion)
2169     PlayField16[*si] = 0;
2170
2171   PlayField16[*si + 2 * FieldWidth] = fiMurphy;
2172   SplitMoveFlag = 0;
2173   *si = *si + FieldWidth;
2174   if (HighByte(PlayField16[*si]) == 1)
2175     subSpPortTest(*si);
2176
2177   *si = *si + FieldWidth;
2178
2179   return;
2180
2181   // ==========================================================================
2182   // Special port left to right
2183   // ==========================================================================
2184
2185 loc_g_72CD:
2186   if (LowByte(PlayField16[*si]) != fiExplosion)
2187     PlayField16[*si] = 0;
2188
2189   PlayField16[*si + 2] = fiMurphy;
2190   SplitMoveFlag = 0;
2191   *si = *si + 1;
2192   if (HighByte(PlayField16[*si]) == 1)
2193     subSpPortTest(*si);
2194
2195   *si = *si + 1;
2196
2197   return;
2198
2199   // ==========================================================================
2200   // Move Red Disk up
2201   // ==========================================================================
2202
2203 loc_g_72FA:
2204   if (LowByte(PlayField16[*si]) != fiExplosion)
2205     PlayField16[*si] = 0;
2206
2207   *si = *si - FieldWidth;
2208   PlayField16[*si] = fiMurphy;
2209   subEatRedDisk(*si); // inc+show Murphy's red disks
2210
2211   return;
2212
2213   // ==========================================================================
2214   // Move Red Disk left
2215   // ==========================================================================
2216
2217 loc_g_7318:
2218   if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2219     PlayField16[*si + 1] = 0;
2220
2221   PlayField16[*si] = fiMurphy;
2222   subEatRedDisk(*si); // inc+show Murphy's red disks
2223
2224   return;
2225
2226   // ==========================================================================
2227   // Move Red Disk down
2228   // ==========================================================================
2229
2230 loc_g_7333:
2231   if (LowByte(PlayField16[*si]) != fiExplosion)
2232     PlayField16[*si] = 0;
2233
2234   *si = *si + FieldWidth;
2235   PlayField16[*si] = fiMurphy;
2236   subEatRedDisk(*si); // inc+show Murphy's red disks
2237
2238   return;
2239
2240   // ==========================================================================
2241   // Move Red Disk right
2242   // ==========================================================================
2243
2244 loc_g_7351:
2245   if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2246     PlayField16[*si - 1] = 0;
2247
2248   PlayField16[*si] = fiMurphy;
2249   subEatRedDisk(*si); // inc+show Murphy's red disks
2250
2251   return;
2252
2253   // ==========================================================================
2254   // Eat Red Disk up
2255   // ==========================================================================
2256
2257 loc_g_736C:
2258   if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
2259     PlayField16[*si - FieldWidth] = 0;
2260
2261   subEatRedDisk(*si - FieldWidth); // inc+show Murphy's red disks
2262
2263   return;
2264
2265   // ==========================================================================
2266   // Eat Red Disk left
2267   // ==========================================================================
2268
2269 loc_g_7381:
2270   if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2271     PlayField16[*si - 1] = 0;
2272
2273   subEatRedDisk(*si - 1); // inc+show Murphy's red disks
2274
2275   return;
2276
2277   // ==========================================================================
2278   // Eat Red Disk down
2279   // ==========================================================================
2280
2281 loc_g_7396:
2282   if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion)
2283     PlayField16[*si + FieldWidth] = 0;
2284
2285   subEatRedDisk(*si + FieldWidth); // inc+show Murphy's red disks
2286
2287   return;
2288
2289   // ==========================================================================
2290   // Eat Red Disk right
2291   // ==========================================================================
2292
2293 loc_g_73AB:
2294   if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2295     PlayField16[*si + 1] = 0;
2296
2297   subEatRedDisk(*si + 1); // inc+show Murphy's red disks
2298
2299   return;
2300
2301   // ==========================================================================
2302   //                       yellow disk, pushing up
2303   // ==========================================================================
2304
2305 loc_g_73C0:
2306   if (LowByte(PlayField16[*si]) != fiExplosion)
2307     PlayField16[*si] = 0;
2308
2309   *si = *si - FieldWidth;
2310   PlayField16[*si] = fiMurphy;
2311   PlayField16[*si - FieldWidth] = fiYellowDisk;
2312
2313   return;
2314
2315   // ==========================================================================
2316   //                       yellow disk, pushing left
2317   // ==========================================================================
2318
2319 loc_g_73DD:
2320   if (LowByte(PlayField16[*si]) != fiExplosion)
2321     PlayField16[*si] = 0;
2322
2323   *si = *si - 1;
2324   PlayField16[*si] = fiMurphy;
2325   PlayField16[*si - 1] = fiYellowDisk;
2326
2327   return;
2328
2329   // ==========================================================================
2330   //                       yellow disk, pushing down
2331   // ==========================================================================
2332
2333 loc_g_73FA:
2334   if (LowByte(PlayField16[*si]) != fiExplosion)
2335     PlayField16[*si] = 0;
2336
2337   *si = *si + FieldWidth;
2338   PlayField16[*si] = fiMurphy;
2339   PlayField16[*si + FieldWidth] = fiYellowDisk;
2340
2341   return;
2342
2343   // ==========================================================================
2344   //                       yellow disk pushing right
2345   // ==========================================================================
2346
2347 loc_g_7417:
2348   if (LowByte(PlayField16[*si]) != fiExplosion)
2349     PlayField16[*si] = 0;
2350
2351   *si = *si + 1;
2352   PlayField16[*si] = fiMurphy;
2353   PlayField16[*si + 1] = fiYellowDisk;
2354
2355   return;
2356
2357   // ==========================================================================
2358   //                       orange disk, pushing left
2359   // ==========================================================================
2360
2361 loc_g_7434:
2362   if (LowByte(PlayField16[*si]) != fiExplosion)
2363     PlayField16[*si] = 0;
2364
2365   *si = *si - 1;
2366   PlayField16[*si] = fiMurphy;
2367   PlayField16[*si - 1] = fiOrangeDisk;
2368
2369   return;
2370
2371   // ==========================================================================
2372   //                       orange disk, pushing right
2373   // ==========================================================================
2374
2375 loc_g_7451:
2376   if (LowByte(PlayField16[*si]) != fiExplosion)
2377     PlayField16[*si] = 0;
2378
2379   *si = *si + 1;
2380   PlayField16[*si] = fiMurphy;
2381   PlayField16[*si + 1] = fiOrangeDisk;
2382   if (PlayField16[*si + FieldWidth + 1] == 0) // make it fall down if below is empty
2383   {
2384     MovHighByte(&PlayField16[*si + 1], 0x20);
2385     MovHighByte(&PlayField16[*si + FieldWidth + 1], fiOrangeDisk);
2386   }
2387
2388   return;
2389
2390   // ==========================================================================
2391   //                     Release a red disk
2392   // ==========================================================================
2393
2394 loc_g_747F:
2395   PlayField16[*si] = fiMurphy;
2396   RedDiskReleasePhase = 2;
2397   RedDiskCount = RedDiskCount - 1;
2398
2399   subSoundFX(*si, fiRedDisk, actDropping);
2400 } // subAnimateMurphy
2401
2402 // ==========================================================================
2403 //                              SUBROUTINE
2404 // ==========================================================================
2405 void subExplodeSnikSnaksBelow(int si)
2406 {
2407   int ax;
2408
2409   ax = LowByte(PlayField16[si + FieldWidth]);
2410   if (ax == 0x11 || ax == 0xBB)
2411     ExplodeFieldSP(si + FieldWidth);
2412 } // subExplodeSnikSnaksBelow
2413
2414 // ==========================================================================
2415 //                              SUBROUTINE
2416 // Does pushing against an object kill Murphy?
2417 // ==========================================================================
2418 static boolean subMoveKillsMurphy(int si, int ax, int bl)
2419 {
2420   static boolean subMoveKillsMurphy;
2421
2422   int al, ah;
2423
2424   al = LowByte(ax);
2425   ah = HighByte(ax);
2426   if (ax == 0xFFFF || ax == 0xAAAA || ah == 0)
2427     goto loc_g_752E;
2428
2429   if (al == fiZonk)
2430     goto loc_g_74E7;
2431
2432   if (al == fiExplosion)
2433     goto loc_g_7530;
2434
2435   if (fiOrangeDisk <= al && al <= fiPortUp)
2436     goto loc_g_752E;
2437
2438   ExplodeFieldSP(si);                 // Explode
2439   subMoveKillsMurphy = True;
2440   return subMoveKillsMurphy;
2441
2442 loc_g_74E7: // zonk
2443   if (bl == keyLeft)
2444     goto loc_g_74F6;
2445
2446   if (bl == keyRight)
2447     goto loc_g_7512;
2448
2449   ExplodeFieldSP(si);                 // Explode
2450   subMoveKillsMurphy = True;
2451   return subMoveKillsMurphy;
2452
2453 loc_g_74F6: // zonk left
2454   ah = ah & 0xF0;
2455   if (! (ah == 0x20 || ah == 0x40 || ah == 0x50 || ah == 0x70))
2456     ExplodeFieldSP(si);
2457
2458   subMoveKillsMurphy = True;                           // Set carry flag
2459   return subMoveKillsMurphy;
2460
2461 loc_g_7512: // zonk right
2462   ah = ah & 0xF0;
2463   if (! (ah == 0x30 || ah == 0x40 || ah == 0x60 || ah == 0x70))
2464     ExplodeFieldSP(si);
2465
2466 loc_g_752E: // Marked fields and Ports
2467   subMoveKillsMurphy = True;                           // Set carry flag
2468   return subMoveKillsMurphy;
2469
2470 loc_g_7530: // explosion
2471   if ((ah & 0x80) != 0)
2472     goto loc_g_753A;
2473
2474   if (ah >= 4)
2475     goto loc_g_753F;
2476
2477 loc_g_753A:
2478   ExplodeFieldSP(si);                 // Explode
2479   subMoveKillsMurphy = True;                           // Set carry flag
2480   return subMoveKillsMurphy;
2481
2482 loc_g_753F:
2483   PlayField16[si] = 0;
2484   subMoveKillsMurphy = False;
2485
2486   return subMoveKillsMurphy;
2487 } // subMoveKillsMurphy
2488
2489 // ==========================================================================
2490 //                              SUBROUTINE
2491 // Test If si 's a special (grav) port and If so Then fetch new values (see below)
2492 // change conditions to port specs
2493 // The 10-port data base is at data_h_0D28, 10 entries of 6 bytes each:
2494 // (hi),(lo),(gravity),(freeze zonks),(freeze enemies),(unused)
2495 // ==========================================================================
2496
2497 void subSpPortTest(int si)
2498 {
2499   int i;
2500
2501   for (i = 0; i < LInfo.SpecialPortCount; i++)
2502   {
2503     if (LInfo.SpecialPort[i].PortLocation / 2 == si)
2504     {
2505       GravityFlag              = LInfo.SpecialPort[i].Gravity;
2506       FreezeZonks              = LInfo.SpecialPort[i].FreezeZonks;
2507       SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
2508
2509       break;
2510     }
2511   }
2512 }
2513
2514 void subCopyAnimToScreen(int si, int graphic, int sync_frame)
2515 {
2516   int X, Y;
2517
2518   // +++++++++++++++++++++++++++++++++++++++++
2519   X = GetStretchX(si);
2520   Y = GetStretchY(si);
2521   DDSpriteBuffer_BltImg(X, Y, graphic, sync_frame);
2522   // +++++++++++++++++++++++++++++++++++++++++
2523 }
2524
2525 void subCopyImageToScreen(int si, int graphic)
2526 {
2527   subCopyAnimToScreen(si, graphic, 0);
2528 }
2529
2530 static void subEatRedDisk(int si)
2531 {
2532   if (AllowRedDiskCheat == 0)
2533   {
2534     if (RedDiskReleasePhase != 0)
2535     {
2536       if (RedDiskReleaseMurphyPos == si)
2537         return;
2538     }
2539   }
2540
2541   RedDiskCount = (RedDiskCount + 1) % 256;
2542 }
2543
2544 void subAdjustZonksInfotronsAboveMurphy(int si)
2545 {
2546   int ax;
2547
2548   if (LowByte(PlayField16[si]) != fiExplosion)
2549     PlayField16[si] = 0;
2550
2551   ax = PlayField16[si - FieldWidth];
2552   if (ax == 0 || ax == 0x9999)
2553     goto loc_g_15A8;
2554
2555   if (ax == fiZonk || ax == fiInfotron)
2556   {
2557     MovHighByte(&PlayField16[si - FieldWidth], 0x40); // make falling straigt down
2558   }
2559
2560   return;
2561
2562 loc_g_15A8: // empty above
2563   ax = PlayField16[si - FieldWidth - 1];
2564   if (ax == fiZonk || ax == fiInfotron)
2565     goto loc_g_15C5;
2566
2567 loc_g_15B6:
2568   ax = PlayField16[si - FieldWidth + 1];
2569   if (ax == fiZonk || ax == fiInfotron)
2570     goto loc_g_15E8;
2571
2572   return;
2573
2574 loc_g_15C5: // zonk/infotron above left
2575   ax = PlayField16[si - 1];
2576   if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM)) // continue testing right above
2577     goto loc_g_15B6;
2578
2579   MovHighByte(&PlayField16[si - FieldWidth - 1], 0x60); // make roll right
2580   PlayField16[si - FieldWidth] = 0x8888;
2581
2582   return;
2583
2584 loc_g_15E8: // zonk/infotron above right
2585   ax = PlayField16[si + 1];
2586   if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
2587   {
2588     MovHighByte(&PlayField16[si - FieldWidth + 1], 0x50); // make roll left
2589     PlayField16[si - FieldWidth] = 0x8888;
2590   }
2591 }