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 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 subSoundFX(*si, fiBase, actDigging);
764 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
765 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
766 PlayField16[*si - FieldWidth] = 0x503;
767 PlayField16[*si] = 0x300;
768 *si = *si - FieldWidth;
769 goto loc_StopNoSplit;
771 // ==========================================================================
772 // BUG moving right to left
773 // ==========================================================================
776 if (SgnHighByte(PlayField16[*si - 1]) >= 0)
778 ExplodeFieldSP(*si); // Explode
783 PlayField16[*si - 1] = fiBase;
784 // ==========================================================================
785 // BASE moving right to left
786 // ==========================================================================
790 subSoundFX(*si, fiBase, actDigging);
795 dx = aniFramesMurphyEatLeft;
796 dx1 = aniMurphyDigLeft;
797 PlayField16[*si - 1] = 0x203;
798 PlayField16[*si] = 0x300;
800 goto loc_StopNoSplit;
802 // ==========================================================================
803 // BUG moving up to down
804 // ==========================================================================
807 if (SgnHighByte(PlayField16[*si + FieldWidth]) >= 0)
809 ExplodeFieldSP(*si); // Explode
814 PlayField16[*si + FieldWidth] = fiBase;
815 // ==========================================================================
816 // BASE moving up to down
817 // ==========================================================================
821 subSoundFX(*si, fiBase, actDigging);
826 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
827 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
828 PlayField16[*si + FieldWidth] = 0x703;
829 PlayField16[*si] = 0x300;
830 *si = *si + FieldWidth;
831 goto loc_StopNoSplit;
833 // ==========================================================================
834 // BUG moving left to right
835 // ==========================================================================
838 if (SgnHighByte(PlayField16[*si + 1]) >= 0)
840 ExplodeFieldSP(*si); // Explode
845 PlayField16[*si + 1] = fiBase;
846 // ==========================================================================
847 // BASE moving left to right
848 // ==========================================================================
852 subSoundFX(*si, fiBase, actDigging);
857 dx = aniFramesMurphyEatRight;
858 dx1 = aniMurphyDigRight;
859 PlayField16[*si + 1] = 0x803;
860 PlayField16[*si] = 0x300;
862 goto loc_StopNoSplit;
864 // ==========================================================================
865 // BUG touching down to up
866 // ==========================================================================
869 if (SgnHighByte(PlayField16[*si - FieldWidth]) >= 0)
871 ExplodeFieldSP(*si); // Explode
876 PlayField16[*si - FieldWidth] = fiBase;
877 // ==========================================================================
878 // BASE touching down to up
879 // ==========================================================================
882 subCopyImageToScreen(*si, aniMurphyTouchUp);
884 subSoundFX(*si, fiBase, actDigging);
889 dx = aniFramesTouchBase;
891 dxPos = *si - FieldWidth;
892 MovHighByte(&PlayField16[*si], 0x10);
893 goto loc_StopNoSplit;
895 // ==========================================================================
896 // BUG touching right to left
897 // ==========================================================================
900 if (SgnHighByte(PlayField16[*si - 1]) >= 0)
902 ExplodeFieldSP(*si); // Explode
907 PlayField16[*si - 1] = fiBase;
908 // ==========================================================================
909 // BASE touching right to left
910 // ==========================================================================
913 subCopyImageToScreen(*si, aniMurphyTouchLeft);
915 subSoundFX(*si, fiBase, actDigging);
920 dx = aniFramesTouchBase;
923 MovHighByte(&PlayField16[*si], 0x11);
924 goto loc_StopNoSplit;
926 // ==========================================================================
927 // BUG touching up to down
928 // ==========================================================================
931 if (SgnHighByte(PlayField16[*si + FieldWidth]) >= 0)
933 ExplodeFieldSP(*si); // Explode
938 PlayField16[*si + FieldWidth] = fiBase;
939 // ==========================================================================
940 // BASE touching up to down
941 // ==========================================================================
944 subCopyImageToScreen(*si, aniMurphyTouchDown);
946 subSoundFX(*si, fiBase, actDigging);
951 dx = aniFramesTouchBase;
953 dxPos = *si + FieldWidth;
954 MovHighByte(&PlayField16[*si], 0x12);
955 goto loc_StopNoSplit;
957 // ==========================================================================
958 // BUG touching left to right
959 // ==========================================================================
962 if (SgnHighByte(PlayField16[*si + 1]) >= 0)
964 ExplodeFieldSP(*si); // Explode
969 PlayField16[*si + 1] = fiBase;
970 // ==========================================================================
971 // BASE touching left to right
972 // ==========================================================================
975 subCopyImageToScreen(*si, aniMurphyTouchRight);
977 subSoundFX(*si, fiBase, actDigging);
982 dx = aniFramesTouchBase;
985 MovHighByte(&PlayField16[*si], 0x13);
986 goto loc_StopNoSplit;
988 // ==========================================================================
989 // INFOTRON moving down to up
990 // ==========================================================================
994 subSoundFX(*si, fiInfotron, actCollecting);
996 subSoundFXInfotron();
999 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
1000 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
1001 PlayField16[*si - FieldWidth] = 0x903;
1002 PlayField16[*si] = 0x300;
1003 *si = *si - FieldWidth;
1004 goto loc_StopNoSplit;
1006 // ==========================================================================
1007 // INFOTRON moving right to left
1008 // ==========================================================================
1012 subSoundFX(*si, fiInfotron, actCollecting);
1014 subSoundFXInfotron();
1017 dx = aniFramesEatInfotronLeft;
1018 dx1 = aniEatInfotronLeft;
1024 PlayField16[*si - 1] = 0xA03;
1025 PlayField16[*si] = 0x300;
1027 goto loc_StopNoSplit;
1029 // ==========================================================================
1030 // INFOTRON moving up to down
1031 // ==========================================================================
1035 subSoundFX(*si, fiInfotron, actCollecting);
1037 subSoundFXInfotron();
1040 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
1041 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
1042 PlayField16[*si + FieldWidth] = 0xB03;
1043 PlayField16[*si] = 0x300;
1044 *si = *si + FieldWidth;
1045 goto loc_StopNoSplit;
1047 // ==========================================================================
1048 // INFOTRON moving left to right
1049 // ==========================================================================
1053 subSoundFX(*si, fiInfotron, actCollecting);
1055 subSoundFXInfotron();
1058 dx = aniFramesEatInfotronRight;
1059 dx1 = aniEatInfotronRight;
1065 PlayField16[*si + 1] = 0xC03;
1066 PlayField16[*si] = 0x300;
1068 goto loc_StopNoSplit;
1070 // ==========================================================================
1071 // INFOTRON touching down to up
1072 // ==========================================================================
1075 subCopyImageToScreen(*si, aniMurphyTouchUp);
1077 subSoundFX(*si, fiInfotron, actCollecting);
1079 subSoundFXInfotron();
1082 dx = aniFramesTouchInfotron;
1083 dx1 = aniTouchInfotron;
1084 MovHighByte(&PlayField16[*si], 0x14);
1085 MovHighByte(&PlayField16[*si - FieldWidth], 0xFF);
1086 goto loc_StopNoSplit;
1088 // ==========================================================================
1089 // INFOTRON touching right to left
1090 // ==========================================================================
1093 subCopyImageToScreen(*si, aniMurphyTouchLeft);
1095 subSoundFX(*si, fiInfotron, actCollecting);
1097 subSoundFXInfotron();
1100 dx = aniFramesTouchInfotron;
1101 dx1 = aniTouchInfotron;
1102 MovHighByte(&PlayField16[*si], 0x15);
1103 MovHighByte(&PlayField16[*si - 1], 0xFF);
1104 goto loc_StopNoSplit;
1106 // ==========================================================================
1107 // INFOTRON touching up to down
1108 // ==========================================================================
1111 subCopyImageToScreen(*si, aniMurphyTouchDown);
1113 subSoundFX(*si, fiInfotron, actCollecting);
1115 subSoundFXInfotron();
1118 dx = aniFramesTouchInfotron;
1119 dx1 = aniTouchInfotron;
1120 MovHighByte(&PlayField16[*si], 0x16);
1121 MovHighByte(&PlayField16[*si + FieldWidth], 0xFF);
1122 goto loc_StopNoSplit;
1124 // ==========================================================================
1125 // INFOTRON touching left to right
1126 // ==========================================================================
1129 subCopyImageToScreen(*si, aniMurphyTouchRight);
1131 subSoundFX(*si, fiInfotron, actCollecting);
1133 subSoundFXInfotron();
1136 dx = aniFramesTouchInfotron;
1137 dx1 = aniTouchInfotron;
1138 MovHighByte(&PlayField16[*si], 0x17);
1139 MovHighByte(&PlayField16[*si + 1], 0xFF);
1140 goto loc_StopNoSplit;
1142 // ==========================================================================
1143 // EXIT pressed from any direction
1144 // ==========================================================================
1152 if (LowByte(InfotronsNeeded) != 0)
1156 if (!game_sp.LevelSolved)
1157 printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n",LevelNumber);
1161 game_sp.LevelSolved = TRUE;
1165 subSoundFX(*si, fiExit, actPassing);
1170 data_h_DemoDone = 1; // EP set level success bytes
1171 LevelStatus = 1; // set Level Status DONE
1172 EP_GameDemoVar0DAA = 0; // force demo for lead-out
1173 if (SavedGameFlag == 0) // saved game running?
1175 if (UpdateTimeFlag != 0) // update time?
1177 UpdatedFlag = 1; // prevent double update
1178 subUpdatePlayingTime(); // update playing time
1183 subUpdateHallOfFame(); // update time + Hall-Of-Fame
1186 LeadOutCounter = 0x40; // quit: start lead-out
1187 dx = aniFramesMurphyExit;
1188 dx1 = aniMurphyExit;
1189 MovHighByte(&PlayField16[*si], 0xD);
1190 goto loc_StopNoSplit;
1192 // ==========================================================================
1193 // ZONK moving right to left
1194 // ==========================================================================
1197 ax = PlayField16[*si - 2];
1201 MovHighByte(&PlayField16[*si - 2], 1);
1202 subCopyImageToScreen(*si, aniPushLeft); // draw pushing murphy
1203 dx = aniFramesZonkRollLeft;
1204 dx1 = aniZonkRollLeft;
1208 MovHighByte(&PlayField16[*si], 0xE);
1209 goto loc_MoveNoSplit;
1211 // ==========================================================================
1212 // ZONK moving left to right
1213 // ==========================================================================
1216 ax = PlayField16[*si + 2];
1220 ax = PlayField16[*si + FieldWidth + 1];
1221 if (ax == 0) // zonk falls
1224 MovHighByte(&PlayField16[*si + 2], 1);
1225 subCopyImageToScreen(*si, aniPushRight); // draw pushing murphy
1226 dx = aniFramesZonkRollRight;
1227 dx1 = aniZonkRollRight;
1231 MovHighByte(&PlayField16[*si], 0xF);
1232 goto loc_MoveNoSplit;
1234 // ==========================================================================
1235 // TERMINAL moving/touching down to up
1236 // ==========================================================================
1239 subCopyImageToScreen(*si, aniMurphyTouchUp);
1240 if (YellowDisksExploded != 0)
1242 YawnSleepCounter = 40; // stay hypnotized
1248 // draw new terminal type
1250 GfxGraphic[GetX(*si - FieldWidth)][GetY(*si - FieldWidth)] = aniTerminalActive;
1252 subCopyImageToScreen(*si - FieldWidth, aniTerminalActive);
1255 subCopyFieldToScreen(*si - FieldWidth, 0x88); // draw new terminal type
1257 TerminalState[*si - FieldWidth] = 8;
1260 // ==========================================================================
1261 // TERMINAL moving/touching right to left
1262 // ==========================================================================
1265 subCopyImageToScreen(*si, aniMurphyTouchLeft);
1266 if (YellowDisksExploded != 0)
1268 YawnSleepCounter = 40; // stay hypnotized
1274 // draw new terminal type
1276 GfxGraphic[GetX(*si - 1)][GetY(*si - 1)] = aniTerminalActive;
1278 subCopyImageToScreen(*si - 1, aniTerminalActive);
1281 subCopyFieldToScreen(*si - 1, 0x88); // draw new terminal type
1283 TerminalState[*si - 1] = 8;
1286 // ==========================================================================
1287 // TERMINAL moving/touching up to down
1288 // ==========================================================================
1291 subCopyImageToScreen(*si, aniMurphyTouchDown);
1292 if (YellowDisksExploded != 0)
1294 YawnSleepCounter = 40; // stay hypnotized
1300 // draw new terminal type
1302 GfxGraphic[GetX(*si + FieldWidth)][GetY(*si + FieldWidth)] = aniTerminalActive;
1304 subCopyImageToScreen(*si + FieldWidth, aniTerminalActive);
1307 subCopyFieldToScreen(*si + FieldWidth, 0x88); // draw new terminal type
1309 TerminalState[*si + FieldWidth] = 8;
1312 // ==========================================================================
1313 // TERMINAL moving/touching left to right
1314 // ==========================================================================
1317 subCopyImageToScreen(*si, aniMurphyTouchRight);
1318 if (YellowDisksExploded != 0)
1320 YawnSleepCounter = 40; // stay hypnotized
1326 // draw new terminal type
1328 GfxGraphic[GetX(*si + 1)][GetY(*si + 1)] = aniTerminalActive;
1330 subCopyImageToScreen(*si + 1, aniTerminalActive);
1333 subCopyFieldToScreen(*si + 1, 0x88); // draw new terminal type
1335 TerminalState[*si + 1] = 8;
1336 // ==========================================================================
1337 // common TERMINAL stuff moving/touching from all directions
1338 // ==========================================================================
1341 TerminalMaxCycles = 7;
1342 YellowDisksExploded = 1;
1343 for (i = 0; i <= LevelMax; i++)
1345 if (PlayField16[i] == fiYellowDisk)
1351 // ==========================================================================
1352 // PORT down to up, VERTICAL PORT, CROSS PORT all moving down to up
1353 // ==========================================================================
1356 if (PlayField16[*si - 2 * FieldWidth] != 0)
1359 dx = aniFramesSplitUpDown;
1360 dx1 = aniSplitUpDown;
1361 dx2Step = -FieldWidth;
1362 PlayField16[*si] = 0x1803;
1363 PlayField16[*si - 2 * FieldWidth] = 0x300;
1366 // ==========================================================================
1367 // PORT right to left, HORIZONTAL PORT, CROSS PORT all moving right to left
1368 // ==========================================================================
1371 if (PlayField16[*si - 2] != 0)
1374 dx = aniFramesMurphyEatLeft;
1375 dx1 = aniMurphyMoveLeft;
1377 PlayField16[*si] = 0x1903;
1378 PlayField16[*si - 2] = 0x300;
1381 // ==========================================================================
1382 // PORT up to down, VERTICAL PORT, CROSS PORT all moving up to down
1383 // ==========================================================================
1386 if (PlayField16[*si + 2 * FieldWidth] != 0)
1389 dx = aniFramesSplitUpDown;
1390 dx1 = aniSplitUpDown;
1391 dx2Step = FieldWidth;
1392 PlayField16[*si] = 0x1A03;
1393 PlayField16[*si + 2 * FieldWidth] = 0x300;
1396 // ==========================================================================
1397 // PORT left to right, HORIZONTAL PORT, CROSS PORT all moving left to right
1398 // ==========================================================================
1401 if (PlayField16[*si + 2] != 0)
1404 dx = aniFramesMurphyEatRight;
1405 dx1 = aniMurphyMoveRight;
1407 PlayField16[*si] = 0x1B03;
1408 PlayField16[*si + 2] = 0x300;
1411 MovingPictureSequencePhase = 0; // stop picture move sequence
1412 SplitMoveFlag = 1; // port: split movement
1415 // ==========================================================================
1416 // RED DISK moving down to up
1417 // ==========================================================================
1420 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
1421 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
1422 PlayField16[*si] = 0x1C03;
1423 PlayField16[*si - FieldWidth] = 0x300;
1424 goto loc_StopNoSplit;
1426 // ==========================================================================
1427 // RED DISK moving right to left
1428 // ==========================================================================
1431 dx = aniFramesMurphyEatLeft;
1432 dx1 = aniMurphyEatLeft;
1433 PlayField16[*si] = 0x300; // !!!!!! this time we move murphy at sequence-start!
1434 PlayField16[*si - 1] = 0x1D03;
1436 goto loc_StopNoSplit;
1438 // ==========================================================================
1439 // RED DISK moving up to down
1440 // ==========================================================================
1443 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
1444 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
1445 PlayField16[*si] = 0x1E03;
1446 PlayField16[*si + FieldWidth] = 0x300;
1447 goto loc_StopNoSplit;
1449 // ==========================================================================
1450 // RED DISK moving left to right
1451 // ==========================================================================
1454 // dx = aniFramesMurphyEatRightRedDisk 'this sequence is 9 steps long!
1455 dx = aniFramesMurphyEatRight;
1456 dx1 = aniMurphyEatRight;
1457 // --------------------------------------------------------------------------
1459 // Table data_h_145A, pointed to by table data_h_105E, has a severe bug:
1460 // The Red Disk sequence is 8 pictures long, but 9 are displayed, because it
1461 // has 1 extra entry, which causes Murphy to end slightly shifted to the left!
1462 // We may not fix the table, because then the timing of the game changes
1463 // and several existing demo's do not run properly anymore.
1464 // We only correct Murphies x-location here, when the sequence starts.
1465 // Remember that this is not the real bug-fix, but we must live with
1466 // this existing bug and correct for the consequences of it.
1469 if (0 == AllowEatRightRedDiskBug) // Murphy's screen x-position
1470 MurphyScreenXPos = MurphyScreenXPos - 2 * MurphyZoomFactor;
1472 if (0 == AllowEatRightRedDiskBug) // Murphy's screen x-position
1473 MurphyScreenXPos = MurphyScreenXPos - 2;
1477 // FS: for me this means to blit the first animation frame twice
1479 // --------------------------------------------------------------------------
1480 PlayField16[*si] = 0x300; // !!!!!! this time we move murphy at sequence-start!
1481 PlayField16[*si + 1] = 0x1F03;
1483 goto loc_StopNoSplit;
1485 // ==========================================================================
1486 // RED DISK touching down to up
1487 // ==========================================================================
1490 dx = aniFramesTouchRedDisk;
1491 dx1 = aniTouchRedDisk;
1492 MovHighByte(&PlayField16[*si], 0x20);
1493 MovHighByte(&PlayField16[*si - FieldWidth], 3);
1494 goto loc_StopNoSplit;
1496 // ==========================================================================
1497 // RED DISK touching right to left
1498 // ==========================================================================
1501 dx = aniFramesTouchRedDisk;
1502 dx1 = aniTouchRedDisk;
1503 MovHighByte(&PlayField16[*si], 0x21);
1504 MovHighByte(&PlayField16[*si - 1], 3);
1505 goto loc_StopNoSplit;
1507 // ==========================================================================
1508 // RED DISK touching up to down
1509 // ==========================================================================
1512 dx = aniFramesTouchRedDisk;
1513 dx1 = aniTouchRedDisk;
1514 MovHighByte(&PlayField16[*si], 0x22);
1515 MovHighByte(&PlayField16[*si + FieldWidth], 3);
1516 goto loc_StopNoSplit;
1518 // ==========================================================================
1519 // RED DISK touching left to right
1520 // ==========================================================================
1523 dx = aniFramesTouchRedDisk;
1524 dx1 = aniTouchRedDisk;
1525 MovHighByte(&PlayField16[*si], 0x23);
1526 MovHighByte(&PlayField16[*si + 1], 3);
1529 MovingPictureSequencePhase = 0; // stop picture move sequence
1532 // ==========================================================================
1533 // YELLOW DISK moving down to up
1534 // ==========================================================================
1537 if (PlayField16[*si - 2 * FieldWidth] != 0)
1540 PlayField16[*si - 2 * FieldWidth] = 0x1200;
1542 subCopyImageToScreen(*si, aniPushRight);
1544 dx = aniFramesYellowDisk;
1545 dx1 = aniYellowDisk;
1546 dxPos = *si - FieldWidth;
1548 dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
1550 dx2 = aniPushUpDown;
1552 dx2Step = FieldWidth;
1553 PlayField16[*si] = 0x2403;
1555 subCopyImageToScreen(*si, dx2);
1557 goto loc_MoveNoSplit;
1559 // ==========================================================================
1560 // YELLOW DISK moving right to left
1561 // ==========================================================================
1564 if (PlayField16[*si - 2] != 0)
1567 PlayField16[*si - 2] = 0x1200;
1568 subCopyImageToScreen(*si, aniPushLeft);
1569 dx = aniFramesYellowDisk;
1570 dx1 = aniYellowDisk;
1574 PlayField16[*si] = 0x2503;
1575 goto loc_MoveNoSplit;
1577 // ==========================================================================
1578 // YELLOW DISK moving up to down
1579 // ==========================================================================
1582 if (PlayField16[*si + 2 * FieldWidth] != 0)
1585 PlayField16[*si + 2 * FieldWidth] = 0x1200;
1587 subCopyImageToScreen(*si, aniPushRight);
1589 dx = aniFramesYellowDisk;
1590 dx1 = aniYellowDisk;
1591 dxPos = *si + FieldWidth;
1593 dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
1595 dx2 = aniPushUpDown;
1597 dx2Step = -FieldWidth;
1598 PlayField16[*si] = 0x2703;
1600 subCopyImageToScreen(*si, dx2);
1602 goto loc_MoveNoSplit;
1604 // ==========================================================================
1605 // YELLOW DISK moving left to right
1606 // ==========================================================================
1609 if (PlayField16[*si + 2] != 0)
1612 PlayField16[*si + 2] = 0x1200;
1613 subCopyImageToScreen(*si, aniPushRight);
1614 dx = aniFramesYellowDisk;
1615 dx1 = aniYellowDisk;
1619 PlayField16[*si] = 0x2603;
1620 goto loc_MoveNoSplit;
1622 // ==========================================================================
1623 // ORANGE DISK moving right to left
1624 // ==========================================================================
1627 if (PlayField16[*si - 2] != 0)
1630 PlayField16[*si - 2] = 0x800;
1631 subCopyImageToScreen(*si, aniPushLeft);
1632 dx = aniFramesOrangeDisk;
1633 dx1 = aniOrangeDisk;
1637 PlayField16[*si] = 0x2803;
1638 goto loc_MoveNoSplit;
1640 // ==========================================================================
1641 // ORANGE DISK moving left to right
1642 // ==========================================================================
1645 if (PlayField16[*si + 2] != 0)
1648 if (PlayField16[*si + FieldWidth + 1] == 0) // falling goes before pushing
1651 PlayField16[*si + 2] = 0x100;
1652 subCopyImageToScreen(*si, aniPushRight);
1653 dx = aniFramesOrangeDisk;
1654 dx1 = aniOrangeDisk;
1658 PlayField16[*si] = 0x2903;
1659 // ==========================================================================
1660 // Copy screen animation action table to action work space
1661 // (To paint sequence: Push Zonk/Disk / release red disk / Port passing)
1662 // ==========================================================================
1665 MovingPictureSequencePhase = 8; // init picture move sequence
1668 SplitMoveFlag = 0; // no port: no split movement
1671 // copy/store global move sequence info????????????????????????????????????
1672 // ... dont think so ...(FS)
1673 // ==========================================================================
1674 // Proceed with all movements
1675 // ==========================================================================
1677 locProceedMovingMurphy: // proceed moving murphy
1678 YawnSleepCounter = 0; // Wake up sleeping Murphy
1679 ax = MovingPictureSequencePhase; // sequence busy?
1680 if (ax == 0) // no -- start sequence!
1683 ax = ax - 1; // next picture of sequence
1684 MovingPictureSequencePhase = ax; // store for later
1686 if (ax == 0) // Sound effects
1689 switch (HighByte(PlayField16[*si]))
1693 subSoundFX(*si, fiZonk, actPushing);
1698 subSoundFX(*si, fiOrangeDisk, actPushing);
1705 subSoundFX(*si, fiYellowDisk, actPushing);
1716 bl = HighByte(PlayField16[*si]);
1717 if (bl == 0xE) // Push Zonk to left
1720 if (bl == 0xF) // Push Zonk to right
1723 if (bl == 0x28) // Push orange disk to left
1726 if (bl == 0x29) // Push orange disk to right
1729 if (bl == 0x24) // Push yellow disk up
1732 if (bl == 0x25) // Push yellow disk to left
1735 if (bl == 0x27) // Push yellow disk down
1738 if (bl == 0x26) // Push yellow disk to right
1741 if (bl == 0x2A) // Red disk release timer
1746 // ==========================================================================
1747 // Paint frame of MOVING.DAT sequence
1748 // ==========================================================================
1754 dx1SequenceLength = getSequenceLength(dx1);
1757 if (SplitMoveFlag == 0)
1759 // ++++++++++++++++++++++++++
1760 // Begin of normal movement
1762 MurphyScreenXPos = MurphyScreenXPos + MurphyDX * MurphyZoomFactor;
1763 MurphyScreenYPos = MurphyScreenYPos + MurphyDY * MurphyZoomFactor;
1765 MurphyScreenXPos = MurphyScreenXPos + MurphyDX;
1766 MurphyScreenYPos = MurphyScreenYPos + MurphyDY;
1771 printf("::: %04d [%03ld, %02d] ----------> %s [%d] [%d, %d] [%d, %d] [%d]\n",
1773 DemoOffset - DemoPointer, DemoKeyRepeatCounter,
1774 (DemoKeyCode == keyNone ? "(none)" :
1775 DemoKeyCode == keyLeft ? "left" :
1776 DemoKeyCode == keyRight ? "right" :
1777 DemoKeyCode == keyUp ? "up" :
1778 DemoKeyCode == keyDown ? "down" :
1779 DemoKeyCode == keySpace ? "space" :
1780 DemoKeyCode == keySpaceLeft ? "space + left" :
1781 DemoKeyCode == keySpaceRight ? "space + right" :
1782 DemoKeyCode == keySpaceUp ? "space + up" :
1783 DemoKeyCode == keySpaceDown ? "space + down" : "(unknown)"),
1785 MurphyScreenXPos, MurphyScreenYPos,
1786 MurphyPosIndex % 60, MurphyPosIndex / 60,
1795 if (!(ClearPos < 0)) // clear field that murphy is leaving
1796 subCopyImageToScreen(ClearPos, aniSpace);
1798 if (! ClearPos < 0) // clear field that murphy is leaving
1799 subCopyFieldToScreen(ClearPos, 0);
1803 printf("::: ---------------> %d, %d [%d, %d]\n",
1804 MurphyScreenXPos, MurphyScreenYPos, MurphyDX, MurphyDY);
1808 // !!! special two-tile animation currently not used !!!
1809 if (dx2 == fiInfotron) // special case of infotron moving left or right
1817 tDeltaX = MurphyDX * LocalStretch * (SeqPos + 1);
1818 tDeltaY = MurphyDY * LocalStretch * (SeqPos + 1);
1821 X = GetStretchX(dxPos) + tDeltaX;
1822 Y = GetStretchY(dxPos) + tDeltaY;
1823 Tmp = (SeqPos < 0 ? 0 : SeqPos); // 9StepBugFix!(red disk move right)
1826 if (isSnappingSequence(dx1) && SeqPos == dx1SequenceLength - 1)
1831 StretchedSprites.BltImg(X, Y, dx1, Tmp);
1832 GfxGraphic[GetX(*si)][GetY(*si)] = -1; // (Murphy's position)
1833 GfxGraphic[GetX(dxPos)][GetY(dxPos)] = -1; // (snapping position)
1834 // printf("::: Tmp: %d\n", Tmp);
1836 StretchedSprites.BltEx(X, Y, dx[Tmp]);
1845 tPos = dxPos + dx2Step;
1846 X = GetStretchX(tPos);
1847 Y = GetStretchY(tPos);
1849 // !!! special two-tile animation currently not used !!!
1850 if (dx2 == fiInfotron) // special case of infotron moving left or right
1852 StretchedSprites.BltEx(X, Y, dx[SeqPos] + dx2Step);
1854 else // pushing something
1858 // (SeqPos iterates from 0 to 7 while pushing)
1859 StretchedSprites.BltImg(X + tDeltaX, Y + tDeltaY, dx2, SeqPos);
1860 // printf("::: SeqPos: %d\n", SeqPos);
1862 StretchedSprites.BltEx(X + tDeltaX, Y + tDeltaY, dx2);
1867 // End of normal movement
1868 // ------------------------
1872 // ++++++++++++++++++++++++++++++++
1873 // Begin of split movement (port)
1875 MurphyScreenXPos = MurphyScreenXPos + 2 * MurphyDX * MurphyZoomFactor;
1876 MurphyScreenYPos = MurphyScreenYPos + 2 * MurphyDY * MurphyZoomFactor;
1878 MurphyScreenXPos = MurphyScreenXPos + 2 * MurphyDX;
1879 MurphyScreenYPos = MurphyScreenYPos + 2 * MurphyDY;
1881 subCopyImageToScreen(ClearPos, aniSpace); // clear the field that murphy leaves
1882 tDeltaX = MurphyDX * LocalStretch * (SeqPos + 1);
1883 tDeltaY = MurphyDY * LocalStretch * (SeqPos + 1);
1884 X = GetStretchX(dxPos) + tDeltaX;
1885 Y = GetStretchY(dxPos) + tDeltaY;
1887 StretchedSprites.BltImg(X, Y, dx1, SeqPos); // plot first murphy
1889 StretchedSprites.BltEx(X, Y, dx[SeqPos]); // plot first murphy
1891 tPos = dxPos + dx2Step;
1892 X = GetStretchX(tPos);
1893 Y = GetStretchY(tPos);
1895 StretchedSprites.BltImg(X + tDeltaX, Y + tDeltaY, dx1, SeqPos); // plot second murphy
1896 StretchedSprites.BltImg(X, Y, fiGraphic[LowByte(PlayField16[tPos])], 0); // replot the port on top
1898 StretchedSprites.BltEx(X + tDeltaX, Y + tDeltaY, dx[SeqPos]); // plot second murphy
1899 StretchedSprites.BltEx(X, Y, LowByte(PlayField16[tPos])); // replot the port on top
1901 // End of split movement (port)
1902 // ------------------------------
1903 } // loc_g_6D1E:'loc_g_6D28:
1905 SeqPos = SeqPos + 1;
1907 if (SeqPos < dx1SequenceLength)
1910 if (dx[SeqPos] > -1)
1914 // Follow-up after movement completed 'loc_g_6D35:
1915 MurphyXPos = MurphyXPos + MurphyDX;
1916 MurphyYPos = MurphyYPos + MurphyDY;
1917 bl = HighByte(PlayField16[*si]); // animation phase
1918 MovHighByte(&PlayField16[*si], 0);
1920 if (bl == 0x1) // space, moving up
1923 if (bl == 0x2) // space, moving left
1926 if (bl == 0x3) // space, moving down
1929 if (bl == 0x4) // space, moving right
1932 if (bl == 0x5) // base , moving up
1935 if (bl == 0x6) // base , moving left -> 6 is not used, value is set to 2 instead of 6!
1938 if (bl == 0x7) // base , moving down
1941 if (bl == 0x8) // base , moving right
1944 if (bl == 0x9) // infotron, moving up
1947 if (bl == 0xA) // infotron, moving left
1950 if (bl == 0xB) // infotron, moving down
1953 if (bl == 0xC) // infotron, moving right
1956 if (bl == 0xD) // exit
1959 if (bl == 0xE) // zonk, pushing left
1962 if (bl == 0xF) // zonk, pushing right
1965 if (bl == 0x10) // base , touching up
1968 if (bl == 0x11) // base , touching left
1971 if (bl == 0x12) // base , touching down
1974 if (bl == 0x13) // base , touching right
1977 if (bl == 0x14) // infotron touching up
1980 if (bl == 0x15) // infotron touching left
1983 if (bl == 0x16) // infotron touching down
1986 if (bl == 0x17) // infotron touching right
1989 if (bl == 0x18) // port up
1992 if (bl == 0x19) // port left
1995 if (bl == 0x1A) // port down
1998 if (bl == 0x1B) // port right
2001 if (bl == 0x1C) // red disk, moving up
2004 if (bl == 0x1D) // red disk, moving left
2007 if (bl == 0x1E) // red disk, moving down
2010 if (bl == 0x1F) // red disk, moving right -> 9-Step-Bug!
2013 if (bl == 0x20) // red disk, touching up
2016 if (bl == 0x21) // red disk, touching left
2019 if (bl == 0x22) // red disk, touching down
2022 if (bl == 0x23) // red disk, touching right
2025 if (bl == 0x24) // yellow disk, pushing up
2028 if (bl == 0x25) // yellow disk, pushing left
2031 if (bl == 0x26) // yellow disk, pushing right -> order of "down" exchanged with "right"!
2034 if (bl == 0x27) // yellow disk, pushing down -> order of "down" exchanged with "right"!
2037 if (bl == 0x28) // orange disk, pushing left
2040 if (bl == 0x29) // orange disk, pushing right
2043 if (bl == 0x2A) // red disk, release
2050 // ==========================================================================
2051 // infotron, moving up
2052 // ==========================================================================
2055 if (0 < LowByte(InfotronsNeeded))
2056 InfotronsNeeded = InfotronsNeeded - 1;
2058 subDisplayInfotronsNeeded();
2059 loc_g_6EC8: // space, base
2060 PlayField16[*si] = fiMurphy;
2061 subAdjustZonksInfotronsAboveMurphy(*si + FieldWidth);
2065 // ==========================================================================
2066 // infotron, moving left
2067 // ==========================================================================
2070 if (0 < LowByte(InfotronsNeeded))
2071 InfotronsNeeded = InfotronsNeeded - 1;
2073 subDisplayInfotronsNeeded();
2074 loc_g_6EE6: // space, base
2075 PlayField16[*si] = fiMurphy;
2076 subAdjustZonksInfotronsAboveMurphy(*si + 1);
2080 // ==========================================================================
2081 // infotron, moving down
2082 // ==========================================================================
2085 if (0 < LowByte(InfotronsNeeded))
2086 InfotronsNeeded = InfotronsNeeded - 1;
2088 subDisplayInfotronsNeeded();
2089 loc_g_6F04: // space, base
2090 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
2091 PlayField16[*si - FieldWidth] = 0;
2093 PlayField16[*si] = fiMurphy;
2097 // ==========================================================================
2098 // infotron, moving right
2099 // ==========================================================================
2102 if (0 < LowByte(InfotronsNeeded))
2103 InfotronsNeeded = InfotronsNeeded - 1;
2105 subDisplayInfotronsNeeded();
2106 loc_g_71C4: // space, base
2107 subAdjustZonksInfotronsAboveMurphy(*si - 1);
2108 PlayField16[*si] = fiMurphy;
2112 // ==========================================================================
2113 // infotron, touching up
2114 // ==========================================================================
2117 if (0 < LowByte(InfotronsNeeded))
2118 InfotronsNeeded = InfotronsNeeded - 1;
2120 subDisplayInfotronsNeeded();
2122 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
2123 PlayField16[*si - FieldWidth] = 0;
2127 // ==========================================================================
2128 // infotron, touching left
2129 // ==========================================================================
2132 if (0 < LowByte(InfotronsNeeded))
2133 InfotronsNeeded = InfotronsNeeded - 1;
2135 subDisplayInfotronsNeeded();
2137 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2138 PlayField16[*si - 1] = 0;
2142 // ==========================================================================
2143 // infotron, touching down
2144 // ==========================================================================
2147 if (0 < LowByte(InfotronsNeeded))
2148 InfotronsNeeded = InfotronsNeeded - 1;
2150 subDisplayInfotronsNeeded();
2152 if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion)
2153 PlayField16[*si + FieldWidth] = 0;
2157 // ==========================================================================
2158 // infotron, touching right
2159 // ==========================================================================
2162 if (0 < LowByte(InfotronsNeeded))
2163 InfotronsNeeded = InfotronsNeeded - 1;
2165 subDisplayInfotronsNeeded();
2167 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2168 PlayField16[*si + 1] = 0;
2172 // ==========================================================================
2173 // zonk, pushing left
2174 // ==========================================================================
2177 if (LowByte(PlayField16[*si]) != fiExplosion)
2178 PlayField16[*si] = 0;
2180 PlayField16[*si - 1] = fiMurphy;
2181 PlayField16[*si - 2] = fiZonk;
2182 subExplodeSnikSnaksBelow(*si - 2);
2187 // ==========================================================================
2188 // zonk, pushing right
2189 // ==========================================================================
2192 if (LowByte(PlayField16[*si]) != fiExplosion)
2193 PlayField16[*si] = 0;
2195 PlayField16[*si + 1] = fiMurphy;
2196 PlayField16[*si + 2] = fiZonk;
2197 subExplodeSnikSnaksBelow(*si + 2);
2202 // ==========================================================================
2204 // ==========================================================================
2210 PlayField16[*si] = fiSpace; // remove Murphy from playfield after exiting
2215 // ==========================================================================
2216 // Push Zonk from right to left
2217 // ==========================================================================
2220 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiZonk)
2223 PlayField16[*si] = fiMurphy; // else restore - no more zonk pushing!
2224 PlayField16[*si - 1] = fiZonk;
2225 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2226 PlayField16[*si - 2] = 0;
2228 subCopyImageToScreen(*si, aniMurphy);
2232 // ==========================================================================
2233 // Push Zonk from left to right
2234 // ==========================================================================
2237 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiZonk)
2240 PlayField16[*si] = fiMurphy; // else restore - no more zonk pushing!
2241 PlayField16[*si + 1] = fiZonk;
2242 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2243 PlayField16[*si + 2] = 0;
2245 subCopyImageToScreen(*si, aniMurphy);
2249 // ==========================================================================
2250 // Push orange disk from right to left
2251 // ==========================================================================
2254 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiOrangeDisk)
2257 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2258 PlayField16[*si - 1] = fiOrangeDisk;
2259 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2260 PlayField16[*si - 2] = 0;
2262 subCopyImageToScreen(*si, aniMurphy);
2266 // ==========================================================================
2267 // Push orange disk from left to right
2268 // ==========================================================================
2271 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiOrangeDisk)
2274 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2275 PlayField16[*si + 1] = fiOrangeDisk;
2276 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2277 PlayField16[*si + 2] = 0;
2279 subCopyImageToScreen(*si, aniMurphy);
2283 // ==========================================================================
2284 // Push yellow disk from down to up
2285 // ==========================================================================
2288 if (DemoKeyCode == keyUp && PlayField16[*si - FieldWidth] == fiYellowDisk)
2291 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2292 PlayField16[*si - FieldWidth] = fiYellowDisk;
2293 if (LowByte(PlayField16[*si - 2 * FieldWidth]) != fiExplosion)
2294 PlayField16[*si - 2 * FieldWidth] = 0;
2296 subCopyImageToScreen(*si, aniMurphy);
2300 // ==========================================================================
2301 // Push yellow disk from right to left
2302 // ==========================================================================
2305 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiYellowDisk)
2308 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2309 PlayField16[*si - 1] = fiYellowDisk;
2310 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2311 PlayField16[*si - 2] = 0;
2313 subCopyImageToScreen(*si, aniMurphy);
2317 // ==========================================================================
2318 // Push yellow disk from up to down
2319 // ==========================================================================
2322 if (DemoKeyCode == keyDown && PlayField16[*si + FieldWidth] == fiYellowDisk)
2325 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2326 PlayField16[*si + FieldWidth] = fiYellowDisk;
2327 if (LowByte(PlayField16[*si + 2 * FieldWidth]) != fiExplosion)
2328 PlayField16[*si + 2 * FieldWidth] = 0;
2330 subCopyImageToScreen(*si, aniMurphy);
2334 // ==========================================================================
2335 // Push yellow disk from left to right
2336 // ==========================================================================
2339 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiYellowDisk)
2342 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2343 PlayField16[*si + 1] = fiYellowDisk;
2344 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2345 PlayField16[*si + 2] = 0;
2347 subCopyImageToScreen(*si, aniMurphy);
2351 // ==========================================================================
2352 // time red disk release (space)
2353 // ==========================================================================
2356 if (DemoKeyCode != keySpace)
2358 PlayField16[*si] = fiMurphy;
2359 subCopyImageToScreen(*si, aniMurphy);
2360 RedDiskReleasePhase = 0;
2362 else if (MovingPictureSequencePhase == 0x20)
2365 // anxious murphy, dropping red disk
2366 subCopyImageToScreen(*si, aniMurphyDropping);
2368 subCopyFieldToScreen(*si, 43); // anxious murphy
2370 RedDiskReleasePhase = 1;
2375 // ==========================================================================
2376 // Special port down to up
2377 // ==========================================================================
2380 if (LowByte(PlayField16[*si]) != fiExplosion)
2381 PlayField16[*si] = 0;
2383 PlayField16[*si - 2 * FieldWidth] = fiMurphy;
2385 *si = *si - FieldWidth;
2386 if (HighByte(PlayField16[*si]) == 1)
2389 *si = *si - FieldWidth;
2393 // ==========================================================================
2394 // Special port right to left
2395 // ==========================================================================
2398 if (LowByte(PlayField16[*si]) != fiExplosion)
2399 PlayField16[*si] = 0;
2401 PlayField16[*si - 2] = fiMurphy;
2404 if (HighByte(PlayField16[*si]) == 1)
2411 // ==========================================================================
2412 // Special port up to down
2413 // ==========================================================================
2416 if (LowByte(PlayField16[*si]) != fiExplosion)
2417 PlayField16[*si] = 0;
2419 PlayField16[*si + 2 * FieldWidth] = fiMurphy;
2421 *si = *si + FieldWidth;
2422 if (HighByte(PlayField16[*si]) == 1)
2425 *si = *si + FieldWidth;
2429 // ==========================================================================
2430 // Special port left to right
2431 // ==========================================================================
2434 if (LowByte(PlayField16[*si]) != fiExplosion)
2435 PlayField16[*si] = 0;
2437 PlayField16[*si + 2] = fiMurphy;
2440 if (HighByte(PlayField16[*si]) == 1)
2447 // ==========================================================================
2449 // ==========================================================================
2452 if (LowByte(PlayField16[*si]) != fiExplosion)
2453 PlayField16[*si] = 0;
2455 *si = *si - FieldWidth;
2456 PlayField16[*si] = fiMurphy;
2457 subEatRedDisk(*si); // inc+show Murphy's red disks
2461 // ==========================================================================
2462 // Move Red Disk left
2463 // ==========================================================================
2466 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2467 PlayField16[*si + 1] = 0;
2469 PlayField16[*si] = fiMurphy;
2470 subEatRedDisk(*si); // inc+show Murphy's red disks
2474 // ==========================================================================
2475 // Move Red Disk down
2476 // ==========================================================================
2479 if (LowByte(PlayField16[*si]) != fiExplosion)
2480 PlayField16[*si] = 0;
2482 *si = *si + FieldWidth;
2483 PlayField16[*si] = fiMurphy;
2484 subEatRedDisk(*si); // inc+show Murphy's red disks
2488 // ==========================================================================
2489 // Move Red Disk right
2490 // ==========================================================================
2493 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2494 PlayField16[*si - 1] = 0;
2496 PlayField16[*si] = fiMurphy;
2497 subEatRedDisk(*si); // inc+show Murphy's red disks
2501 // ==========================================================================
2503 // ==========================================================================
2506 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
2507 PlayField16[*si - FieldWidth] = 0;
2509 subEatRedDisk(*si - FieldWidth); // inc+show Murphy's red disks
2513 // ==========================================================================
2514 // Eat Red Disk left
2515 // ==========================================================================
2518 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2519 PlayField16[*si - 1] = 0;
2521 subEatRedDisk(*si - 1); // inc+show Murphy's red disks
2525 // ==========================================================================
2526 // Eat Red Disk down
2527 // ==========================================================================
2530 if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion)
2531 PlayField16[*si + FieldWidth] = 0;
2533 subEatRedDisk(*si + FieldWidth); // inc+show Murphy's red disks
2537 // ==========================================================================
2538 // Eat Red Disk right
2539 // ==========================================================================
2542 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2543 PlayField16[*si + 1] = 0;
2545 subEatRedDisk(*si + 1); // inc+show Murphy's red disks
2549 // ==========================================================================
2550 // yellow disk, pushing up
2551 // ==========================================================================
2554 if (LowByte(PlayField16[*si]) != fiExplosion)
2555 PlayField16[*si] = 0;
2557 *si = *si - FieldWidth;
2558 PlayField16[*si] = fiMurphy;
2559 PlayField16[*si - FieldWidth] = fiYellowDisk;
2563 // ==========================================================================
2564 // yellow disk, pushing left
2565 // ==========================================================================
2568 if (LowByte(PlayField16[*si]) != fiExplosion)
2569 PlayField16[*si] = 0;
2572 PlayField16[*si] = fiMurphy;
2573 PlayField16[*si - 1] = fiYellowDisk;
2577 // ==========================================================================
2578 // yellow disk, pushing down
2579 // ==========================================================================
2582 if (LowByte(PlayField16[*si]) != fiExplosion)
2583 PlayField16[*si] = 0;
2585 *si = *si + FieldWidth;
2586 PlayField16[*si] = fiMurphy;
2587 PlayField16[*si + FieldWidth] = fiYellowDisk;
2591 // ==========================================================================
2592 // yellow disk pushing right
2593 // ==========================================================================
2596 if (LowByte(PlayField16[*si]) != fiExplosion)
2597 PlayField16[*si] = 0;
2600 PlayField16[*si] = fiMurphy;
2601 PlayField16[*si + 1] = fiYellowDisk;
2605 // ==========================================================================
2606 // orange disk, pushing left
2607 // ==========================================================================
2610 if (LowByte(PlayField16[*si]) != fiExplosion)
2611 PlayField16[*si] = 0;
2614 PlayField16[*si] = fiMurphy;
2615 PlayField16[*si - 1] = fiOrangeDisk;
2619 // ==========================================================================
2620 // orange disk, pushing right
2621 // ==========================================================================
2624 if (LowByte(PlayField16[*si]) != fiExplosion)
2625 PlayField16[*si] = 0;
2628 PlayField16[*si] = fiMurphy;
2629 PlayField16[*si + 1] = fiOrangeDisk;
2630 if (PlayField16[*si + FieldWidth + 1] == 0) // make it fall down if below is empty
2632 MovHighByte(&PlayField16[*si + 1], 0x20);
2633 MovHighByte(&PlayField16[*si + FieldWidth + 1], fiOrangeDisk);
2638 // ==========================================================================
2639 // Release a red disk
2640 // ==========================================================================
2643 PlayField16[*si] = fiMurphy;
2644 RedDiskReleasePhase = 2;
2645 RedDiskCount = RedDiskCount - 1;
2646 subDisplayRedDiskCount();
2649 subSoundFX(*si, fiRedDisk, actDropping);
2651 subSoundFXPush(); // Sound effects
2653 } // subAnimateMurphy
2655 // ==========================================================================
2657 // ==========================================================================
2658 void subExplodeSnikSnaksBelow(int si)
2662 ax = LowByte(PlayField16[si + FieldWidth]);
2663 if (ax == 0x11 || ax == 0xBB)
2664 ExplodeFieldSP(si + FieldWidth);
2665 } // subExplodeSnikSnaksBelow
2667 // ==========================================================================
2669 // Does pushing against an object kill Murphy?
2670 // ==========================================================================
2671 static boolean subMoveKillsMurphy(int si, int ax, int bl)
2673 static boolean subMoveKillsMurphy;
2679 if (ax == 0xFFFF || ax == 0xAAAA || ah == 0)
2685 if (al == fiExplosion)
2688 if (fiOrangeDisk <= al && al <= fiPortUp)
2691 ExplodeFieldSP(si); // Explode
2692 subMoveKillsMurphy = True;
2693 return subMoveKillsMurphy;
2702 ExplodeFieldSP(si); // Explode
2703 subMoveKillsMurphy = True;
2704 return subMoveKillsMurphy;
2706 loc_g_74F6: // zonk left
2708 if (! (ah == 0x20 || ah == 0x40 || ah == 0x50 || ah == 0x70))
2711 subMoveKillsMurphy = True; // Set carry flag
2712 return subMoveKillsMurphy;
2714 loc_g_7512: // zonk right
2716 if (! (ah == 0x30 || ah == 0x40 || ah == 0x60 || ah == 0x70))
2719 loc_g_752E: // Marked fields and Ports
2720 subMoveKillsMurphy = True; // Set carry flag
2721 return subMoveKillsMurphy;
2723 loc_g_7530: // explosion
2724 if ((ah & 0x80) != 0)
2731 ExplodeFieldSP(si); // Explode
2732 subMoveKillsMurphy = True; // Set carry flag
2733 return subMoveKillsMurphy;
2736 PlayField16[si] = 0;
2737 subMoveKillsMurphy = False;
2739 return subMoveKillsMurphy;
2740 } // subMoveKillsMurphy
2742 // ==========================================================================
2744 // Test If si 's a special (grav) port and If so Then fetch new values (see below)
2745 // change conditions to port specs
2746 // The 10-port data base is at data_h_0D28, 10 entries of 6 bytes each:
2747 // (hi),(lo),(gravity),(freeze zonks),(freeze enemies),(unused)
2748 // ==========================================================================
2749 int subSpPortTest(int si)
2756 cx = LInfo.SpecialPortCount; // number of special ports
2758 for (i = 0; i < cx; i++)
2761 /* this assumes that PortLocation is stored as big endian */
2762 bx = LInfo.SpecialPort[i].PortLocation;
2764 /* this assumes that PortLocation is stored as little endian */
2765 bx = HighByte(LInfo.SpecialPort[i].PortLocation);
2766 MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
2771 GravityFlag = LInfo.SpecialPort[i].Gravity;
2772 FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
2773 SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
2775 // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
2783 cx = LInfo.SpecialPortCount; // number of special ports
2784 for (i = 1; i <= cx; i++)
2787 bx = HighByte(LInfo.SpecialPort[i].PortLocation);
2788 MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
2791 GravityFlag = LInfo.SpecialPort[i].Gravity;
2792 FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
2793 SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
2794 // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
2801 return subSpPortTest;
2806 void subCopyFieldToScreen(int si, int fi)
2810 // +++++++++++++++++++++++++++++++++++++++++
2811 X = GetStretchX(si);
2812 Y = GetStretchY(si);
2813 StretchedSprites.BltEx(X, Y, fi);
2814 // +++++++++++++++++++++++++++++++++++++++++
2819 void subCopyAnimToScreen(int si, int graphic, int sync_frame)
2823 // +++++++++++++++++++++++++++++++++++++++++
2824 X = GetStretchX(si);
2825 Y = GetStretchY(si);
2826 StretchedSprites.BltImg(X, Y, graphic, sync_frame);
2827 // +++++++++++++++++++++++++++++++++++++++++
2830 void subCopyImageToScreen(int si, int graphic)
2832 subCopyAnimToScreen(si, graphic, 0);
2835 static void subEatRedDisk(int si)
2837 if (AllowRedDiskCheat == 0)
2839 if (RedDiskReleasePhase != 0)
2841 if (RedDiskReleaseMurphyPos == si)
2846 RedDiskCount = (RedDiskCount + 1) % 256;
2847 subDisplayRedDiskCount();
2850 void subAdjustZonksInfotronsAboveMurphy(int si)
2854 if (LowByte(PlayField16[si]) != fiExplosion)
2855 PlayField16[si] = 0;
2857 ax = PlayField16[si - FieldWidth];
2858 if (ax == 0 || ax == 0x9999)
2861 if (ax == fiZonk || ax == fiInfotron)
2863 MovHighByte(&PlayField16[si - FieldWidth], 0x40); // make falling straigt down
2868 loc_g_15A8: // empty above
2869 ax = PlayField16[si - FieldWidth - 1];
2870 if (ax == fiZonk || ax == fiInfotron)
2874 ax = PlayField16[si - FieldWidth + 1];
2875 if (ax == fiZonk || ax == fiInfotron)
2880 loc_g_15C5: // zonk/infotron above left
2881 ax = PlayField16[si - 1];
2882 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM)) // continue testing right above
2885 MovHighByte(&PlayField16[si - FieldWidth - 1], 0x60); // make roll right
2886 PlayField16[si - FieldWidth] = 0x8888;
2890 loc_g_15E8: // zonk/infotron above right
2891 ax = PlayField16[si + 1];
2892 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
2894 MovHighByte(&PlayField16[si - FieldWidth + 1], 0x50); // make roll left
2895 PlayField16[si - FieldWidth] = 0x8888;
2897 } // subAdjustZonksInfotronsAboveMurphy