1 /***********************************************************
2 * Mirror Magic -- McDuffin's Revenge                       *
3 *----------------------------------------------------------*
4 * (c) 1994-2001 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * main.h                                                   *
12 ***********************************************************/
13 
14 #ifndef MAIN_H
15 #define MAIN_H
16 
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include <sys/time.h>
21 #include <sys/types.h>
22 #include <sys/stat.h>
23 #include <errno.h>
24 #include <unistd.h>
25 #include <fcntl.h>
26 
27 #include "libgame/libgame.h"
28 
29 #define WIN_XSIZE	640
30 #define WIN_YSIZE	400
31 
32 #if !defined(PLATFORM_MSDOS)
33 #define WIN_XPOS	0
34 #define WIN_YPOS	0
35 #else
36 #define WIN_XPOS	((XRES - WIN_XSIZE) / 2)
37 #define WIN_YPOS	((YRES - WIN_YSIZE) / 2)
38 #endif
39 
40 #define SCR_FIELDX	16
41 #define SCR_FIELDY	12
42 #define STD_LEV_FIELDX  SCR_FIELDX
43 #define STD_LEV_FIELDY  SCR_FIELDY
44 #define MAX_LEV_FIELDX	SCR_FIELDX
45 #define MAX_LEV_FIELDY	SCR_FIELDY
46 #define MAX_BUF_XSIZE	SCR_FIELDX
47 #define MAX_BUF_YSIZE	SCR_FIELDY
48 
49 #define MAX_PLAYERS     1
50 
51 #define SCREENX(a)      (a)
52 #define SCREENY(a)      (a)
53 #define LEVELX(a)       (a)
54 #define LEVELY(a)       (a)
55 #define IN_VIS_FIELD(x,y) ((x)>=0 && (x)<SCR_FIELDX && (y)>=0 &&(y)<SCR_FIELDY)
56 #define IN_SCR_FIELD(x,y) ((x)>=BX1 && (x)<=BX2 && (y)>=BY1 &&(y)<=BY2)
57 #define IN_LEV_FIELD(x,y) ((x)>=0 && (x)<lev_fieldx && (y)>=0 &&(y)<lev_fieldy)
58 #define IN_PIX_FIELD(x,y) ((x)>=0 && (x)<SXSIZE && (y)>=0 && (y)<SYSIZE)
59 
60 /* values for 'Elementeigenschaften' */
61 #define EP_BIT_GRID		(1 << 0)
62 #define EP_BIT_MCDUFFIN		(1 << 1)
63 #define EP_BIT_RECTANGLE	(1 << 2)
64 #define EP_BIT_MIRROR		(1 << 3)
65 #define EP_BIT_MIRROR_FIXED	(1 << 4)
66 #define EP_BIT_POLAR		(1 << 5)
67 #define EP_BIT_POLAR_CROSS	(1 << 6)
68 #define EP_BIT_BEAMER		(1 << 7)
69 #define EP_BIT_CHAR		(1 << 8)
70 #define EP_BIT_REFLECTING	(1 << 9)
71 #define EP_BIT_ABSORBING	(1 << 10)
72 #define EP_BIT_INACTIVE		(1 << 11)
73 #define EP_BIT_WALL		(1 << 12)
74 #define EP_BIT_PACMAN		(1 << 13)
75 
76 #define IS_GRID(e)		(Elementeigenschaften[e] & EP_BIT_GRID)
77 #define IS_MCDUFFIN(e)		(Elementeigenschaften[e] & EP_BIT_MCDUFFIN)
78 #define IS_RECTANGLE(e)		(Elementeigenschaften[e] & EP_BIT_RECTANGLE)
79 #define IS_MIRROR(e)		(Elementeigenschaften[e] & EP_BIT_MIRROR)
80 #define IS_MIRROR_FIXED(e)	(Elementeigenschaften[e] & EP_BIT_MIRROR_FIXED)
81 #define IS_POLAR(e)		(Elementeigenschaften[e] & EP_BIT_POLAR)
82 #define IS_POLAR_CROSS(e)	(Elementeigenschaften[e] & EP_BIT_POLAR_CROSS)
83 #define IS_BEAMER_OLD(e)	(Elementeigenschaften[e] & EP_BIT_BEAMER)
84 #define IS_CHAR(e)		(Elementeigenschaften[e] & EP_BIT_CHAR)
85 #define IS_REFLECTING(e)	(Elementeigenschaften[e] & EP_BIT_REFLECTING)
86 #define IS_ABSORBING(e)		(Elementeigenschaften[e] & EP_BIT_ABSORBING)
87 #define IS_INACTIVE(e)		(Elementeigenschaften[e] & EP_BIT_INACTIVE)
88 #define IS_MM_WALL(e)		(Elementeigenschaften[e] & EP_BIT_WALL)
89 #define IS_PACMAN(e)		(Elementeigenschaften[e] & EP_BIT_PACMAN)
90 
91 #define IS_WALL_STEEL(e)	((e) >= EL_WALL_STEEL_START &&		\
92 				 (e) <= EL_WALL_STEEL_END)
93 #define IS_WALL_WOOD(e)		((e) >= EL_WALL_WOOD_START &&		\
94 				 (e) <= EL_WALL_WOOD_END)
95 #define IS_WALL_ICE(e)		((e) >= EL_WALL_ICE_START &&		\
96 				 (e) <= EL_WALL_ICE_END)
97 #define IS_WALL_AMOEBA(e)	((e) >= EL_WALL_AMOEBA_START &&		\
98 				 (e) <= EL_WALL_AMOEBA_END)
99 #define IS_DF_WALL_STEEL(e)	((e) >= EL_DF_WALL_STEEL_START &&	\
100 				 (e) <= EL_DF_WALL_STEEL_END)
101 #define IS_DF_WALL_WOOD(e)	((e) >= EL_DF_WALL_WOOD_START &&	\
102 				 (e) <= EL_DF_WALL_WOOD_END)
103 #define IS_DF_WALL(e)		((e) >= EL_DF_WALL_START &&		\
104 				 (e) <= EL_DF_WALL_END)
105 #define IS_WALL(e)		(IS_MM_WALL(e) || IS_DF_WALL(e))
106 #define IS_WALL_CHANGING(e)	((e) >= EL_WALL_CHANGING_START &&	\
107 				 (e) <= EL_WALL_CHANGING_END)
108 #define IS_GRID_STEEL(e)	((e) >= EL_GRID_STEEL_START &&		\
109 				 (e) <= EL_GRID_STEEL_END)
110 #define IS_GRID_WOOD(e)		((e) >= EL_GRID_WOOD_START &&		\
111 				 (e) <= EL_GRID_WOOD_END)
112 #define IS_GRID_WOOD_FIXED(e)	((e) >= EL_GRID_WOOD_FIXED_START &&	\
113 				 (e) <= EL_GRID_WOOD_FIXED_END)
114 #define IS_GRID_STEEL_FIXED(e)	((e) >= EL_GRID_STEEL_FIXED_START &&	\
115 				 (e) <= EL_GRID_STEEL_FIXED_END)
116 #define IS_GRID_WOOD_AUTO(e)	((e) >= EL_GRID_WOOD_AUTO_START &&	\
117 				 (e) <= EL_GRID_WOOD_AUTO_END)
118 #define IS_GRID_STEEL_AUTO(e)	((e) >= EL_GRID_STEEL_AUTO_START &&	\
119 				 (e) <= EL_GRID_STEEL_AUTO_END)
120 #define IS_DF_GRID(e)		(IS_GRID_WOOD_FIXED(e) ||		\
121 				 IS_GRID_STEEL_FIXED(e) ||		\
122 				 IS_GRID_WOOD_AUTO(e) ||		\
123 				 IS_GRID_STEEL_AUTO(e))
124 #define IS_DF_MIRROR(e)		((e) >= EL_DF_MIRROR_START &&		\
125 				 (e) <= EL_DF_MIRROR_END)
126 #define IS_DF_MIRROR_AUTO(e)	((e) >= EL_DF_MIRROR_AUTO_START &&	\
127 				 (e) <= EL_DF_MIRROR_AUTO_END)
128 #define IS_LASER(e)		((e) >= EL_LASER_START &&		\
129 				 (e) <= EL_LASER_END)
130 #define IS_RECEIVER(e)		((e) >= EL_RECEIVER_START &&		\
131 				 (e) <= EL_RECEIVER_END)
132 #define IS_FIBRE_OPTIC(e)	((e) >= EL_FIBRE_OPTIC_START &&		\
133 				 (e) <= EL_FIBRE_OPTIC_END)
134 #define FIBRE_OPTIC_NR(e)	(((e) - EL_FIBRE_OPTIC_START) / 2)
135 #define IS_BEAMER(e)		((e) >= EL_BEAMER_RED_START &&		\
136 				 (e) <= EL_BEAMER_BLUE_END)
137 #define BEAMER_CLASSIC_NR(e)	(((e) - EL_BEAMER_RED_START) / 16)
138 #define BEAMER_NR(e)		(IS_BEAMER(e) ? BEAMER_CLASSIC_NR(e) :	\
139 				 IS_FIBRE_OPTIC(e) ? (FIBRE_OPTIC_NR(e)+4) : 0)
140 #define IS_EXPLODING(e)		((e) == EL_EXPLODING_OPAQUE ||		\
141 				 (e) == EL_EXPLODING_TRANSP)
142 
143 #define IS_EATABLE4PACMAN(e)	((e) == EL_EMPTY ||			\
144 				 (e) == EL_KETTLE ||			\
145 				 (e) == EL_CELL ||			\
146 				 (e) == EL_BOMB ||			\
147 				 IS_WALL_AMOEBA(e))
148 
149 #define CAN_MOVE(e)		((e) == EL_PACMAN)
150 #define IS_FREE(x,y)            (Feld[x][y] == EL_EMPTY)
151 
152 #define IS_MOVING(x,y)          (MovPos[x][y] != 0)
153 #define IS_BLOCKED(x,y)         (Feld[x][y] == EL_BLOCKED)
154 #define IS_DRAWABLE(e)          ((e) < EL_BLOCKED)
155 #define IS_NOT_DRAWABLE(e)      ((e) >= EL_BLOCKED)
156 
157 #define PLAYERINFO(x,y)         (&stored_player[StorePlayer[x][y]-EL_SPIELER1])
158 
159 #define WALL_BASE(e)		((e) & 0xfff0)
160 #define WALL_BITS(e)		((e) & 0x000f)
161 
162 /* Bitmaps with graphic file */
163 #define PIX_BACK		0
164 #define PIX_DOOR		1
165 #define PIX_TOONS		2
166 #define PIX_DF			3
167 #define	PIX_BIGFONT		4
168 #define PIX_SMALLFONT		5
169 #define PIX_MEDIUMFONT		6
170 /* Bitmaps without graphic file */
171 #define PIX_DB_DOOR		7
172 
173 #define NUM_PICTURES		7
174 #define NUM_BITMAPS		8
175 
176 /* boundaries of arrays etc. */
177 #define MAX_PLAYER_NAME_LEN	10
178 #define MAX_LEVEL_NAME_LEN	32
179 #define MAX_LEVEL_AUTHOR_LEN	32
180 #define MAX_SCORE_ENTRIES	100
181 #define MAX_ELEMENTS		700		/* 500 static + 200 runtime */
182 #define MAX_NUM_AMOEBA		100
183 #define MAX_NUM_BEAMERS		8
184 
185 #define MAX_LASER_LEN		256
186 #define MAX_LASER_ENERGY	100
187 #define MAX_LASER_OVERLOAD	100
188 
189 #define LEVEL_SCORE_ELEMENTS	16	/* level elements with score */
190 
191 /* fundamental game speed values */
192 #define GAME_FRAME_DELAY	20	/* frame delay in milliseconds */
193 #define FFWD_FRAME_DELAY	10	/* 200% speed for fast forward */
194 #define FRAMES_PER_SECOND	(1000 / GAME_FRAME_DELAY)
195 #define MICROLEVEL_SCROLL_DELAY	50	/* delay for scrolling micro level */
196 #define MICROLEVEL_LABEL_DELAY	250	/* delay for micro level label */
197 
198 struct HiScore
199 {
200   char Name[MAX_PLAYER_NAME_LEN + 1];
201   int Score;
202 };
203 
204 struct SetupInfo
205 {
206   char *player_name;
207 
208   boolean sound;
209   boolean sound_loops;
210   boolean sound_music;
211   boolean sound_simple;
212   boolean toons;
213   boolean quick_doors;
214   boolean handicap;
215   boolean time_limit;
216   boolean fullscreen;
217 };
218 
219 struct PlayerInfo
220 {
221   byte action;			/* action from local input device */
222 
223   int jx,jy, last_jx,last_jy;
224   int MovDir, MovPos, GfxPos;
225   int Frame;
226 
227   boolean Pushing;
228   boolean Switching;
229   boolean LevelSolved, GameOver;
230   boolean snapped;
231 
232   unsigned long move_delay;
233   int move_delay_value;
234 
235   int last_move_dir;
236 
237   unsigned long push_delay;
238   unsigned long push_delay_value;
239 
240   int frame_reset_delay;
241 
242   unsigned long actual_frame_counter;
243 
244   int score;
245   int gems_still_needed;
246   int sokobanfields_still_needed;
247   int lights_still_needed;
248   int friends_still_needed;
249   int key[4];
250   int dynamite;
251   int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
252   int shield_passive_time_left;
253   int shield_active_time_left;
254 };
255 
256 struct LevelInfo
257 {
258   int file_version;		/* version of file the level was stored with */
259   int game_version;		/* version of game engine to play this level */
260   boolean encoding_16bit_field;		/* level contains 16-bit elements */
261 
262   int fieldx;
263   int fieldy;
264   int time;
265   int kettles_needed;
266   boolean auto_count_kettles;
267   boolean laser_red, laser_green, laser_blue;
268   char name[MAX_LEVEL_NAME_LEN + 1];
269   char author[MAX_LEVEL_AUTHOR_LEN + 1];
270   int score[LEVEL_SCORE_ELEMENTS];
271   int amoeba_speed;
272   int time_fuse;
273 };
274 
275 struct CycleList
276 {
277   int x, y;
278   int steps;
279 };
280 
281 struct MovingList
282 {
283   int x, y;
284   int dir;
285 };
286 
287 struct DamageList
288 {
289   int x, y;
290   int edge, angle;
291   boolean is_mirror;
292 };
293 
294 struct BeamerInfo
295 {
296   int x, y;
297   int num;
298 };
299 
300 struct PacMan
301 {
302   int XP, YP;
303   int Dr;
304 };
305 
306 #if 0
307 struct XY
308 {
309   short x, y;		/* must be "short" to match "XPoint" structure! */
310 };
311 #endif
312 
313 struct GameInfo
314 {
315   struct CycleList cycle[MAX_LEV_FIELDX * MAX_LEV_FIELDY];
316   int num_cycle;
317   struct MovingList pacman[MAX_LEV_FIELDX * MAX_LEV_FIELDY];
318   int num_pacman;
319 
320   int score;
321   int energy_left;
322   int kettles_still_needed;
323   int lights_still_needed;
324   int num_keys;
325 
326   boolean level_solved;
327   boolean game_over;
328   int game_over_cause;
329 
330   boolean cheat_no_overload;
331   boolean cheat_no_explosion;
332 };
333 
334 struct LaserInfo
335 {
336   struct XY start_edge;
337   int start_angle;
338 
339   int current_angle;
340 
341   /*
342   int pixel_x;
343   int pixel_y;
344   int step_x;
345   int step_y;
346   int elx;
347   int ely;
348   */
349 
350   struct DamageList damage[MAX_LASER_LEN + 10];
351   int num_damages;
352 
353   struct XY edge[MAX_LASER_LEN + 10];
354   int num_edges;
355 
356   struct BeamerInfo beamer[MAX_NUM_BEAMERS][2];
357   int beamer_edge[MAX_NUM_BEAMERS];
358   int beamer_nr[MAX_NUM_BEAMERS];
359   int num_beamers;
360 
361   boolean overloaded;
362   int overload_value;
363 
364   boolean fuse_off;
365   int fuse_x, fuse_y;
366 
367   int dest_element;
368   boolean stops_inside_element;
369 
370   boolean redraw;
371 
372   int wall_mask;
373 };
374 
375 struct EditorInfo
376 {
377   boolean draw_walls_masked;
378 };
379 
380 struct PlayerInfo_OLD
381 {
382   char login_name[MAX_PLAYER_NAME_LEN + 1];
383   char alias_name[MAX_PLAYER_NAME_LEN + 1];
384   boolean last_used;
385   int handicap;
386   unsigned int setup;
387 };
388 
389 struct GlobalInfo
390 {
391   float frames_per_second;
392   boolean fps_slowdown;
393   int fps_slowdown_factor;
394 };
395 
396 extern GC		tile_clip_gc, line_gc[];
397 extern Bitmap	       *pix[];
398 extern Pixmap		tile_clipmask[];
399 extern DrawBuffer     *fieldbuffer;
400 extern DrawBuffer     *drawto_field;
401 
402 extern int		joystick_device;
403 extern char	       *joystick_device_name[];
404 
405 extern int		game_status;
406 extern boolean		level_editor_test_game;
407 extern boolean		network_playing;
408 
409 extern int		key_joystick_mapping;
410 extern int	    	global_joystick_status, joystick_status;
411 extern int		sound_status;
412 extern boolean		sound_loops_allowed;
413 
414 extern boolean		redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
415 extern int		redraw_x1, redraw_y1;
416 
417 extern short		Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
418 extern short		Ur[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
419 extern short		Hit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
420 extern short		Box[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
421 extern short		Angle[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
422 
423 extern short		MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
424 extern short		MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
425 extern short		MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
426 extern short		Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
427 extern short		Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
428 extern short		StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
429 extern short		Frame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
430 extern boolean		Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
431 extern short		JustStopped[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
432 extern short		AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
433 extern short		AmoebaCnt[MAX_NUM_AMOEBA], AmoebaCnt2[MAX_NUM_AMOEBA];
434 extern unsigned long	Elementeigenschaften[MAX_ELEMENTS];
435 
436 extern int		level_nr;
437 extern int		lev_fieldx,lev_fieldy, scroll_x,scroll_y;
438 
439 extern int		FX,FY, ScrollStepSize;
440 extern int		ScreenMovDir, ScreenMovPos, ScreenGfxPos;
441 extern int		GameFrameDelay;
442 extern int		FfwdFrameDelay;
443 extern int		BX1,BY1, BX2,BY2;
444 extern int		SBX_Left, SBX_Right;
445 extern int		SBY_Upper, SBY_Lower;
446 extern int		ZX,ZY, ExitX,ExitY;
447 extern int		AllPlayersGone;
448 extern int		TimeFrames, TimePlayed, TimeLeft;
449 extern boolean		SiebAktiv;
450 extern int		SiebCount;
451 
452 #if 0
453 extern boolean		network_player_action_received;
454 #endif
455 
456 extern struct LevelInfo		level;
457 #if 0
458 extern struct PlayerInfo	stored_player[], *local_player;
459 #endif
460 extern struct HiScore		highscore[];
461 extern struct TapeInfo		tape;
462 extern struct SetupInfo		setup;
463 extern struct GameInfo		game;
464 extern struct LaserInfo		laser;
465 extern struct EditorInfo	editor;
466 extern struct GlobalInfo	global;
467 
468 extern short 		LX,LY, XS,YS, ELX,ELY;
469 extern short 		CT,Ct;
470 
471 extern Pixel		pen_fg, pen_bg, pen_ray, pen_magicolor[2];
472 extern int		color_status;
473 
474 extern struct XY	Step[];
475 extern short		Sign[16];
476 
477 extern char		*sound_name[];
478 extern int		background_loop[];
479 extern int		num_bg_loops;
480 extern char		*element_info[];
481 extern int		num_element_info;
482 
483 /* often used screen positions */
484 #define SX			8
485 #define SY			8
486 #define REAL_SX			(SX - 2)
487 #define REAL_SY			(SY - 2)
488 #define DX			534
489 #define DY			60
490 #define EX			DX
491 #define EY			(DY + 178)
492 #define TILEX			32
493 #define TILEY			32
494 #define MINI_TILEX		(TILEX / 2)
495 #define MINI_TILEY		(TILEY / 2)
496 #define MICRO_TILEX		(TILEX / 4)
497 #define MICRO_TILEY		(TILEY / 4)
498 #define MICRO_WALLX		(TILEX / 8)
499 #define MICRO_WALLY		(TILEY / 8)
500 #define MIDPOSX			(SCR_FIELDX / 2)
501 #define MIDPOSY			(SCR_FIELDY / 2)
502 #define SXSIZE			(SCR_FIELDX * TILEX)
503 #define SYSIZE			(SCR_FIELDY * TILEY)
504 #define FXSIZE			((SCR_FIELDX + 2) * TILEX)
505 #define FYSIZE			((SCR_FIELDY + 2) * TILEY)
506 #define DXSIZE			100
507 #define DYSIZE			280
508 #define VXSIZE			DXSIZE
509 #define VYSIZE			100
510 #define EXSIZE			DXSIZE
511 #define EYSIZE			(VXSIZE + 44)
512 #define FULL_SXSIZE		(2 + SXSIZE + 2)
513 #define FULL_SYSIZE		(2 + SYSIZE + 2)
514 #define MICROLEV_XPOS		(SX + 12 * TILEX)
515 #define MICROLEV_YPOS		(SY +  6 * TILEY)
516 #define MICROLEV_XSIZE		(STD_LEV_FIELDX * MICRO_TILEX)
517 #define MICROLEV_YSIZE		(STD_LEV_FIELDY * MICRO_TILEY)
518 #define MICROLABEL_XPOS		(SY)
519 #define MICROLABEL_YPOS		(SY + 352)
520 #define MICROLABEL_XSIZE	(SXSIZE)
521 #define MICROLABEL_YSIZE	(FONT4_YSIZE)
522 
523 #define GFX_STARTX		SX
524 #define GFX_STARTY		SY
525 #define MINI_GFX_STARTX		(SX + 8 * TILEX)
526 #define MINI_GFX_STARTY		(SY + 6 * TILEY)
527 #define MICRO_GFX_STARTX	(MINI_GFX_STARTX + 8 * MINI_TILEX)
528 #define MICRO_GFX_STARTY	(MINI_GFX_STARTY + 6 * MINI_TILEY)
529 #define GFX_PER_LINE		16
530 #define MINI_GFX_PER_LINE	GFX_PER_LINE
531 #define MICRO_GFX_PER_LINE	GFX_PER_LINE
532 
533 #define MINI_DF_STARTX		(8 * TILEX)
534 #define MINI_DF_STARTY		(8 * TILEY)
535 #define MICRO_DF_STARTX		(MINI_DF_STARTX + 8 * MINI_TILEX)
536 #define MICRO_DF_STARTY		(MINI_DF_STARTY + 8 * MINI_TILEY)
537 #define DF_PER_LINE		16
538 #define MINI_DF_PER_LINE	DF_PER_LINE
539 #define MICRO_DF_PER_LINE	DF_PER_LINE
540 
541 #define MICRO_FONT_STARTX	(MICRO_DF_STARTX + 8 * MICRO_TILEX)
542 #define MICRO_FONT_STARTY	(MICRO_DF_STARTY + 8 * MICRO_TILEY)
543 #define MICRO_FONT_PER_LINE	8
544 
545 /* wall positions (that can be OR'ed together) */
546 #define WALL_TOPLEFT		1
547 #define WALL_TOPRIGHT		2
548 #define WALL_BOTTOMLEFT		4
549 #define WALL_BOTTOMRIGHT	8
550 #define WALL_LEFT		(WALL_TOPLEFT    | WALL_BOTTOMLEFT)
551 #define WALL_RIGHT		(WALL_TOPRIGHT   | WALL_BOTTOMRIGHT)
552 #define WALL_TOP		(WALL_TOPLEFT    | WALL_TOPRIGHT)
553 #define WALL_BOTTOM		(WALL_BOTTOMLEFT | WALL_BOTTOMRIGHT)
554 
555 /* game elements:
556 **	  0 - 499: real elements, stored in level file
557 **      500 - 699: flag elements, only used at runtime
558 */
559 /* "real" level elements */
560 #define EL_EMPTY		0
561 #define EL_MIRROR_START		1
562 #define EL_MIRROR_00		(EL_MIRROR_START + 0)
563 #define EL_MIRROR_01		(EL_MIRROR_START + 1)
564 #define EL_MIRROR_02		(EL_MIRROR_START + 2)
565 #define EL_MIRROR_03		(EL_MIRROR_START + 3)
566 #define EL_MIRROR_04		(EL_MIRROR_START + 4)
567 #define EL_MIRROR_05		(EL_MIRROR_START + 5)
568 #define EL_MIRROR_06		(EL_MIRROR_START + 6)
569 #define EL_MIRROR_07		(EL_MIRROR_START + 7)
570 #define EL_MIRROR_08		(EL_MIRROR_START + 8)
571 #define EL_MIRROR_09		(EL_MIRROR_START + 9)
572 #define EL_MIRROR_10		(EL_MIRROR_START + 10)
573 #define EL_MIRROR_11		(EL_MIRROR_START + 11)
574 #define EL_MIRROR_12		(EL_MIRROR_START + 12)
575 #define EL_MIRROR_13		(EL_MIRROR_START + 13)
576 #define EL_MIRROR_14		(EL_MIRROR_START + 14)
577 #define EL_MIRROR_15		(EL_MIRROR_START + 15)
578 #define EL_MIRROR_END		EL_MIRROR_15
579 #define EL_GRID_STEEL_START	17
580 #define EL_GRID_STEEL_00	(EL_GRID_STEEL_START + 0)
581 #define EL_GRID_STEEL_01	(EL_GRID_STEEL_START + 1)
582 #define EL_GRID_STEEL_02	(EL_GRID_STEEL_START + 2)
583 #define EL_GRID_STEEL_03	(EL_GRID_STEEL_START + 3)
584 #define EL_GRID_STEEL_END	EL_GRID_STEEL_03
585 #define EL_MCDUFFIN_START	21
586 #define EL_MCDUFFIN_RIGHT	(EL_MCDUFFIN_START + 0)
587 #define EL_MCDUFFIN_UP		(EL_MCDUFFIN_START + 1)
588 #define EL_MCDUFFIN_LEFT	(EL_MCDUFFIN_START + 2)
589 #define EL_MCDUFFIN_DOWN	(EL_MCDUFFIN_START + 3)
590 #define EL_MCDUFFIN_END		EL_MCDUFFIN_DOWN
591 #define EL_EXIT_CLOSED		25
592 #define EL_EXIT_OPENING_1	26
593 #define EL_EXIT_OPENING_2	27
594 #define EL_EXIT_OPEN		28
595 #define EL_KETTLE		29
596 #define EL_BOMB			30
597 #define EL_PRISM		31
598 #define EL_WALL_START		32
599 #define EL_WALL_EMPTY		EL_WALL_START
600 #define EL_WALL_00		EL_WALL_START
601 #define EL_WALL_STEEL		EL_WALL_00
602 #define EL_WALL_STEEL_START	EL_WALL_00
603 #define EL_WALL_15		47
604 #define EL_WALL_STEEL_END	EL_WALL_15
605 #define EL_WALL_16		48
606 #define EL_WALL_WOOD		EL_WALL_16
607 #define EL_WALL_WOOD_START	EL_WALL_16
608 #define EL_WALL_31		63
609 #define EL_WALL_WOOD_END	EL_WALL_31
610 #define EL_WALL_32		64
611 #define EL_WALL_ICE		EL_WALL_32
612 #define EL_WALL_ICE_START	EL_WALL_32
613 #define EL_WALL_47		79
614 #define EL_WALL_ICE_END		EL_WALL_47
615 #define EL_WALL_48		80
616 #define EL_WALL_AMOEBA		EL_WALL_48
617 #define EL_WALL_AMOEBA_START	EL_WALL_48
618 #define EL_WALL_63		95
619 #define EL_WALL_AMOEBA_END	EL_WALL_63
620 #define EL_WALL_END		EL_WALL_63
621 #define EL_BLOCK_WOOD		96
622 #define EL_BALL_GRAY		97
623 #define EL_BEAMER_START		98
624 #define EL_BEAMER_00		(EL_BEAMER_START + 0)
625 #define EL_BEAMER_01		(EL_BEAMER_START + 1)
626 #define EL_BEAMER_02		(EL_BEAMER_START + 2)
627 #define EL_BEAMER_03		(EL_BEAMER_START + 3)
628 #define EL_BEAMER_04		(EL_BEAMER_START + 4)
629 #define EL_BEAMER_05		(EL_BEAMER_START + 5)
630 #define EL_BEAMER_06		(EL_BEAMER_START + 6)
631 #define EL_BEAMER_07		(EL_BEAMER_START + 7)
632 #define EL_BEAMER_08		(EL_BEAMER_START + 8)
633 #define EL_BEAMER_09		(EL_BEAMER_START + 9)
634 #define EL_BEAMER_10		(EL_BEAMER_START + 10)
635 #define EL_BEAMER_11		(EL_BEAMER_START + 11)
636 #define EL_BEAMER_12		(EL_BEAMER_START + 12)
637 #define EL_BEAMER_13		(EL_BEAMER_START + 13)
638 #define EL_BEAMER_14		(EL_BEAMER_START + 14)
639 #define EL_BEAMER_15		(EL_BEAMER_START + 15)
640 #define EL_BEAMER_END		EL_BEAMER_15
641 #define EL_FUSE_ON		114
642 #define EL_PACMAN_START		115
643 #define EL_PACMAN_RIGHT		(EL_PACMAN_START + 0)
644 #define EL_PACMAN_UP		(EL_PACMAN_START + 1)
645 #define EL_PACMAN_LEFT		(EL_PACMAN_START + 2)
646 #define EL_PACMAN_DOWN		(EL_PACMAN_START + 3)
647 #define EL_PACMAN_END		EL_PACMAN_DOWN
648 #define EL_POLAR_START		119
649 #define EL_POLAR_00		(EL_POLAR_START + 0)
650 #define EL_POLAR_01		(EL_POLAR_START + 1)
651 #define EL_POLAR_02		(EL_POLAR_START + 2)
652 #define EL_POLAR_03		(EL_POLAR_START + 3)
653 #define EL_POLAR_04		(EL_POLAR_START + 4)
654 #define EL_POLAR_05		(EL_POLAR_START + 5)
655 #define EL_POLAR_06		(EL_POLAR_START + 6)
656 #define EL_POLAR_07		(EL_POLAR_START + 7)
657 #define EL_POLAR_08		(EL_POLAR_START + 8)
658 #define EL_POLAR_09		(EL_POLAR_START + 9)
659 #define EL_POLAR_10		(EL_POLAR_START + 10)
660 #define EL_POLAR_11		(EL_POLAR_START + 11)
661 #define EL_POLAR_12		(EL_POLAR_START + 12)
662 #define EL_POLAR_13		(EL_POLAR_START + 13)
663 #define EL_POLAR_14		(EL_POLAR_START + 14)
664 #define EL_POLAR_15		(EL_POLAR_START + 15)
665 #define EL_POLAR_END		EL_POLAR_15
666 #define EL_POLAR_CROSS_START	135
667 #define EL_POLAR_CROSS_00	(EL_POLAR_CROSS_START + 0)
668 #define EL_POLAR_CROSS_01	(EL_POLAR_CROSS_START + 1)
669 #define EL_POLAR_CROSS_02	(EL_POLAR_CROSS_START + 2)
670 #define EL_POLAR_CROSS_03	(EL_POLAR_CROSS_START + 3)
671 #define EL_POLAR_CROSS_END	EL_POLAR_CROSS_03
672 #define EL_MIRROR_FIXED_START	139
673 #define EL_MIRROR_FIXED_00	(EL_MIRROR_FIXED_START + 0)
674 #define EL_MIRROR_FIXED_01	(EL_MIRROR_FIXED_START + 1)
675 #define EL_MIRROR_FIXED_02	(EL_MIRROR_FIXED_START + 2)
676 #define EL_MIRROR_FIXED_03	(EL_MIRROR_FIXED_START + 3)
677 #define EL_MIRROR_FIXED_END	EL_MIRROR_FIXED_03
678 #define EL_GATE_STONE		143
679 #define EL_KEY			144
680 #define EL_LIGHTBULB_OFF	145
681 #define EL_LIGHTBULB_ON		146
682 #define EL_LIGHTBALL		147
683 #define EL_BLOCK_STONE		148
684 #define EL_GATE_WOOD		149
685 #define EL_FUEL_FULL		150
686 #define EL_GRID_WOOD_START	151
687 #define EL_GRID_WOOD_00		(EL_GRID_WOOD_START + 0)
688 #define EL_GRID_WOOD_01		(EL_GRID_WOOD_START + 1)
689 #define EL_GRID_WOOD_02		(EL_GRID_WOOD_START + 2)
690 #define EL_GRID_WOOD_03		(EL_GRID_WOOD_START + 3)
691 #define EL_GRID_WOOD_END	EL_GRID_WOOD_03
692 #define EL_FUEL_EMPTY		155
693 
694 #define EL_CHAR_START		160
695 #define EL_CHAR_ASCII0		(EL_CHAR_START-32)
696 #define EL_CHAR_AUSRUF		(EL_CHAR_ASCII0+33)
697 #define EL_CHAR_ZOLL		(EL_CHAR_ASCII0+34)
698 #define EL_CHAR_RAUTE		(EL_CHAR_ASCII0+35)
699 #define EL_CHAR_DOLLAR		(EL_CHAR_ASCII0+36)
700 #define EL_CHAR_PROZ		(EL_CHAR_ASCII0+37)
701 #define EL_CHAR_AMPERSAND	(EL_CHAR_ASCII0+38)
702 #define EL_CHAR_APOSTR		(EL_CHAR_ASCII0+39)
703 #define EL_CHAR_KLAMM1		(EL_CHAR_ASCII0+40)
704 #define EL_CHAR_KLAMM2		(EL_CHAR_ASCII0+41)
705 #define EL_CHAR_MULT		(EL_CHAR_ASCII0+42)
706 #define EL_CHAR_PLUS		(EL_CHAR_ASCII0+43)
707 #define EL_CHAR_KOMMA		(EL_CHAR_ASCII0+44)
708 #define EL_CHAR_MINUS		(EL_CHAR_ASCII0+45)
709 #define EL_CHAR_PUNKT		(EL_CHAR_ASCII0+46)
710 #define EL_CHAR_SLASH		(EL_CHAR_ASCII0+47)
711 #define EL_CHAR_0		(EL_CHAR_ASCII0+48)
712 #define EL_CHAR_9		(EL_CHAR_ASCII0+57)
713 #define EL_CHAR_DOPPEL		(EL_CHAR_ASCII0+58)
714 #define EL_CHAR_SEMIKL		(EL_CHAR_ASCII0+59)
715 #define EL_CHAR_LT		(EL_CHAR_ASCII0+60)
716 #define EL_CHAR_GLEICH		(EL_CHAR_ASCII0+61)
717 #define EL_CHAR_GT		(EL_CHAR_ASCII0+62)
718 #define EL_CHAR_FRAGE		(EL_CHAR_ASCII0+63)
719 #define EL_CHAR_AT		(EL_CHAR_ASCII0+64)
720 #define EL_CHAR_A		(EL_CHAR_ASCII0+65)
721 #define EL_CHAR_Z		(EL_CHAR_ASCII0+90)
722 #define EL_CHAR_AE		(EL_CHAR_ASCII0+91)
723 #define EL_CHAR_OE		(EL_CHAR_ASCII0+92)
724 #define EL_CHAR_UE		(EL_CHAR_ASCII0+93)
725 #define EL_CHAR_COPY		(EL_CHAR_ASCII0+94)
726 #define EL_CHAR_END		(EL_CHAR_START+79)
727 
728 #define EL_CHAR(x)		((x) == '�' ? EL_CHAR_AE : \
729 				 (x) == '�' ? EL_CHAR_OE : \
730 				 (x) == '�' ? EL_CHAR_UE : \
731 				 EL_CHAR_A + (x) - 'A')
732 
733 /* elements for "Deflektor" style levels */
734 #define EL_DF_START		240
735 
736 #define EL_DF_MIRROR_START	EL_DF_START
737 #define EL_DF_MIRROR_00		(EL_DF_MIRROR_START + 0)
738 #define EL_DF_MIRROR_01		(EL_DF_MIRROR_START + 1)
739 #define EL_DF_MIRROR_02		(EL_DF_MIRROR_START + 2)
740 #define EL_DF_MIRROR_03		(EL_DF_MIRROR_START + 3)
741 #define EL_DF_MIRROR_04		(EL_DF_MIRROR_START + 4)
742 #define EL_DF_MIRROR_05		(EL_DF_MIRROR_START + 5)
743 #define EL_DF_MIRROR_06		(EL_DF_MIRROR_START + 6)
744 #define EL_DF_MIRROR_07		(EL_DF_MIRROR_START + 7)
745 #define EL_DF_MIRROR_08		(EL_DF_MIRROR_START + 8)
746 #define EL_DF_MIRROR_09		(EL_DF_MIRROR_START + 9)
747 #define EL_DF_MIRROR_10		(EL_DF_MIRROR_START + 10)
748 #define EL_DF_MIRROR_11		(EL_DF_MIRROR_START + 11)
749 #define EL_DF_MIRROR_12		(EL_DF_MIRROR_START + 12)
750 #define EL_DF_MIRROR_13		(EL_DF_MIRROR_START + 13)
751 #define EL_DF_MIRROR_14		(EL_DF_MIRROR_START + 14)
752 #define EL_DF_MIRROR_15		(EL_DF_MIRROR_START + 15)
753 #define EL_DF_MIRROR_END	EL_DF_MIRROR_15
754 
755 #define EL_GRID_WOOD_FIXED_START 256
756 #define EL_GRID_WOOD_FIXED_00	(EL_GRID_WOOD_FIXED_START + 0)	/*   0.0� */
757 #define EL_GRID_WOOD_FIXED_01	(EL_GRID_WOOD_FIXED_START + 1)	/*  22.5� */
758 #define EL_GRID_WOOD_FIXED_02	(EL_GRID_WOOD_FIXED_START + 2)	/*  45.0� */
759 #define EL_GRID_WOOD_FIXED_03	(EL_GRID_WOOD_FIXED_START + 3)	/*  67.5� */
760 #define EL_GRID_WOOD_FIXED_04	(EL_GRID_WOOD_FIXED_START + 4)	/*  90.0� */
761 #define EL_GRID_WOOD_FIXED_05	(EL_GRID_WOOD_FIXED_START + 5)	/* 112.5� */
762 #define EL_GRID_WOOD_FIXED_06	(EL_GRID_WOOD_FIXED_START + 6)	/* 135.0� */
763 #define EL_GRID_WOOD_FIXED_07	(EL_GRID_WOOD_FIXED_START + 7)	/* 157.5� */
764 #define EL_GRID_WOOD_FIXED_END	EL_GRID_WOOD_FIXED_07
765 
766 #define EL_GRID_STEEL_FIXED_START 264
767 #define EL_GRID_STEEL_FIXED_00	(EL_GRID_STEEL_FIXED_START + 0)	/*   0.0� */
768 #define EL_GRID_STEEL_FIXED_01	(EL_GRID_STEEL_FIXED_START + 1)	/*  22.5� */
769 #define EL_GRID_STEEL_FIXED_02	(EL_GRID_STEEL_FIXED_START + 2)	/*  45.0� */
770 #define EL_GRID_STEEL_FIXED_03	(EL_GRID_STEEL_FIXED_START + 3)	/*  67.5� */
771 #define EL_GRID_STEEL_FIXED_04	(EL_GRID_STEEL_FIXED_START + 4)	/*  90.0� */
772 #define EL_GRID_STEEL_FIXED_05	(EL_GRID_STEEL_FIXED_START + 5)	/* 112.5� */
773 #define EL_GRID_STEEL_FIXED_06	(EL_GRID_STEEL_FIXED_START + 6)	/* 135.0� */
774 #define EL_GRID_STEEL_FIXED_07	(EL_GRID_STEEL_FIXED_START + 7)	/* 157.5� */
775 #define EL_GRID_STEEL_FIXED_END	EL_GRID_STEEL_FIXED_07
776 
777 #define EL_DF_WALL_WOOD		272
778 #define EL_DF_WALL_START	EL_DF_WALL_WOOD_START
779 #define EL_DF_WALL_WOOD_START	(EL_DF_WALL_WOOD + 0)
780 #define EL_DF_WALL_WOOD_END	(EL_DF_WALL_WOOD + 15)
781 
782 #define EL_DF_WALL_STEEL	288
783 #define EL_DF_WALL_STEEL_START	(EL_DF_WALL_STEEL + 0)
784 #define EL_DF_WALL_STEEL_END	(EL_DF_WALL_STEEL + 15)
785 #define EL_DF_WALL_END		EL_DF_WALL_STEEL_END
786 
787 #define EL_DF_EMPTY		304
788 #define EL_CELL			305
789 #define EL_MINE			306
790 #define EL_REFRACTOR		307
791 
792 #define EL_LASER_START		308
793 #define EL_LASER_RIGHT		(EL_LASER_START + 0)
794 #define EL_LASER_UP		(EL_LASER_START + 1)
795 #define EL_LASER_LEFT		(EL_LASER_START + 2)
796 #define EL_LASER_DOWN		(EL_LASER_START + 3)
797 #define EL_LASER_END		EL_LASER_DOWN
798 
799 #define EL_RECEIVER_START	312
800 #define EL_RECEIVER_RIGHT	(EL_RECEIVER_START + 0)
801 #define EL_RECEIVER_UP		(EL_RECEIVER_START + 1)
802 #define EL_RECEIVER_LEFT	(EL_RECEIVER_START + 2)
803 #define EL_RECEIVER_DOWN	(EL_RECEIVER_START + 3)
804 #define EL_RECEIVER_END		EL_RECEIVER_DOWN
805 
806 #define EL_FIBRE_OPTIC_START	316
807 #define EL_FIBRE_OPTIC_00	(EL_FIBRE_OPTIC_START + 0)
808 #define EL_FIBRE_OPTIC_01	(EL_FIBRE_OPTIC_START + 1)
809 #define EL_FIBRE_OPTIC_02	(EL_FIBRE_OPTIC_START + 2)
810 #define EL_FIBRE_OPTIC_03	(EL_FIBRE_OPTIC_START + 3)
811 #define EL_FIBRE_OPTIC_04	(EL_FIBRE_OPTIC_START + 4)
812 #define EL_FIBRE_OPTIC_05	(EL_FIBRE_OPTIC_START + 5)
813 #define EL_FIBRE_OPTIC_06	(EL_FIBRE_OPTIC_START + 6)
814 #define EL_FIBRE_OPTIC_07	(EL_FIBRE_OPTIC_START + 7)
815 #define EL_FIBRE_OPTIC_END	EL_FIBRE_OPTIC_07
816 
817 #define EL_DF_MIRROR_AUTO_START	324
818 #define EL_DF_MIRROR_AUTO_00	(EL_DF_MIRROR_AUTO_START + 0)
819 #define EL_DF_MIRROR_AUTO_01	(EL_DF_MIRROR_AUTO_START + 1)
820 #define EL_DF_MIRROR_AUTO_02	(EL_DF_MIRROR_AUTO_START + 2)
821 #define EL_DF_MIRROR_AUTO_03	(EL_DF_MIRROR_AUTO_START + 3)
822 #define EL_DF_MIRROR_AUTO_04	(EL_DF_MIRROR_AUTO_START + 4)
823 #define EL_DF_MIRROR_AUTO_05	(EL_DF_MIRROR_AUTO_START + 5)
824 #define EL_DF_MIRROR_AUTO_06	(EL_DF_MIRROR_AUTO_START + 6)
825 #define EL_DF_MIRROR_AUTO_07	(EL_DF_MIRROR_AUTO_START + 7)
826 #define EL_DF_MIRROR_AUTO_08	(EL_DF_MIRROR_AUTO_START + 8)
827 #define EL_DF_MIRROR_AUTO_09	(EL_DF_MIRROR_AUTO_START + 9)
828 #define EL_DF_MIRROR_AUTO_10	(EL_DF_MIRROR_AUTO_START + 10)
829 #define EL_DF_MIRROR_AUTO_11	(EL_DF_MIRROR_AUTO_START + 11)
830 #define EL_DF_MIRROR_AUTO_12	(EL_DF_MIRROR_AUTO_START + 12)
831 #define EL_DF_MIRROR_AUTO_13	(EL_DF_MIRROR_AUTO_START + 13)
832 #define EL_DF_MIRROR_AUTO_14	(EL_DF_MIRROR_AUTO_START + 14)
833 #define EL_DF_MIRROR_AUTO_15	(EL_DF_MIRROR_AUTO_START + 15)
834 #define EL_DF_MIRROR_AUTO_END	EL_DF_MIRROR_AUTO_15
835 
836 #define EL_GRID_WOOD_AUTO_START 340
837 #define EL_GRID_WOOD_AUTO_00	(EL_GRID_WOOD_AUTO_START + 0)
838 #define EL_GRID_WOOD_AUTO_01	(EL_GRID_WOOD_AUTO_START + 1)
839 #define EL_GRID_WOOD_AUTO_02	(EL_GRID_WOOD_AUTO_START + 2)
840 #define EL_GRID_WOOD_AUTO_03	(EL_GRID_WOOD_AUTO_START + 3)
841 #define EL_GRID_WOOD_AUTO_04	(EL_GRID_WOOD_AUTO_START + 4)
842 #define EL_GRID_WOOD_AUTO_05	(EL_GRID_WOOD_AUTO_START + 5)
843 #define EL_GRID_WOOD_AUTO_06	(EL_GRID_WOOD_AUTO_START + 6)
844 #define EL_GRID_WOOD_AUTO_07	(EL_GRID_WOOD_AUTO_START + 7)
845 #define EL_GRID_WOOD_AUTO_END	EL_GRID_WOOD_AUTO_07
846 
847 #define EL_GRID_STEEL_AUTO_START 348
848 #define EL_GRID_STEEL_AUTO_00	(EL_GRID_STEEL_AUTO_START + 0)
849 #define EL_GRID_STEEL_AUTO_01	(EL_GRID_STEEL_AUTO_START + 1)
850 #define EL_GRID_STEEL_AUTO_02	(EL_GRID_STEEL_AUTO_START + 2)
851 #define EL_GRID_STEEL_AUTO_03	(EL_GRID_STEEL_AUTO_START + 3)
852 #define EL_GRID_STEEL_AUTO_04	(EL_GRID_STEEL_AUTO_START + 4)
853 #define EL_GRID_STEEL_AUTO_05	(EL_GRID_STEEL_AUTO_START + 5)
854 #define EL_GRID_STEEL_AUTO_06	(EL_GRID_STEEL_AUTO_START + 6)
855 #define EL_GRID_STEEL_AUTO_07	(EL_GRID_STEEL_AUTO_START + 7)
856 #define EL_GRID_STEEL_AUTO_END	EL_GRID_STEEL_AUTO_07
857 
858 #define EL_DF_END		355
859 
860 #define EL_BEAMER_RED_START	356
861 #define EL_BEAMER_RED_END	(EL_BEAMER_RED_START + 15)
862 #define EL_BEAMER_YELLOW_START	372
863 #define EL_BEAMER_YELLOW_END	(EL_BEAMER_YELLOW_START + 15)
864 #define EL_BEAMER_GREEN_START	388
865 #define EL_BEAMER_GREEN_END	(EL_BEAMER_GREEN_START + 15)
866 #define EL_BEAMER_BLUE_START	404
867 #define EL_BEAMER_BLUE_END	(EL_BEAMER_BLUE_START + 15)
868 
869 /* "real" (and therefore drawable) runtime elements */
870 #define EL_FIRST_RUNTIME_EL	500
871 #define EL_FUSE_OFF		501
872 #define EL_PACMAN		502
873 #define EL_EXIT_OPENING		503
874 #define EL_GRAY_BALL_OPENING	504
875 
876 #define EL_WALL_CHANGING	512
877 #define EL_WALL_CHANGING_START	(EL_WALL_CHANGING + 0)
878 #define EL_WALL_CHANGING_END	(EL_WALL_CHANGING + 15)
879 
880 #if 0
881 #define EL_MIRROR		5
882 #define EL_GRID_STEEL		5
883 #define EL_MCDUFFIN		5
884 #define EL_BEAMER		5
885 #define EL_POLAR		5
886 #define EL_POLAR_CROSS		5
887 #define EL_MIRROR_FIXED		5
888 #define EL_GRID_WOOD		5
889 #define EL_DF_MIRROR		5
890 #define EL_GRID_WOOD_FIXED	5
891 #define EL_GRID_STEEL_FIXED	5
892 #define EL_LASER		5
893 #define EL_RECEIVER		5
894 #define EL_FIBRE_OPTIC		5
895 #define EL_DF_MIRROR_AUTO	5
896 #define EL_GRID_WOOD_AUTO	5
897 #define EL_GRID_STEEL_AUTO	5
898 #endif
899 
900 /* "unreal" (and therefore not drawable) runtime elements */
901 #define EL_BLOCKED		600
902 #define EL_EXPLODING_OPAQUE	601
903 #define EL_EXPLODING_TRANSP	602
904 
905 
906 /* game graphics:
907 **	  0 -  191: graphics from "MirrorScreen"
908 **	192 -  255: pseudo graphics mapped to "MirrorScreen"
909 **	256 -  511: graphics from "MirrorFont"
910 **	512 -  767: graphics from "MirrorDF"
911 */
912 
913 #define GFX_START_MIRRORSCREEN	0
914 #define GFX_END_MIRRORSCREEN	191
915 #define GFX_START_PSEUDO	192
916 #define GFX_END_PSEUDO		255
917 #define GFX_START_MIRRORFONT	256
918 #define GFX_END_MIRRORFONT	511
919 #define GFX_START_MIRRORDF	512
920 #define GFX_END_MIRRORDF	767
921 
922 #define NUM_TILES		512
923 
924 /* graphics from "MirrorScreen" */
925 #define GFX_EMPTY		(-1)
926 /* row 0 (0) */
927 #define GFX_MIRROR_START	0
928 #define GFX_MIRROR		GFX_MIRROR_START
929 #define GFX_MIRROR_00		(GFX_MIRROR_START + 0)
930 #define GFX_MIRROR_01		(GFX_MIRROR_START + 1)
931 #define GFX_MIRROR_02		(GFX_MIRROR_START + 2)
932 #define GFX_MIRROR_03		(GFX_MIRROR_START + 3)
933 #define GFX_MIRROR_04		(GFX_MIRROR_START + 4)
934 #define GFX_MIRROR_05		(GFX_MIRROR_START + 5)
935 #define GFX_MIRROR_06		(GFX_MIRROR_START + 6)
936 #define GFX_MIRROR_07		(GFX_MIRROR_START + 7)
937 #define GFX_MIRROR_08		(GFX_MIRROR_START + 8)
938 #define GFX_MIRROR_09		(GFX_MIRROR_START + 9)
939 #define GFX_MIRROR_10		(GFX_MIRROR_START + 10)
940 #define GFX_MIRROR_11		(GFX_MIRROR_START + 11)
941 #define GFX_MIRROR_12		(GFX_MIRROR_START + 12)
942 #define GFX_MIRROR_13		(GFX_MIRROR_START + 13)
943 #define GFX_MIRROR_14		(GFX_MIRROR_START + 14)
944 #define GFX_MIRROR_15		(GFX_MIRROR_START + 15)
945 #define GFX_MIRROR_END		GFX_MIRROR_15
946 /* row 1 (16) */
947 #define GFX_GRID_STEEL_START	16
948 #define GFX_GRID_STEEL		GFX_GRID_STEEL_START
949 #define GFX_GRID_STEEL_00	(GFX_GRID_STEEL_START + 0)
950 #define GFX_GRID_STEEL_01	(GFX_GRID_STEEL_START + 1)
951 #define GFX_GRID_STEEL_02	(GFX_GRID_STEEL_START + 2)
952 #define GFX_GRID_STEEL_03	(GFX_GRID_STEEL_START + 3)
953 #define GFX_MCDUFFIN_START	20
954 #define GFX_MCDUFFIN		GFX_MCDUFFIN_START
955 #define GFX_MCDUFFIN_RIGHT	(GFX_MCDUFFIN_START + 0)
956 #define GFX_MCDUFFIN_UP		(GFX_MCDUFFIN_START + 1)
957 #define GFX_MCDUFFIN_LEFT	(GFX_MCDUFFIN_START + 2)
958 #define GFX_MCDUFFIN_DOWN	(GFX_MCDUFFIN_START + 3)
959 #define GFX_EXIT_CLOSED		24
960 #define GFX_EXIT_OPENING_1	25
961 #define GFX_EXIT_OPENING_2	26
962 #define GFX_EXIT_OPEN		27
963 #define GFX_KETTLE		28
964 #define GFX_EXPLOSION_KETTLE	29
965 /* row 2 (32) */
966 #define GFX_PRISM		32
967 #define GFX_WALL_SEVERAL	33
968 #define GFX_WALL_ANIMATION	34
969 #define GFX_BLOCK_WOOD		36
970 #define GFX_BOMB		37
971 #define GFX_FUSE_ON		38
972 #define GFX_FUSE_OFF		39
973 #define GFX_GATE_STONE		40
974 #define GFX_KEY			41
975 #define GFX_LIGHTBULB_OFF	42
976 #define GFX_LIGHTBULB_ON	43
977 #define GFX_BALL_RED		44
978 #define GFX_BALL_BLUE		45
979 #define GFX_BALL_YELLOW		46
980 #define GFX_BALL_GRAY		47
981 /* row 3 (48) */
982 #define GFX_BEAMER_START	48
983 #define GFX_BEAMER_END		63
984 /* row 4 (64) */
985 #define GFX_PACMAN_START	64
986 #define GFX_PACMAN		GFX_PACMAN_START
987 #define GFX_PACMAN_RIGHT	(GFX_PACMAN_START + 0)
988 #define GFX_PACMAN_UP		(GFX_PACMAN_START + 1)
989 #define GFX_PACMAN_LEFT		(GFX_PACMAN_START + 2)
990 #define GFX_PACMAN_DOWN		(GFX_PACMAN_START + 3)
991 #define GFX_EXPLOSION_START	72
992 #define GFX_EXPLOSION_SHORT	76
993 #define GFX_EXPLOSION_LAST	78
994 /* row 5 (80) */
995 #define GFX_POLAR_START		80
996 #define GFX_POLAR_END		95
997 /* row 6 (96) */
998 #define GFX_POLAR_CROSS_START	96
999 #define GFX_POLAR_CROSS		GFX_POLAR_CROSS_START
1000 #define GFX_POLAR_CROSS_00	(GFX_POLAR_CROSS_START + 0)
1001 #define GFX_POLAR_CROSS_01	(GFX_POLAR_CROSS_START + 1)
1002 #define GFX_POLAR_CROSS_02	(GFX_POLAR_CROSS_START + 2)
1003 #define GFX_POLAR_CROSS_03	(GFX_POLAR_CROSS_START + 3)
1004 #define GFX_MIRROR_FIXED_START	100
1005 #define GFX_MIRROR_FIXED	GFX_MIRROR_FIXED_START
1006 #define GFX_MIRROR_FIXED_00	(GFX_MIRROR_FIXED_START + 0)
1007 #define GFX_MIRROR_FIXED_01	(GFX_MIRROR_FIXED_START + 1)
1008 #define GFX_MIRROR_FIXED_02	(GFX_MIRROR_FIXED_START + 2)
1009 #define GFX_MIRROR_FIXED_03	(GFX_MIRROR_FIXED_START + 3)
1010 /* row 7 (112) */
1011 #define GFX_BLOCK_STONE		112
1012 #define GFX_GATE_WOOD		113
1013 #define GFX_FUEL_FULL		114
1014 #define GFX_FUEL_EMPTY		115
1015 #define GFX_GRID_WOOD_00	116
1016 #define GFX_GRID_WOOD_01	117
1017 #define GFX_GRID_WOOD_02	118
1018 #define GFX_GRID_WOOD_03	119
1019 /* row 8 (128) */
1020 #define GFX_ARROW_BLUE_LEFT	128
1021 #define GFX_ARROW_BLUE_RIGHT	129
1022 #define GFX_ARROW_BLUE_UP	130
1023 #define GFX_ARROW_BLUE_DOWN	131
1024 #define GFX_ARROW_RED_LEFT	132
1025 #define GFX_ARROW_RED_RIGHT	133
1026 #define GFX_ARROW_RED_UP	134
1027 #define GFX_ARROW_RED_DOWN	135
1028 /* row 9 (144) */
1029 #define GFX_SCROLLBAR_BLUE	144
1030 #define GFX_SCROLLBAR_RED	145
1031 /* row 10 (160) */
1032 #define GFX_MASK_CIRCLE		160
1033 #define GFX_MASK_RECTANGLE	161
1034 #define GFX_MASK_RECTANGLE2	162
1035 #define GFX_MASK_RECTANGLE3	163
1036 #define GFX_MASK_GRID_00	164
1037 #define GFX_MASK_GRID_01	165
1038 #define GFX_MASK_GRID_02	166
1039 #define GFX_MASK_GRID_03	167
1040 /* row 11 (176) */
1041 #define GFX_MASK_MCDUFFIN_00	176
1042 #define GFX_MASK_MCDUFFIN_01	177
1043 #define GFX_MASK_MCDUFFIN_02	178
1044 #define GFX_MASK_MCDUFFIN_03	179
1045 
1046 /* pseudo-graphics; will be mapped to other graphics */
1047 #define GFX_WALL_STEEL		192
1048 #define GFX_WALL_WOOD		193
1049 #define GFX_WALL_ICE		194
1050 #define GFX_WALL_AMOEBA		195
1051 #define GFX_DF_WALL_STEEL	196
1052 #define GFX_DF_WALL_WOOD	197
1053 
1054 #define GFX_KUGEL_ROT		GFX_BALL_RED
1055 #define GFX_KUGEL_BLAU		GFX_BALL_BLUE
1056 #define GFX_KUGEL_GELB		GFX_BALL_YELLOW
1057 #define GFX_KUGEL_GRAU		GFX_BALL_GRAY
1058 
1059 /* graphics from "MirrorFont" */
1060 #define GFX_CHAR_START		(GFX_START_MIRRORFONT)
1061 #define GFX_CHAR_ASCII0		(GFX_CHAR_START - 32)
1062 #define GFX_CHAR_AUSRUF		(GFX_CHAR_ASCII0 + 33)
1063 #define GFX_CHAR_ZOLL		(GFX_CHAR_ASCII0 + 34)
1064 #define GFX_CHAR_DOLLAR		(GFX_CHAR_ASCII0 + 36)
1065 #define GFX_CHAR_PROZ		(GFX_CHAR_ASCII0 + 37)
1066 #define GFX_CHAR_APOSTR		(GFX_CHAR_ASCII0 + 39)
1067 #define GFX_CHAR_KLAMM1		(GFX_CHAR_ASCII0 + 40)
1068 #define GFX_CHAR_KLAMM2		(GFX_CHAR_ASCII0 + 41)
1069 #define GFX_CHAR_PLUS		(GFX_CHAR_ASCII0 + 43)
1070 #define GFX_CHAR_KOMMA		(GFX_CHAR_ASCII0 + 44)
1071 #define GFX_CHAR_MINUS		(GFX_CHAR_ASCII0 + 45)
1072 #define GFX_CHAR_PUNKT		(GFX_CHAR_ASCII0 + 46)
1073 #define GFX_CHAR_SLASH		(GFX_CHAR_ASCII0 + 47)
1074 #define GFX_CHAR_0		(GFX_CHAR_ASCII0 + 48)
1075 #define GFX_CHAR_9		(GFX_CHAR_ASCII0 + 57)
1076 #define GFX_CHAR_DOPPEL		(GFX_CHAR_ASCII0 + 58)
1077 #define GFX_CHAR_SEMIKL		(GFX_CHAR_ASCII0 + 59)
1078 #define GFX_CHAR_LT		(GFX_CHAR_ASCII0 + 60)
1079 #define GFX_CHAR_GLEICH		(GFX_CHAR_ASCII0 + 61)
1080 #define GFX_CHAR_GT		(GFX_CHAR_ASCII0 + 62)
1081 #define GFX_CHAR_FRAGE		(GFX_CHAR_ASCII0 + 63)
1082 #define GFX_CHAR_AT		(GFX_CHAR_ASCII0 + 64)
1083 #define GFX_CHAR_A		(GFX_CHAR_ASCII0 + 65)
1084 #define GFX_CHAR_Z		(GFX_CHAR_ASCII0 + 90)
1085 #define GFX_CHAR_AE		(GFX_CHAR_ASCII0 + 91)
1086 #define GFX_CHAR_OE		(GFX_CHAR_ASCII0 + 92)
1087 #define GFX_CHAR_UE		(GFX_CHAR_ASCII0 + 93)
1088 #define GFX_CHAR_COPY		(GFX_CHAR_ASCII0 + 94)
1089 #define GFX_CHAR_END		(GFX_CHAR_START + 79)
1090 
1091 /* graphics from "MirrorDF" */
1092 #define GFX_DF_MIRROR_00	(GFX_START_MIRRORDF +  0 * DF_PER_LINE +  0)
1093 #define GFX_DF_MIRROR_01	(GFX_START_MIRRORDF +  0 * DF_PER_LINE +  1)
1094 #define GFX_DF_MIRROR_02	(GFX_START_MIRRORDF +  0 * DF_PER_LINE +  2)
1095 #define GFX_DF_MIRROR_03	(GFX_START_MIRRORDF +  0 * DF_PER_LINE +  3)
1096 #define GFX_DF_MIRROR_04	(GFX_START_MIRRORDF +  0 * DF_PER_LINE +  4)
1097 #define GFX_DF_MIRROR_05	(GFX_START_MIRRORDF +  0 * DF_PER_LINE +  5)
1098 #define GFX_DF_MIRROR_06	(GFX_START_MIRRORDF +  0 * DF_PER_LINE +  6)
1099 #define GFX_DF_MIRROR_07	(GFX_START_MIRRORDF +  0 * DF_PER_LINE +  7)
1100 #define GFX_DF_MIRROR_08	(GFX_START_MIRRORDF +  0 * DF_PER_LINE +  8)
1101 #define GFX_DF_MIRROR_09	(GFX_START_MIRRORDF +  0 * DF_PER_LINE +  9)
1102 #define GFX_DF_MIRROR_10	(GFX_START_MIRRORDF +  0 * DF_PER_LINE + 10)
1103 #define GFX_DF_MIRROR_11	(GFX_START_MIRRORDF +  0 * DF_PER_LINE + 11)
1104 #define GFX_DF_MIRROR_12	(GFX_START_MIRRORDF +  0 * DF_PER_LINE + 12)
1105 #define GFX_DF_MIRROR_13	(GFX_START_MIRRORDF +  0 * DF_PER_LINE + 13)
1106 #define GFX_DF_MIRROR_14	(GFX_START_MIRRORDF +  0 * DF_PER_LINE + 14)
1107 #define GFX_DF_MIRROR_15	(GFX_START_MIRRORDF +  0 * DF_PER_LINE + 15)
1108 
1109 #define GFX_DF_MIRROR_AUTO_00	(GFX_START_MIRRORDF +  1 * DF_PER_LINE +  0)
1110 #define GFX_DF_MIRROR_AUTO_01	(GFX_START_MIRRORDF +  1 * DF_PER_LINE +  1)
1111 #define GFX_DF_MIRROR_AUTO_02	(GFX_START_MIRRORDF +  1 * DF_PER_LINE +  2)
1112 #define GFX_DF_MIRROR_AUTO_03	(GFX_START_MIRRORDF +  1 * DF_PER_LINE +  3)
1113 #define GFX_DF_MIRROR_AUTO_04	(GFX_START_MIRRORDF +  1 * DF_PER_LINE +  4)
1114 #define GFX_DF_MIRROR_AUTO_05	(GFX_START_MIRRORDF +  1 * DF_PER_LINE +  5)
1115 #define GFX_DF_MIRROR_AUTO_06	(GFX_START_MIRRORDF +  1 * DF_PER_LINE +  6)
1116 #define GFX_DF_MIRROR_AUTO_07	(GFX_START_MIRRORDF +  1 * DF_PER_LINE +  7)
1117 #define GFX_DF_MIRROR_AUTO_08	(GFX_START_MIRRORDF +  1 * DF_PER_LINE +  8)
1118 #define GFX_DF_MIRROR_AUTO_09	(GFX_START_MIRRORDF +  1 * DF_PER_LINE +  9)
1119 #define GFX_DF_MIRROR_AUTO_10	(GFX_START_MIRRORDF +  1 * DF_PER_LINE + 10)
1120 #define GFX_DF_MIRROR_AUTO_11	(GFX_START_MIRRORDF +  1 * DF_PER_LINE + 11)
1121 #define GFX_DF_MIRROR_AUTO_12	(GFX_START_MIRRORDF +  1 * DF_PER_LINE + 12)
1122 #define GFX_DF_MIRROR_AUTO_13	(GFX_START_MIRRORDF +  1 * DF_PER_LINE + 13)
1123 #define GFX_DF_MIRROR_AUTO_14	(GFX_START_MIRRORDF +  1 * DF_PER_LINE + 14)
1124 #define GFX_DF_MIRROR_AUTO_15	(GFX_START_MIRRORDF +  1 * DF_PER_LINE + 15)
1125 
1126 #define GFX_GRID_STEEL_FIXED_00	(GFX_START_MIRRORDF +  2 * DF_PER_LINE +  0)
1127 #define GFX_GRID_STEEL_FIXED_01	(GFX_START_MIRRORDF +  2 * DF_PER_LINE +  1)
1128 #define GFX_GRID_STEEL_FIXED_02	(GFX_START_MIRRORDF +  2 * DF_PER_LINE +  2)
1129 #define GFX_GRID_STEEL_FIXED_03	(GFX_START_MIRRORDF +  2 * DF_PER_LINE +  3)
1130 #define GFX_GRID_STEEL_FIXED_04	(GFX_START_MIRRORDF +  2 * DF_PER_LINE +  4)
1131 #define GFX_GRID_STEEL_FIXED_05	(GFX_START_MIRRORDF +  2 * DF_PER_LINE +  5)
1132 #define GFX_GRID_STEEL_FIXED_06	(GFX_START_MIRRORDF +  2 * DF_PER_LINE +  6)
1133 #define GFX_GRID_STEEL_FIXED_07	(GFX_START_MIRRORDF +  2 * DF_PER_LINE +  7)
1134 #define GFX_GRID_STEEL_FIXED	GFX_GRID_STEEL_FIXED_00
1135 
1136 #define GFX_GRID_WOOD_FIXED_00	(GFX_START_MIRRORDF +  2 * DF_PER_LINE +  8)
1137 #define GFX_GRID_WOOD_FIXED_01	(GFX_START_MIRRORDF +  2 * DF_PER_LINE +  9)
1138 #define GFX_GRID_WOOD_FIXED_02	(GFX_START_MIRRORDF +  2 * DF_PER_LINE + 10)
1139 #define GFX_GRID_WOOD_FIXED_03	(GFX_START_MIRRORDF +  2 * DF_PER_LINE + 11)
1140 #define GFX_GRID_WOOD_FIXED_04	(GFX_START_MIRRORDF +  2 * DF_PER_LINE + 12)
1141 #define GFX_GRID_WOOD_FIXED_05	(GFX_START_MIRRORDF +  2 * DF_PER_LINE + 13)
1142 #define GFX_GRID_WOOD_FIXED_06	(GFX_START_MIRRORDF +  2 * DF_PER_LINE + 14)
1143 #define GFX_GRID_WOOD_FIXED_07	(GFX_START_MIRRORDF +  2 * DF_PER_LINE + 15)
1144 #define GFX_GRID_WOOD_FIXED	GFX_GRID_WOOD_FIXED_00
1145 
1146 #define GFX_GRID_STEEL_AUTO_00	(GFX_START_MIRRORDF +  3 * DF_PER_LINE +  0)
1147 #define GFX_GRID_STEEL_AUTO_01	(GFX_START_MIRRORDF +  3 * DF_PER_LINE +  1)
1148 #define GFX_GRID_STEEL_AUTO_02	(GFX_START_MIRRORDF +  3 * DF_PER_LINE +  2)
1149 #define GFX_GRID_STEEL_AUTO_03	(GFX_START_MIRRORDF +  3 * DF_PER_LINE +  3)
1150 #define GFX_GRID_STEEL_AUTO_04	(GFX_START_MIRRORDF +  3 * DF_PER_LINE +  4)
1151 #define GFX_GRID_STEEL_AUTO_05	(GFX_START_MIRRORDF +  3 * DF_PER_LINE +  5)
1152 #define GFX_GRID_STEEL_AUTO_06	(GFX_START_MIRRORDF +  3 * DF_PER_LINE +  6)
1153 #define GFX_GRID_STEEL_AUTO_07	(GFX_START_MIRRORDF +  3 * DF_PER_LINE +  7)
1154 #define GFX_GRID_STEEL_AUTO	GFX_GRID_STEEL_AUTO_00
1155 
1156 #define GFX_GRID_WOOD_AUTO_00	(GFX_START_MIRRORDF +  3 * DF_PER_LINE +  8)
1157 #define GFX_GRID_WOOD_AUTO_01	(GFX_START_MIRRORDF +  3 * DF_PER_LINE +  9)
1158 #define GFX_GRID_WOOD_AUTO_02	(GFX_START_MIRRORDF +  3 * DF_PER_LINE + 10)
1159 #define GFX_GRID_WOOD_AUTO_03	(GFX_START_MIRRORDF +  3 * DF_PER_LINE + 11)
1160 #define GFX_GRID_WOOD_AUTO_04	(GFX_START_MIRRORDF +  3 * DF_PER_LINE + 12)
1161 #define GFX_GRID_WOOD_AUTO_05	(GFX_START_MIRRORDF +  3 * DF_PER_LINE + 13)
1162 #define GFX_GRID_WOOD_AUTO_06	(GFX_START_MIRRORDF +  3 * DF_PER_LINE + 14)
1163 #define GFX_GRID_WOOD_AUTO_07	(GFX_START_MIRRORDF +  3 * DF_PER_LINE + 15)
1164 #define GFX_GRID_WOOD_AUTO	GFX_GRID_WOOD_AUTO_00
1165 
1166 #define GFX_BEAMER_RED_START	(GFX_START_MIRRORDF +  4 * DF_PER_LINE +  0)
1167 #define GFX_BEAMER_RED_END	(GFX_START_MIRRORDF +  4 * DF_PER_LINE + 15)
1168 #define GFX_BEAMER_YELLOW_START	(GFX_START_MIRRORDF +  5 * DF_PER_LINE +  0)
1169 #define GFX_BEAMER_YELLOW_END	(GFX_START_MIRRORDF +  5 * DF_PER_LINE + 15)
1170 #define GFX_BEAMER_GREEN_START	(GFX_START_MIRRORDF +  6 * DF_PER_LINE +  0)
1171 #define GFX_BEAMER_GREEN_END	(GFX_START_MIRRORDF +  6 * DF_PER_LINE + 15)
1172 #define GFX_BEAMER_BLUE_START	(GFX_START_MIRRORDF +  7 * DF_PER_LINE +  0)
1173 #define GFX_BEAMER_BLUE_END	(GFX_START_MIRRORDF +  7 * DF_PER_LINE + 15)
1174 
1175 #define GFX_DF_WALL_SEVERAL	(GFX_START_MIRRORDF +  8 * DF_PER_LINE +  0)
1176 #define GFX_REFRACTOR		(GFX_START_MIRRORDF +  8 * DF_PER_LINE +  1)
1177 #define GFX_CELL		(GFX_START_MIRRORDF +  8 * DF_PER_LINE +  2)
1178 #define GFX_MINE		(GFX_START_MIRRORDF +  8 * DF_PER_LINE +  4)
1179 
1180 #define GFX_LASER_RIGHT		(GFX_START_MIRRORDF +  9 * DF_PER_LINE +  0)
1181 #define GFX_LASER_UP		(GFX_START_MIRRORDF +  9 * DF_PER_LINE +  1)
1182 #define GFX_LASER_LEFT		(GFX_START_MIRRORDF +  9 * DF_PER_LINE +  2)
1183 #define GFX_LASER_DOWN		(GFX_START_MIRRORDF +  9 * DF_PER_LINE +  3)
1184 #define GFX_RECEIVER_RIGHT	(GFX_START_MIRRORDF +  9 * DF_PER_LINE +  4)
1185 #define GFX_RECEIVER_UP		(GFX_START_MIRRORDF +  9 * DF_PER_LINE +  5)
1186 #define GFX_RECEIVER_LEFT	(GFX_START_MIRRORDF +  9 * DF_PER_LINE +  6)
1187 #define GFX_RECEIVER_DOWN	(GFX_START_MIRRORDF +  9 * DF_PER_LINE +  7)
1188 
1189 #define GFX_FIBRE_OPTIC_00	(GFX_START_MIRRORDF + 10 * DF_PER_LINE +  0)
1190 #define GFX_FIBRE_OPTIC_01	(GFX_START_MIRRORDF + 10 * DF_PER_LINE +  1)
1191 #define GFX_FIBRE_OPTIC_02	(GFX_START_MIRRORDF + 10 * DF_PER_LINE +  2)
1192 #define GFX_FIBRE_OPTIC_03	(GFX_START_MIRRORDF + 10 * DF_PER_LINE +  3)
1193 #define GFX_FIBRE_OPTIC_04	(GFX_START_MIRRORDF + 10 * DF_PER_LINE +  4)
1194 #define GFX_FIBRE_OPTIC_05	(GFX_START_MIRRORDF + 10 * DF_PER_LINE +  5)
1195 #define GFX_FIBRE_OPTIC_06	(GFX_START_MIRRORDF + 10 * DF_PER_LINE +  6)
1196 #define GFX_FIBRE_OPTIC_07	(GFX_START_MIRRORDF + 10 * DF_PER_LINE +  7)
1197 
1198 #define GFX_FIBRE_OPTIC_ED_00	(GFX_START_MIRRORDF + 11 * DF_PER_LINE +  0)
1199 #define GFX_FIBRE_OPTIC_ED_01	(GFX_START_MIRRORDF + 11 * DF_PER_LINE +  1)
1200 #define GFX_FIBRE_OPTIC_ED_02	(GFX_START_MIRRORDF + 11 * DF_PER_LINE +  2)
1201 #define GFX_FIBRE_OPTIC_ED_03	(GFX_START_MIRRORDF + 11 * DF_PER_LINE +  3)
1202 #define GFX_FIBRE_OPTIC_ED_04	(GFX_START_MIRRORDF + 11 * DF_PER_LINE +  4)
1203 #define GFX_FIBRE_OPTIC_ED_05	(GFX_START_MIRRORDF + 11 * DF_PER_LINE +  5)
1204 #define GFX_FIBRE_OPTIC_ED_06	(GFX_START_MIRRORDF + 11 * DF_PER_LINE +  6)
1205 #define GFX_FIBRE_OPTIC_ED_07	(GFX_START_MIRRORDF + 11 * DF_PER_LINE +  7)
1206 
1207 /* the names of the sounds */
1208 #define SND_AMOEBE		0
1209 #define SND_ANTIGRAV		1
1210 #define SND_AUTSCH		2
1211 #define SND_BONG		3
1212 #define SND_FUEL		4
1213 #define SND_HALLOFFAME		5
1214 #define SND_HOLZ		6
1215 #define SND_HUI			7
1216 #define SND_KABUMM		8
1217 #define SND_KINK		9
1218 #define SND_KLING		10
1219 #define SND_LASER		11
1220 #define SND_OEFFNEN		12
1221 #define SND_QUIEK		13
1222 #define SND_RHYTHMLOOP		14
1223 #define SND_ROAAAR		15
1224 #define SND_SIRR		16
1225 #define SND_SLURP		17
1226 #define SND_WARNTON		18
1227 #define SND_WHOOSH		19
1228 
1229 #define NUM_SOUNDS		20
1230 
1231 /* default input keys */
1232 #define DEFAULT_KEY_LEFT	KSYM_Left
1233 #define DEFAULT_KEY_RIGHT	KSYM_Right
1234 #define DEFAULT_KEY_UP		KSYM_Up
1235 #define DEFAULT_KEY_DOWN	KSYM_Down
1236 #define DEFAULT_KEY_SNAP	KSYM_Shift_L
1237 #define DEFAULT_KEY_BOMB	KSYM_Shift_R
1238 #define DEFAULT_KEY_OKAY	KSYM_Return
1239 #define DEFAULT_KEY_CANCEL	KSYM_Escape
1240 
1241 /* directions for moving */
1242 #define MV_NO_MOVING		0
1243 #define MV_LEFT			(1 << 0)
1244 #define MV_RIGHT		(1 << 1)
1245 #define MV_UP			(1 << 2)
1246 #define MV_DOWN	       		(1 << 3)
1247 
1248 /* laser angles (directions) */
1249 #define ANG_RAY_RIGHT		0
1250 #define ANG_RAY_UP		4
1251 #define ANG_RAY_LEFT		8
1252 #define ANG_RAY_DOWN		12
1253 
1254 /* laser angles (degree) */
1255 #define ANG_RAY_0		0
1256 #define ANG_RAY_90		4
1257 #define ANG_RAY_180		8
1258 #define ANG_RAY_270		12
1259 #define IS_22_5_ANGLE(angle)	((angle) % 2)
1260 #define IS_90_ANGLE(angle)	(!((angle) % 4))
1261 #define IS_HORIZ_ANGLE(angle)	(!((angle) % 8))
1262 #define IS_VERT_ANGLE(angle)	((angle) % 8)
1263 
1264 /* mirror angles */
1265 #define ANG_MIRROR_0		0
1266 #define ANG_MIRROR_45		4
1267 #define ANG_MIRROR_90		8
1268 #define ANG_MIRROR_135		12
1269 
1270 /* positions for checking where laser already hits element */
1271 #define HIT_POS_CENTER		1
1272 #define HIT_POS_EDGE		2
1273 #define HIT_POS_BETWEEN		4
1274 
1275 /* masks for scanning elements */
1276 #define HIT_MASK_NO_HIT		0
1277 #define HIT_MASK_TOPLEFT	1
1278 #define HIT_MASK_TOPRIGHT	2
1279 #define HIT_MASK_BOTTOMLEFT	4
1280 #define HIT_MASK_BOTTOMRIGHT	8
1281 #define HIT_MASK_LEFT		(HIT_MASK_TOPLEFT | HIT_MASK_BOTTOMLEFT)
1282 #define HIT_MASK_RIGHT		(HIT_MASK_TOPRIGHT | HIT_MASK_BOTTOMRIGHT)
1283 #define HIT_MASK_TOP		(HIT_MASK_TOPLEFT | HIT_MASK_TOPRIGHT)
1284 #define HIT_MASK_BOTTOM		(HIT_MASK_BOTTOMLEFT | HIT_MASK_BOTTOMRIGHT)
1285 #define HIT_MASK_ALL		(HIT_MASK_LEFT | HIT_MASK_RIGHT)
1286 
1287 /* step values for rotating elements */
1288 #define ROTATE_NO_ROTATING	0
1289 #define ROTATE_LEFT		(+1)
1290 #define ROTATE_RIGHT		(-1)
1291 #define BUTTON_ROTATION(button)	((button) == MB_LEFTBUTTON  ? ROTATE_LEFT :  \
1292 				 (button) == MB_RIGHTBUTTON ? ROTATE_RIGHT : \
1293 	 			 ROTATE_NO_ROTATING)
1294 
1295 /* game over values */
1296 #define GAME_OVER_NO_ENERGY	1
1297 #define GAME_OVER_OVERLOADED	2
1298 #define GAME_OVER_BOMB		3
1299 
1300 /* values for joystick directions and buttons */
1301 #define JOY_LEFT                MV_LEFT
1302 #define JOY_RIGHT               MV_RIGHT
1303 #define JOY_UP                  MV_UP
1304 #define JOY_DOWN                MV_DOWN
1305 #define JOY_BUTTON_1            (1 << 4)
1306 #define JOY_BUTTON_2            (1 << 5)
1307 #define JOY_BUTTON              (JOY_BUTTON_1 | JOY_BUTTON_2)
1308 
1309 /* values for game_status */
1310 #define EXITGAME		0
1311 #define MAINMENU		1
1312 #define PLAYING			2
1313 #define LEVELED			3
1314 #define HELPSCREEN		4
1315 #define CHOOSELEVEL		5
1316 #define TYPENAME		6
1317 #define HALLOFFAME		7
1318 #define SETUP			8
1319 
1320 /* return values for GameActions */
1321 #define ACT_GO_ON	0
1322 #define ACT_GAME_OVER	1
1323 #define ACT_NEW_GAME	2
1324 
1325 /* values for color_status */
1326 #define STATIC_COLORS   0
1327 #define DYNAMIC_COLORS  1
1328 
1329 #define PROGRAM_VERSION_MAJOR	2
1330 #define PROGRAM_VERSION_MINOR	0
1331 #define PROGRAM_VERSION_PATCH	2
1332 #define PROGRAM_VERSION_STRING	"2.0.2"
1333 
1334 #define PROGRAM_TITLE_STRING	"Mirror Magic II"
1335 #define PROGRAM_AUTHOR_STRING	"Holger Schemel"
1336 #define PROGRAM_RIGHTS_STRING	"Copyright ^1994-2001"
1337 #define PROGRAM_DOS_PORT_STRING	"DOS port based on code by Guido Schulz"
1338 #define PROGRAM_IDENT_STRING	PROGRAM_VERSION_STRING " " TARGET_STRING
1339 #define WINDOW_TITLE_STRING	PROGRAM_TITLE_STRING " " PROGRAM_IDENT_STRING
1340 #define WINDOW_SUBTITLE_STRING	PROGRAM_RIGHTS_STRING " " PROGRAM_AUTHOR_STRING
1341 #define ICON_TITLE_STRING	PROGRAM_TITLE_STRING
1342 #define UNIX_USERDATA_DIRECTORY	".mirrormagic"
1343 
1344 #define X11_ICON_FILENAME	"mirrormagic_icon.xbm"
1345 #define X11_ICONMASK_FILENAME	"mirrormagic_iconmask.xbm"
1346 #define MSDOS_POINTER_FILENAME	"mouse.pcx"
1347 
1348 /* file version numbers for resource files (levels, score, setup, etc.)
1349 ** currently supported/known file version numbers:
1350 **	1.4 (still in use)
1351 **	2.0 (actual)
1352 */
1353 #define FILE_VERSION_1_4	VERSION_IDENT(1,4,0)
1354 #define FILE_VERSION_2_0	VERSION_IDENT(2,0,0)
1355 
1356 /* file version does not change for every program version, but is changed
1357    when new features are introduced that are incompatible with older file
1358    versions, so that they can be treated accordingly */
1359 #define FILE_VERSION_ACTUAL	FILE_VERSION_2_0
1360 
1361 #define GAME_VERSION_ACTUAL	VERSION_IDENT(PROGRAM_VERSION_MAJOR, \
1362 					      PROGRAM_VERSION_MINOR, \
1363 					      PROGRAM_VERSION_PATCH)
1364 
1365 /* for DrawGraphicAnimation() [tools.c] and AnimateToon() [cartoons.c] */
1366 #define ANIM_NORMAL		0
1367 #define ANIM_OSCILLATE		1
1368 #define ANIM_REVERSE		2
1369 
1370 /* sound control */
1371 
1372 #define ST(x)           (((x)-8)*16)
1373 
1374 #endif	/* MAIN_H */
1375