rnd-20100216-4-src
[rocksndiamonds.git] / src / game_sp / Globals.h
1 // ----------------------------------------------------------------------------
2 // Globals.h
3 // ----------------------------------------------------------------------------
4
5 #ifndef GLOBALS_H
6 #define GLOBALS_H
7
8 #include "vb_types.h"
9 #include "vb_defs.h"
10 #include "vb_vars.h"
11 #include "vb_lib.h"
12
13 #include "global.h"
14
15 #if 1
16
17 #define ZoomFactor                      (2)
18
19 #define BaseWidth                       (ZoomFactor * 16)
20 #define StretchWidth                    (ZoomFactor * 16)
21 #define StretchWidth2                   (StretchWidth / 2)
22 #define TwoPixels                       (ZoomFactor * 2)
23
24 #else
25
26 #define BaseWidth                       (16)
27 #define StretchWidth                    (16)
28 #define StretchWidth2                   (StretchWidth / 2)
29 #define TwoPixels                       (2)
30
31 #endif
32
33
34 // ----------------------------------------------------------------------------
35 // elements (stored in file and playfield)
36 // ----------------------------------------------------------------------------
37
38 #if 1
39
40 #define fiSpace                         (0)
41 #define fiZonk                          (1)
42 #define fiBase                          (2)
43 #define fiMurphy                        (3)
44 #define fiInfotron                      (4)
45 #define fiRAM                           (5)
46 #define fiHardWare                      (6)
47 #define fiExit                          (7)
48 #define fiOrangeDisk                    (8)
49 #define fiPortRight                     (9)
50 #define fiPortDown                      (10)
51 #define fiPortLeft                      (11)
52 #define fiPortUp                        (12)
53 #define fiSpPortRight                   (13)
54 #define fiSpPortDown                    (14)
55 #define fiSpPortLeft                    (15)
56 #define fiSpPortUp                      (16)
57 #define fiSnikSnak                      (17)
58 #define fiYellowDisk                    (18)
59 #define fiTerminal                      (19)
60 #define fiRedDisk                       (20)
61 #define fiPortUpAndDown                 (21)
62 #define fiPortLeftAndRight              (22)
63 #define fiPortAllDirections             (23)
64 #define fiElectron                      (24)
65 #define fiBug                           (25)
66 #define fiRAMLeft                       (26)
67 #define fiRAMRight                      (27)
68 #define fiHWFirst                       (28)
69 #define fiHW0                           (fiHWFirst + 0)         // fiHWFirst
70 #define fiHW1                           (fiHWFirst + 1)
71 #define fiHW2                           (fiHWFirst + 2)
72 #define fiHW3                           (fiHWFirst + 3)
73 #define fiHW4                           (fiHWFirst + 4)
74 #define fiHW5                           (fiHWFirst + 5)
75 #define fiHW6                           (fiHWFirst + 6)
76 #define fiHW7                           (fiHWFirst + 7)
77 #define fiHW8                           (fiHWFirst + 8)
78 #define fiHW9                           (fiHWFirst + 9)         // fiHWLast
79 #define fiHWLast                        (37)
80 #define fiRAMTop                        (38)
81 #define fiRAMBottom                     (39)
82 #define fiWallSpace                     (40)
83 #define fiHWTrash1                      (41)
84 #define fiHWTrash2                      (42)
85 #define fiHWMurphy                      (43)
86
87 #define fiExplosion                     (0x1F)
88
89 #else
90
91 #define fiBase                          (2)
92 #define fiBug                           (25)
93 #define fiElectron                      (24)
94 #define fiExit                          (7)
95 #define fiExplosion                     (0x1F)
96 #define fiHWFirst                       (28)
97 #define fiHWLast                        (37)
98 #define fiHWMurphy                      (43)
99 #define fiHWTrash1                      (41)
100 #define fiHWTrash2                      (42)
101 #define fiHardWare                      (6)
102 #define fiInfotron                      (4)
103 #define fiMurphy                        (3)
104 #define fiOrangeDisk                    (8)
105 #define fiPortAllDirections             (23)
106 #define fiPortDown                      (10)
107 #define fiPortLeft                      (11)
108 #define fiPortLeftAndRight              (22)
109 #define fiPortRight                     (9)
110 #define fiPortUp                        (12)
111 #define fiPortUpAndDown                 (21)
112 #define fiRAM                           (5)
113 #define fiRAMBottom                     (39)
114 #define fiRAMLeft                       (26)
115 #define fiRAMRight                      (27)
116 #define fiRAMTop                        (38)
117 #define fiRedDisk                       (20)
118 #define fiSnikSnak                      (17)
119 #define fiSpPortDown                    (14)
120 #define fiSpPortLeft                    (15)
121 #define fiSpPortRight                   (13)
122 #define fiSpPortUp                      (16)
123 #define fiSpace                         (0)
124 #define fiTerminal                      (19)
125 #define fiWallSpace                     (40)
126 #define fiYellowDisk                    (18)
127 #define fiZonk                          (1)
128
129 #endif
130
131
132 // ----------------------------------------------------------------------------
133 // graphics and animations (used at runtime to display the elements)
134 // ----------------------------------------------------------------------------
135
136 #if 1
137
138 // graphics and animations directly related to file elements
139
140 #define aniSpace                        IMG_EMPTY_SPACE
141 #define aniZonk                         IMG_SP_ZONK
142 #define aniBase                         IMG_SP_BASE
143 #define aniMurphy                       IMG_SP_MURPHY
144 #define aniInfotron                     IMG_SP_INFOTRON
145 #define aniRAM                          IMG_SP_CHIP_SINGLE
146 #define aniHardWare                     IMG_SP_HARDWARE_GRAY
147 #define aniExit                         IMG_SP_EXIT_CLOSED
148 #define aniOrangeDisk                   IMG_SP_DISK_ORANGE
149 #define aniPortRight                    IMG_SP_PORT_RIGHT
150 #define aniPortDown                     IMG_SP_PORT_DOWN
151 #define aniPortLeft                     IMG_SP_PORT_LEFT
152 #define aniPortUp                       IMG_SP_PORT_UP
153 #define aniSpPortRight                  IMG_SP_GRAVITY_PORT_RIGHT
154 #define aniSpPortDown                   IMG_SP_GRAVITY_PORT_DOWN
155 #define aniSpPortLeft                   IMG_SP_GRAVITY_PORT_LEFT
156 #define aniSpPortUp                     IMG_SP_GRAVITY_PORT_UP
157 #define aniSnikSnak                     IMG_SP_SNIKSNAK
158 #define aniYellowDisk                   IMG_SP_DISK_YELLOW
159 #define aniTerminal                     IMG_SP_TERMINAL
160 #define aniRedDisk                      IMG_SP_DISK_RED
161 #define aniPortUpAndDown                IMG_SP_PORT_VERTICAL
162 #define aniPortLeftAndRight             IMG_SP_PORT_HORIZONTAL
163 #define aniPortAllDirections            IMG_SP_PORT_ANY
164 #define aniElectron                     IMG_SP_ELECTRON
165 #define aniBug                          IMG_SP_BUGGY_BASE
166 #define aniRAMLeft                      IMG_SP_CHIP_LEFT
167 #define aniRAMRight                     IMG_SP_CHIP_RIGHT
168 #define aniHWFirst                      IMG_SP_HARDWARE_BASE_1
169 #define aniHW0                          IMG_SP_HARDWARE_BASE_1
170 #define aniHW1                          IMG_SP_HARDWARE_GREEN
171 #define aniHW2                          IMG_SP_HARDWARE_BLUE
172 #define aniHW3                          IMG_SP_HARDWARE_RED
173 #define aniHW4                          IMG_SP_HARDWARE_YELLOW
174 #define aniHW5                          IMG_SP_HARDWARE_BASE_2
175 #define aniHW6                          IMG_SP_HARDWARE_BASE_3
176 #define aniHW7                          IMG_SP_HARDWARE_BASE_4
177 #define aniHW8                          IMG_SP_HARDWARE_BASE_5
178 #define aniHW9                          IMG_SP_HARDWARE_BASE_6
179 #define aniHWLast                       IMG_SP_HARDWARE_BASE_6
180 #define aniRAMTop                       IMG_SP_CHIP_TOP
181 #define aniRAMBottom                    IMG_SP_CHIP_BOTTOM
182 #define aniWallSpace                    IMG_INVISIBLE_WALL
183 #define aniHWTrash1                     
184 #define aniHWTrash2                     
185 #define aniHWMurphy                     
186
187
188 // graphics and animations related to in-game animations for element actions
189
190 #define aniMurphyDropping               IMG_SP_MURPHY_DROPPING
191
192 #define aniMurphySleepLeft              IMG_SP_MURPHY_SLEEPING_LEFT
193 #define aniMurphySleepRight             IMG_SP_MURPHY_SLEEPING_RIGHT
194 #define aniMurphyTouchLeft              IMG_SP_MURPHY_SNAPPING_LEFT
195 #define aniMurphyTouchRight             IMG_SP_MURPHY_SNAPPING_RIGHT
196 #define aniMurphyTouchUp                IMG_SP_MURPHY_SNAPPING_UP
197 #define aniMurphyTouchDown              IMG_SP_MURPHY_SNAPPING_DOWN
198 #define aniMurphyYawn                   IMG_SP_MURPHY_BORING_1
199 #define aniPushLeft                     IMG_SP_MURPHY_PUSHING_LEFT
200 #define aniPushRight                    IMG_SP_MURPHY_PUSHING_RIGHT
201 #define aniPushUpDown                   IMG_SP_MURPHY_PUSHING_RIGHT
202
203 #define aniBugActivating                IMG_SP_BUGGY_BASE_ACTIVATING
204 #define aniBugDeactivating              IMG_SP_BUGGY_BASE_ACTIVATING
205 #define aniBugActive                    IMG_SP_BUGGY_BASE_ACTIVE
206 #define aniZonkRollLeft                 IMG_SP_ZONK_MOVING_LEFT
207 #define aniZonkRollRight                IMG_SP_ZONK_MOVING_RIGHT
208 #define aniEatInfotronLeft              IMG_SP_MURPHY_COLLECTING_LEFT
209 #define aniEatInfotronRight             IMG_SP_MURPHY_COLLECTING_RIGHT
210 #define aniInfotronRollLeft             IMG_SP_INFOTRON_MOVING_LEFT
211 #define aniInfotronRollRight            IMG_SP_INFOTRON_MOVING_RIGHT
212 #define aniMurphyMoveLeft               IMG_SP_MURPHY_MOVING_LEFT
213 #define aniMurphyMoveRight              IMG_SP_MURPHY_MOVING_RIGHT
214 #define aniMurphyMoveUpLeft             IMG_SP_MURPHY_MOVING_LEFT
215 #define aniMurphyMoveUpRight            IMG_SP_MURPHY_MOVING_RIGHT
216 #define aniMurphyDigLeft                IMG_SP_MURPHY_DIGGING_LEFT
217 #define aniMurphyDigRight               IMG_SP_MURPHY_DIGGING_RIGHT
218 #define aniMurphyDigUpLeft              IMG_SP_MURPHY_DIGGING_LEFT
219 #define aniMurphyDigUpRight             IMG_SP_MURPHY_DIGGING_RIGHT
220 #define aniMurphyEatLeft                IMG_SP_MURPHY_COLLECTING_LEFT
221 #define aniMurphyEatRight               IMG_SP_MURPHY_COLLECTING_RIGHT
222 #define aniMurphyEatUpLeft              IMG_SP_MURPHY_COLLECTING_LEFT
223 #define aniMurphyEatUpRight             IMG_SP_MURPHY_COLLECTING_RIGHT
224 #define aniSplitUpDown                  IMG_SP_MURPHY
225 #define aniMurphyExit                   IMG_SP_MURPHY_SHRINKING
226 #define aniElectron                     IMG_SP_ELECTRON
227 #define aniExplosion                    IMG_SP_DEFAULT_EXPLODING
228 #define aniTouchBase                    IMG_SP_BASE_SNAPPING
229 #define aniTouchInfotron                IMG_SP_INFOTRON_COLLECTING
230 #define aniTouchRedDisk                 IMG_SP_DISK_RED_COLLECTING
231 #define aniYellowDisk                   IMG_SP_DISK_YELLOW
232 #define aniOrangeDisk                   IMG_SP_DISK_ORANGE
233 #define aniRedDisk                      IMG_SP_DISK_RED
234
235 #define aniSnikSnakDown                 IMG_SP_SNIKSNAK_DOWN
236 #define aniSnikSnakLeft                 IMG_SP_SNIKSNAK_LEFT
237 #define aniSnikSnakRight                IMG_SP_SNIKSNAK_RIGHT
238 #define aniSnikSnakUp                   IMG_SP_SNIKSNAK_UP
239
240 #define aniSnikSnakTurnLeftToUp         IMG_SP_SNIKSNAK_TURNING_FROM_LEFT_UP
241 #define aniSnikSnakTurnLeftToDown       IMG_SP_SNIKSNAK_TURNING_FROM_LEFT_DOWN
242 #define aniSnikSnakTurnRightToUp        IMG_SP_SNIKSNAK_TURNING_FROM_RIGHT_UP
243 #define aniSnikSnakTurnRightToDown      IMG_SP_SNIKSNAK_TURNING_FROM_RIGHT_DOWN
244 #define aniSnikSnakTurnUpToLeft         IMG_SP_SNIKSNAK_TURNING_FROM_UP_LEFT
245 #define aniSnikSnakTurnUpToRight        IMG_SP_SNIKSNAK_TURNING_FROM_UP_RIGHT
246 #define aniSnikSnakTurnDownToLeft       IMG_SP_SNIKSNAK_TURNING_FROM_DOWN_LEFT
247 #define aniSnikSnakTurnDownToRight      IMG_SP_SNIKSNAK_TURNING_FROM_DOWN_RIGHT
248
249 #define aniTerminalActive               IMG_SP_TERMINAL_ACTIVE
250
251 #define aniExplosionInfo                (111)
252
253 #else
254
255 #define aniMurphySleepLeft              (71)
256 #define aniMurphySleepRight             (68)
257 #define aniMurphyTouchDown              (47)
258 #define aniMurphyTouchLeft              (95)
259 #define aniMurphyTouchRight             (94)
260 #define aniMurphyTouchUp                (46)
261 #define aniMurphyYawn                   (56)
262 #define aniPushLeft                     (45)
263 #define aniPushRight                    (44)
264 #define aniPushUpDown                   (79)
265
266 #define aniSnikSnakDown                 (167)
267 #define aniSnikSnakLeft                 (239)
268 #define aniSnikSnakRight                (247)
269 #define aniSnikSnakUp                   (159)
270
271 #define aniTerminal                     (0x80)
272 #define aniTerminalActive               (0x88)
273
274 #define aniExplosionInfo                (111)
275
276 #endif
277
278 #define posFrameCorner                  (55)
279 #define posFrameHorizontal              (111)
280 #define posFrameVertical                (110)
281
282
283 #if 1
284
285 extern int aniFramesBug[], aniFramesZonkRollRight[], aniFramesZonkRollLeft[];
286 extern int aniFramesEatInfotronLeft[], aniFramesEatInfotronRight[];
287 extern int aniFramesInfotronRollRight[], aniFramesInfotronRollLeft[];
288 extern int aniFramesMurphyEatLeft[], aniFramesMurphyEatRight[];
289 extern int aniFramesMurphyEatUpLeft[], aniFramesMurphyEatUpRight[], aniFramesSplitUpDown[];
290 extern int aniFramesMurphyExit[];
291 extern int aniFramesSnikSnak[], aniFramesElectron[], aniFramesExplosion[];
292 extern int aniFramesTouchBase[], aniFramesTouchInfotron[], aniFramesTouchRedDisk[];
293 extern int aniFramesYellowDisk[], aniFramesOrangeDisk[], aniFramesRedDisk[];
294
295 #else
296
297 extern int *aniBug, *aniZonkRollRight, *aniZonkRollLeft;
298 extern int *aniEatInfotronLeft, *aniEatInfotronRight;
299 extern int *aniInfotronRollRight, *aniInfotronRollLeft;
300 extern int *aniMurphyEatLeft, *aniMurphyEatRight;
301 extern int *aniMurphyEatUpLeft, *aniMurphyEatUpRight, *aniSplitUpDown;
302 extern int *aniMurphyExit;
303 extern int *aniSnikSnak, *aniElectron, *aniExplosion;
304 extern int *aniTouchBase, *aniTouchInfotron, *aniTouchRedDisk;
305 extern int *aniYellowDisk, *aniOrangeDisk, *aniRedDisk;
306
307 #endif
308
309
310 // ----------------------------------------------------------------------------
311 // input keys
312 // ----------------------------------------------------------------------------
313
314 #if 1
315
316 #define keyNone                         (0)
317 #define keyUp                           (1)
318 #define keyLeft                         (2)
319 #define keyDown                         (3)
320 #define keyRight                        (4)
321 #define keySpaceUp                      (5)
322 #define keySpaceLeft                    (6)
323 #define keySpaceDown                    (7)
324 #define keySpaceRight                   (8)
325 #define keySpace                        (9)
326
327 #else
328
329 #define keyDown                         (3)
330 #define keyLeft                         (2)
331 #define keyNone                         (0)
332 #define keyRight                        (4)
333 #define keySpace                        (9)
334 #define keySpaceDown                    (7)
335 #define keySpaceLeft                    (6)
336 #define keySpaceRight                   (8)
337 #define keySpaceUp                      (5)
338 #define keyUp                           (1)
339
340 #endif
341
342
343 extern int GetSI(int X, int Y);
344 extern int GetStretchX(int si);
345 extern int GetStretchY(int si);
346 extern int GetX(int si);
347 extern int GetY(int si);
348 extern void InitGlobals();
349 extern void InitPseudoCompileFlags();
350
351 extern void ReadLevel();
352
353 extern int getSequenceLength(int sequence);
354 extern boolean isSnappingSequence(int sequence);
355
356 extern int fiGraphic[];
357 extern int aniSnikSnakTurningLeft[];
358 extern int aniSnikSnakTurningRight[];
359
360 extern boolean Alignments;
361 extern boolean BlockingSpeed;
362 extern boolean Cracked;
363 extern boolean Ctrl_Alt_Fix;
364 extern boolean Dead_Code;
365 extern boolean DebugSwitch;
366 extern boolean DemoRecordFix;
367 extern boolean EGA_Arg;
368 extern boolean EP_DEBUG;
369 extern boolean EP_DEMO;
370 extern boolean EP_ENHANCE;
371 extern boolean EP_OLD8;
372 extern boolean EXTRASPEED;
373 extern boolean HP_DEMO;
374 extern boolean LevelLoaded;
375 extern boolean Level_Arg;
376 extern boolean Level_Fix;
377 extern boolean Norm_Time;
378 extern boolean Original;
379 extern boolean Protection;
380 extern boolean Record_Fix;
381 extern boolean Redundant;
382 extern boolean SAVEGAME;
383 extern boolean SafeRecord;
384 extern boolean ScreenFix;
385 extern boolean SpeedKeys;
386 extern boolean TIMINGFIX;
387 extern boolean Ver62;
388 extern boolean Ver62test;
389 extern boolean Ver63;
390 extern boolean Ver64;
391 extern boolean bCapturePane;
392 extern byte *DisPlayField;
393 extern byte *PlayField8;
394 extern char *CurPath, *OrigPath, *TmpPath;
395 extern currency DeltaT;
396 extern int *PlayField16;
397
398 extern int FieldHeight;
399 extern int FieldMax, LevelMax;
400 extern int FieldWidth;
401 extern int FreezeZonks;
402 extern int HeaderSize;
403 extern int LevelNumber;
404 extern int TimerVar;
405 extern short RandomSeed;
406 extern long DeltaTPlay, DeltaTDemo;
407 extern long FileMax;
408 extern long SignatureDelay;
409
410 #endif /* GLOBALS_H */