1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
7 static void subEatRedDisk(int si);
8 static boolean subMoveKillsMurphy(int si, int ax, int bl);
10 // static char *VB_Name = "modMurphy";
12 // --- Option Explicit
16 #define LocalStretch (2)
17 #define MurphyZoomFactor (ZoomFactor)
21 #define LocalStretch (1)
22 #define MurphyZoomFactor (1)
26 // ==========================================================================
28 // Move Murphy in any direction
29 // ==========================================================================
31 void subAnimateMurphy(int *si)
33 // int ax, al, ah, bx, bl, i, X, Y;
34 // int tX, tY, tDeltaX, tDeltaY, tPos, Tmp;
36 int ax, al, bl, i, X, Y;
39 int ax, al, bx, bl, i, X, Y;
41 int tDeltaX, tDeltaY, tPos, Tmp;
43 // Variables that hold information about the animation sequence
44 static int *dx = 0; // an array of image positions in moving.mpx, finalized with -1
45 static int dx1 = 0; // same as "*dx" above, but as image/animation token
46 static int dx2 = 0; // an additional image position of a second sprite, for instance: yellow disk if pushed
47 static int MurphyDX = 0, MurphyDY = 0; // murphys move steps
48 static int SeqPos = 0; // index into dx()
49 static int ClearPos = 0; // Position to clear before blitting sprites, none=-1
50 static int dxPos = 0; // field-position to draw dx(SeqPos)
51 static int dx2Step = 0; // position of dx2 relative to dx-position
52 static int dx1SequenceLength = 0;
54 ax = PlayField16[*si];
58 printf("::: Murphy.c: subAnimateMurphy(): %d [%d, %d] %d, %d [%d]\n",
59 *si, *si % 60, *si / 60, ax, al, (al == fiMurphy));
63 printf("::: Murphy.c: subAnimateMurphy(): %d [%d] [%d]\n",
64 YawnSleepCounter, FrameCounter, TimerVar);
69 MurphyMoveCounter = 0; // We have no Murphy! Exit!
74 MurphyMoveCounter = 1; // We have a Murphy!
75 MurphyExplodePos = *si;
77 // (check if high byte of PlayField16 has stored movement information)
78 if (ax != fiMurphy) // yes--go proceed moving murphy?
79 goto locProceedMovingMurphy;
81 // FS: reset moving sequence variables
90 ScratchGravity = 0; // scratch gravity off
91 if (GravityFlag != 0) // Gravity? (1=gravity on)
93 bl = LowByte(PlayField16[*si - FieldWidth]); // check above
94 if (! (bl == fiPortUp || bl == fiPortUpAndDown || bl == fiPortAllDirections))
96 if (PlayField16[*si + FieldWidth] == 0) // gravity on and space below!
102 if (bl != 0) // a key was pressed!
103 goto locKeyPressed5FCF;
106 printf("::: Murphy.c: !!! %d [%d]\n", DemoKeyCode, GravityFlag);
109 RedDiskReleaseFlag = 1;
110 if (ScratchGravity != 0) // gravity pulls & space below?'-> force Space up to down
124 // ------------------------------------------------------------------
125 // Murphy's YAWN & SLEEP sequence, counted down by YawnSleepCounter:
127 YawnSleepCounter = YawnSleepCounter + 1;
129 if (YawnSleepCounter < 16)
132 if (YawnSleepCounter < 2000)
135 // (default: single graphic, no animation)
136 subCopyAnimToScreen(*si, aniMurphy, YawnSleepCounter - 16);
141 if (YawnSleepCounter < 4000)
143 // yawn! and look depressed afterwards...
144 // (default: 12 animation frames with delay of 8)
145 subCopyAnimToScreen(*si, aniMurphyYawn, YawnSleepCounter - 2000);
150 if (YawnSleepCounter < 6400)
153 // (default: 12 animation frames with delay of 8)
154 subCopyAnimToScreen(*si, aniMurphyYawn, YawnSleepCounter - 4000);
159 // time1 = 6400 + 12 * 8; // (default: 6496 == 6400 + 12 * 8)
160 time1 = 6400 + 12 * 10;
162 if (YawnSleepCounter < time1)
164 // yawn again! - third time
165 // (default: 12 animation frames with delay of 8)
166 subCopyAnimToScreen(*si, aniMurphyYawn, YawnSleepCounter - 6400);
171 // time2 = 6496 + 3 * 64; // (default: 6688 == 6496 + 3 * 64)
172 time2 = 6496 + 3 * 100;
174 if (YawnSleepCounter > time2) // Murphy already went to sleep
177 if (PlayField16[*si - 1] == 0)
179 if (PlayField16[*si + 1] == 0)
181 // no sleep -- go back to "wait and start yawning" phase
182 YawnSleepCounter = 144;
188 // go to sleep (right side)
189 // (default: 3 animation frames with delay of 64)
190 subCopyAnimToScreen(*si, aniMurphySleepRight, YawnSleepCounter - time1);
196 // go to sleep (left side)
197 // (default: 3 animation frames with delay of 64)
198 subCopyAnimToScreen(*si, aniMurphySleepLeft, YawnSleepCounter - time1);
202 // end of YAWN-SLEEP-Sequence
210 // ------------------------------------------------------------------
211 // Murphy's YAWN & SLEEP sequence, counted down by YawnSleepCounter:
212 YawnSleepCounter = YawnSleepCounter + 1;
213 if (YawnSleepCounter == 4)
215 subCopyFieldToScreen(*si, fiMurphy); // normal grin
219 if (YawnSleepCounter <= 500) // loc_g_5ED7:
222 if (YawnSleepCounter <= 522)
224 bx = (YawnSleepCounter - 500) / 2;
225 subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn! and look depressed afterwards...
229 if (YawnSleepCounter <= 1000)
232 if (YawnSleepCounter <= 1022)
234 bx = (YawnSleepCounter - 1000) / 2;
235 subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn again!
239 if (YawnSleepCounter <= 1600) // loc_g_5F3B:
242 if (YawnSleepCounter <= 1622)
244 bx = (YawnSleepCounter - 1600) / 2;
245 subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn again! - third time
249 if (YawnSleepCounter > 1654)
252 if (PlayField16[*si - 1] == 0)
254 if (PlayField16[*si + 1] == 0)
256 YawnSleepCounter = 36;
262 bx = (YawnSleepCounter - 1622) / 16;
263 subCopyFieldToScreen(*si, aniMurphySleepRight + bx); // go to sleep
268 bx = (YawnSleepCounter - 1622) / 16;
269 subCopyFieldToScreen(*si, aniMurphySleepLeft + bx); // go to sleep
273 // end of YAWN-SLEEP-Sequence
277 // ------------------------------------------------------------------
278 // ==========================================================================
279 // (Direct Jump) a key was pressed
280 // ==========================================================================
283 if (ScratchGravity == 0)
286 if (PlayField16[*si + FieldWidth] != 0)
291 if (PlayField16[*si - FieldWidth] == fiBase)
295 else if (bl == keyLeft)
297 if (PlayField16[*si - 1] == fiBase)
301 else if (bl == keyRight)
303 if (PlayField16[*si + 1] == fiBase)
307 bl = keyDown; // force moving down!
312 RedDiskReleaseFlag = 0; // moving down to up ...
318 RedDiskReleaseFlag = 0; // moving right to left ...
324 RedDiskReleaseFlag = 0; // moving up to down ...
330 RedDiskReleaseFlag = 0; // moving left to right ...
335 case keySpaceUp: // 5
336 RedDiskReleaseFlag = 0; // touching down to up ...
341 case keySpaceLeft: // 6
342 RedDiskReleaseFlag = 0; // touching right to left ...
347 case keySpaceDown: // 7
348 RedDiskReleaseFlag = 0; // touching up to down ...
353 case keySpaceRight: // 8
354 RedDiskReleaseFlag = 0; // touching left to right ...
360 goto loc_g_62E2; // no move ...
365 RedDiskReleaseFlag = 0;
370 // ==========================================================================
371 // moving down to up ...
372 // ==========================================================================
378 ax = PlayField16[*si - FieldWidth];
389 if (ax == fiInfotron)
395 if (al == fiTerminal)
398 if (al == fiPortUp || al == fiPortUpAndDown || al == fiPortAllDirections)
404 if (al == fiYellowDisk)
407 if (! subMoveKillsMurphy(*si - FieldWidth, ax, bl))
412 // ==========================================================================
413 // moving right to left ...
414 // ==========================================================================
420 MurphyVarFaceLeft = 1;
421 ax = PlayField16[*si - 1];
432 if (ax == fiInfotron)
441 if (al == fiTerminal)
444 if (al == fiPortLeft || al == fiPortLeftAndRight || al == fiPortAllDirections)
450 if (ax == fiYellowDisk)
453 if (ax == fiOrangeDisk)
456 if (! subMoveKillsMurphy(*si - 1, ax, bl))
461 // ==========================================================================
462 // moving up to down ...
463 // ==========================================================================
469 ax = PlayField16[*si + FieldWidth];
480 if (ax == fiInfotron)
486 if (al == fiTerminal)
489 if (al == fiPortDown || al == fiPortUpAndDown || al == fiPortAllDirections)
495 if (al == fiYellowDisk)
498 if (! subMoveKillsMurphy(*si + FieldWidth, ax, bl))
503 // ==========================================================================
504 // moving left to right ...
505 // ==========================================================================
511 MurphyVarFaceLeft = 0;
512 ax = PlayField16[*si + 1];
523 if (ax == fiInfotron)
532 if (al == fiTerminal)
535 if (al == fiPortRight || al == fiPortLeftAndRight || al == fiPortAllDirections)
541 if (al == fiYellowDisk)
544 if (ax == fiOrangeDisk)
547 if (! subMoveKillsMurphy(*si + 1, ax, bl))
552 // ==========================================================================
553 // touching down to up ...
554 // ==========================================================================
559 dxPos = *si - FieldWidth;
561 ax = PlayField16[*si - FieldWidth];
570 if (ax == fiInfotron)
573 if (al == fiTerminal)
581 // ==========================================================================
582 // touching right to left ...
583 // ==========================================================================
590 MurphyVarFaceLeft = 1;
591 ax = PlayField16[*si - 1];
599 if (ax == fiInfotron)
602 if (al == fiTerminal)
610 // ==========================================================================
611 // touching up to down ...
612 // ==========================================================================
617 dxPos = *si + FieldWidth;
619 ax = PlayField16[*si + FieldWidth];
627 if (ax == fiInfotron)
630 if (al == fiTerminal)
638 // ==========================================================================
639 // touching left to right ...
640 // ==========================================================================
647 MurphyVarFaceLeft = 0;
648 ax = PlayField16[*si + 1];
656 if (ax == fiInfotron)
659 if (al == fiTerminal)
667 // ==========================================================================
668 // Release Red disk: no move ...
669 // ==========================================================================
675 if (LowByte(RedDiskCount) == 0)
678 if (LowByte(RedDiskReleasePhase) != 0)
681 if (LowByte(RedDiskReleaseFlag) != 1)
684 MovHighByte(&PlayField16[*si], 0x2A);
685 MovingPictureSequencePhase = 0x40; // init picture move sequence
686 dx = aniFramesRedDisk;
688 MovLowByte(&RedDiskReleasePhase, 1);
689 Mov(&RedDiskReleaseMurphyPos, *si); // remember Murphy's location
692 // ==========================================================================
693 // SPACE moving down to up
694 // ==========================================================================
697 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
698 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyMoveUpRight : aniMurphyMoveUpLeft);
699 PlayField16[*si - FieldWidth] = 0x103;
700 PlayField16[*si] = 0x300;
701 *si = *si - FieldWidth;
702 goto loc_StopNoSplit;
704 // ==========================================================================
705 // SPACE moving right to left
706 // ==========================================================================
709 dx = aniFramesMurphyEatLeft;
710 dx1 = aniMurphyMoveLeft;
711 PlayField16[*si - 1] = 0x203;
712 PlayField16[*si] = 0x300;
714 goto loc_StopNoSplit;
716 // ==========================================================================
717 // SPACE moving up to down, and when gravity is pulling!
718 // ==========================================================================
721 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
722 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyMoveUpRight : aniMurphyMoveUpLeft);
723 PlayField16[*si + FieldWidth] = 0x303;
724 PlayField16[*si] = 0x300;
725 *si = *si + FieldWidth;
726 goto loc_StopNoSplit;
728 // ==========================================================================
729 // SPACE moving left to right
730 // ==========================================================================
733 dx = aniFramesMurphyEatRight;
734 dx1 = aniMurphyMoveRight;
735 PlayField16[*si + 1] = 0x403;
736 PlayField16[*si] = 0x300;
738 goto loc_StopNoSplit;
740 // ==========================================================================
741 // BUG moving down to up
742 // ==========================================================================
745 if (SgnHighByte(PlayField16[*si - FieldWidth]) >= 0)
747 ExplodeFieldSP(*si); // Explode
752 PlayField16[*si - FieldWidth] = fiBase;
753 // ==========================================================================
754 // BASE moving down to up
755 // ==========================================================================
759 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
760 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
761 PlayField16[*si - FieldWidth] = 0x503;
762 PlayField16[*si] = 0x300;
763 *si = *si - FieldWidth;
764 goto loc_StopNoSplit;
766 // ==========================================================================
767 // BUG moving right to left
768 // ==========================================================================
771 if (SgnHighByte(PlayField16[*si - 1]) >= 0)
773 ExplodeFieldSP(*si); // Explode
778 PlayField16[*si - 1] = fiBase;
779 // ==========================================================================
780 // BASE moving right to left
781 // ==========================================================================
785 dx = aniFramesMurphyEatLeft;
786 dx1 = aniMurphyDigLeft;
787 PlayField16[*si - 1] = 0x203;
788 PlayField16[*si] = 0x300;
790 goto loc_StopNoSplit;
792 // ==========================================================================
793 // BUG moving up to down
794 // ==========================================================================
797 if (SgnHighByte(PlayField16[*si + FieldWidth]) >= 0)
799 ExplodeFieldSP(*si); // Explode
804 PlayField16[*si + FieldWidth] = fiBase;
805 // ==========================================================================
806 // BASE moving up to down
807 // ==========================================================================
811 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
812 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
813 PlayField16[*si + FieldWidth] = 0x703;
814 PlayField16[*si] = 0x300;
815 *si = *si + FieldWidth;
816 goto loc_StopNoSplit;
818 // ==========================================================================
819 // BUG moving left to right
820 // ==========================================================================
823 if (SgnHighByte(PlayField16[*si + 1]) >= 0)
825 ExplodeFieldSP(*si); // Explode
830 PlayField16[*si + 1] = fiBase;
831 // ==========================================================================
832 // BASE moving left to right
833 // ==========================================================================
837 dx = aniFramesMurphyEatRight;
838 dx1 = aniMurphyDigRight;
839 PlayField16[*si + 1] = 0x803;
840 PlayField16[*si] = 0x300;
842 goto loc_StopNoSplit;
844 // ==========================================================================
845 // BUG touching down to up
846 // ==========================================================================
849 if (SgnHighByte(PlayField16[*si - FieldWidth]) >= 0)
851 ExplodeFieldSP(*si); // Explode
856 PlayField16[*si - FieldWidth] = fiBase;
857 // ==========================================================================
858 // BASE touching down to up
859 // ==========================================================================
862 subCopyImageToScreen(*si, aniMurphyTouchUp);
864 dx = aniFramesTouchBase;
866 dxPos = *si - FieldWidth;
867 MovHighByte(&PlayField16[*si], 0x10);
868 goto loc_StopNoSplit;
870 // ==========================================================================
871 // BUG touching right to left
872 // ==========================================================================
875 if (SgnHighByte(PlayField16[*si - 1]) >= 0)
877 ExplodeFieldSP(*si); // Explode
882 PlayField16[*si - 1] = fiBase;
883 // ==========================================================================
884 // BASE touching right to left
885 // ==========================================================================
888 subCopyImageToScreen(*si, aniMurphyTouchLeft);
890 dx = aniFramesTouchBase;
893 MovHighByte(&PlayField16[*si], 0x11);
894 goto loc_StopNoSplit;
896 // ==========================================================================
897 // BUG touching up to down
898 // ==========================================================================
901 if (SgnHighByte(PlayField16[*si + FieldWidth]) >= 0)
903 ExplodeFieldSP(*si); // Explode
908 PlayField16[*si + FieldWidth] = fiBase;
909 // ==========================================================================
910 // BASE touching up to down
911 // ==========================================================================
914 subCopyImageToScreen(*si, aniMurphyTouchDown);
916 dx = aniFramesTouchBase;
918 dxPos = *si + FieldWidth;
919 MovHighByte(&PlayField16[*si], 0x12);
920 goto loc_StopNoSplit;
922 // ==========================================================================
923 // BUG touching left to right
924 // ==========================================================================
927 if (SgnHighByte(PlayField16[*si + 1]) >= 0)
929 ExplodeFieldSP(*si); // Explode
934 PlayField16[*si + 1] = fiBase;
935 // ==========================================================================
936 // BASE touching left to right
937 // ==========================================================================
940 subCopyImageToScreen(*si, aniMurphyTouchRight);
942 dx = aniFramesTouchBase;
945 MovHighByte(&PlayField16[*si], 0x13);
946 goto loc_StopNoSplit;
948 // ==========================================================================
949 // INFOTRON moving down to up
950 // ==========================================================================
953 subSoundFXInfotron();
954 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
955 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
956 PlayField16[*si - FieldWidth] = 0x903;
957 PlayField16[*si] = 0x300;
958 *si = *si - FieldWidth;
959 goto loc_StopNoSplit;
961 // ==========================================================================
962 // INFOTRON moving right to left
963 // ==========================================================================
966 subSoundFXInfotron();
967 dx = aniFramesEatInfotronLeft;
968 dx1 = aniEatInfotronLeft;
974 PlayField16[*si - 1] = 0xA03;
975 PlayField16[*si] = 0x300;
977 goto loc_StopNoSplit;
979 // ==========================================================================
980 // INFOTRON moving up to down
981 // ==========================================================================
984 subSoundFXInfotron();
985 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
986 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
987 PlayField16[*si + FieldWidth] = 0xB03;
988 PlayField16[*si] = 0x300;
989 *si = *si + FieldWidth;
990 goto loc_StopNoSplit;
992 // ==========================================================================
993 // INFOTRON moving left to right
994 // ==========================================================================
997 subSoundFXInfotron();
998 dx = aniFramesEatInfotronRight;
999 dx1 = aniEatInfotronRight;
1005 PlayField16[*si + 1] = 0xC03;
1006 PlayField16[*si] = 0x300;
1008 goto loc_StopNoSplit;
1010 // ==========================================================================
1011 // INFOTRON touching down to up
1012 // ==========================================================================
1015 subCopyImageToScreen(*si, aniMurphyTouchUp);
1016 subSoundFXInfotron();
1017 dx = aniFramesTouchInfotron;
1018 dx1 = aniTouchInfotron;
1019 MovHighByte(&PlayField16[*si], 0x14);
1020 MovHighByte(&PlayField16[*si - FieldWidth], 0xFF);
1021 goto loc_StopNoSplit;
1023 // ==========================================================================
1024 // INFOTRON touching right to left
1025 // ==========================================================================
1028 subCopyImageToScreen(*si, aniMurphyTouchLeft);
1029 subSoundFXInfotron();
1030 dx = aniFramesTouchInfotron;
1031 dx1 = aniTouchInfotron;
1032 MovHighByte(&PlayField16[*si], 0x15);
1033 MovHighByte(&PlayField16[*si - 1], 0xFF);
1034 goto loc_StopNoSplit;
1036 // ==========================================================================
1037 // INFOTRON touching up to down
1038 // ==========================================================================
1041 subCopyImageToScreen(*si, aniMurphyTouchDown);
1042 subSoundFXInfotron();
1043 dx = aniFramesTouchInfotron;
1044 dx1 = aniTouchInfotron;
1045 MovHighByte(&PlayField16[*si], 0x16);
1046 MovHighByte(&PlayField16[*si + FieldWidth], 0xFF);
1047 goto loc_StopNoSplit;
1049 // ==========================================================================
1050 // INFOTRON touching left to right
1051 // ==========================================================================
1054 subCopyImageToScreen(*si, aniMurphyTouchRight);
1055 subSoundFXInfotron();
1056 dx = aniFramesTouchInfotron;
1057 dx1 = aniTouchInfotron;
1058 MovHighByte(&PlayField16[*si], 0x17);
1059 MovHighByte(&PlayField16[*si + 1], 0xFF);
1060 goto loc_StopNoSplit;
1062 // ==========================================================================
1063 // EXIT pressed from any direction
1064 // ==========================================================================
1072 if (LowByte(InfotronsNeeded) != 0)
1076 if (!game_sp_info.LevelSolved)
1077 printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n",LevelNumber);
1081 game_sp_info.LevelSolved = TRUE;
1085 data_h_DemoDone = 1; // EP set level success bytes
1086 LevelStatus = 1; // set Level Status DONE
1087 EP_GameDemoVar0DAA = 0; // force demo for lead-out
1088 if (SavedGameFlag == 0) // saved game running?
1090 if (UpdateTimeFlag != 0) // update time?
1092 UpdatedFlag = 1; // prevent double update
1093 subUpdatePlayingTime(); // update playing time
1098 subUpdateHallOfFame(); // update time + Hall-Of-Fame
1101 LeadOutCounter = 0x40; // quit: start lead-out
1102 dx = aniFramesMurphyExit;
1103 dx1 = aniMurphyExit;
1104 MovHighByte(&PlayField16[*si], 0xD);
1105 goto loc_StopNoSplit;
1107 // ==========================================================================
1108 // ZONK moving right to left
1109 // ==========================================================================
1112 ax = PlayField16[*si - 2];
1116 MovHighByte(&PlayField16[*si - 2], 1);
1117 subCopyImageToScreen(*si, aniPushLeft); // draw pushing murphy
1118 dx = aniFramesZonkRollLeft;
1119 dx1 = aniZonkRollLeft;
1123 MovHighByte(&PlayField16[*si], 0xE);
1124 goto loc_MoveNoSplit;
1126 // ==========================================================================
1127 // ZONK moving left to right
1128 // ==========================================================================
1131 ax = PlayField16[*si + 2];
1135 ax = PlayField16[*si + FieldWidth + 1];
1136 if (ax == 0) // zonk falls
1139 MovHighByte(&PlayField16[*si + 2], 1);
1140 subCopyImageToScreen(*si, aniPushRight); // draw pushing murphy
1141 dx = aniFramesZonkRollRight;
1142 dx1 = aniZonkRollRight;
1146 MovHighByte(&PlayField16[*si], 0xF);
1147 goto loc_MoveNoSplit;
1149 // ==========================================================================
1150 // TERMINAL moving/touching down to up
1151 // ==========================================================================
1154 subCopyImageToScreen(*si, aniMurphyTouchUp);
1155 if (YellowDisksExploded != 0)
1157 YawnSleepCounter = 40; // stay hypnotized
1163 // draw new terminal type
1164 subCopyImageToScreen(*si - FieldWidth, aniTerminalActive);
1166 subCopyFieldToScreen(*si - FieldWidth, 0x88); // draw new terminal type
1168 TerminalState[*si - FieldWidth] = 8;
1171 // ==========================================================================
1172 // TERMINAL moving/touching right to left
1173 // ==========================================================================
1176 subCopyImageToScreen(*si, aniMurphyTouchLeft);
1177 if (YellowDisksExploded != 0)
1179 YawnSleepCounter = 40; // stay hypnotized
1185 // draw new terminal type
1186 subCopyImageToScreen(*si - 1, aniTerminalActive);
1188 subCopyFieldToScreen(*si - 1, 0x88); // draw new terminal type
1190 TerminalState[*si - 1] = 8;
1193 // ==========================================================================
1194 // TERMINAL moving/touching up to down
1195 // ==========================================================================
1198 subCopyImageToScreen(*si, aniMurphyTouchDown);
1199 if (YellowDisksExploded != 0)
1201 YawnSleepCounter = 40; // stay hypnotized
1207 // draw new terminal type
1208 subCopyImageToScreen(*si + FieldWidth, aniTerminalActive);
1210 subCopyFieldToScreen(*si + FieldWidth, 0x88); // draw new terminal type
1212 TerminalState[*si + FieldWidth] = 8;
1215 // ==========================================================================
1216 // TERMINAL moving/touching left to right
1217 // ==========================================================================
1220 subCopyImageToScreen(*si, aniMurphyTouchRight);
1221 if (YellowDisksExploded != 0)
1223 YawnSleepCounter = 40; // stay hypnotized
1229 // draw new terminal type
1230 subCopyImageToScreen(*si + 1, aniTerminalActive);
1232 subCopyFieldToScreen(*si + 1, 0x88); // draw new terminal type
1234 TerminalState[*si + 1] = 8;
1235 // ==========================================================================
1236 // common TERMINAL stuff moving/touching from all directions
1237 // ==========================================================================
1240 TerminalMaxCycles = 7;
1241 YellowDisksExploded = 1;
1242 for (i = 0; i <= LevelMax; i++)
1244 if (PlayField16[i] == fiYellowDisk)
1250 // ==========================================================================
1251 // PORT down to up, VERTICAL PORT, CROSS PORT all moving down to up
1252 // ==========================================================================
1255 if (PlayField16[*si - 2 * FieldWidth] != 0)
1258 dx = aniFramesSplitUpDown;
1259 dx1 = aniSplitUpDown;
1260 dx2Step = -FieldWidth;
1261 PlayField16[*si] = 0x1803;
1262 PlayField16[*si - 2 * FieldWidth] = 0x300;
1265 // ==========================================================================
1266 // PORT right to left, HORIZONTAL PORT, CROSS PORT all moving right to left
1267 // ==========================================================================
1270 if (PlayField16[*si - 2] != 0)
1273 dx = aniFramesMurphyEatLeft;
1274 dx1 = aniMurphyMoveLeft;
1276 PlayField16[*si] = 0x1903;
1277 PlayField16[*si - 2] = 0x300;
1280 // ==========================================================================
1281 // PORT up to down, VERTICAL PORT, CROSS PORT all moving up to down
1282 // ==========================================================================
1285 if (PlayField16[*si + 2 * FieldWidth] != 0)
1288 dx = aniFramesSplitUpDown;
1289 dx1 = aniSplitUpDown;
1290 dx2Step = FieldWidth;
1291 PlayField16[*si] = 0x1A03;
1292 PlayField16[*si + 2 * FieldWidth] = 0x300;
1295 // ==========================================================================
1296 // PORT left to right, HORIZONTAL PORT, CROSS PORT all moving left to right
1297 // ==========================================================================
1300 if (PlayField16[*si + 2] != 0)
1303 dx = aniFramesMurphyEatRight;
1304 dx1 = aniMurphyMoveRight;
1306 PlayField16[*si] = 0x1B03;
1307 PlayField16[*si + 2] = 0x300;
1310 MovingPictureSequencePhase = 0; // stop picture move sequence
1311 SplitMoveFlag = 1; // port: split movement
1314 // ==========================================================================
1315 // RED DISK moving down to up
1316 // ==========================================================================
1319 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
1320 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
1321 PlayField16[*si] = 0x1C03;
1322 PlayField16[*si - FieldWidth] = 0x300;
1323 goto loc_StopNoSplit;
1325 // ==========================================================================
1326 // RED DISK moving right to left
1327 // ==========================================================================
1330 dx = aniFramesMurphyEatLeft;
1331 dx1 = aniMurphyEatLeft;
1332 PlayField16[*si] = 0x300; // !!!!!! this time we move murphy at sequence-start!
1333 PlayField16[*si - 1] = 0x1D03;
1335 goto loc_StopNoSplit;
1337 // ==========================================================================
1338 // RED DISK moving up to down
1339 // ==========================================================================
1342 dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
1343 dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
1344 PlayField16[*si] = 0x1E03;
1345 PlayField16[*si + FieldWidth] = 0x300;
1346 goto loc_StopNoSplit;
1348 // ==========================================================================
1349 // RED DISK moving left to right
1350 // ==========================================================================
1353 // dx = aniFramesMurphyEatRightRedDisk 'this sequence is 9 steps long!
1354 dx = aniFramesMurphyEatRight;
1355 dx1 = aniMurphyEatRight;
1356 // --------------------------------------------------------------------------
1358 // Table data_h_145A, pointed to by table data_h_105E, has a severe bug:
1359 // The Red Disk sequence is 8 pictures long, but 9 are displayed, because it
1360 // has 1 extra entry, which causes Murphy to end slightly shifted to the left!
1361 // We may not fix the table, because then the timing of the game changes
1362 // and several existing demo's do not run properly anymore.
1363 // We only correct Murphies x-location here, when the sequence starts.
1364 // Remember that this is not the real bug-fix, but we must live with
1365 // this existing bug and correct for the consequences of it.
1368 if (0 == AllowEatRightRedDiskBug) // Murphy's screen x-position
1369 MurphyScreenXPos = MurphyScreenXPos - 2 * MurphyZoomFactor;
1371 if (0 == AllowEatRightRedDiskBug) // Murphy's screen x-position
1372 MurphyScreenXPos = MurphyScreenXPos - 2;
1376 // FS: for me this means to blit the first animation frame twice
1378 // --------------------------------------------------------------------------
1379 PlayField16[*si] = 0x300; // !!!!!! this time we move murphy at sequence-start!
1380 PlayField16[*si + 1] = 0x1F03;
1382 goto loc_StopNoSplit;
1384 // ==========================================================================
1385 // RED DISK touching down to up
1386 // ==========================================================================
1389 dx = aniFramesTouchRedDisk;
1390 dx1 = aniTouchRedDisk;
1391 MovHighByte(&PlayField16[*si], 0x20);
1392 MovHighByte(&PlayField16[*si - FieldWidth], 3);
1393 goto loc_StopNoSplit;
1395 // ==========================================================================
1396 // RED DISK touching right to left
1397 // ==========================================================================
1400 dx = aniFramesTouchRedDisk;
1401 dx1 = aniTouchRedDisk;
1402 MovHighByte(&PlayField16[*si], 0x21);
1403 MovHighByte(&PlayField16[*si - 1], 3);
1404 goto loc_StopNoSplit;
1406 // ==========================================================================
1407 // RED DISK touching up to down
1408 // ==========================================================================
1411 dx = aniFramesTouchRedDisk;
1412 dx1 = aniTouchRedDisk;
1413 MovHighByte(&PlayField16[*si], 0x22);
1414 MovHighByte(&PlayField16[*si + FieldWidth], 3);
1415 goto loc_StopNoSplit;
1417 // ==========================================================================
1418 // RED DISK touching left to right
1419 // ==========================================================================
1422 dx = aniFramesTouchRedDisk;
1423 dx1 = aniTouchRedDisk;
1424 MovHighByte(&PlayField16[*si], 0x23);
1425 MovHighByte(&PlayField16[*si + 1], 3);
1428 MovingPictureSequencePhase = 0; // stop picture move sequence
1431 // ==========================================================================
1432 // YELLOW DISK moving down to up
1433 // ==========================================================================
1436 if (PlayField16[*si - 2 * FieldWidth] != 0)
1439 PlayField16[*si - 2 * FieldWidth] = 0x1200;
1441 subCopyImageToScreen(*si, aniPushRight);
1443 dx = aniFramesYellowDisk;
1444 dx1 = aniYellowDisk;
1445 dxPos = *si - FieldWidth;
1447 dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
1449 dx2 = aniPushUpDown;
1451 dx2Step = FieldWidth;
1452 PlayField16[*si] = 0x2403;
1454 subCopyImageToScreen(*si, dx2);
1456 goto loc_MoveNoSplit;
1458 // ==========================================================================
1459 // YELLOW DISK moving right to left
1460 // ==========================================================================
1463 if (PlayField16[*si - 2] != 0)
1466 PlayField16[*si - 2] = 0x1200;
1467 subCopyImageToScreen(*si, aniPushLeft);
1468 dx = aniFramesYellowDisk;
1469 dx1 = aniYellowDisk;
1473 PlayField16[*si] = 0x2503;
1474 goto loc_MoveNoSplit;
1476 // ==========================================================================
1477 // YELLOW DISK moving up to down
1478 // ==========================================================================
1481 if (PlayField16[*si + 2 * FieldWidth] != 0)
1484 PlayField16[*si + 2 * FieldWidth] = 0x1200;
1486 subCopyImageToScreen(*si, aniPushRight);
1488 dx = aniFramesYellowDisk;
1489 dx1 = aniYellowDisk;
1490 dxPos = *si + FieldWidth;
1492 dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
1494 dx2 = aniPushUpDown;
1496 dx2Step = -FieldWidth;
1497 PlayField16[*si] = 0x2703;
1499 subCopyImageToScreen(*si, dx2);
1501 goto loc_MoveNoSplit;
1503 // ==========================================================================
1504 // YELLOW DISK moving left to right
1505 // ==========================================================================
1508 if (PlayField16[*si + 2] != 0)
1511 PlayField16[*si + 2] = 0x1200;
1512 subCopyImageToScreen(*si, aniPushRight);
1513 dx = aniFramesYellowDisk;
1514 dx1 = aniYellowDisk;
1518 PlayField16[*si] = 0x2603;
1519 goto loc_MoveNoSplit;
1521 // ==========================================================================
1522 // ORANGE DISK moving right to left
1523 // ==========================================================================
1526 if (PlayField16[*si - 2] != 0)
1529 PlayField16[*si - 2] = 0x800;
1530 subCopyImageToScreen(*si, aniPushLeft);
1531 dx = aniFramesOrangeDisk;
1532 dx1 = aniOrangeDisk;
1536 PlayField16[*si] = 0x2803;
1537 goto loc_MoveNoSplit;
1539 // ==========================================================================
1540 // ORANGE DISK moving left to right
1541 // ==========================================================================
1544 if (PlayField16[*si + 2] != 0)
1547 if (PlayField16[*si + FieldWidth + 1] == 0) // falling goes before pushing
1550 PlayField16[*si + 2] = 0x100;
1551 subCopyImageToScreen(*si, aniPushRight);
1552 dx = aniFramesOrangeDisk;
1553 dx1 = aniOrangeDisk;
1557 PlayField16[*si] = 0x2903;
1558 // ==========================================================================
1559 // Copy screen animation action table to action work space
1560 // (To paint sequence: Push Zonk/Disk / release red disk / Port passing)
1561 // ==========================================================================
1564 MovingPictureSequencePhase = 8; // init picture move sequence
1567 SplitMoveFlag = 0; // no port: no split movement
1570 // copy/store global move sequence info????????????????????????????????????
1571 // ... dont think so ...(FS)
1572 // ==========================================================================
1573 // Proceed with all movements
1574 // ==========================================================================
1576 locProceedMovingMurphy: // proceed moving murphy
1577 YawnSleepCounter = 0; // Wake up sleeping Murphy
1578 ax = MovingPictureSequencePhase; // sequence busy?
1579 if (ax == 0) // no -- start sequence!
1582 ax = ax - 1; // next picture of sequence
1583 MovingPictureSequencePhase = ax; // store for later
1584 if (ax == 0) // Sound effects
1587 bl = HighByte(PlayField16[*si]);
1588 if (bl == 0xE) // Push Zonk to left
1591 if (bl == 0xF) // Push Zonk to right
1594 if (bl == 0x28) // Push orange disk to left
1597 if (bl == 0x29) // Push orange disk to right
1600 if (bl == 0x24) // Push yellow disk up
1603 if (bl == 0x25) // Push yellow disk to left
1606 if (bl == 0x27) // Push yellow disk down
1609 if (bl == 0x26) // Push yellow disk to right
1612 if (bl == 0x2A) // Red disk release timer
1617 // ==========================================================================
1618 // Paint frame of MOVING.DAT sequence
1619 // ==========================================================================
1625 dx1SequenceLength = getSequenceLength(dx1);
1628 if (SplitMoveFlag == 0)
1630 // ++++++++++++++++++++++++++
1631 // Begin of normal movement
1633 MurphyScreenXPos = MurphyScreenXPos + MurphyDX * MurphyZoomFactor;
1634 MurphyScreenYPos = MurphyScreenYPos + MurphyDY * MurphyZoomFactor;
1636 MurphyScreenXPos = MurphyScreenXPos + MurphyDX;
1637 MurphyScreenYPos = MurphyScreenYPos + MurphyDY;
1642 printf("::: %04d [%03ld, %02d] ----------> %s [%d] [%d, %d] [%d, %d] [%d]\n",
1644 DemoOffset - DemoPointer, DemoKeyRepeatCounter,
1645 (DemoKeyCode == keyNone ? "(none)" :
1646 DemoKeyCode == keyLeft ? "left" :
1647 DemoKeyCode == keyRight ? "right" :
1648 DemoKeyCode == keyUp ? "up" :
1649 DemoKeyCode == keyDown ? "down" :
1650 DemoKeyCode == keySpace ? "space" :
1651 DemoKeyCode == keySpaceLeft ? "space + left" :
1652 DemoKeyCode == keySpaceRight ? "space + right" :
1653 DemoKeyCode == keySpaceUp ? "space + up" :
1654 DemoKeyCode == keySpaceDown ? "space + down" : "(unknown)"),
1656 MurphyScreenXPos, MurphyScreenYPos,
1657 MurphyPosIndex % 60, MurphyPosIndex / 60,
1666 if (!(ClearPos < 0)) // clear field that murphy is leaving
1667 subCopyImageToScreen(ClearPos, aniSpace);
1669 if (! ClearPos < 0) // clear field that murphy is leaving
1670 subCopyFieldToScreen(ClearPos, 0);
1674 printf("::: ---------------> %d, %d [%d, %d]\n",
1675 MurphyScreenXPos, MurphyScreenYPos, MurphyDX, MurphyDY);
1678 if (dx2 == fiInfotron) // special case of infotron moving left or right
1685 tDeltaX = MurphyDX * LocalStretch * (SeqPos + 1);
1686 tDeltaY = MurphyDY * LocalStretch * (SeqPos + 1);
1689 X = GetStretchX(dxPos) + tDeltaX;
1690 Y = GetStretchY(dxPos) + tDeltaY;
1691 Tmp = (SeqPos < 0 ? 0 : SeqPos); // 9StepBugFix!(red disk move right)
1694 if (isSnappingSequence(dx1) && SeqPos == dx1SequenceLength - 1)
1699 StretchedSprites.BltImg(X, Y, dx1, Tmp);
1700 // printf("::: Tmp: %d\n", Tmp);
1702 StretchedSprites.BltEx(X, Y, dx[Tmp]);
1711 tPos = dxPos + dx2Step;
1712 X = GetStretchX(tPos);
1713 Y = GetStretchY(tPos);
1714 if (dx2 == fiInfotron) // special case of infotron moving left or right
1716 StretchedSprites.BltEx(X, Y, dx[SeqPos] + dx2Step);
1718 else // pushing something
1721 // (SeqPos iterates from 0 to 7 while pushing)
1722 StretchedSprites.BltImg(X + tDeltaX, Y + tDeltaY, dx2, SeqPos);
1723 // printf("::: SeqPos: %d\n", SeqPos);
1725 StretchedSprites.BltEx(X + tDeltaX, Y + tDeltaY, dx2);
1730 // End of normal movement
1731 // ------------------------
1735 // ++++++++++++++++++++++++++++++++
1736 // Begin of split movement (port)
1738 MurphyScreenXPos = MurphyScreenXPos + 2 * MurphyDX * MurphyZoomFactor;
1739 MurphyScreenYPos = MurphyScreenYPos + 2 * MurphyDY * MurphyZoomFactor;
1741 MurphyScreenXPos = MurphyScreenXPos + 2 * MurphyDX;
1742 MurphyScreenYPos = MurphyScreenYPos + 2 * MurphyDY;
1744 subCopyImageToScreen(ClearPos, aniSpace); // clear the field that murphy leaves
1745 tDeltaX = MurphyDX * LocalStretch * (SeqPos + 1);
1746 tDeltaY = MurphyDY * LocalStretch * (SeqPos + 1);
1747 X = GetStretchX(dxPos) + tDeltaX;
1748 Y = GetStretchY(dxPos) + tDeltaY;
1749 StretchedSprites.BltEx(X, Y, dx[SeqPos]); // plot first murphy
1750 tPos = dxPos + dx2Step;
1751 X = GetStretchX(tPos);
1752 Y = GetStretchY(tPos);
1753 StretchedSprites.BltEx(X + tDeltaX, Y + tDeltaY, dx[SeqPos]); // plot second murphy
1754 StretchedSprites.BltEx(X, Y, LowByte(PlayField16[tPos])); // replot the port on top
1755 // End of split movement (port)
1756 // ------------------------------
1757 } // loc_g_6D1E:'loc_g_6D28:
1759 SeqPos = SeqPos + 1;
1761 if (SeqPos < dx1SequenceLength)
1764 if (dx[SeqPos] > -1)
1768 // Follow-up after movement completed 'loc_g_6D35:
1769 MurphyXPos = MurphyXPos + MurphyDX;
1770 MurphyYPos = MurphyYPos + MurphyDY;
1771 bl = HighByte(PlayField16[*si]); // animation phase
1772 MovHighByte(&PlayField16[*si], 0);
1774 if (bl == 0x1) // space, moving up
1777 if (bl == 0x2) // space, moving left
1780 if (bl == 0x3) // space, moving down
1783 if (bl == 0x4) // space, moving right
1786 if (bl == 0x5) // base , moving up
1789 if (bl == 0x6) // base , moving left -> 6 is not used, value is set to 2 instead of 6!
1792 if (bl == 0x7) // base , moving down
1795 if (bl == 0x8) // base , moving right
1798 if (bl == 0x9) // infotron, moving up
1801 if (bl == 0xA) // infotron, moving left
1804 if (bl == 0xB) // infotron, moving down
1807 if (bl == 0xC) // infotron, moving right
1810 if (bl == 0xD) // exit
1813 if (bl == 0xE) // zonk, pushing left
1816 if (bl == 0xF) // zonk, pushing right
1819 if (bl == 0x10) // base , touching up
1822 if (bl == 0x11) // base , touching left
1825 if (bl == 0x12) // base , touching down
1828 if (bl == 0x13) // base , touching right
1831 if (bl == 0x14) // infotron touching up
1834 if (bl == 0x15) // infotron touching left
1837 if (bl == 0x16) // infotron touching down
1840 if (bl == 0x17) // infotron touching right
1843 if (bl == 0x18) // port up
1846 if (bl == 0x19) // port left
1849 if (bl == 0x1A) // port down
1852 if (bl == 0x1B) // port right
1855 if (bl == 0x1C) // red disk, moving up
1858 if (bl == 0x1D) // red disk, moving left
1861 if (bl == 0x1E) // red disk, moving down
1864 if (bl == 0x1F) // red disk, moving right -> 9-Step-Bug!
1867 if (bl == 0x20) // red disk, touching up
1870 if (bl == 0x21) // red disk, touching left
1873 if (bl == 0x22) // red disk, touching down
1876 if (bl == 0x23) // red disk, touching right
1879 if (bl == 0x24) // yellow disk, pushing up
1882 if (bl == 0x25) // yellow disk, pushing left
1885 if (bl == 0x26) // yellow disk, pushing right -> order of "down" exchanged with "right"!
1888 if (bl == 0x27) // yellow disk, pushing down -> order of "down" exchanged with "right"!
1891 if (bl == 0x28) // orange disk, pushing left
1894 if (bl == 0x29) // orange disk, pushing right
1897 if (bl == 0x2A) // red disk, release
1904 // ==========================================================================
1905 // infotron, moving up
1906 // ==========================================================================
1909 if (0 < LowByte(InfotronsNeeded))
1910 InfotronsNeeded = InfotronsNeeded - 1;
1912 subDisplayInfotronsNeeded();
1913 loc_g_6EC8: // space, base
1914 PlayField16[*si] = fiMurphy;
1915 subAdjustZonksInfotronsAboveMurphy(*si + FieldWidth);
1919 // ==========================================================================
1920 // infotron, moving left
1921 // ==========================================================================
1924 if (0 < LowByte(InfotronsNeeded))
1925 InfotronsNeeded = InfotronsNeeded - 1;
1927 subDisplayInfotronsNeeded();
1928 loc_g_6EE6: // space, base
1929 PlayField16[*si] = fiMurphy;
1930 subAdjustZonksInfotronsAboveMurphy(*si + 1);
1934 // ==========================================================================
1935 // infotron, moving down
1936 // ==========================================================================
1939 if (0 < LowByte(InfotronsNeeded))
1940 InfotronsNeeded = InfotronsNeeded - 1;
1942 subDisplayInfotronsNeeded();
1943 loc_g_6F04: // space, base
1944 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
1945 PlayField16[*si - FieldWidth] = 0;
1947 PlayField16[*si] = fiMurphy;
1951 // ==========================================================================
1952 // infotron, moving right
1953 // ==========================================================================
1956 if (0 < LowByte(InfotronsNeeded))
1957 InfotronsNeeded = InfotronsNeeded - 1;
1959 subDisplayInfotronsNeeded();
1960 loc_g_71C4: // space, base
1961 subAdjustZonksInfotronsAboveMurphy(*si - 1);
1962 PlayField16[*si] = fiMurphy;
1966 // ==========================================================================
1967 // infotron, touching up
1968 // ==========================================================================
1971 if (0 < LowByte(InfotronsNeeded))
1972 InfotronsNeeded = InfotronsNeeded - 1;
1974 subDisplayInfotronsNeeded();
1976 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
1977 PlayField16[*si - FieldWidth] = 0;
1981 // ==========================================================================
1982 // infotron, touching left
1983 // ==========================================================================
1986 if (0 < LowByte(InfotronsNeeded))
1987 InfotronsNeeded = InfotronsNeeded - 1;
1989 subDisplayInfotronsNeeded();
1991 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
1992 PlayField16[*si - 1] = 0;
1996 // ==========================================================================
1997 // infotron, touching down
1998 // ==========================================================================
2001 if (0 < LowByte(InfotronsNeeded))
2002 InfotronsNeeded = InfotronsNeeded - 1;
2004 subDisplayInfotronsNeeded();
2006 if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion)
2007 PlayField16[*si + FieldWidth] = 0;
2011 // ==========================================================================
2012 // infotron, touching right
2013 // ==========================================================================
2016 if (0 < LowByte(InfotronsNeeded))
2017 InfotronsNeeded = InfotronsNeeded - 1;
2019 subDisplayInfotronsNeeded();
2021 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2022 PlayField16[*si + 1] = 0;
2026 // ==========================================================================
2027 // zonk, pushing left
2028 // ==========================================================================
2031 if (LowByte(PlayField16[*si]) != fiExplosion)
2032 PlayField16[*si] = 0;
2034 PlayField16[*si - 1] = fiMurphy;
2035 PlayField16[*si - 2] = fiZonk;
2036 subExplodeSnikSnaksBelow(*si - 2);
2041 // ==========================================================================
2042 // zonk, pushing right
2043 // ==========================================================================
2046 if (LowByte(PlayField16[*si]) != fiExplosion)
2047 PlayField16[*si] = 0;
2049 PlayField16[*si + 1] = fiMurphy;
2050 PlayField16[*si + 2] = fiZonk;
2051 subExplodeSnikSnaksBelow(*si + 2);
2056 // ==========================================================================
2058 // ==========================================================================
2064 PlayField16[*si] = fiSpace; // remove Murphy from playfield after exiting
2069 // ==========================================================================
2070 // Push Zonk from right to left
2071 // ==========================================================================
2074 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiZonk)
2077 PlayField16[*si] = fiMurphy; // else restore - no more zonk pushing!
2078 PlayField16[*si - 1] = fiZonk;
2079 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2080 PlayField16[*si - 2] = 0;
2082 subCopyImageToScreen(*si, aniMurphy);
2086 // ==========================================================================
2087 // Push Zonk from left to right
2088 // ==========================================================================
2091 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiZonk)
2094 PlayField16[*si] = fiMurphy; // else restore - no more zonk pushing!
2095 PlayField16[*si + 1] = fiZonk;
2096 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2097 PlayField16[*si + 2] = 0;
2099 subCopyImageToScreen(*si, aniMurphy);
2103 // ==========================================================================
2104 // Push orange disk from right to left
2105 // ==========================================================================
2108 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiOrangeDisk)
2111 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2112 PlayField16[*si - 1] = fiOrangeDisk;
2113 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2114 PlayField16[*si - 2] = 0;
2116 subCopyImageToScreen(*si, aniMurphy);
2120 // ==========================================================================
2121 // Push orange disk from left to right
2122 // ==========================================================================
2125 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiOrangeDisk)
2128 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2129 PlayField16[*si + 1] = fiOrangeDisk;
2130 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2131 PlayField16[*si + 2] = 0;
2133 subCopyImageToScreen(*si, aniMurphy);
2137 // ==========================================================================
2138 // Push yellow disk from down to up
2139 // ==========================================================================
2142 if (DemoKeyCode == keyUp && PlayField16[*si - FieldWidth] == fiYellowDisk)
2145 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2146 PlayField16[*si - FieldWidth] = fiYellowDisk;
2147 if (LowByte(PlayField16[*si - 2 * FieldWidth]) != fiExplosion)
2148 PlayField16[*si - 2 * FieldWidth] = 0;
2150 subCopyImageToScreen(*si, aniMurphy);
2154 // ==========================================================================
2155 // Push yellow disk from right to left
2156 // ==========================================================================
2159 if (DemoKeyCode == keyLeft && PlayField16[*si - 1] == fiYellowDisk)
2162 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2163 PlayField16[*si - 1] = fiYellowDisk;
2164 if (LowByte(PlayField16[*si - 2]) != fiExplosion)
2165 PlayField16[*si - 2] = 0;
2167 subCopyImageToScreen(*si, aniMurphy);
2171 // ==========================================================================
2172 // Push yellow disk from up to down
2173 // ==========================================================================
2176 if (DemoKeyCode == keyDown && PlayField16[*si + FieldWidth] == fiYellowDisk)
2179 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2180 PlayField16[*si + FieldWidth] = fiYellowDisk;
2181 if (LowByte(PlayField16[*si + 2 * FieldWidth]) != fiExplosion)
2182 PlayField16[*si + 2 * FieldWidth] = 0;
2184 subCopyImageToScreen(*si, aniMurphy);
2188 // ==========================================================================
2189 // Push yellow disk from left to right
2190 // ==========================================================================
2193 if (DemoKeyCode == keyRight && PlayField16[*si + 1] == fiYellowDisk)
2196 PlayField16[*si] = fiMurphy; // else restore - no more pushing!
2197 PlayField16[*si + 1] = fiYellowDisk;
2198 if (LowByte(PlayField16[*si + 2]) != fiExplosion)
2199 PlayField16[*si + 2] = 0;
2201 subCopyImageToScreen(*si, aniMurphy);
2205 // ==========================================================================
2206 // time red disk release (space)
2207 // ==========================================================================
2210 if (DemoKeyCode != keySpace)
2212 PlayField16[*si] = fiMurphy;
2213 subCopyImageToScreen(*si, aniMurphy);
2214 RedDiskReleasePhase = 0;
2216 else if (MovingPictureSequencePhase == 0x20)
2219 // anxious murphy, dropping red disk
2220 subCopyImageToScreen(*si, aniMurphyDropping);
2222 subCopyFieldToScreen(*si, 43); // anxious murphy
2224 RedDiskReleasePhase = 1;
2229 // ==========================================================================
2230 // Special port down to up
2231 // ==========================================================================
2234 if (LowByte(PlayField16[*si]) != fiExplosion)
2235 PlayField16[*si] = 0;
2237 PlayField16[*si - 2 * FieldWidth] = fiMurphy;
2239 *si = *si - FieldWidth;
2240 if (HighByte(PlayField16[*si]) == 1)
2243 *si = *si - FieldWidth;
2247 // ==========================================================================
2248 // Special port right to left
2249 // ==========================================================================
2252 if (LowByte(PlayField16[*si]) != fiExplosion)
2253 PlayField16[*si] = 0;
2255 PlayField16[*si - 2] = fiMurphy;
2258 if (HighByte(PlayField16[*si]) == 1)
2265 // ==========================================================================
2266 // Special port up to down
2267 // ==========================================================================
2270 if (LowByte(PlayField16[*si]) != fiExplosion)
2271 PlayField16[*si] = 0;
2273 PlayField16[*si + 2 * FieldWidth] = fiMurphy;
2275 *si = *si + FieldWidth;
2276 if (HighByte(PlayField16[*si]) == 1)
2279 *si = *si + FieldWidth;
2283 // ==========================================================================
2284 // Special port left to right
2285 // ==========================================================================
2288 if (LowByte(PlayField16[*si]) != fiExplosion)
2289 PlayField16[*si] = 0;
2291 PlayField16[*si + 2] = fiMurphy;
2294 if (HighByte(PlayField16[*si]) == 1)
2301 // ==========================================================================
2303 // ==========================================================================
2306 if (LowByte(PlayField16[*si]) != fiExplosion)
2307 PlayField16[*si] = 0;
2309 *si = *si - FieldWidth;
2310 PlayField16[*si] = fiMurphy;
2311 subEatRedDisk(*si); // inc+show Murphy's red disks
2315 // ==========================================================================
2316 // Move Red Disk left
2317 // ==========================================================================
2320 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2321 PlayField16[*si + 1] = 0;
2323 PlayField16[*si] = fiMurphy;
2324 subEatRedDisk(*si); // inc+show Murphy's red disks
2328 // ==========================================================================
2329 // Move Red Disk down
2330 // ==========================================================================
2333 if (LowByte(PlayField16[*si]) != fiExplosion)
2334 PlayField16[*si] = 0;
2336 *si = *si + FieldWidth;
2337 PlayField16[*si] = fiMurphy;
2338 subEatRedDisk(*si); // inc+show Murphy's red disks
2342 // ==========================================================================
2343 // Move Red Disk right
2344 // ==========================================================================
2347 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2348 PlayField16[*si - 1] = 0;
2350 PlayField16[*si] = fiMurphy;
2351 subEatRedDisk(*si); // inc+show Murphy's red disks
2355 // ==========================================================================
2357 // ==========================================================================
2360 if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
2361 PlayField16[*si - FieldWidth] = 0;
2363 subEatRedDisk(*si - FieldWidth); // inc+show Murphy's red disks
2367 // ==========================================================================
2368 // Eat Red Disk left
2369 // ==========================================================================
2372 if (LowByte(PlayField16[*si - 1]) != fiExplosion)
2373 PlayField16[*si - 1] = 0;
2375 subEatRedDisk(*si - 1); // inc+show Murphy's red disks
2379 // ==========================================================================
2380 // Eat Red Disk down
2381 // ==========================================================================
2384 if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion)
2385 PlayField16[*si + FieldWidth] = 0;
2387 subEatRedDisk(*si + FieldWidth); // inc+show Murphy's red disks
2391 // ==========================================================================
2392 // Eat Red Disk right
2393 // ==========================================================================
2396 if (LowByte(PlayField16[*si + 1]) != fiExplosion)
2397 PlayField16[*si + 1] = 0;
2399 subEatRedDisk(*si + 1); // inc+show Murphy's red disks
2403 // ==========================================================================
2404 // yellow disk, pushing up
2405 // ==========================================================================
2408 if (LowByte(PlayField16[*si]) != fiExplosion)
2409 PlayField16[*si] = 0;
2411 *si = *si - FieldWidth;
2412 PlayField16[*si] = fiMurphy;
2413 PlayField16[*si - FieldWidth] = fiYellowDisk;
2417 // ==========================================================================
2418 // yellow disk, pushing left
2419 // ==========================================================================
2422 if (LowByte(PlayField16[*si]) != fiExplosion)
2423 PlayField16[*si] = 0;
2426 PlayField16[*si] = fiMurphy;
2427 PlayField16[*si - 1] = fiYellowDisk;
2431 // ==========================================================================
2432 // yellow disk, pushing down
2433 // ==========================================================================
2436 if (LowByte(PlayField16[*si]) != fiExplosion)
2437 PlayField16[*si] = 0;
2439 *si = *si + FieldWidth;
2440 PlayField16[*si] = fiMurphy;
2441 PlayField16[*si + FieldWidth] = fiYellowDisk;
2445 // ==========================================================================
2446 // yellow disk pushing right
2447 // ==========================================================================
2450 if (LowByte(PlayField16[*si]) != fiExplosion)
2451 PlayField16[*si] = 0;
2454 PlayField16[*si] = fiMurphy;
2455 PlayField16[*si + 1] = fiYellowDisk;
2459 // ==========================================================================
2460 // orange disk, pushing left
2461 // ==========================================================================
2464 if (LowByte(PlayField16[*si]) != fiExplosion)
2465 PlayField16[*si] = 0;
2468 PlayField16[*si] = fiMurphy;
2469 PlayField16[*si - 1] = fiOrangeDisk;
2473 // ==========================================================================
2474 // orange disk, pushing right
2475 // ==========================================================================
2478 if (LowByte(PlayField16[*si]) != fiExplosion)
2479 PlayField16[*si] = 0;
2482 PlayField16[*si] = fiMurphy;
2483 PlayField16[*si + 1] = fiOrangeDisk;
2484 if (PlayField16[*si + FieldWidth + 1] == 0) // make it fall down if below is empty
2486 MovHighByte(&PlayField16[*si + 1], 0x20);
2487 MovHighByte(&PlayField16[*si + FieldWidth + 1], fiOrangeDisk);
2492 // ==========================================================================
2493 // Release a red disk
2494 // ==========================================================================
2497 PlayField16[*si] = fiMurphy;
2498 RedDiskReleasePhase = 2;
2499 RedDiskCount = RedDiskCount - 1;
2500 subDisplayRedDiskCount();
2501 subSoundFXPush(); // Sound effects
2502 } // subAnimateMurphy
2504 // ==========================================================================
2506 // ==========================================================================
2507 void subExplodeSnikSnaksBelow(int si)
2511 ax = LowByte(PlayField16[si + FieldWidth]);
2512 if (ax == 0x11 || ax == 0xBB)
2513 ExplodeFieldSP(si + FieldWidth);
2514 } // subExplodeSnikSnaksBelow
2516 // ==========================================================================
2518 // Does pushing against an object kill Murphy?
2519 // ==========================================================================
2520 static boolean subMoveKillsMurphy(int si, int ax, int bl)
2522 static boolean subMoveKillsMurphy;
2528 if (ax == 0xFFFF || ax == 0xAAAA || ah == 0)
2534 if (al == fiExplosion)
2537 if (fiOrangeDisk <= al && al <= fiPortUp)
2540 ExplodeFieldSP(si); // Explode
2541 subMoveKillsMurphy = True;
2542 return subMoveKillsMurphy;
2551 ExplodeFieldSP(si); // Explode
2552 subMoveKillsMurphy = True;
2553 return subMoveKillsMurphy;
2555 loc_g_74F6: // zonk left
2557 if (! (ah == 0x20 || ah == 0x40 || ah == 0x50 || ah == 0x70))
2560 subMoveKillsMurphy = True; // Set carry flag
2561 return subMoveKillsMurphy;
2563 loc_g_7512: // zonk right
2565 if (! (ah == 0x30 || ah == 0x40 || ah == 0x60 || ah == 0x70))
2568 loc_g_752E: // Marked fields and Ports
2569 subMoveKillsMurphy = True; // Set carry flag
2570 return subMoveKillsMurphy;
2572 loc_g_7530: // explosion
2573 if ((ah & 0x80) != 0)
2580 ExplodeFieldSP(si); // Explode
2581 subMoveKillsMurphy = True; // Set carry flag
2582 return subMoveKillsMurphy;
2585 PlayField16[si] = 0;
2586 subMoveKillsMurphy = False;
2588 return subMoveKillsMurphy;
2589 } // subMoveKillsMurphy
2591 // ==========================================================================
2593 // Test If si 's a special (grav) port and If so Then fetch new values (see below)
2594 // change conditions to port specs
2595 // The 10-port data base is at data_h_0D28, 10 entries of 6 bytes each:
2596 // (hi),(lo),(gravity),(freeze zonks),(freeze enemies),(unused)
2597 // ==========================================================================
2598 int subSpPortTest(int si)
2605 cx = LInfo.SpecialPortCount; // number of special ports
2607 for (i = 0; i < cx; i++)
2610 /* this assumes that PortLocation is stored as big endian */
2611 bx = LInfo.SpecialPort[i].PortLocation;
2613 /* this assumes that PortLocation is stored as little endian */
2614 bx = HighByte(LInfo.SpecialPort[i].PortLocation);
2615 MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
2620 GravityFlag = LInfo.SpecialPort[i].Gravity;
2621 FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
2622 SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
2624 // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
2632 cx = LInfo.SpecialPortCount; // number of special ports
2633 for (i = 1; i <= cx; i++)
2636 bx = HighByte(LInfo.SpecialPort[i].PortLocation);
2637 MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
2640 GravityFlag = LInfo.SpecialPort[i].Gravity;
2641 FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
2642 SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
2643 // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
2650 return subSpPortTest;
2653 void subCopyFieldToScreen(int si, int fi)
2657 // +++++++++++++++++++++++++++++++++++++++++
2658 X = GetStretchX(si);
2659 Y = GetStretchY(si);
2660 StretchedSprites.BltEx(X, Y, fi);
2661 // +++++++++++++++++++++++++++++++++++++++++
2664 void subCopyAnimToScreen(int si, int graphic, int sync_frame)
2668 // +++++++++++++++++++++++++++++++++++++++++
2669 X = GetStretchX(si);
2670 Y = GetStretchY(si);
2671 StretchedSprites.BltImg(X, Y, graphic, sync_frame);
2672 // +++++++++++++++++++++++++++++++++++++++++
2675 void subCopyImageToScreen(int si, int graphic)
2677 subCopyAnimToScreen(si, graphic, 0);
2680 static void subEatRedDisk(int si)
2682 if (AllowRedDiskCheat == 0)
2684 if (RedDiskReleasePhase != 0)
2686 if (RedDiskReleaseMurphyPos == si)
2691 RedDiskCount = (RedDiskCount + 1) % 256;
2692 subDisplayRedDiskCount();
2695 void subAdjustZonksInfotronsAboveMurphy(int si)
2699 if (LowByte(PlayField16[si]) != fiExplosion)
2700 PlayField16[si] = 0;
2702 ax = PlayField16[si - FieldWidth];
2703 if (ax == 0 || ax == 0x9999)
2706 if (ax == fiZonk || ax == fiInfotron)
2708 MovHighByte(&PlayField16[si - FieldWidth], 0x40); // make falling straigt down
2713 loc_g_15A8: // empty above
2714 ax = PlayField16[si - FieldWidth - 1];
2715 if (ax == fiZonk || ax == fiInfotron)
2719 ax = PlayField16[si - FieldWidth + 1];
2720 if (ax == fiZonk || ax == fiInfotron)
2725 loc_g_15C5: // zonk/infotron above left
2726 ax = PlayField16[si - 1];
2727 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM)) // continue testing right above
2730 MovHighByte(&PlayField16[si - FieldWidth - 1], 0x60); // make roll right
2731 PlayField16[si - FieldWidth] = 0x8888;
2735 loc_g_15E8: // zonk/infotron above right
2736 ax = PlayField16[si + 1];
2737 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
2739 MovHighByte(&PlayField16[si - FieldWidth + 1], 0x50); // make roll left
2740 PlayField16[si - FieldWidth] = 0x8888;
2742 } // subAdjustZonksInfotronsAboveMurphy