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