1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
13 boolean DemoAvailable;
16 int FieldWidth; // = 60
17 int FieldHeight; // = 24
18 int HeaderSize; // = 96
19 int FieldMax, LevelMax;
25 // Public DisplayMin%, DisplayMax%, DisplayWidth%, DisplayHeight%
38 float Stretch = 1; // , StretchWidth%, TwoPixels!
40 int ScrollMinX, ScrollMaxX, ScrollMinY, ScrollMaxY;
43 // constants for Fixed Fields:
44 // --- const int fiSpace = 0; // &H00 space(28 = wall space ...)
45 // --- const int fiZonk = 1; // &H01 zonk
46 // --- const int fiBase = 2; // &H02 base
47 // --- const int fiMurphy = 3; // &H03 Murphy
48 // --- const int fiInfotron = 4; // &H04 infotron
49 // --- const int fiRAM = 5; // &H05 small RAM chip
50 // --- const int fiHardWare = 6; // &H06 hardware (square, standard pyramid shape)
51 // --- const int fiExit = 7; // &H07 exit
52 // --- const int fiOrangeDisk = 8; // &H08 brown/orange utility disk
53 // --- const int fiPortRight = 9; // &H09 port 1 left to right
54 // --- const int fiPortDown = 10; // &H0A port 1 up to down
55 // --- const int fiPortLeft = 11; // &H0B port 1 right to left
56 // --- const int fiPortUp = 12; // &H0C port 1 down to up
57 // --- const int fiSpPortRight = 13; // &H0D port 2 left to right (gravity change)
58 // --- const int fiSpPortDown = 14; // &H0E port 2 up to down (gravity change)
59 // --- const int fiSpPortLeft = 15; // &H0F port 2 right to left (gravity change)
60 // --- const int fiSpPortUp = 16; // &H10 port 2 down to up (gravity change)
61 // --- const int fiSnikSnak = 17; // &H11 snik snak
62 // --- const int fiYellowDisk = 18; // &H12 yellow utility disk
63 // --- const int fiTerminal = 19; // &H13 terminal
64 // --- const int fiRedDisk = 20; // &H14 red utility disk
65 // --- const int fiPortUpAndDown = 21; // &H15 vertical port
66 // --- const int fiPortLeftAndRight = 22; // &H16 horizontal port
67 // --- const int fiPortAllDirections = 23; // &H17 horizontal + vertical port
68 // --- const int fiElectron = 24; // &H18 electron
69 // --- const int fiBug = 25; // &H19 bug
70 // --- const int fiRAMLeft = 26; // &H1A horizontal RAM chip, left (pin 1)
71 // --- const int fiRAMRight = 27; // &H1B horizontal RAM chip, right
72 // --- const int fiHWFirst = 28; // &H1C hardware (radial blue circular cap + coloured shapes)
74 // Public Const fiHW1% = 29 ' 29 = 1D hardware (green signal lamp)
75 // Public Const fiHW2% = 30 ' 30 = 1E hardware (blue signal lamp)
76 // Public Const fiHW3% = 31 ' 31 = 1F hardware (red signal lamp)
77 // Public Const fiHW4% = 32 ' 32 = 20 hardware (yellow/black diagonal stripes)
78 // Public Const fiHW5% = 33 ' 33 = 21 hardware (yellow resistor + blue + red shapes)
79 // Public Const fiHW6% = 34 ' 34 = 22 hardware (horizontal red capacitor + smd shape)
80 // Public Const fiHW7% = 35 ' 35 = 23 hardware (red + yellow + blue horizontal resistors)
81 // Public Const fiHW8% = 36 ' 36 = 24 hardware (3 red vertical resistors)
82 // --- const int fiHWLast = 37; // 37 = 25 hardware (3 yellow horizontal resistors)
83 // --- const int fiRAMTop = 38; // 38 = 26 vertical RAM chip, top (pin 1)
84 // --- const int fiRAMBottom = 39; // 39 = 27 vertical RAM chip, bottom
86 // Specials to experiment with ...
87 // --- const int fiWallSpace = 40; // 40 = 28 invisible wall (can explode, zonks don't roll off)
88 // --- const int fiHWTrash1 = 41; // 41 = 29 hardware trash
89 // --- const int fiHWTrash2 = 42; // 42 = 2A hardware trash
90 // --- const int fiHWMurphy = 43; // 43 = 2B hardware inverted Murphy ... (maybe nice for use?)
92 // --- const int fiExplosion = 0x1F;
94 // --- const int keyNone = 0;
95 // --- const int keyUp = 1;
96 // --- const int keyLeft = 2;
97 // --- const int keyDown = 3;
98 // --- const int keyRight = 4;
99 // --- const int keySpaceUp = 5;
100 // --- const int keySpaceLeft = 6;
101 // --- const int keySpaceDown = 7;
102 // --- const int keySpaceRight = 8;
103 // --- const int keySpace = 9;
106 int aniFramesBug[] = { 74, 75, 76, 77, 78, 77, 76, 77, 78, 77, 76, 75, 74, 25 };
107 int aniFramesZonkRollRight[] = { 198, 197, 196, 195, 194, 193, 192, 1, -1 };
108 int aniFramesZonkRollLeft[] = { 192, 193, 194, 195, 196, 197, 198, 1, -1 };
109 int aniFramesInfotronRollRight[] = { 206, 205, 204, 203, 202, 201, 200, 4 };
110 int aniFramesInfotronRollLeft[] = { 200, 201, 202, 203, 204, 205, 206, 4 };
111 int aniFramesSnikSnak[] = { 121, 122, 123, 124, 125, 126, 127, 120, 121 };
112 int aniFramesElectron[] = { 144, 145, 146, 147, 148, 149, 150, 151, 144 };
113 int aniFramesExplosion[] = { 3, 103, 104, 105, 106, 107, 108, 109, 0 };
114 int aniFramesTouchBase[] = { 80, 81, 82, 83, 84, 85, 86, 0, -1 };
115 int aniFramesTouchInfotron[] = { 87, 88, 89, 91, 92, 93, 0, -1 }; // Only seven frames!!!!
116 int aniFramesTouchRedDisk[] = { 96, 97, 98, 99, 100, 101, 102, 0, -1 };
117 int aniFramesMurphyExit[] = { 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 0, 0, 0, 0, -1 };
118 int aniFramesMurphyEatLeft[] = { 176, 177, 178, 179, 180, 181, 182, 183, -1 };
119 int aniFramesMurphyEatRight[] = { 184, 185, 186, 187, 188, 189, 190, 191, -1 };
120 int aniFramesMurphyEatUpLeft[] = { 183, 182, 181, 180, 179, 178, 177, 176, -1 };
121 int aniFramesMurphyEatUpRight[] = { 191, 190, 189, 188, 187, 186, 185, 184, -1 };
122 // aniFramesMurphyEatRightRedDisk = { 184, 184, 185, 186, 187, 188, 189, 190, 191, -1) '9 frames!
123 int aniFramesEatInfotronLeft[] = { 209, 211, 213, 215, 217, 219, 221, 223, -1 };
124 int aniFramesEatInfotronRight[] = { 224, 226, 228, 230, 232, 234, 236, 238, -1 };
125 int aniFramesSplitUpDown[] = { 3, 3, 3, 3, 3, 3, 3, 3, -1 };
126 int aniFramesYellowDisk[] = { 18, 18, 18, 18, 18, 18, 18, 18, -1 };
127 int aniFramesOrangeDisk[] = { 8, 8, 8, 8, 8, 8, 8, 8, -1 };
128 int aniFramesRedDisk[] = { 20, -1 };
156 aniPortAllDirections,
176 int aniSnikSnakTurningLeft[] =
178 aniSnikSnakTurnUpToLeft,
179 aniSnikSnakTurnLeftToDown,
180 aniSnikSnakTurnDownToRight,
181 aniSnikSnakTurnRightToUp
184 int aniSnikSnakTurningRight[] =
186 aniSnikSnakTurnUpToRight,
187 aniSnikSnakTurnRightToDown,
188 aniSnikSnakTurnDownToLeft,
189 aniSnikSnakTurnLeftToUp
193 int getSequenceLength(int sequence)
204 case aniTouchInfotron:
218 boolean isSnappingSequence(int sequence)
223 case aniTouchInfotron:
224 case aniTouchRedDisk:
234 AutoScrollFlag = True;
240 FieldMax = (FieldWidth * FieldHeight) + HeaderSize - 1;
241 LevelMax = (FieldWidth * FieldHeight) - 1;
245 int GetSI(int X, int Y)
247 return Y * FieldWidth + X;
252 return si % FieldWidth;
257 return si / FieldWidth;
260 int GetStretchX(int si)
262 return StretchWidth * (si % FieldWidth);
265 int GetStretchY(int si)
267 return StretchWidth * (si / FieldWidth);
272 copyInternalEngineVars_SP();
279 LevelNumber = level_nr;
284 void Trace(char *Source, char *Message)
286 printf("::: Trace: Source == '%s', Message == '%s'\n", Source, Message);
289 void ReportError(char *Source, char *Message)
291 printf("::: ReportError: Source == '%s', Message == '%s'\n", Source, Message);
294 int Min(int A, int B)
296 return (A < B ? A : B);
299 int Max(int A, int B)
301 return (A < B ? B : A);