1 /***********************************************************
2 * Artsoft Retro-Game Library *
3 *----------------------------------------------------------*
4 * (c) 1994-2002 Artsoft Entertainment *
6 * Detmolder Strasse 189 *
9 * e-mail: info@artsoft.org *
10 *----------------------------------------------------------*
12 ***********************************************************/
21 #if defined(PLATFORM_MACOSX)
23 #elif defined(PLATFORM_WIN32)
25 #elif defined(PLATFORM_MSDOS)
29 #if defined(TARGET_SDL)
31 #elif defined(TARGET_X11)
36 /* the additional 'b' is needed for Win32 to open files in binary mode */
37 #define MODE_READ "rb"
38 #define MODE_WRITE "wb"
39 #define MODE_APPEND "ab"
41 #define DEFAULT_DEPTH 0
45 #define BLIT_INVERSE 2
46 #define BLIT_ON_BACKGROUND 3
48 #define FULLSCREEN_NOT_AVAILABLE FALSE
49 #define FULLSCREEN_AVAILABLE TRUE
51 /* default input keys */
52 #define DEFAULT_KEY_LEFT KSYM_Left
53 #define DEFAULT_KEY_RIGHT KSYM_Right
54 #define DEFAULT_KEY_UP KSYM_Up
55 #define DEFAULT_KEY_DOWN KSYM_Down
56 #if defined(PLATFORM_MACOSX)
57 #define DEFAULT_KEY_SNAP KSYM_Control_L
58 #define DEFAULT_KEY_DROP KSYM_KP_Enter
60 #define DEFAULT_KEY_SNAP KSYM_Control_L
61 #define DEFAULT_KEY_DROP KSYM_Control_R
63 #define DEFAULT_KEY_OKAY KSYM_Return
64 #define DEFAULT_KEY_CANCEL KSYM_Escape
66 /* default shortcut keys */
67 #define DEFAULT_KEY_SAVE_GAME KSYM_F1
68 #define DEFAULT_KEY_LOAD_GAME KSYM_F2
69 #define DEFAULT_KEY_TOGGLE_PAUSE KSYM_space
70 #define DEFAULT_KEY_FOCUS_PLAYER_1 KSYM_F5
71 #define DEFAULT_KEY_FOCUS_PLAYER_2 KSYM_F6
72 #define DEFAULT_KEY_FOCUS_PLAYER_3 KSYM_F7
73 #define DEFAULT_KEY_FOCUS_PLAYER_4 KSYM_F8
74 #define DEFAULT_KEY_FOCUS_PLAYER_ALL KSYM_F9
76 /* values for key_status */
77 #define KEY_NOT_PRESSED FALSE
78 #define KEY_RELEASED FALSE
79 #define KEY_PRESSED TRUE
81 /* values for button status */
82 #define MB_NOT_PRESSED FALSE
83 #define MB_NOT_RELEASED TRUE
84 #define MB_RELEASED FALSE
85 #define MB_PRESSED TRUE
86 #define MB_MENU_CHOICE FALSE
87 #define MB_MENU_MARK TRUE
88 #define MB_MENU_INITIALIZE (-1)
89 #define MB_MENU_LEAVE (-2)
90 #define MB_LEFTBUTTON 1
91 #define MB_MIDDLEBUTTON 2
92 #define MB_RIGHTBUTTON 3
95 /* values for move directions */
97 #define MV_BIT_RIGHT 1
101 #define NUM_DIRECTIONS 4
103 /* diagonal movement directions are used in a different contect than buttons */
104 #define MV_BIT_UPLEFT 4
105 #define MV_BIT_UPRIGHT 5
106 #define MV_BIT_DOWNLEFT 6
107 #define MV_BIT_DOWNRIGHT 7
109 #define NUM_DIRECTIONS_FULL 8
111 /* values for special "button" bitmasks */
115 /* values for move directions and special "button" key bitmasks */
117 #define MV_LEFT (1 << MV_BIT_LEFT)
118 #define MV_RIGHT (1 << MV_BIT_RIGHT)
119 #define MV_UP (1 << MV_BIT_UP)
120 #define MV_DOWN (1 << MV_BIT_DOWN)
122 #define MV_UPLEFT (MV_UP | MV_LEFT)
123 #define MV_UPRIGHT (MV_UP | MV_RIGHT)
124 #define MV_DOWNLEFT (MV_DOWN | MV_LEFT)
125 #define MV_DOWNRIGHT (MV_DOWN | MV_RIGHT)
127 #define MV_HORIZONTAL (MV_LEFT | MV_RIGHT)
128 #define MV_VERTICAL (MV_UP | MV_DOWN)
129 #define MV_ALL_DIRECTIONS (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
130 #define MV_ANY_DIRECTION (MV_ALL_DIRECTIONS)
131 #define MV_NO_DIRECTION (MV_NONE)
133 #define KEY_BUTTON_1 (1 << BUTTON_1)
134 #define KEY_BUTTON_2 (1 << BUTTON_2)
135 #define KEY_MOTION (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
136 #define KEY_BUTTON (KEY_BUTTON_1 | KEY_BUTTON_2)
137 #define KEY_ACTION (KEY_MOTION | KEY_BUTTON)
139 #define MV_DIR_FROM_BIT(x) ((x) < NUM_DIRECTIONS ? 1 << (x) : \
140 (x) == MV_BIT_UPLEFT ? MV_UPLEFT : \
141 (x) == MV_BIT_UPRIGHT ? MV_UPRIGHT : \
142 (x) == MV_BIT_DOWNLEFT ? MV_DOWNLEFT : \
143 (x) == MV_BIT_DOWNRIGHT ? MV_DOWNRIGHT : \
146 #define MV_DIR_TO_BIT(x) ((x) == MV_LEFT ? MV_BIT_LEFT : \
147 (x) == MV_RIGHT ? MV_BIT_RIGHT : \
148 (x) == MV_UP ? MV_BIT_UP : \
149 (x) == MV_DOWN ? MV_BIT_DOWN : \
150 (x) == MV_UPLEFT ? MV_BIT_UPLEFT : \
151 (x) == MV_UPRIGHT ? MV_BIT_UPRIGHT : \
152 (x) == MV_DOWNLEFT ? MV_BIT_DOWNLEFT : \
153 (x) == MV_DOWNRIGHT ? MV_BIT_DOWNRIGHT : \
156 #define MV_DIR_OPPOSITE(x) ((x) == MV_LEFT ? MV_RIGHT : \
157 (x) == MV_RIGHT ? MV_LEFT : \
158 (x) == MV_UP ? MV_DOWN : \
159 (x) == MV_DOWN ? MV_UP : \
160 (x) == MV_UPLEFT ? MV_DOWNRIGHT : \
161 (x) == MV_UPRIGHT ? MV_DOWNLEFT : \
162 (x) == MV_DOWNLEFT ? MV_UPRIGHT : \
163 (x) == MV_DOWNRIGHT ? MV_UPLEFT : \
166 /* values for animation mode (frame order and direction) */
168 #define ANIM_LOOP (1 << 0)
169 #define ANIM_LINEAR (1 << 1)
170 #define ANIM_PINGPONG (1 << 2)
171 #define ANIM_PINGPONG2 (1 << 3)
172 #define ANIM_RANDOM (1 << 4)
173 #define ANIM_CE_VALUE (1 << 5)
174 #define ANIM_CE_SCORE (1 << 6)
175 #define ANIM_REVERSE (1 << 7)
176 #define ANIM_OPAQUE_PLAYER (1 << 8)
178 /* values for special (non game element) animation modes */
179 #define ANIM_HORIZONTAL (1 << 9)
180 #define ANIM_VERTICAL (1 << 10)
181 #define ANIM_STATIC_PANEL (1 << 11)
183 #define ANIM_DEFAULT ANIM_LOOP
185 /* values for redraw_mask */
186 #define REDRAW_NONE (0)
187 #define REDRAW_ALL (1 << 0)
188 #define REDRAW_FIELD (1 << 1)
189 #define REDRAW_TILES (1 << 2)
190 #define REDRAW_DOOR_1 (1 << 3)
191 #define REDRAW_VIDEO_1 (1 << 4)
192 #define REDRAW_VIDEO_2 (1 << 5)
193 #define REDRAW_VIDEO_3 (1 << 6)
194 #define REDRAW_MICROLEVEL (1 << 7)
195 #define REDRAW_MICROLABEL (1 << 8)
196 #define REDRAW_FROM_BACKBUFFER (1 << 9)
197 #define REDRAW_DOOR_2 (REDRAW_VIDEO_1 | \
200 #define REDRAW_DOOR_3 (1 << 10)
201 #define REDRAW_DOORS (REDRAW_DOOR_1 | \
204 #define REDRAW_MAIN (REDRAW_FIELD | \
207 #define REDRAW_FPS (1 << 11)
208 #define REDRAWTILES_THRESHOLD (SCR_FIELDX * SCR_FIELDY / 2)
210 #define IN_GFX_SCREEN(x, y) (x >= gfx.sx && x < gfx.sx + gfx.sxsize && \
211 y >= gfx.sy && y < gfx.sy + gfx.sysize)
212 #define IN_GFX_DOOR(x, y) (x >= gfx.dx && x < gfx.dx + gfx.dxsize && \
213 y >= gfx.dy && y < gfx.dy + gfx.dysize)
214 #define IN_GFX_VIDEO(x, y) (x >= gfx.vx && x < gfx.vx + gfx.vxsize && \
215 y >= gfx.vy && y < gfx.vy + gfx.vysize)
217 /* values for mouse cursor */
218 #define CURSOR_DEFAULT 0
219 #define CURSOR_PLAYFIELD 1
222 /* maximum playfield size supported by libgame functions */
223 #define MAX_PLAYFIELD_WIDTH 128
224 #define MAX_PLAYFIELD_HEIGHT 128
226 /* maximum number of parallel players supported by libgame functions */
227 #define MAX_PLAYERS 4
229 /* maximum allowed length of player name */
230 #define MAX_PLAYER_NAME_LEN 10
232 /* default name for empty highscore entry */
233 #define EMPTY_PLAYER_NAME "no name"
235 /* default name for unknown player names */
236 #define ANONYMOUS_NAME "anonymous"
238 /* default for other unknown names */
239 #define UNKNOWN_NAME "unknown"
241 /* default name for new levels */
242 #define NAMELESS_LEVEL_NAME "nameless level"
244 /* default text for non-existant artwork */
245 #define NOT_AVAILABLE "(not available)"
247 /* default value for undefined filename */
248 #define UNDEFINED_FILENAME "[NONE]"
250 /* default value for undefined parameter */
251 #define ARG_DEFAULT "[DEFAULT]"
253 /* default values for undefined configuration file parameters */
254 #define ARG_UNDEFINED "-1000000"
255 #define ARG_UNDEFINED_VALUE (atoi(ARG_UNDEFINED))
257 /* definitions for game sub-directories */
259 #define RO_GAME_DIR "."
263 #define RW_GAME_DIR "."
266 #define RO_BASE_PATH RO_GAME_DIR
267 #define RW_BASE_PATH RW_GAME_DIR
269 /* directory names */
270 #define GRAPHICS_DIRECTORY "graphics"
271 #define SOUNDS_DIRECTORY "sounds"
272 #define MUSIC_DIRECTORY "music"
273 #define LEVELS_DIRECTORY "levels"
274 #define TAPES_DIRECTORY "tapes"
275 #define SCORES_DIRECTORY "scores"
276 #define DOCS_DIRECTORY "docs"
278 #if !defined(PLATFORM_MSDOS)
279 #define GFX_CLASSIC_SUBDIR "gfx_classic"
280 #define SND_CLASSIC_SUBDIR "snd_classic"
281 #define MUS_CLASSIC_SUBDIR "mus_classic"
283 #define GFX_CLASSIC_SUBDIR "gfx_orig"
284 #define SND_CLASSIC_SUBDIR "snd_orig"
285 #define MUS_CLASSIC_SUBDIR "mus_orig"
288 /* file names and filename extensions */
289 #if !defined(PLATFORM_MSDOS)
290 #define LEVELSETUP_DIRECTORY "levelsetup"
291 #define SETUP_FILENAME "setup.conf"
292 #define LEVELSETUP_FILENAME "levelsetup.conf"
293 #define EDITORSETUP_FILENAME "editorsetup.conf"
294 #define EDITORCASCADE_FILENAME "editorcascade.conf"
295 #define HELPANIM_FILENAME "helpanim.conf"
296 #define HELPTEXT_FILENAME "helptext.conf"
297 #define LEVELINFO_FILENAME "levelinfo.conf"
298 #define GRAPHICSINFO_FILENAME "graphicsinfo.conf"
299 #define SOUNDSINFO_FILENAME "soundsinfo.conf"
300 #define MUSICINFO_FILENAME "musicinfo.conf"
301 #define LEVELFILE_EXTENSION "level"
302 #define TAPEFILE_EXTENSION "tape"
303 #define SCOREFILE_EXTENSION "score"
305 #define LEVELSETUP_DIRECTORY "lvlsetup"
306 #define SETUP_FILENAME "setup.cnf"
307 #define LEVELSETUP_FILENAME "lvlsetup.cnf"
308 #define EDITORSETUP_FILENAME "edsetup.cnf"
309 #define EDITORCASCADE_FILENAME "edcascad.conf"
310 #define HELPANIM_FILENAME "helpanim.cnf"
311 #define HELPTEXT_FILENAME "helptext.cnf"
312 #define LEVELINFO_FILENAME "lvlinfo.cnf"
313 #define GRAPHICSINFO_FILENAME "gfxinfo.cnf"
314 #define SOUNDSINFO_FILENAME "sndinfo.cnf"
315 #define MUSICINFO_FILENAME "musinfo.cnf"
316 #define LEVELFILE_EXTENSION "lvl"
317 #define TAPEFILE_EXTENSION "tap"
318 #define SCOREFILE_EXTENSION "sco"
322 /* areas in bitmap PIX_DOOR */
323 /* meaning in PIX_DB_DOOR: (3 PAGEs)
324 PAGEX1: 1. buffer for DOOR_1
325 PAGEX2: 2. buffer for DOOR_1
326 PAGEX3: buffer for animations
329 /* these values are hard-coded to be able to use them in initialization */
330 #define DOOR_GFX_PAGE_WIDTH 100 /* should be set to "gfx.dxsize" */
331 #define DOOR_GFX_PAGE_HEIGHT 280 /* should be set to "gfx.dysize" */
333 #define DOOR_GFX_PAGESIZE (DOOR_GFX_PAGE_WIDTH)
334 #define DOOR_GFX_PAGEX1 (0 * DOOR_GFX_PAGESIZE)
335 #define DOOR_GFX_PAGEX2 (1 * DOOR_GFX_PAGESIZE)
336 #define DOOR_GFX_PAGEX3 (2 * DOOR_GFX_PAGESIZE)
337 #define DOOR_GFX_PAGEX4 (3 * DOOR_GFX_PAGESIZE)
338 #define DOOR_GFX_PAGEX5 (4 * DOOR_GFX_PAGESIZE)
339 #define DOOR_GFX_PAGEX6 (5 * DOOR_GFX_PAGESIZE)
340 #define DOOR_GFX_PAGEX7 (6 * DOOR_GFX_PAGESIZE)
341 #define DOOR_GFX_PAGEX8 (7 * DOOR_GFX_PAGESIZE)
342 #define DOOR_GFX_PAGEY1 (0)
343 #define DOOR_GFX_PAGEY2 (DOOR_GFX_PAGE_HEIGHT)
346 /* macros for version handling */
347 #define VERSION_MAJOR(x) ((x) / 1000000)
348 #define VERSION_MINOR(x) (((x) % 1000000) / 10000)
349 #define VERSION_PATCH(x) (((x) % 10000) / 100)
350 #define VERSION_BUILD(x) ((x) % 100)
351 #define VERSION_IDENT(a,b,c,d) ((a) * 1000000 + (b) * 10000 + (c) * 100 + (d))
354 /* macros for parent/child process identification */
355 #if defined(PLATFORM_UNIX)
356 #define IS_PARENT_PROCESS() (audio.mixer_pid != getpid())
357 #define IS_CHILD_PROCESS() (audio.mixer_pid == getpid())
358 #define HAS_CHILD_PROCESS() (audio.mixer_pid > 0)
360 #define IS_PARENT_PROCESS() TRUE
361 #define IS_CHILD_PROCESS() FALSE
362 #define HAS_CHILD_PROCESS() FALSE
366 /* values for artwork type */
367 #define ARTWORK_TYPE_GRAPHICS 0
368 #define ARTWORK_TYPE_SOUNDS 1
369 #define ARTWORK_TYPE_MUSIC 2
371 #define NUM_ARTWORK_TYPES 3
374 /* values for tree type (chosen to match artwork type) */
375 #define TREE_TYPE_UNDEFINED -1
376 #define TREE_TYPE_GRAPHICS_DIR ARTWORK_TYPE_GRAPHICS
377 #define TREE_TYPE_SOUNDS_DIR ARTWORK_TYPE_SOUNDS
378 #define TREE_TYPE_MUSIC_DIR ARTWORK_TYPE_MUSIC
379 #define TREE_TYPE_LEVEL_DIR 3
381 #define NUM_TREE_TYPES 4
384 /* values for artwork handling */
385 #define LEVELDIR_ARTWORK_SET_PTR(leveldir, type) \
386 ((type) == ARTWORK_TYPE_GRAPHICS ? \
387 &(leveldir)->graphics_set : \
388 (type) == ARTWORK_TYPE_SOUNDS ? \
389 &(leveldir)->sounds_set : \
390 &(leveldir)->music_set)
392 #define LEVELDIR_ARTWORK_SET(leveldir, type) \
393 ((type) == ARTWORK_TYPE_GRAPHICS ? \
394 (leveldir)->graphics_set : \
395 (type) == ARTWORK_TYPE_SOUNDS ? \
396 (leveldir)->sounds_set : \
397 (leveldir)->music_set)
399 #define LEVELDIR_ARTWORK_PATH_PTR(leveldir, type) \
400 ((type) == ARTWORK_TYPE_GRAPHICS ? \
401 &(leveldir)->graphics_path : \
402 (type) == ARTWORK_TYPE_SOUNDS ? \
403 &(leveldir)->sounds_path : \
404 &(leveldir)->music_path)
406 #define LEVELDIR_ARTWORK_PATH(leveldir, type) \
407 ((type) == ARTWORK_TYPE_GRAPHICS ? \
408 (leveldir)->graphics_path : \
409 (type) == ARTWORK_TYPE_SOUNDS ? \
410 (leveldir)->sounds_path : \
411 (leveldir)->music_path)
413 #define SETUP_ARTWORK_SET(setup, type) \
414 ((type) == ARTWORK_TYPE_GRAPHICS ? \
415 (setup).graphics_set : \
416 (type) == ARTWORK_TYPE_SOUNDS ? \
417 (setup).sounds_set : \
420 #define SETUP_OVERRIDE_ARTWORK(setup, type) \
421 ((type) == ARTWORK_TYPE_GRAPHICS ? \
422 (setup).override_level_graphics : \
423 (type) == ARTWORK_TYPE_SOUNDS ? \
424 (setup).override_level_sounds : \
425 (setup).override_level_music)
427 #define ARTWORK_FIRST_NODE(artwork, type) \
428 ((type) == ARTWORK_TYPE_GRAPHICS ? \
429 (artwork).gfx_first : \
430 (type) == ARTWORK_TYPE_SOUNDS ? \
431 (artwork).snd_first : \
434 #define ARTWORK_CURRENT_IDENTIFIER_PTR(artwork, type) \
435 ((type) == ARTWORK_TYPE_GRAPHICS ? \
436 &(artwork).gfx_current_identifier : \
437 (type) == ARTWORK_TYPE_SOUNDS ? \
438 &(artwork).snd_current_identifier : \
439 &(artwork).mus_current_identifier)
441 #define ARTWORK_CURRENT_IDENTIFIER(artwork, type) \
442 ((type) == ARTWORK_TYPE_GRAPHICS ? \
443 (artwork).gfx_current_identifier : \
444 (type) == ARTWORK_TYPE_SOUNDS ? \
445 (artwork).snd_current_identifier : \
446 (artwork).mus_current_identifier)
448 #define ARTWORKINFO_FILENAME(type) \
449 ((type) == ARTWORK_TYPE_GRAPHICS ? \
450 GRAPHICSINFO_FILENAME : \
451 (type) == ARTWORK_TYPE_SOUNDS ? \
452 SOUNDSINFO_FILENAME : \
453 (type) == ARTWORK_TYPE_MUSIC ? \
454 MUSICINFO_FILENAME : "")
456 #define ARTWORK_DIRECTORY(type) \
457 ((type) == ARTWORK_TYPE_GRAPHICS ? \
458 GRAPHICS_DIRECTORY : \
459 (type) == ARTWORK_TYPE_SOUNDS ? \
461 (type) == ARTWORK_TYPE_MUSIC ? \
462 MUSIC_DIRECTORY : "")
464 #define OPTIONS_ARTWORK_DIRECTORY(type) \
465 ((type) == ARTWORK_TYPE_GRAPHICS ? \
466 options.graphics_directory : \
467 (type) == ARTWORK_TYPE_SOUNDS ? \
468 options.sounds_directory : \
469 (type) == ARTWORK_TYPE_MUSIC ? \
470 options.music_directory : "")
473 /* type definitions */
474 typedef int (*EventFilter)(const Event *);
477 /* structure definitions */
481 char *command_basepath; /* directory that contains the program */
482 char *command_basename; /* base filename of the program binary */
483 char *userdata_directory; /* personal user data directory */
489 char *x11_icon_filename;
490 char *x11_iconmask_filename;
491 char *msdos_cursor_filename;
494 char *filename_prefix; /* prefix to cut off from DOS filenames */
500 void (*exit_function)(int);
509 char *ro_base_directory;
510 char *rw_base_directory;
511 char *level_directory;
512 char *graphics_directory;
513 char *sounds_directory;
514 char *music_directory;
515 char *docs_directory;
516 char *execute_command;
524 struct VideoSystemInfo
527 int width, height, depth;
528 boolean fullscreen_available;
529 boolean fullscreen_enabled;
532 struct AudioSystemInfo
534 boolean sound_available;
535 boolean loops_available;
536 boolean music_available;
538 boolean sound_enabled;
539 boolean sound_deactivated; /* for temporarily disabling sound */
548 int first_sound_channel;
551 struct FontBitmapInfo
554 int src_x, src_y; /* start position of animation frames */
555 int width, height; /* width/height of each animation frame */
556 int draw_x, draw_y; /* offset for drawing font characters */
558 int num_chars_per_line;
560 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
561 Pixmap *clip_mask; /* single-char-only clip mask array for X11 */
569 int real_sx, real_sy;
570 int full_sxsize, full_sysize;
571 int scrollbuffer_width, scrollbuffer_height;
579 int draw_deactivation_mask;
580 int draw_background_mask;
582 Bitmap *field_save_buffer;
584 Bitmap *background_bitmap;
585 int background_bitmap_mask;
588 struct FontBitmapInfo *font_bitmap_info;
589 int (*select_font_function)(int);
591 int anim_random_frame;
597 int fd[MAX_PLAYERS]; /* file descriptor of player's joystick */
600 struct SetupJoystickInfo
602 char *device_name; /* device name of player's joystick */
604 int xleft, xmiddle, xright;
605 int yupper, ymiddle, ylower;
609 struct SetupKeyboardInfo
611 Key left, right, up, down;
615 struct SetupInputInfo
617 boolean use_joystick;
618 struct SetupJoystickInfo joy;
619 struct SetupKeyboardInfo key;
622 struct SetupEditorInfo
624 boolean el_boulderdash;
625 boolean el_emerald_mine;
626 boolean el_emerald_mine_club;
630 boolean el_diamond_caves;
631 boolean el_dx_boulderdash;
634 boolean el_user_defined;
637 boolean el_headlines;
640 struct SetupEditorCascadeInfo
657 struct SetupShortcutInfo
663 Key focus_player[MAX_PLAYERS];
664 Key focus_player_all;
667 struct SetupSystemInfo
669 char *sdl_audiodriver;
670 int audio_fragment_size;
680 boolean sound_simple;
682 boolean double_buffering;
683 boolean direct_draw; /* !double_buffering (redundant!) */
684 boolean scroll_delay;
685 boolean soft_scrolling;
694 boolean ask_on_escape;
695 boolean ask_on_escape_editor;
696 boolean quick_switch;
701 boolean override_level_graphics;
702 boolean override_level_sounds;
703 boolean override_level_music;
705 struct SetupEditorInfo editor;
706 struct SetupEditorCascadeInfo editor_cascade;
707 struct SetupShortcutInfo shortcut;
708 struct SetupInputInfo input[MAX_PLAYERS];
709 struct SetupSystemInfo system;
710 struct OptionInfo options;
715 struct TreeInfo **node_top; /* topmost node in tree */
716 struct TreeInfo *node_parent; /* parent level directory info */
717 struct TreeInfo *node_group; /* level group sub-directory info */
718 struct TreeInfo *next; /* next level series structure node */
720 int cl_first; /* internal control field for setup screen */
721 int cl_cursor; /* internal control field for setup screen */
723 int type; /* type of tree content */
725 /* fields for "type == TREE_TYPE_LEVEL_DIR" */
727 char *subdir; /* tree info sub-directory basename (may be ".") */
728 char *fullpath; /* complete path relative to tree base directory */
729 char *basepath; /* absolute base path of tree base directory */
730 char *identifier; /* identifier string for configuration files */
731 char *name; /* tree info name, as displayed in selection menues */
732 char *name_sorting; /* optional sorting name for correct name sorting */
733 char *author; /* level or artwork author name */
734 char *imported_from; /* optional comment for imported levels or artwork */
735 char *imported_by; /* optional comment for imported levels or artwork */
737 char *graphics_set; /* optional custom graphics set (level tree only) */
738 char *sounds_set; /* optional custom sounds set (level tree only) */
739 char *music_set; /* optional custom music set (level tree only) */
740 char *graphics_path; /* path to optional custom graphics set (level only) */
741 char *sounds_path; /* path to optional custom sounds set (level only) */
742 char *music_path; /* path to optional custom music set (level only) */
744 char *level_filename; /* filename of level file (for packed level file) */
745 char *level_filetype; /* type of levels in level directory or level file */
747 int levels; /* number of levels in level series */
748 int first_level; /* first level number (to allow start with 0 or 1) */
749 int last_level; /* last level number (automatically calculated) */
750 int sort_priority; /* sort levels by 'sort_priority' and then by name */
752 boolean latest_engine;/* force level set to use the latest game engine */
754 boolean level_group; /* directory contains more level series directories */
755 boolean parent_link; /* entry links back to parent directory */
756 boolean in_user_dir; /* user defined levels are stored in home directory */
757 boolean user_defined; /* levels in user directory and marked as "private" */
758 boolean readonly; /* readonly levels can not be changed with editor */
759 boolean handicap; /* level set has no handicap when set to "false" */
760 boolean skip_levels; /* levels can be skipped when set to "true" */
762 int color; /* color to use on selection screen for this level */
763 char *class_desc; /* description of level series class */
764 int handicap_level; /* number of the lowest unsolved level */
767 typedef struct TreeInfo TreeInfo;
768 typedef struct TreeInfo LevelDirTree;
769 typedef struct TreeInfo ArtworkDirTree;
770 typedef struct TreeInfo GraphicsDirTree;
771 typedef struct TreeInfo SoundsDirTree;
772 typedef struct TreeInfo MusicDirTree;
776 GraphicsDirTree *gfx_first;
777 GraphicsDirTree *gfx_current;
778 SoundsDirTree *snd_first;
779 SoundsDirTree *snd_current;
780 MusicDirTree *mus_first;
781 MusicDirTree *mus_current;
783 char *gfx_current_identifier;
784 char *snd_current_identifier;
785 char *mus_current_identifier;
800 struct ConfigTypeInfo
807 struct TokenIntPtrInfo
817 char *default_filename;
820 char **default_parameter; /* array of file parameters */
821 char **parameter; /* array of file parameters */
824 boolean fallback_to_default;
832 struct SetupFileList *next;
837 char *source_filename; /* primary key for node list */
841 struct PropertyMapping
851 struct ArtworkListInfo
853 int type; /* type of artwork */
855 int num_file_list_entries;
856 int num_dynamic_file_list_entries;
857 struct FileInfo *file_list; /* static artwork file array */
858 struct FileInfo *dynamic_file_list; /* dynamic artwrk file array */
860 int num_suffix_list_entries;
861 struct ConfigTypeInfo *suffix_list; /* parameter suffixes array */
863 int num_base_prefixes;
864 int num_ext1_suffixes;
865 int num_ext2_suffixes;
866 int num_ext3_suffixes;
867 char **base_prefixes; /* base token prefixes array */
868 char **ext1_suffixes; /* property suffixes array 1 */
869 char **ext2_suffixes; /* property suffixes array 2 */
870 char **ext3_suffixes; /* property suffixes array 3 */
872 int num_ignore_tokens;
873 char **ignore_tokens; /* file tokens to be ignored */
875 int num_property_mapping_entries;
876 struct PropertyMapping *property_mapping; /* mapping token -> artwork */
878 int sizeof_artwork_list_entry;
880 struct ListNodeInfo **artwork_list; /* static artwork node array */
881 struct ListNodeInfo **dynamic_artwork_list; /* dynamic artwrk node array */
882 struct ListNode *content_list; /* dynamic artwork node list */
884 void *(*load_artwork)(char *); /* constructor function */
885 void (*free_artwork)(void *); /* destructor function */
889 /* ========================================================================= */
890 /* exported variables */
891 /* ========================================================================= */
893 extern struct ProgramInfo program;
894 extern struct OptionInfo options;
895 extern struct VideoSystemInfo video;
896 extern struct AudioSystemInfo audio;
897 extern struct GfxInfo gfx;
898 extern struct AnimInfo anim;
899 extern struct ArtworkInfo artwork;
900 extern struct JoystickInfo joystick;
901 extern struct SetupInfo setup;
903 extern LevelDirTree *leveldir_first_all;
904 extern LevelDirTree *leveldir_first;
905 extern LevelDirTree *leveldir_current;
908 extern Display *display;
909 extern Visual *visual;
911 extern Colormap cmap;
913 extern DrawWindow *window;
914 extern DrawBuffer *backbuffer;
915 extern DrawBuffer *drawto;
917 extern int button_status;
918 extern boolean motion_status;
920 extern int redraw_mask;
921 extern int redraw_tiles;
923 extern int FrameCounter;
926 /* function definitions */
928 void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
929 char *, char *, char *, int);
931 void InitExitFunction(void (*exit_function)(int));
932 void InitPlatformDependentStuff(void);
933 void ClosePlatformDependentStuff(void);
935 void InitGfxFieldInfo(int, int, int, int, int, int, int, int, Bitmap *);
936 void InitGfxDoor1Info(int, int, int, int);
937 void InitGfxDoor2Info(int, int, int, int);
938 void InitGfxScrollbufferInfo(int, int);
939 void SetDrawDeactivationMask(int);
940 void SetDrawBackgroundMask(int);
941 void SetMainBackgroundBitmap(Bitmap *);
942 void SetDoorBackgroundBitmap(Bitmap *);
944 inline void InitVideoDisplay(void);
945 inline void CloseVideoDisplay(void);
946 inline void InitVideoBuffer(DrawBuffer **,DrawWindow **, int,int,int, boolean);
947 inline Bitmap *CreateBitmapStruct(void);
948 inline Bitmap *CreateBitmap(int, int, int);
949 inline void FreeBitmap(Bitmap *);
950 inline void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
951 inline void FillRectangle(Bitmap *, int, int, int, int, Pixel);
952 inline void ClearRectangle(Bitmap *, int, int, int, int);
953 inline void ClearRectangleOnBackground(Bitmap *, int, int, int, int);
954 inline void SetClipMask(Bitmap *, GC, Pixmap);
955 inline void SetClipOrigin(Bitmap *, GC, int, int);
956 inline void BlitBitmapMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
957 inline boolean DrawingOnBackground(int, int);
958 inline void BlitBitmapOnBackground(Bitmap *, Bitmap *, int, int, int, int, int,
960 inline void DrawSimpleBlackLine(Bitmap *, int, int, int, int);
961 inline void DrawSimpleWhiteLine(Bitmap *, int, int, int, int);
962 inline void DrawLines(Bitmap *, struct XY *, int, Pixel);
963 inline Pixel GetPixel(Bitmap *, int, int);
964 inline Pixel GetPixelFromRGB(Bitmap *, unsigned int,unsigned int,unsigned int);
965 inline Pixel GetPixelFromRGBcompact(Bitmap *, unsigned int);
967 inline void FlushDisplay(void);
968 inline void SyncDisplay(void);
969 inline void KeyboardAutoRepeatOn(void);
970 inline void KeyboardAutoRepeatOff(void);
971 inline boolean PointerInWindow(DrawWindow *);
972 inline boolean SetVideoMode(boolean);
973 inline boolean ChangeVideoModeIfNeeded(boolean);
975 Bitmap *LoadImage(char *);
976 Bitmap *LoadCustomImage(char *);
977 void ReloadCustomImage(Bitmap *, char *);
979 Bitmap *ZoomBitmap(Bitmap *, int, int);
980 void CreateBitmapWithSmallBitmaps(Bitmap *, int);
982 void SetMouseCursor(int);
984 inline void OpenAudio(void);
985 inline void CloseAudio(void);
986 inline void SetAudioMode(boolean);
988 inline void InitEventFilter(EventFilter);
989 inline boolean PendingEvent(void);
990 inline void NextEvent(Event *event);
991 inline void PeekEvent(Event *event);
992 inline Key GetEventKey(KeyEvent *, boolean);
993 inline KeyMod HandleKeyModState(Key, int);
994 inline KeyMod GetKeyModState();
995 inline boolean CheckCloseWindowEvent(ClientMessageEvent *);
997 inline void InitJoysticks();
998 inline boolean ReadJoystick(int, int *, int *, boolean *, boolean *);
1000 #endif /* SYSTEM_H */