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 loc_g_6EC8: // space, base
2059 PlayField16[*si] = fiMurphy;
2060 subAdjustZonksInfotronsAboveMurphy(*si + FieldWidth);
2064 // ==========================================================================
2065 // infotron, moving left
2066 // ==========================================================================
2069 if (0 < LowByte(InfotronsNeeded))
2070 InfotronsNeeded = InfotronsNeeded - 1;
2072 loc_g_6EE6: // space, base
2073 PlayField16[*si] = fiMurphy;
2074 subAdjustZonksInfotronsAboveMurphy(*si + 1);
2078 // ==========================================================================
2079 // infotron, moving down
2080 // ==========================================================================
2083 if (0 < LowByte(InfotronsNeeded))
2084 InfotronsNeeded = InfotronsNeeded - 1;
2086 loc_g_6F04: // space, base
2087 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
2088 PlayField16[*si - FieldWidth] = 0;
2090 PlayField16[*si] = fiMurphy;
2094 // ==========================================================================
2095 // infotron, moving right
2096 // ==========================================================================
2099 if (0 < LowByte(InfotronsNeeded))
2100 InfotronsNeeded = InfotronsNeeded - 1;
2102 loc_g_71C4: // space, base
2103 subAdjustZonksInfotronsAboveMurphy(*si - 1);
2104 PlayField16[*si] = fiMurphy;
2108 // ==========================================================================
2109 // infotron, touching up
2110 // ==========================================================================
2113 if (0 < LowByte(InfotronsNeeded))
2114 InfotronsNeeded = InfotronsNeeded - 1;
2117 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
2118 PlayField16[*si - FieldWidth] = 0;
2122 // ==========================================================================
2123 // infotron, touching left
2124 // ==========================================================================
2127 if (0 < LowByte(InfotronsNeeded))
2128 InfotronsNeeded = InfotronsNeeded - 1;
2131 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2132 PlayField16[*si - 1] = 0;
2136 // ==========================================================================
2137 // infotron, touching down
2138 // ==========================================================================
2141 if (0 < LowByte(InfotronsNeeded))
2142 InfotronsNeeded = InfotronsNeeded - 1;
2145 if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion)
2146 PlayField16[*si + FieldWidth] = 0;
2150 // ==========================================================================
2151 // infotron, touching right
2152 // ==========================================================================
2155 if (0 < LowByte(InfotronsNeeded))
2156 InfotronsNeeded = InfotronsNeeded - 1;
2159 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2160 PlayField16[*si + 1] = 0;
2164 // ==========================================================================
2165 // zonk, pushing left
2166 // ==========================================================================
2169 if (LowByte(PlayField16[*si]) != fiExplosion)
2170 PlayField16[*si] = 0;
2172 PlayField16[*si - 1] = fiMurphy;
2173 PlayField16[*si - 2] = fiZonk;
2174 subExplodeSnikSnaksBelow(*si - 2);
2179 // ==========================================================================
2180 // zonk, pushing right
2181 // ==========================================================================
2184 if (LowByte(PlayField16[*si]) != fiExplosion)
2185 PlayField16[*si] = 0;
2187 PlayField16[*si + 1] = fiMurphy;
2188 PlayField16[*si + 2] = fiZonk;
2189 subExplodeSnikSnaksBelow(*si + 2);
2194 // ==========================================================================
2196 // ==========================================================================
2202 PlayField16[*si] = fiSpace; // remove Murphy from playfield after exiting
2207 // ==========================================================================
2208 // Push Zonk from right to left
2209 // ==========================================================================
2212 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiZonk)
2215 PlayField16[*si] = fiMurphy; // else restore - no more zonk pushing!
2216 PlayField16[*si - 1] = fiZonk;
2217 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2218 PlayField16[*si - 2] = 0;
2220 subCopyImageToScreen(*si, aniMurphy);
2224 // ==========================================================================
2225 // Push Zonk from left to right
2226 // ==========================================================================
2229 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiZonk)
2232 PlayField16[*si] = fiMurphy; // else restore - no more zonk pushing!
2233 PlayField16[*si + 1] = fiZonk;
2234 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2235 PlayField16[*si + 2] = 0;
2237 subCopyImageToScreen(*si, aniMurphy);
2241 // ==========================================================================
2242 // Push orange disk from right to left
2243 // ==========================================================================
2246 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiOrangeDisk)
2249 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2250 PlayField16[*si - 1] = fiOrangeDisk;
2251 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2252 PlayField16[*si - 2] = 0;
2254 subCopyImageToScreen(*si, aniMurphy);
2258 // ==========================================================================
2259 // Push orange disk from left to right
2260 // ==========================================================================
2263 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiOrangeDisk)
2266 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2267 PlayField16[*si + 1] = fiOrangeDisk;
2268 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2269 PlayField16[*si + 2] = 0;
2271 subCopyImageToScreen(*si, aniMurphy);
2275 // ==========================================================================
2276 // Push yellow disk from down to up
2277 // ==========================================================================
2280 if (DemoKeyCode == keyUp && PlayField16[*si - FieldWidth] == fiYellowDisk)
2283 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2284 PlayField16[*si - FieldWidth] = fiYellowDisk;
2285 if (LowByte(PlayField16[*si - 2 * FieldWidth]) != fiExplosion)
2286 PlayField16[*si - 2 * FieldWidth] = 0;
2288 subCopyImageToScreen(*si, aniMurphy);
2292 // ==========================================================================
2293 // Push yellow disk from right to left
2294 // ==========================================================================
2297 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiYellowDisk)
2300 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2301 PlayField16[*si - 1] = fiYellowDisk;
2302 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2303 PlayField16[*si - 2] = 0;
2305 subCopyImageToScreen(*si, aniMurphy);
2309 // ==========================================================================
2310 // Push yellow disk from up to down
2311 // ==========================================================================
2314 if (DemoKeyCode == keyDown && PlayField16[*si + FieldWidth] == fiYellowDisk)
2317 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2318 PlayField16[*si + FieldWidth] = fiYellowDisk;
2319 if (LowByte(PlayField16[*si + 2 * FieldWidth]) != fiExplosion)
2320 PlayField16[*si + 2 * FieldWidth] = 0;
2322 subCopyImageToScreen(*si, aniMurphy);
2326 // ==========================================================================
2327 // Push yellow disk from left to right
2328 // ==========================================================================
2331 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiYellowDisk)
2334 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2335 PlayField16[*si + 1] = fiYellowDisk;
2336 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2337 PlayField16[*si + 2] = 0;
2339 subCopyImageToScreen(*si, aniMurphy);
2343 // ==========================================================================
2344 // time red disk release (space)
2345 // ==========================================================================
2348 if (DemoKeyCode != keySpace)
2350 PlayField16[*si] = fiMurphy;
2351 subCopyImageToScreen(*si, aniMurphy);
2352 RedDiskReleasePhase = 0;
2354 else if (MovingPictureSequencePhase == 0x20)
2357 // anxious murphy, dropping red disk
2358 subCopyImageToScreen(*si, aniMurphyDropping);
2360 subCopyFieldToScreen(*si, 43); // anxious murphy
2362 RedDiskReleasePhase = 1;
2367 // ==========================================================================
2368 // Special port down to up
2369 // ==========================================================================
2372 if (LowByte(PlayField16[*si]) != fiExplosion)
2373 PlayField16[*si] = 0;
2375 PlayField16[*si - 2 * FieldWidth] = fiMurphy;
2377 *si = *si - FieldWidth;
2378 if (HighByte(PlayField16[*si]) == 1)
2381 *si = *si - FieldWidth;
2385 // ==========================================================================
2386 // Special port right to left
2387 // ==========================================================================
2390 if (LowByte(PlayField16[*si]) != fiExplosion)
2391 PlayField16[*si] = 0;
2393 PlayField16[*si - 2] = fiMurphy;
2396 if (HighByte(PlayField16[*si]) == 1)
2403 // ==========================================================================
2404 // Special port up to down
2405 // ==========================================================================
2408 if (LowByte(PlayField16[*si]) != fiExplosion)
2409 PlayField16[*si] = 0;
2411 PlayField16[*si + 2 * FieldWidth] = fiMurphy;
2413 *si = *si + FieldWidth;
2414 if (HighByte(PlayField16[*si]) == 1)
2417 *si = *si + FieldWidth;
2421 // ==========================================================================
2422 // Special port left to right
2423 // ==========================================================================
2426 if (LowByte(PlayField16[*si]) != fiExplosion)
2427 PlayField16[*si] = 0;
2429 PlayField16[*si + 2] = fiMurphy;
2432 if (HighByte(PlayField16[*si]) == 1)
2439 // ==========================================================================
2441 // ==========================================================================
2444 if (LowByte(PlayField16[*si]) != fiExplosion)
2445 PlayField16[*si] = 0;
2447 *si = *si - FieldWidth;
2448 PlayField16[*si] = fiMurphy;
2449 subEatRedDisk(*si); // inc+show Murphy's red disks
2453 // ==========================================================================
2454 // Move Red Disk left
2455 // ==========================================================================
2458 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2459 PlayField16[*si + 1] = 0;
2461 PlayField16[*si] = fiMurphy;
2462 subEatRedDisk(*si); // inc+show Murphy's red disks
2466 // ==========================================================================
2467 // Move Red Disk down
2468 // ==========================================================================
2471 if (LowByte(PlayField16[*si]) != fiExplosion)
2472 PlayField16[*si] = 0;
2474 *si = *si + FieldWidth;
2475 PlayField16[*si] = fiMurphy;
2476 subEatRedDisk(*si); // inc+show Murphy's red disks
2480 // ==========================================================================
2481 // Move Red Disk right
2482 // ==========================================================================
2485 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2486 PlayField16[*si - 1] = 0;
2488 PlayField16[*si] = fiMurphy;
2489 subEatRedDisk(*si); // inc+show Murphy's red disks
2493 // ==========================================================================
2495 // ==========================================================================
2498 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
2499 PlayField16[*si - FieldWidth] = 0;
2501 subEatRedDisk(*si - FieldWidth); // inc+show Murphy's red disks
2505 // ==========================================================================
2506 // Eat Red Disk left
2507 // ==========================================================================
2510 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2511 PlayField16[*si - 1] = 0;
2513 subEatRedDisk(*si - 1); // inc+show Murphy's red disks
2517 // ==========================================================================
2518 // Eat Red Disk down
2519 // ==========================================================================
2522 if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion)
2523 PlayField16[*si + FieldWidth] = 0;
2525 subEatRedDisk(*si + FieldWidth); // inc+show Murphy's red disks
2529 // ==========================================================================
2530 // Eat Red Disk right
2531 // ==========================================================================
2534 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2535 PlayField16[*si + 1] = 0;
2537 subEatRedDisk(*si + 1); // inc+show Murphy's red disks
2541 // ==========================================================================
2542 // yellow disk, pushing up
2543 // ==========================================================================
2546 if (LowByte(PlayField16[*si]) != fiExplosion)
2547 PlayField16[*si] = 0;
2549 *si = *si - FieldWidth;
2550 PlayField16[*si] = fiMurphy;
2551 PlayField16[*si - FieldWidth] = fiYellowDisk;
2555 // ==========================================================================
2556 // yellow disk, pushing left
2557 // ==========================================================================
2560 if (LowByte(PlayField16[*si]) != fiExplosion)
2561 PlayField16[*si] = 0;
2564 PlayField16[*si] = fiMurphy;
2565 PlayField16[*si - 1] = fiYellowDisk;
2569 // ==========================================================================
2570 // yellow disk, pushing down
2571 // ==========================================================================
2574 if (LowByte(PlayField16[*si]) != fiExplosion)
2575 PlayField16[*si] = 0;
2577 *si = *si + FieldWidth;
2578 PlayField16[*si] = fiMurphy;
2579 PlayField16[*si + FieldWidth] = fiYellowDisk;
2583 // ==========================================================================
2584 // yellow disk pushing right
2585 // ==========================================================================
2588 if (LowByte(PlayField16[*si]) != fiExplosion)
2589 PlayField16[*si] = 0;
2592 PlayField16[*si] = fiMurphy;
2593 PlayField16[*si + 1] = fiYellowDisk;
2597 // ==========================================================================
2598 // orange disk, pushing left
2599 // ==========================================================================
2602 if (LowByte(PlayField16[*si]) != fiExplosion)
2603 PlayField16[*si] = 0;
2606 PlayField16[*si] = fiMurphy;
2607 PlayField16[*si - 1] = fiOrangeDisk;
2611 // ==========================================================================
2612 // orange disk, pushing right
2613 // ==========================================================================
2616 if (LowByte(PlayField16[*si]) != fiExplosion)
2617 PlayField16[*si] = 0;
2620 PlayField16[*si] = fiMurphy;
2621 PlayField16[*si + 1] = fiOrangeDisk;
2622 if (PlayField16[*si + FieldWidth + 1] == 0) // make it fall down if below is empty
2624 MovHighByte(&PlayField16[*si + 1], 0x20);
2625 MovHighByte(&PlayField16[*si + FieldWidth + 1], fiOrangeDisk);
2630 // ==========================================================================
2631 // Release a red disk
2632 // ==========================================================================
2635 PlayField16[*si] = fiMurphy;
2636 RedDiskReleasePhase = 2;
2637 RedDiskCount = RedDiskCount - 1;
2640 subSoundFX(*si, fiRedDisk, actDropping);
2642 subSoundFXPush(); // Sound effects
2644 } // subAnimateMurphy
2646 // ==========================================================================
2648 // ==========================================================================
2649 void subExplodeSnikSnaksBelow(int si)
2653 ax = LowByte(PlayField16[si + FieldWidth]);
2654 if (ax == 0x11 || ax == 0xBB)
2655 ExplodeFieldSP(si + FieldWidth);
2656 } // subExplodeSnikSnaksBelow
2658 // ==========================================================================
2660 // Does pushing against an object kill Murphy?
2661 // ==========================================================================
2662 static boolean subMoveKillsMurphy(int si, int ax, int bl)
2664 static boolean subMoveKillsMurphy;
2670 if (ax == 0xFFFF || ax == 0xAAAA || ah == 0)
2676 if (al == fiExplosion)
2679 if (fiOrangeDisk <= al && al <= fiPortUp)
2682 ExplodeFieldSP(si); // Explode
2683 subMoveKillsMurphy = True;
2684 return subMoveKillsMurphy;
2693 ExplodeFieldSP(si); // Explode
2694 subMoveKillsMurphy = True;
2695 return subMoveKillsMurphy;
2697 loc_g_74F6: // zonk left
2699 if (! (ah == 0x20 || ah == 0x40 || ah == 0x50 || ah == 0x70))
2702 subMoveKillsMurphy = True; // Set carry flag
2703 return subMoveKillsMurphy;
2705 loc_g_7512: // zonk right
2707 if (! (ah == 0x30 || ah == 0x40 || ah == 0x60 || ah == 0x70))
2710 loc_g_752E: // Marked fields and Ports
2711 subMoveKillsMurphy = True; // Set carry flag
2712 return subMoveKillsMurphy;
2714 loc_g_7530: // explosion
2715 if ((ah & 0x80) != 0)
2722 ExplodeFieldSP(si); // Explode
2723 subMoveKillsMurphy = True; // Set carry flag
2724 return subMoveKillsMurphy;
2727 PlayField16[si] = 0;
2728 subMoveKillsMurphy = False;
2730 return subMoveKillsMurphy;
2731 } // subMoveKillsMurphy
2733 // ==========================================================================
2735 // Test If si 's a special (grav) port and If so Then fetch new values (see below)
2736 // change conditions to port specs
2737 // The 10-port data base is at data_h_0D28, 10 entries of 6 bytes each:
2738 // (hi),(lo),(gravity),(freeze zonks),(freeze enemies),(unused)
2739 // ==========================================================================
2740 int subSpPortTest(int si)
2747 cx = LInfo.SpecialPortCount; // number of special ports
2749 for (i = 0; i < cx; i++)
2752 /* this assumes that PortLocation is stored as big endian */
2753 bx = LInfo.SpecialPort[i].PortLocation;
2755 /* this assumes that PortLocation is stored as little endian */
2756 bx = HighByte(LInfo.SpecialPort[i].PortLocation);
2757 MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
2762 GravityFlag = LInfo.SpecialPort[i].Gravity;
2763 FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
2764 SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
2766 // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
2774 cx = LInfo.SpecialPortCount; // number of special ports
2775 for (i = 1; i <= cx; i++)
2778 bx = HighByte(LInfo.SpecialPort[i].PortLocation);
2779 MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
2782 GravityFlag = LInfo.SpecialPort[i].Gravity;
2783 FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
2784 SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
2785 // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
2792 return subSpPortTest;
2797 void subCopyFieldToScreen(int si, int fi)
2801 // +++++++++++++++++++++++++++++++++++++++++
2802 X = GetStretchX(si);
2803 Y = GetStretchY(si);
2804 StretchedSprites.BltEx(X, Y, fi);
2805 // +++++++++++++++++++++++++++++++++++++++++
2810 void subCopyAnimToScreen(int si, int graphic, int sync_frame)
2814 // +++++++++++++++++++++++++++++++++++++++++
2815 X = GetStretchX(si);
2816 Y = GetStretchY(si);
2817 StretchedSprites.BltImg(X, Y, graphic, sync_frame);
2818 // +++++++++++++++++++++++++++++++++++++++++
2821 void subCopyImageToScreen(int si, int graphic)
2823 subCopyAnimToScreen(si, graphic, 0);
2826 static void subEatRedDisk(int si)
2828 if (AllowRedDiskCheat == 0)
2830 if (RedDiskReleasePhase != 0)
2832 if (RedDiskReleaseMurphyPos == si)
2837 RedDiskCount = (RedDiskCount + 1) % 256;
2840 void subAdjustZonksInfotronsAboveMurphy(int si)
2844 if (LowByte(PlayField16[si]) != fiExplosion)
2845 PlayField16[si] = 0;
2847 ax = PlayField16[si - FieldWidth];
2848 if (ax == 0 || ax == 0x9999)
2851 if (ax == fiZonk || ax == fiInfotron)
2853 MovHighByte(&PlayField16[si - FieldWidth], 0x40); // make falling straigt down
2858 loc_g_15A8: // empty above
2859 ax = PlayField16[si - FieldWidth - 1];
2860 if (ax == fiZonk || ax == fiInfotron)
2864 ax = PlayField16[si - FieldWidth + 1];
2865 if (ax == fiZonk || ax == fiInfotron)
2870 loc_g_15C5: // zonk/infotron above left
2871 ax = PlayField16[si - 1];
2872 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM)) // continue testing right above
2875 MovHighByte(&PlayField16[si - FieldWidth - 1], 0x60); // make roll right
2876 PlayField16[si - FieldWidth] = 0x8888;
2880 loc_g_15E8: // zonk/infotron above right
2881 ax = PlayField16[si + 1];
2882 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
2884 MovHighByte(&PlayField16[si - FieldWidth + 1], 0x50); // make roll left
2885 PlayField16[si - FieldWidth] = 0x8888;
2887 } // subAdjustZonksInfotronsAboveMurphy