1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
7 static void subEatRedDisk(int si);
8 static boolean subMoveKillsMurphy(int si, int ax, int bl);
10 // static char *VB_Name = "modMurphy";
12 // --- Option Explicit
16 #define LocalStretch (2)
17 #define MurphyZoomFactor (ZoomFactor)
21 #define LocalStretch (1)
22 #define MurphyZoomFactor (1)
26 // ==========================================================================
28 // Move Murphy in any direction
29 // ==========================================================================
31 void subAnimateMurphy(int *si)
33 // int ax, al, ah, bx, bl, i, X, Y;
34 // int tX, tY, tDeltaX, tDeltaY, tPos, Tmp;
36 int ax, al, bl, i, X, Y;
39 int ax, al, bx, bl, i, X, Y;
41 int tDeltaX, tDeltaY, tPos, Tmp;
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;
54 ax = PlayField16[*si];
58 printf("::: Murphy.c: subAnimateMurphy(): %d [%d, %d] %d, %d [%d]\n",
59 *si, *si % 60, *si / 60, ax, al, (al == fiMurphy));
63 printf("::: Murphy.c: subAnimateMurphy(): %d [%d] [%d]\n",
64 YawnSleepCounter, FrameCounter, TimerVar);
69 MurphyMoveCounter = 0; // We have no Murphy! Exit!
74 MurphyMoveCounter = 1; // We have a Murphy!
75 MurphyExplodePos = *si;
77 // (check if high byte of PlayField16 has stored movement information)
78 if (ax != fiMurphy) // yes--go proceed moving murphy?
79 goto locProceedMovingMurphy;
81 // FS: reset moving sequence variables
90 ScratchGravity = 0; // scratch gravity off
91 if (GravityFlag != 0) // Gravity? (1=gravity on)
93 bl = LowByte(PlayField16[*si - FieldWidth]); // check above
94 if (! (bl == fiPortUp || bl == fiPortUpAndDown || bl == fiPortAllDirections))
96 if (PlayField16[*si + FieldWidth] == 0) // gravity on and space below!
102 if (bl != 0) // a key was pressed!
103 goto locKeyPressed5FCF;
106 printf("::: Murphy.c: !!! %d [%d]\n", DemoKeyCode, GravityFlag);
109 RedDiskReleaseFlag = 1;
110 if (ScratchGravity != 0) // gravity pulls & space below?'-> force Space up to down
124 // ------------------------------------------------------------------
125 // Murphy's YAWN & SLEEP sequence, counted down by YawnSleepCounter:
127 YawnSleepCounter = YawnSleepCounter + 1;
129 if (YawnSleepCounter < 16)
132 if (YawnSleepCounter < 2000)
135 // (default: single graphic, no animation)
136 subCopyAnimToScreen(*si, aniMurphy, YawnSleepCounter - 16);
141 if (YawnSleepCounter < 4000)
143 // yawn! and look depressed afterwards...
144 // (default: 12 animation frames with delay of 8)
145 subCopyAnimToScreen(*si, aniMurphyYawn, YawnSleepCounter - 2000);
150 if (YawnSleepCounter < 6400)
153 // (default: 12 animation frames with delay of 8)
154 subCopyAnimToScreen(*si, aniMurphyYawn, YawnSleepCounter - 4000);
159 // time1 = 6400 + 12 * 8; // (default: 6496 == 6400 + 12 * 8)
160 time1 = 6400 + 12 * 10;
162 if (YawnSleepCounter < time1)
164 // yawn again! - third time
165 // (default: 12 animation frames with delay of 8)
166 subCopyAnimToScreen(*si, aniMurphyYawn, YawnSleepCounter - 6400);
171 // time2 = 6496 + 3 * 64; // (default: 6688 == 6496 + 3 * 64)
172 time2 = 6496 + 3 * 100;
174 if (YawnSleepCounter > time2) // Murphy already went to sleep
177 if (PlayField16[*si - 1] == 0)
179 if (PlayField16[*si + 1] == 0)
181 // no sleep -- go back to "wait and start yawning" phase
182 YawnSleepCounter = 144;
188 // go to sleep (right side)
189 // (default: 3 animation frames with delay of 64)
190 subCopyAnimToScreen(*si, aniMurphySleepRight, YawnSleepCounter - time1);
196 // go to sleep (left side)
197 // (default: 3 animation frames with delay of 64)
198 subCopyAnimToScreen(*si, aniMurphySleepLeft, YawnSleepCounter - time1);
202 // end of YAWN-SLEEP-Sequence
210 // ------------------------------------------------------------------
211 // Murphy's YAWN & SLEEP sequence, counted down by YawnSleepCounter:
212 YawnSleepCounter = YawnSleepCounter + 1;
213 if (YawnSleepCounter == 4)
215 subCopyFieldToScreen(*si, fiMurphy); // normal grin
219 if (YawnSleepCounter <= 500) // loc_g_5ED7:
222 if (YawnSleepCounter <= 522)
224 bx = (YawnSleepCounter - 500) / 2;
225 subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn! and look depressed afterwards...
229 if (YawnSleepCounter <= 1000)
232 if (YawnSleepCounter <= 1022)
234 bx = (YawnSleepCounter - 1000) / 2;
235 subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn again!
239 if (YawnSleepCounter <= 1600) // loc_g_5F3B:
242 if (YawnSleepCounter <= 1622)
244 bx = (YawnSleepCounter - 1600) / 2;
245 subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn again! - third time
249 if (YawnSleepCounter > 1654)
252 if (PlayField16[*si - 1] == 0)
254 if (PlayField16[*si + 1] == 0)
256 YawnSleepCounter = 36;
262 bx = (YawnSleepCounter - 1622) / 16;
263 subCopyFieldToScreen(*si, aniMurphySleepRight + bx); // go to sleep
268 bx = (YawnSleepCounter - 1622) / 16;
269 subCopyFieldToScreen(*si, aniMurphySleepLeft + bx); // go to sleep
273 // end of YAWN-SLEEP-Sequence
277 // ------------------------------------------------------------------
278 // ==========================================================================
279 // (Direct Jump) a key was pressed
280 // ==========================================================================
283 if (ScratchGravity == 0)
286 if (PlayField16[*si + FieldWidth] != 0)
291 if (PlayField16[*si - FieldWidth] == fiBase)
295 else if (bl == keyLeft)
297 if (PlayField16[*si - 1] == fiBase)
301 else if (bl == keyRight)
303 if (PlayField16[*si + 1] == fiBase)
307 bl = keyDown; // force moving down!
312 RedDiskReleaseFlag = 0; // moving down to up ...
318 RedDiskReleaseFlag = 0; // moving right to left ...
324 RedDiskReleaseFlag = 0; // moving up to down ...
330 RedDiskReleaseFlag = 0; // moving left to right ...
335 case keySpaceUp: // 5
336 RedDiskReleaseFlag = 0; // touching down to up ...
341 case keySpaceLeft: // 6
342 RedDiskReleaseFlag = 0; // touching right to left ...
347 case keySpaceDown: // 7
348 RedDiskReleaseFlag = 0; // touching up to down ...
353 case keySpaceRight: // 8
354 RedDiskReleaseFlag = 0; // touching left to right ...
360 goto loc_g_62E2; // no move ...
365 RedDiskReleaseFlag = 0;
370 // ==========================================================================
371 // moving down to up ...
372 // ==========================================================================
378 ax = PlayField16[*si - FieldWidth];
389 if (ax == fiInfotron)
395 if (al == fiTerminal)
398 if (al == fiPortUp || al == fiPortUpAndDown || al == fiPortAllDirections)
404 if (al == fiYellowDisk)
407 if (! subMoveKillsMurphy(*si - FieldWidth, ax, bl))
412 // ==========================================================================
413 // moving right to left ...
414 // ==========================================================================
420 MurphyVarFaceLeft = 1;
421 ax = PlayField16[*si - 1];
432 if (ax == fiInfotron)
441 if (al == fiTerminal)
444 if (al == fiPortLeft || al == fiPortLeftAndRight || al == fiPortAllDirections)
450 if (ax == fiYellowDisk)
453 if (ax == fiOrangeDisk)
456 if (! subMoveKillsMurphy(*si - 1, ax, bl))
461 // ==========================================================================
462 // moving up to down ...
463 // ==========================================================================
469 ax = PlayField16[*si + FieldWidth];
480 if (ax == fiInfotron)
486 if (al == fiTerminal)
489 if (al == fiPortDown || al == fiPortUpAndDown || al == fiPortAllDirections)
495 if (al == fiYellowDisk)
498 if (! subMoveKillsMurphy(*si + FieldWidth, ax, bl))
503 // ==========================================================================
504 // moving left to right ...
505 // ==========================================================================
511 MurphyVarFaceLeft = 0;
512 ax = PlayField16[*si + 1];
523 if (ax == fiInfotron)
532 if (al == fiTerminal)
535 if (al == fiPortRight || al == fiPortLeftAndRight || al == fiPortAllDirections)
541 if (al == fiYellowDisk)
544 if (ax == fiOrangeDisk)
547 if (! subMoveKillsMurphy(*si + 1, ax, bl))
552 // ==========================================================================
553 // touching down to up ...
554 // ==========================================================================
559 dxPos = *si - FieldWidth;
561 ax = PlayField16[*si - FieldWidth];
570 if (ax == fiInfotron)
573 if (al == fiTerminal)
581 // ==========================================================================
582 // touching right to left ...
583 // ==========================================================================
590 MurphyVarFaceLeft = 1;
591 ax = PlayField16[*si - 1];
599 if (ax == fiInfotron)
602 if (al == fiTerminal)
610 // ==========================================================================
611 // touching up to down ...
612 // ==========================================================================
617 dxPos = *si + FieldWidth;
619 ax = PlayField16[*si + FieldWidth];
627 if (ax == fiInfotron)
630 if (al == fiTerminal)
638 // ==========================================================================
639 // touching left to right ...
640 // ==========================================================================
647 MurphyVarFaceLeft = 0;
648 ax = PlayField16[*si + 1];
656 if (ax == fiInfotron)
659 if (al == fiTerminal)
667 // ==========================================================================
668 // Release Red disk: no move ...
669 // ==========================================================================
675 if (LowByte(RedDiskCount) == 0)
678 if (LowByte(RedDiskReleasePhase) != 0)
681 if (LowByte(RedDiskReleaseFlag) != 1)
684 MovHighByte(&PlayField16[*si], 0x2A);
685 MovingPictureSequencePhase = 0x40; // init picture move sequence
686 dx = aniFramesRedDisk;
688 MovLowByte(&RedDiskReleasePhase, 1);
689 Mov(&RedDiskReleaseMurphyPos, *si); // remember Murphy's location
692 // ==========================================================================
693 // SPACE moving down to up
694 // ==========================================================================
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;
704 // ==========================================================================
705 // SPACE moving right to left
706 // ==========================================================================
709 dx = aniFramesMurphyEatLeft;
710 dx1 = aniMurphyMoveLeft;
711 PlayField16[*si - 1] = 0x203;
712 PlayField16[*si] = 0x300;
714 goto loc_StopNoSplit;
716 // ==========================================================================
717 // SPACE moving up to down, and when gravity is pulling!
718 // ==========================================================================
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;
728 // ==========================================================================
729 // SPACE moving left to right
730 // ==========================================================================
733 dx = aniFramesMurphyEatRight;
734 dx1 = aniMurphyMoveRight;
735 PlayField16[*si + 1] = 0x403;
736 PlayField16[*si] = 0x300;
738 goto loc_StopNoSplit;
740 // ==========================================================================
741 // BUG moving down to up
742 // ==========================================================================
745 if (SgnHighByte(PlayField16[*si - FieldWidth]) >= 0)
747 ExplodeFieldSP(*si); // Explode
752 PlayField16[*si - FieldWidth] = fiBase;
753 // ==========================================================================
754 // BASE moving down to up
755 // ==========================================================================
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;
766 // ==========================================================================
767 // BUG moving right to left
768 // ==========================================================================
771 if (SgnHighByte(PlayField16[*si - 1]) >= 0)
773 ExplodeFieldSP(*si); // Explode
778 PlayField16[*si - 1] = fiBase;
779 // ==========================================================================
780 // BASE moving right to left
781 // ==========================================================================
785 dx = aniFramesMurphyEatLeft;
786 dx1 = aniMurphyDigLeft;
787 PlayField16[*si - 1] = 0x203;
788 PlayField16[*si] = 0x300;
790 goto loc_StopNoSplit;
792 // ==========================================================================
793 // BUG moving up to down
794 // ==========================================================================
797 if (SgnHighByte(PlayField16[*si + FieldWidth]) >= 0)
799 ExplodeFieldSP(*si); // Explode
804 PlayField16[*si + FieldWidth] = fiBase;
805 // ==========================================================================
806 // BASE moving up to down
807 // ==========================================================================
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;
818 // ==========================================================================
819 // BUG moving left to right
820 // ==========================================================================
823 if (SgnHighByte(PlayField16[*si + 1]) >= 0)
825 ExplodeFieldSP(*si); // Explode
830 PlayField16[*si + 1] = fiBase;
831 // ==========================================================================
832 // BASE moving left to right
833 // ==========================================================================
837 dx = aniFramesMurphyEatRight;
838 dx1 = aniMurphyDigRight;
839 PlayField16[*si + 1] = 0x803;
840 PlayField16[*si] = 0x300;
842 goto loc_StopNoSplit;
844 // ==========================================================================
845 // BUG touching down to up
846 // ==========================================================================
849 if (SgnHighByte(PlayField16[*si - FieldWidth]) >= 0)
851 ExplodeFieldSP(*si); // Explode
856 PlayField16[*si - FieldWidth] = fiBase;
857 // ==========================================================================
858 // BASE touching down to up
859 // ==========================================================================
862 subCopyImageToScreen(*si, aniMurphyTouchUp);
864 dx = aniFramesTouchBase;
866 dxPos = *si - FieldWidth;
867 MovHighByte(&PlayField16[*si], 0x10);
868 goto loc_StopNoSplit;
870 // ==========================================================================
871 // BUG touching right to left
872 // ==========================================================================
875 if (SgnHighByte(PlayField16[*si - 1]) >= 0)
877 ExplodeFieldSP(*si); // Explode
882 PlayField16[*si - 1] = fiBase;
883 // ==========================================================================
884 // BASE touching right to left
885 // ==========================================================================
888 subCopyImageToScreen(*si, aniMurphyTouchLeft);
890 dx = aniFramesTouchBase;
893 MovHighByte(&PlayField16[*si], 0x11);
894 goto loc_StopNoSplit;
896 // ==========================================================================
897 // BUG touching up to down
898 // ==========================================================================
901 if (SgnHighByte(PlayField16[*si + FieldWidth]) >= 0)
903 ExplodeFieldSP(*si); // Explode
908 PlayField16[*si + FieldWidth] = fiBase;
909 // ==========================================================================
910 // BASE touching up to down
911 // ==========================================================================
914 subCopyImageToScreen(*si, aniMurphyTouchDown);
916 dx = aniFramesTouchBase;
918 dxPos = *si + FieldWidth;
919 MovHighByte(&PlayField16[*si], 0x12);
920 goto loc_StopNoSplit;
922 // ==========================================================================
923 // BUG touching left to right
924 // ==========================================================================
927 if (SgnHighByte(PlayField16[*si + 1]) >= 0)
929 ExplodeFieldSP(*si); // Explode
934 PlayField16[*si + 1] = fiBase;
935 // ==========================================================================
936 // BASE touching left to right
937 // ==========================================================================
940 subCopyImageToScreen(*si, aniMurphyTouchRight);
942 dx = aniFramesTouchBase;
945 MovHighByte(&PlayField16[*si], 0x13);
946 goto loc_StopNoSplit;
948 // ==========================================================================
949 // INFOTRON moving down to up
950 // ==========================================================================
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;
961 // ==========================================================================
962 // INFOTRON moving right to left
963 // ==========================================================================
966 subSoundFXInfotron();
967 dx = aniFramesEatInfotronLeft;
968 dx1 = aniEatInfotronLeft;
974 PlayField16[*si - 1] = 0xA03;
975 PlayField16[*si] = 0x300;
977 goto loc_StopNoSplit;
979 // ==========================================================================
980 // INFOTRON moving up to down
981 // ==========================================================================
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;
992 // ==========================================================================
993 // INFOTRON moving left to right
994 // ==========================================================================
997 subSoundFXInfotron();
998 dx = aniFramesEatInfotronRight;
999 dx1 = aniEatInfotronRight;
1005 PlayField16[*si + 1] = 0xC03;
1006 PlayField16[*si] = 0x300;
1008 goto loc_StopNoSplit;
1010 // ==========================================================================
1011 // INFOTRON touching down to up
1012 // ==========================================================================
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;
1023 // ==========================================================================
1024 // INFOTRON touching right to left
1025 // ==========================================================================
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;
1036 // ==========================================================================
1037 // INFOTRON touching up to down
1038 // ==========================================================================
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;
1049 // ==========================================================================
1050 // INFOTRON touching left to right
1051 // ==========================================================================
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;
1062 // ==========================================================================
1063 // EXIT pressed from any direction
1064 // ==========================================================================
1072 if (LowByte(InfotronsNeeded) != 0)
1076 if (!game_sp_info.LevelSolved)
1077 printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n",LevelNumber);
1081 game_sp_info.LevelSolved = TRUE;
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?
1090 if (UpdateTimeFlag != 0) // update time?
1092 UpdatedFlag = 1; // prevent double update
1093 subUpdatePlayingTime(); // update playing time
1098 subUpdateHallOfFame(); // update time + Hall-Of-Fame
1101 LeadOutCounter = 0x40; // quit: start lead-out
1102 dx = aniFramesMurphyExit;
1103 dx1 = aniMurphyExit;
1104 MovHighByte(&PlayField16[*si], 0xD);
1105 goto loc_StopNoSplit;
1107 // ==========================================================================
1108 // ZONK moving right to left
1109 // ==========================================================================
1112 ax = PlayField16[*si - 2];
1116 MovHighByte(&PlayField16[*si - 2], 1);
1117 subCopyImageToScreen(*si, aniPushLeft); // draw pushing murphy
1118 dx = aniFramesZonkRollLeft;
1119 dx1 = aniZonkRollLeft;
1123 MovHighByte(&PlayField16[*si], 0xE);
1124 goto loc_MoveNoSplit;
1126 // ==========================================================================
1127 // ZONK moving left to right
1128 // ==========================================================================
1131 ax = PlayField16[*si + 2];
1135 ax = PlayField16[*si + FieldWidth + 1];
1136 if (ax == 0) // zonk falls
1139 MovHighByte(&PlayField16[*si + 2], 1);
1140 subCopyImageToScreen(*si, aniPushRight); // draw pushing murphy
1141 dx = aniFramesZonkRollRight;
1142 dx1 = aniZonkRollRight;
1146 MovHighByte(&PlayField16[*si], 0xF);
1147 goto loc_MoveNoSplit;
1149 // ==========================================================================
1150 // TERMINAL moving/touching down to up
1151 // ==========================================================================
1154 subCopyImageToScreen(*si, aniMurphyTouchUp);
1155 if (YellowDisksExploded != 0)
1157 YawnSleepCounter = 40; // stay hypnotized
1163 // draw new terminal type
1165 GfxGraphic[GetX(*si - FieldWidth)][GetY(*si - FieldWidth)] = aniTerminalActive;
1167 subCopyImageToScreen(*si - FieldWidth, aniTerminalActive);
1170 subCopyFieldToScreen(*si - FieldWidth, 0x88); // draw new terminal type
1172 TerminalState[*si - FieldWidth] = 8;
1175 // ==========================================================================
1176 // TERMINAL moving/touching right to left
1177 // ==========================================================================
1180 subCopyImageToScreen(*si, aniMurphyTouchLeft);
1181 if (YellowDisksExploded != 0)
1183 YawnSleepCounter = 40; // stay hypnotized
1189 // draw new terminal type
1191 GfxGraphic[GetX(*si - 1)][GetY(*si - 1)] = aniTerminalActive;
1193 subCopyImageToScreen(*si - 1, aniTerminalActive);
1196 subCopyFieldToScreen(*si - 1, 0x88); // draw new terminal type
1198 TerminalState[*si - 1] = 8;
1201 // ==========================================================================
1202 // TERMINAL moving/touching up to down
1203 // ==========================================================================
1206 subCopyImageToScreen(*si, aniMurphyTouchDown);
1207 if (YellowDisksExploded != 0)
1209 YawnSleepCounter = 40; // stay hypnotized
1215 // draw new terminal type
1217 GfxGraphic[GetX(*si + FieldWidth)][GetY(*si + FieldWidth)] = aniTerminalActive;
1219 subCopyImageToScreen(*si + FieldWidth, aniTerminalActive);
1222 subCopyFieldToScreen(*si + FieldWidth, 0x88); // draw new terminal type
1224 TerminalState[*si + FieldWidth] = 8;
1227 // ==========================================================================
1228 // TERMINAL moving/touching left to right
1229 // ==========================================================================
1232 subCopyImageToScreen(*si, aniMurphyTouchRight);
1233 if (YellowDisksExploded != 0)
1235 YawnSleepCounter = 40; // stay hypnotized
1241 // draw new terminal type
1243 GfxGraphic[GetX(*si + 1)][GetY(*si + 1)] = aniTerminalActive;
1245 subCopyImageToScreen(*si + 1, aniTerminalActive);
1248 subCopyFieldToScreen(*si + 1, 0x88); // draw new terminal type
1250 TerminalState[*si + 1] = 8;
1251 // ==========================================================================
1252 // common TERMINAL stuff moving/touching from all directions
1253 // ==========================================================================
1256 TerminalMaxCycles = 7;
1257 YellowDisksExploded = 1;
1258 for (i = 0; i <= LevelMax; i++)
1260 if (PlayField16[i] == fiYellowDisk)
1266 // ==========================================================================
1267 // PORT down to up, VERTICAL PORT, CROSS PORT all moving down to up
1268 // ==========================================================================
1271 if (PlayField16[*si - 2 * FieldWidth] != 0)
1274 dx = aniFramesSplitUpDown;
1275 dx1 = aniSplitUpDown;
1276 dx2Step = -FieldWidth;
1277 PlayField16[*si] = 0x1803;
1278 PlayField16[*si - 2 * FieldWidth] = 0x300;
1281 // ==========================================================================
1282 // PORT right to left, HORIZONTAL PORT, CROSS PORT all moving right to left
1283 // ==========================================================================
1286 if (PlayField16[*si - 2] != 0)
1289 dx = aniFramesMurphyEatLeft;
1290 dx1 = aniMurphyMoveLeft;
1292 PlayField16[*si] = 0x1903;
1293 PlayField16[*si - 2] = 0x300;
1296 // ==========================================================================
1297 // PORT up to down, VERTICAL PORT, CROSS PORT all moving up to down
1298 // ==========================================================================
1301 if (PlayField16[*si + 2 * FieldWidth] != 0)
1304 dx = aniFramesSplitUpDown;
1305 dx1 = aniSplitUpDown;
1306 dx2Step = FieldWidth;
1307 PlayField16[*si] = 0x1A03;
1308 PlayField16[*si + 2 * FieldWidth] = 0x300;
1311 // ==========================================================================
1312 // PORT left to right, HORIZONTAL PORT, CROSS PORT all moving left to right
1313 // ==========================================================================
1316 if (PlayField16[*si + 2] != 0)
1319 dx = aniFramesMurphyEatRight;
1320 dx1 = aniMurphyMoveRight;
1322 PlayField16[*si] = 0x1B03;
1323 PlayField16[*si + 2] = 0x300;
1326 MovingPictureSequencePhase = 0; // stop picture move sequence
1327 SplitMoveFlag = 1; // port: split movement
1330 // ==========================================================================
1331 // RED DISK moving down to up
1332 // ==========================================================================
1335 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
1336 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
1337 PlayField16[*si] = 0x1C03;
1338 PlayField16[*si - FieldWidth] = 0x300;
1339 goto loc_StopNoSplit;
1341 // ==========================================================================
1342 // RED DISK moving right to left
1343 // ==========================================================================
1346 dx = aniFramesMurphyEatLeft;
1347 dx1 = aniMurphyEatLeft;
1348 PlayField16[*si] = 0x300; // !!!!!! this time we move murphy at sequence-start!
1349 PlayField16[*si - 1] = 0x1D03;
1351 goto loc_StopNoSplit;
1353 // ==========================================================================
1354 // RED DISK moving up to down
1355 // ==========================================================================
1358 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
1359 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
1360 PlayField16[*si] = 0x1E03;
1361 PlayField16[*si + FieldWidth] = 0x300;
1362 goto loc_StopNoSplit;
1364 // ==========================================================================
1365 // RED DISK moving left to right
1366 // ==========================================================================
1369 // dx = aniFramesMurphyEatRightRedDisk 'this sequence is 9 steps long!
1370 dx = aniFramesMurphyEatRight;
1371 dx1 = aniMurphyEatRight;
1372 // --------------------------------------------------------------------------
1374 // Table data_h_145A, pointed to by table data_h_105E, has a severe bug:
1375 // The Red Disk sequence is 8 pictures long, but 9 are displayed, because it
1376 // has 1 extra entry, which causes Murphy to end slightly shifted to the left!
1377 // We may not fix the table, because then the timing of the game changes
1378 // and several existing demo's do not run properly anymore.
1379 // We only correct Murphies x-location here, when the sequence starts.
1380 // Remember that this is not the real bug-fix, but we must live with
1381 // this existing bug and correct for the consequences of it.
1384 if (0 == AllowEatRightRedDiskBug) // Murphy's screen x-position
1385 MurphyScreenXPos = MurphyScreenXPos - 2 * MurphyZoomFactor;
1387 if (0 == AllowEatRightRedDiskBug) // Murphy's screen x-position
1388 MurphyScreenXPos = MurphyScreenXPos - 2;
1392 // FS: for me this means to blit the first animation frame twice
1394 // --------------------------------------------------------------------------
1395 PlayField16[*si] = 0x300; // !!!!!! this time we move murphy at sequence-start!
1396 PlayField16[*si + 1] = 0x1F03;
1398 goto loc_StopNoSplit;
1400 // ==========================================================================
1401 // RED DISK touching down to up
1402 // ==========================================================================
1405 dx = aniFramesTouchRedDisk;
1406 dx1 = aniTouchRedDisk;
1407 MovHighByte(&PlayField16[*si], 0x20);
1408 MovHighByte(&PlayField16[*si - FieldWidth], 3);
1409 goto loc_StopNoSplit;
1411 // ==========================================================================
1412 // RED DISK touching right to left
1413 // ==========================================================================
1416 dx = aniFramesTouchRedDisk;
1417 dx1 = aniTouchRedDisk;
1418 MovHighByte(&PlayField16[*si], 0x21);
1419 MovHighByte(&PlayField16[*si - 1], 3);
1420 goto loc_StopNoSplit;
1422 // ==========================================================================
1423 // RED DISK touching up to down
1424 // ==========================================================================
1427 dx = aniFramesTouchRedDisk;
1428 dx1 = aniTouchRedDisk;
1429 MovHighByte(&PlayField16[*si], 0x22);
1430 MovHighByte(&PlayField16[*si + FieldWidth], 3);
1431 goto loc_StopNoSplit;
1433 // ==========================================================================
1434 // RED DISK touching left to right
1435 // ==========================================================================
1438 dx = aniFramesTouchRedDisk;
1439 dx1 = aniTouchRedDisk;
1440 MovHighByte(&PlayField16[*si], 0x23);
1441 MovHighByte(&PlayField16[*si + 1], 3);
1444 MovingPictureSequencePhase = 0; // stop picture move sequence
1447 // ==========================================================================
1448 // YELLOW DISK moving down to up
1449 // ==========================================================================
1452 if (PlayField16[*si - 2 * FieldWidth] != 0)
1455 PlayField16[*si - 2 * FieldWidth] = 0x1200;
1457 subCopyImageToScreen(*si, aniPushRight);
1459 dx = aniFramesYellowDisk;
1460 dx1 = aniYellowDisk;
1461 dxPos = *si - FieldWidth;
1463 dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
1465 dx2 = aniPushUpDown;
1467 dx2Step = FieldWidth;
1468 PlayField16[*si] = 0x2403;
1470 subCopyImageToScreen(*si, dx2);
1472 goto loc_MoveNoSplit;
1474 // ==========================================================================
1475 // YELLOW DISK moving right to left
1476 // ==========================================================================
1479 if (PlayField16[*si - 2] != 0)
1482 PlayField16[*si - 2] = 0x1200;
1483 subCopyImageToScreen(*si, aniPushLeft);
1484 dx = aniFramesYellowDisk;
1485 dx1 = aniYellowDisk;
1489 PlayField16[*si] = 0x2503;
1490 goto loc_MoveNoSplit;
1492 // ==========================================================================
1493 // YELLOW DISK moving up to down
1494 // ==========================================================================
1497 if (PlayField16[*si + 2 * FieldWidth] != 0)
1500 PlayField16[*si + 2 * FieldWidth] = 0x1200;
1502 subCopyImageToScreen(*si, aniPushRight);
1504 dx = aniFramesYellowDisk;
1505 dx1 = aniYellowDisk;
1506 dxPos = *si + FieldWidth;
1508 dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
1510 dx2 = aniPushUpDown;
1512 dx2Step = -FieldWidth;
1513 PlayField16[*si] = 0x2703;
1515 subCopyImageToScreen(*si, dx2);
1517 goto loc_MoveNoSplit;
1519 // ==========================================================================
1520 // YELLOW DISK moving left to right
1521 // ==========================================================================
1524 if (PlayField16[*si + 2] != 0)
1527 PlayField16[*si + 2] = 0x1200;
1528 subCopyImageToScreen(*si, aniPushRight);
1529 dx = aniFramesYellowDisk;
1530 dx1 = aniYellowDisk;
1534 PlayField16[*si] = 0x2603;
1535 goto loc_MoveNoSplit;
1537 // ==========================================================================
1538 // ORANGE DISK moving right to left
1539 // ==========================================================================
1542 if (PlayField16[*si - 2] != 0)
1545 PlayField16[*si - 2] = 0x800;
1546 subCopyImageToScreen(*si, aniPushLeft);
1547 dx = aniFramesOrangeDisk;
1548 dx1 = aniOrangeDisk;
1552 PlayField16[*si] = 0x2803;
1553 goto loc_MoveNoSplit;
1555 // ==========================================================================
1556 // ORANGE DISK moving left to right
1557 // ==========================================================================
1560 if (PlayField16[*si + 2] != 0)
1563 if (PlayField16[*si + FieldWidth + 1] == 0) // falling goes before pushing
1566 PlayField16[*si + 2] = 0x100;
1567 subCopyImageToScreen(*si, aniPushRight);
1568 dx = aniFramesOrangeDisk;
1569 dx1 = aniOrangeDisk;
1573 PlayField16[*si] = 0x2903;
1574 // ==========================================================================
1575 // Copy screen animation action table to action work space
1576 // (To paint sequence: Push Zonk/Disk / release red disk / Port passing)
1577 // ==========================================================================
1580 MovingPictureSequencePhase = 8; // init picture move sequence
1583 SplitMoveFlag = 0; // no port: no split movement
1586 // copy/store global move sequence info????????????????????????????????????
1587 // ... dont think so ...(FS)
1588 // ==========================================================================
1589 // Proceed with all movements
1590 // ==========================================================================
1592 locProceedMovingMurphy: // proceed moving murphy
1593 YawnSleepCounter = 0; // Wake up sleeping Murphy
1594 ax = MovingPictureSequencePhase; // sequence busy?
1595 if (ax == 0) // no -- start sequence!
1598 ax = ax - 1; // next picture of sequence
1599 MovingPictureSequencePhase = ax; // store for later
1600 if (ax == 0) // Sound effects
1603 bl = HighByte(PlayField16[*si]);
1604 if (bl == 0xE) // Push Zonk to left
1607 if (bl == 0xF) // Push Zonk to right
1610 if (bl == 0x28) // Push orange disk to left
1613 if (bl == 0x29) // Push orange disk to right
1616 if (bl == 0x24) // Push yellow disk up
1619 if (bl == 0x25) // Push yellow disk to left
1622 if (bl == 0x27) // Push yellow disk down
1625 if (bl == 0x26) // Push yellow disk to right
1628 if (bl == 0x2A) // Red disk release timer
1633 // ==========================================================================
1634 // Paint frame of MOVING.DAT sequence
1635 // ==========================================================================
1641 dx1SequenceLength = getSequenceLength(dx1);
1644 if (SplitMoveFlag == 0)
1646 // ++++++++++++++++++++++++++
1647 // Begin of normal movement
1649 MurphyScreenXPos = MurphyScreenXPos + MurphyDX * MurphyZoomFactor;
1650 MurphyScreenYPos = MurphyScreenYPos + MurphyDY * MurphyZoomFactor;
1652 MurphyScreenXPos = MurphyScreenXPos + MurphyDX;
1653 MurphyScreenYPos = MurphyScreenYPos + MurphyDY;
1658 printf("::: %04d [%03ld, %02d] ----------> %s [%d] [%d, %d] [%d, %d] [%d]\n",
1660 DemoOffset - DemoPointer, DemoKeyRepeatCounter,
1661 (DemoKeyCode == keyNone ? "(none)" :
1662 DemoKeyCode == keyLeft ? "left" :
1663 DemoKeyCode == keyRight ? "right" :
1664 DemoKeyCode == keyUp ? "up" :
1665 DemoKeyCode == keyDown ? "down" :
1666 DemoKeyCode == keySpace ? "space" :
1667 DemoKeyCode == keySpaceLeft ? "space + left" :
1668 DemoKeyCode == keySpaceRight ? "space + right" :
1669 DemoKeyCode == keySpaceUp ? "space + up" :
1670 DemoKeyCode == keySpaceDown ? "space + down" : "(unknown)"),
1672 MurphyScreenXPos, MurphyScreenYPos,
1673 MurphyPosIndex % 60, MurphyPosIndex / 60,
1682 if (!(ClearPos < 0)) // clear field that murphy is leaving
1683 subCopyImageToScreen(ClearPos, aniSpace);
1685 if (! ClearPos < 0) // clear field that murphy is leaving
1686 subCopyFieldToScreen(ClearPos, 0);
1690 printf("::: ---------------> %d, %d [%d, %d]\n",
1691 MurphyScreenXPos, MurphyScreenYPos, MurphyDX, MurphyDY);
1694 if (dx2 == fiInfotron) // special case of infotron moving left or right
1701 tDeltaX = MurphyDX * LocalStretch * (SeqPos + 1);
1702 tDeltaY = MurphyDY * LocalStretch * (SeqPos + 1);
1705 X = GetStretchX(dxPos) + tDeltaX;
1706 Y = GetStretchY(dxPos) + tDeltaY;
1707 Tmp = (SeqPos < 0 ? 0 : SeqPos); // 9StepBugFix!(red disk move right)
1710 if (isSnappingSequence(dx1) && SeqPos == dx1SequenceLength - 1)
1715 StretchedSprites.BltImg(X, Y, dx1, Tmp);
1716 GfxGraphic[GetX(*si)][GetY(*si)] = -1; // (Murphy's position)
1717 GfxGraphic[GetX(dxPos)][GetY(dxPos)] = -1; // (snapping position)
1718 // printf("::: Tmp: %d\n", Tmp);
1720 StretchedSprites.BltEx(X, Y, dx[Tmp]);
1729 tPos = dxPos + dx2Step;
1730 X = GetStretchX(tPos);
1731 Y = GetStretchY(tPos);
1732 if (dx2 == fiInfotron) // special case of infotron moving left or right
1734 StretchedSprites.BltEx(X, Y, dx[SeqPos] + dx2Step);
1736 else // pushing something
1739 // (SeqPos iterates from 0 to 7 while pushing)
1740 StretchedSprites.BltImg(X + tDeltaX, Y + tDeltaY, dx2, SeqPos);
1741 // printf("::: SeqPos: %d\n", SeqPos);
1743 StretchedSprites.BltEx(X + tDeltaX, Y + tDeltaY, dx2);
1748 // End of normal movement
1749 // ------------------------
1753 // ++++++++++++++++++++++++++++++++
1754 // Begin of split movement (port)
1756 MurphyScreenXPos = MurphyScreenXPos + 2 * MurphyDX * MurphyZoomFactor;
1757 MurphyScreenYPos = MurphyScreenYPos + 2 * MurphyDY * MurphyZoomFactor;
1759 MurphyScreenXPos = MurphyScreenXPos + 2 * MurphyDX;
1760 MurphyScreenYPos = MurphyScreenYPos + 2 * MurphyDY;
1762 subCopyImageToScreen(ClearPos, aniSpace); // clear the field that murphy leaves
1763 tDeltaX = MurphyDX * LocalStretch * (SeqPos + 1);
1764 tDeltaY = MurphyDY * LocalStretch * (SeqPos + 1);
1765 X = GetStretchX(dxPos) + tDeltaX;
1766 Y = GetStretchY(dxPos) + tDeltaY;
1767 StretchedSprites.BltEx(X, Y, dx[SeqPos]); // plot first murphy
1768 tPos = dxPos + dx2Step;
1769 X = GetStretchX(tPos);
1770 Y = GetStretchY(tPos);
1771 StretchedSprites.BltEx(X + tDeltaX, Y + tDeltaY, dx[SeqPos]); // plot second murphy
1772 StretchedSprites.BltEx(X, Y, LowByte(PlayField16[tPos])); // replot the port on top
1773 // End of split movement (port)
1774 // ------------------------------
1775 } // loc_g_6D1E:'loc_g_6D28:
1777 SeqPos = SeqPos + 1;
1779 if (SeqPos < dx1SequenceLength)
1782 if (dx[SeqPos] > -1)
1786 // Follow-up after movement completed 'loc_g_6D35:
1787 MurphyXPos = MurphyXPos + MurphyDX;
1788 MurphyYPos = MurphyYPos + MurphyDY;
1789 bl = HighByte(PlayField16[*si]); // animation phase
1790 MovHighByte(&PlayField16[*si], 0);
1792 if (bl == 0x1) // space, moving up
1795 if (bl == 0x2) // space, moving left
1798 if (bl == 0x3) // space, moving down
1801 if (bl == 0x4) // space, moving right
1804 if (bl == 0x5) // base , moving up
1807 if (bl == 0x6) // base , moving left -> 6 is not used, value is set to 2 instead of 6!
1810 if (bl == 0x7) // base , moving down
1813 if (bl == 0x8) // base , moving right
1816 if (bl == 0x9) // infotron, moving up
1819 if (bl == 0xA) // infotron, moving left
1822 if (bl == 0xB) // infotron, moving down
1825 if (bl == 0xC) // infotron, moving right
1828 if (bl == 0xD) // exit
1831 if (bl == 0xE) // zonk, pushing left
1834 if (bl == 0xF) // zonk, pushing right
1837 if (bl == 0x10) // base , touching up
1840 if (bl == 0x11) // base , touching left
1843 if (bl == 0x12) // base , touching down
1846 if (bl == 0x13) // base , touching right
1849 if (bl == 0x14) // infotron touching up
1852 if (bl == 0x15) // infotron touching left
1855 if (bl == 0x16) // infotron touching down
1858 if (bl == 0x17) // infotron touching right
1861 if (bl == 0x18) // port up
1864 if (bl == 0x19) // port left
1867 if (bl == 0x1A) // port down
1870 if (bl == 0x1B) // port right
1873 if (bl == 0x1C) // red disk, moving up
1876 if (bl == 0x1D) // red disk, moving left
1879 if (bl == 0x1E) // red disk, moving down
1882 if (bl == 0x1F) // red disk, moving right -> 9-Step-Bug!
1885 if (bl == 0x20) // red disk, touching up
1888 if (bl == 0x21) // red disk, touching left
1891 if (bl == 0x22) // red disk, touching down
1894 if (bl == 0x23) // red disk, touching right
1897 if (bl == 0x24) // yellow disk, pushing up
1900 if (bl == 0x25) // yellow disk, pushing left
1903 if (bl == 0x26) // yellow disk, pushing right -> order of "down" exchanged with "right"!
1906 if (bl == 0x27) // yellow disk, pushing down -> order of "down" exchanged with "right"!
1909 if (bl == 0x28) // orange disk, pushing left
1912 if (bl == 0x29) // orange disk, pushing right
1915 if (bl == 0x2A) // red disk, release
1922 // ==========================================================================
1923 // infotron, moving up
1924 // ==========================================================================
1927 if (0 < LowByte(InfotronsNeeded))
1928 InfotronsNeeded = InfotronsNeeded - 1;
1930 subDisplayInfotronsNeeded();
1931 loc_g_6EC8: // space, base
1932 PlayField16[*si] = fiMurphy;
1933 subAdjustZonksInfotronsAboveMurphy(*si + FieldWidth);
1937 // ==========================================================================
1938 // infotron, moving left
1939 // ==========================================================================
1942 if (0 < LowByte(InfotronsNeeded))
1943 InfotronsNeeded = InfotronsNeeded - 1;
1945 subDisplayInfotronsNeeded();
1946 loc_g_6EE6: // space, base
1947 PlayField16[*si] = fiMurphy;
1948 subAdjustZonksInfotronsAboveMurphy(*si + 1);
1952 // ==========================================================================
1953 // infotron, moving down
1954 // ==========================================================================
1957 if (0 < LowByte(InfotronsNeeded))
1958 InfotronsNeeded = InfotronsNeeded - 1;
1960 subDisplayInfotronsNeeded();
1961 loc_g_6F04: // space, base
1962 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
1963 PlayField16[*si - FieldWidth] = 0;
1965 PlayField16[*si] = fiMurphy;
1969 // ==========================================================================
1970 // infotron, moving right
1971 // ==========================================================================
1974 if (0 < LowByte(InfotronsNeeded))
1975 InfotronsNeeded = InfotronsNeeded - 1;
1977 subDisplayInfotronsNeeded();
1978 loc_g_71C4: // space, base
1979 subAdjustZonksInfotronsAboveMurphy(*si - 1);
1980 PlayField16[*si] = fiMurphy;
1984 // ==========================================================================
1985 // infotron, touching up
1986 // ==========================================================================
1989 if (0 < LowByte(InfotronsNeeded))
1990 InfotronsNeeded = InfotronsNeeded - 1;
1992 subDisplayInfotronsNeeded();
1994 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
1995 PlayField16[*si - FieldWidth] = 0;
1999 // ==========================================================================
2000 // infotron, touching left
2001 // ==========================================================================
2004 if (0 < LowByte(InfotronsNeeded))
2005 InfotronsNeeded = InfotronsNeeded - 1;
2007 subDisplayInfotronsNeeded();
2009 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2010 PlayField16[*si - 1] = 0;
2014 // ==========================================================================
2015 // infotron, touching down
2016 // ==========================================================================
2019 if (0 < LowByte(InfotronsNeeded))
2020 InfotronsNeeded = InfotronsNeeded - 1;
2022 subDisplayInfotronsNeeded();
2024 if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion)
2025 PlayField16[*si + FieldWidth] = 0;
2029 // ==========================================================================
2030 // infotron, touching right
2031 // ==========================================================================
2034 if (0 < LowByte(InfotronsNeeded))
2035 InfotronsNeeded = InfotronsNeeded - 1;
2037 subDisplayInfotronsNeeded();
2039 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2040 PlayField16[*si + 1] = 0;
2044 // ==========================================================================
2045 // zonk, pushing left
2046 // ==========================================================================
2049 if (LowByte(PlayField16[*si]) != fiExplosion)
2050 PlayField16[*si] = 0;
2052 PlayField16[*si - 1] = fiMurphy;
2053 PlayField16[*si - 2] = fiZonk;
2054 subExplodeSnikSnaksBelow(*si - 2);
2059 // ==========================================================================
2060 // zonk, pushing right
2061 // ==========================================================================
2064 if (LowByte(PlayField16[*si]) != fiExplosion)
2065 PlayField16[*si] = 0;
2067 PlayField16[*si + 1] = fiMurphy;
2068 PlayField16[*si + 2] = fiZonk;
2069 subExplodeSnikSnaksBelow(*si + 2);
2074 // ==========================================================================
2076 // ==========================================================================
2082 PlayField16[*si] = fiSpace; // remove Murphy from playfield after exiting
2087 // ==========================================================================
2088 // Push Zonk from right to left
2089 // ==========================================================================
2092 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiZonk)
2095 PlayField16[*si] = fiMurphy; // else restore - no more zonk pushing!
2096 PlayField16[*si - 1] = fiZonk;
2097 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2098 PlayField16[*si - 2] = 0;
2100 subCopyImageToScreen(*si, aniMurphy);
2104 // ==========================================================================
2105 // Push Zonk from left to right
2106 // ==========================================================================
2109 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiZonk)
2112 PlayField16[*si] = fiMurphy; // else restore - no more zonk pushing!
2113 PlayField16[*si + 1] = fiZonk;
2114 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2115 PlayField16[*si + 2] = 0;
2117 subCopyImageToScreen(*si, aniMurphy);
2121 // ==========================================================================
2122 // Push orange disk from right to left
2123 // ==========================================================================
2126 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiOrangeDisk)
2129 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2130 PlayField16[*si - 1] = fiOrangeDisk;
2131 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2132 PlayField16[*si - 2] = 0;
2134 subCopyImageToScreen(*si, aniMurphy);
2138 // ==========================================================================
2139 // Push orange disk from left to right
2140 // ==========================================================================
2143 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiOrangeDisk)
2146 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2147 PlayField16[*si + 1] = fiOrangeDisk;
2148 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2149 PlayField16[*si + 2] = 0;
2151 subCopyImageToScreen(*si, aniMurphy);
2155 // ==========================================================================
2156 // Push yellow disk from down to up
2157 // ==========================================================================
2160 if (DemoKeyCode == keyUp && PlayField16[*si - FieldWidth] == fiYellowDisk)
2163 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2164 PlayField16[*si - FieldWidth] = fiYellowDisk;
2165 if (LowByte(PlayField16[*si - 2 * FieldWidth]) != fiExplosion)
2166 PlayField16[*si - 2 * FieldWidth] = 0;
2168 subCopyImageToScreen(*si, aniMurphy);
2172 // ==========================================================================
2173 // Push yellow disk from right to left
2174 // ==========================================================================
2177 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiYellowDisk)
2180 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2181 PlayField16[*si - 1] = fiYellowDisk;
2182 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2183 PlayField16[*si - 2] = 0;
2185 subCopyImageToScreen(*si, aniMurphy);
2189 // ==========================================================================
2190 // Push yellow disk from up to down
2191 // ==========================================================================
2194 if (DemoKeyCode == keyDown && PlayField16[*si + FieldWidth] == fiYellowDisk)
2197 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2198 PlayField16[*si + FieldWidth] = fiYellowDisk;
2199 if (LowByte(PlayField16[*si + 2 * FieldWidth]) != fiExplosion)
2200 PlayField16[*si + 2 * FieldWidth] = 0;
2202 subCopyImageToScreen(*si, aniMurphy);
2206 // ==========================================================================
2207 // Push yellow disk from left to right
2208 // ==========================================================================
2211 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiYellowDisk)
2214 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2215 PlayField16[*si + 1] = fiYellowDisk;
2216 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2217 PlayField16[*si + 2] = 0;
2219 subCopyImageToScreen(*si, aniMurphy);
2223 // ==========================================================================
2224 // time red disk release (space)
2225 // ==========================================================================
2228 if (DemoKeyCode != keySpace)
2230 PlayField16[*si] = fiMurphy;
2231 subCopyImageToScreen(*si, aniMurphy);
2232 RedDiskReleasePhase = 0;
2234 else if (MovingPictureSequencePhase == 0x20)
2237 // anxious murphy, dropping red disk
2238 subCopyImageToScreen(*si, aniMurphyDropping);
2240 subCopyFieldToScreen(*si, 43); // anxious murphy
2242 RedDiskReleasePhase = 1;
2247 // ==========================================================================
2248 // Special port down to up
2249 // ==========================================================================
2252 if (LowByte(PlayField16[*si]) != fiExplosion)
2253 PlayField16[*si] = 0;
2255 PlayField16[*si - 2 * FieldWidth] = fiMurphy;
2257 *si = *si - FieldWidth;
2258 if (HighByte(PlayField16[*si]) == 1)
2261 *si = *si - FieldWidth;
2265 // ==========================================================================
2266 // Special port right to left
2267 // ==========================================================================
2270 if (LowByte(PlayField16[*si]) != fiExplosion)
2271 PlayField16[*si] = 0;
2273 PlayField16[*si - 2] = fiMurphy;
2276 if (HighByte(PlayField16[*si]) == 1)
2283 // ==========================================================================
2284 // Special port up to down
2285 // ==========================================================================
2288 if (LowByte(PlayField16[*si]) != fiExplosion)
2289 PlayField16[*si] = 0;
2291 PlayField16[*si + 2 * FieldWidth] = fiMurphy;
2293 *si = *si + FieldWidth;
2294 if (HighByte(PlayField16[*si]) == 1)
2297 *si = *si + FieldWidth;
2301 // ==========================================================================
2302 // Special port left to right
2303 // ==========================================================================
2306 if (LowByte(PlayField16[*si]) != fiExplosion)
2307 PlayField16[*si] = 0;
2309 PlayField16[*si + 2] = fiMurphy;
2312 if (HighByte(PlayField16[*si]) == 1)
2319 // ==========================================================================
2321 // ==========================================================================
2324 if (LowByte(PlayField16[*si]) != fiExplosion)
2325 PlayField16[*si] = 0;
2327 *si = *si - FieldWidth;
2328 PlayField16[*si] = fiMurphy;
2329 subEatRedDisk(*si); // inc+show Murphy's red disks
2333 // ==========================================================================
2334 // Move Red Disk left
2335 // ==========================================================================
2338 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2339 PlayField16[*si + 1] = 0;
2341 PlayField16[*si] = fiMurphy;
2342 subEatRedDisk(*si); // inc+show Murphy's red disks
2346 // ==========================================================================
2347 // Move Red Disk down
2348 // ==========================================================================
2351 if (LowByte(PlayField16[*si]) != fiExplosion)
2352 PlayField16[*si] = 0;
2354 *si = *si + FieldWidth;
2355 PlayField16[*si] = fiMurphy;
2356 subEatRedDisk(*si); // inc+show Murphy's red disks
2360 // ==========================================================================
2361 // Move Red Disk right
2362 // ==========================================================================
2365 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2366 PlayField16[*si - 1] = 0;
2368 PlayField16[*si] = fiMurphy;
2369 subEatRedDisk(*si); // inc+show Murphy's red disks
2373 // ==========================================================================
2375 // ==========================================================================
2378 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
2379 PlayField16[*si - FieldWidth] = 0;
2381 subEatRedDisk(*si - FieldWidth); // inc+show Murphy's red disks
2385 // ==========================================================================
2386 // Eat Red Disk left
2387 // ==========================================================================
2390 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2391 PlayField16[*si - 1] = 0;
2393 subEatRedDisk(*si - 1); // inc+show Murphy's red disks
2397 // ==========================================================================
2398 // Eat Red Disk down
2399 // ==========================================================================
2402 if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion)
2403 PlayField16[*si + FieldWidth] = 0;
2405 subEatRedDisk(*si + FieldWidth); // inc+show Murphy's red disks
2409 // ==========================================================================
2410 // Eat Red Disk right
2411 // ==========================================================================
2414 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2415 PlayField16[*si + 1] = 0;
2417 subEatRedDisk(*si + 1); // inc+show Murphy's red disks
2421 // ==========================================================================
2422 // yellow disk, pushing up
2423 // ==========================================================================
2426 if (LowByte(PlayField16[*si]) != fiExplosion)
2427 PlayField16[*si] = 0;
2429 *si = *si - FieldWidth;
2430 PlayField16[*si] = fiMurphy;
2431 PlayField16[*si - FieldWidth] = fiYellowDisk;
2435 // ==========================================================================
2436 // yellow disk, pushing left
2437 // ==========================================================================
2440 if (LowByte(PlayField16[*si]) != fiExplosion)
2441 PlayField16[*si] = 0;
2444 PlayField16[*si] = fiMurphy;
2445 PlayField16[*si - 1] = fiYellowDisk;
2449 // ==========================================================================
2450 // yellow disk, pushing down
2451 // ==========================================================================
2454 if (LowByte(PlayField16[*si]) != fiExplosion)
2455 PlayField16[*si] = 0;
2457 *si = *si + FieldWidth;
2458 PlayField16[*si] = fiMurphy;
2459 PlayField16[*si + FieldWidth] = fiYellowDisk;
2463 // ==========================================================================
2464 // yellow disk pushing right
2465 // ==========================================================================
2468 if (LowByte(PlayField16[*si]) != fiExplosion)
2469 PlayField16[*si] = 0;
2472 PlayField16[*si] = fiMurphy;
2473 PlayField16[*si + 1] = fiYellowDisk;
2477 // ==========================================================================
2478 // orange disk, pushing left
2479 // ==========================================================================
2482 if (LowByte(PlayField16[*si]) != fiExplosion)
2483 PlayField16[*si] = 0;
2486 PlayField16[*si] = fiMurphy;
2487 PlayField16[*si - 1] = fiOrangeDisk;
2491 // ==========================================================================
2492 // orange disk, pushing right
2493 // ==========================================================================
2496 if (LowByte(PlayField16[*si]) != fiExplosion)
2497 PlayField16[*si] = 0;
2500 PlayField16[*si] = fiMurphy;
2501 PlayField16[*si + 1] = fiOrangeDisk;
2502 if (PlayField16[*si + FieldWidth + 1] == 0) // make it fall down if below is empty
2504 MovHighByte(&PlayField16[*si + 1], 0x20);
2505 MovHighByte(&PlayField16[*si + FieldWidth + 1], fiOrangeDisk);
2510 // ==========================================================================
2511 // Release a red disk
2512 // ==========================================================================
2515 PlayField16[*si] = fiMurphy;
2516 RedDiskReleasePhase = 2;
2517 RedDiskCount = RedDiskCount - 1;
2518 subDisplayRedDiskCount();
2519 subSoundFXPush(); // Sound effects
2520 } // subAnimateMurphy
2522 // ==========================================================================
2524 // ==========================================================================
2525 void subExplodeSnikSnaksBelow(int si)
2529 ax = LowByte(PlayField16[si + FieldWidth]);
2530 if (ax == 0x11 || ax == 0xBB)
2531 ExplodeFieldSP(si + FieldWidth);
2532 } // subExplodeSnikSnaksBelow
2534 // ==========================================================================
2536 // Does pushing against an object kill Murphy?
2537 // ==========================================================================
2538 static boolean subMoveKillsMurphy(int si, int ax, int bl)
2540 static boolean subMoveKillsMurphy;
2546 if (ax == 0xFFFF || ax == 0xAAAA || ah == 0)
2552 if (al == fiExplosion)
2555 if (fiOrangeDisk <= al && al <= fiPortUp)
2558 ExplodeFieldSP(si); // Explode
2559 subMoveKillsMurphy = True;
2560 return subMoveKillsMurphy;
2569 ExplodeFieldSP(si); // Explode
2570 subMoveKillsMurphy = True;
2571 return subMoveKillsMurphy;
2573 loc_g_74F6: // zonk left
2575 if (! (ah == 0x20 || ah == 0x40 || ah == 0x50 || ah == 0x70))
2578 subMoveKillsMurphy = True; // Set carry flag
2579 return subMoveKillsMurphy;
2581 loc_g_7512: // zonk right
2583 if (! (ah == 0x30 || ah == 0x40 || ah == 0x60 || ah == 0x70))
2586 loc_g_752E: // Marked fields and Ports
2587 subMoveKillsMurphy = True; // Set carry flag
2588 return subMoveKillsMurphy;
2590 loc_g_7530: // explosion
2591 if ((ah & 0x80) != 0)
2598 ExplodeFieldSP(si); // Explode
2599 subMoveKillsMurphy = True; // Set carry flag
2600 return subMoveKillsMurphy;
2603 PlayField16[si] = 0;
2604 subMoveKillsMurphy = False;
2606 return subMoveKillsMurphy;
2607 } // subMoveKillsMurphy
2609 // ==========================================================================
2611 // Test If si 's a special (grav) port and If so Then fetch new values (see below)
2612 // change conditions to port specs
2613 // The 10-port data base is at data_h_0D28, 10 entries of 6 bytes each:
2614 // (hi),(lo),(gravity),(freeze zonks),(freeze enemies),(unused)
2615 // ==========================================================================
2616 int subSpPortTest(int si)
2623 cx = LInfo.SpecialPortCount; // number of special ports
2625 for (i = 0; i < cx; i++)
2628 /* this assumes that PortLocation is stored as big endian */
2629 bx = LInfo.SpecialPort[i].PortLocation;
2631 /* this assumes that PortLocation is stored as little endian */
2632 bx = HighByte(LInfo.SpecialPort[i].PortLocation);
2633 MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
2638 GravityFlag = LInfo.SpecialPort[i].Gravity;
2639 FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
2640 SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
2642 // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
2650 cx = LInfo.SpecialPortCount; // number of special ports
2651 for (i = 1; i <= cx; i++)
2654 bx = HighByte(LInfo.SpecialPort[i].PortLocation);
2655 MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
2658 GravityFlag = LInfo.SpecialPort[i].Gravity;
2659 FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
2660 SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
2661 // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
2668 return subSpPortTest;
2671 void subCopyFieldToScreen(int si, int fi)
2675 // +++++++++++++++++++++++++++++++++++++++++
2676 X = GetStretchX(si);
2677 Y = GetStretchY(si);
2678 StretchedSprites.BltEx(X, Y, fi);
2679 // +++++++++++++++++++++++++++++++++++++++++
2682 void subCopyAnimToScreen(int si, int graphic, int sync_frame)
2686 // +++++++++++++++++++++++++++++++++++++++++
2687 X = GetStretchX(si);
2688 Y = GetStretchY(si);
2689 StretchedSprites.BltImg(X, Y, graphic, sync_frame);
2690 // +++++++++++++++++++++++++++++++++++++++++
2693 void subCopyImageToScreen(int si, int graphic)
2695 subCopyAnimToScreen(si, graphic, 0);
2698 static void subEatRedDisk(int si)
2700 if (AllowRedDiskCheat == 0)
2702 if (RedDiskReleasePhase != 0)
2704 if (RedDiskReleaseMurphyPos == si)
2709 RedDiskCount = (RedDiskCount + 1) % 256;
2710 subDisplayRedDiskCount();
2713 void subAdjustZonksInfotronsAboveMurphy(int si)
2717 if (LowByte(PlayField16[si]) != fiExplosion)
2718 PlayField16[si] = 0;
2720 ax = PlayField16[si - FieldWidth];
2721 if (ax == 0 || ax == 0x9999)
2724 if (ax == fiZonk || ax == fiInfotron)
2726 MovHighByte(&PlayField16[si - FieldWidth], 0x40); // make falling straigt down
2731 loc_g_15A8: // empty above
2732 ax = PlayField16[si - FieldWidth - 1];
2733 if (ax == fiZonk || ax == fiInfotron)
2737 ax = PlayField16[si - FieldWidth + 1];
2738 if (ax == fiZonk || ax == fiInfotron)
2743 loc_g_15C5: // zonk/infotron above left
2744 ax = PlayField16[si - 1];
2745 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM)) // continue testing right above
2748 MovHighByte(&PlayField16[si - FieldWidth - 1], 0x60); // make roll right
2749 PlayField16[si - FieldWidth] = 0x8888;
2753 loc_g_15E8: // zonk/infotron above right
2754 ax = PlayField16[si + 1];
2755 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
2757 MovHighByte(&PlayField16[si - FieldWidth + 1], 0x50); // make roll left
2758 PlayField16[si - FieldWidth] = 0x8888;
2760 } // subAdjustZonksInfotronsAboveMurphy