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
71 /* values for key_status */
72 #define KEY_NOT_PRESSED FALSE
73 #define KEY_RELEASED FALSE
74 #define KEY_PRESSED TRUE
76 /* values for button status */
77 #define MB_NOT_PRESSED FALSE
78 #define MB_NOT_RELEASED TRUE
79 #define MB_RELEASED FALSE
80 #define MB_PRESSED TRUE
81 #define MB_MENU_CHOICE FALSE
82 #define MB_MENU_MARK TRUE
83 #define MB_MENU_INITIALIZE (-1)
84 #define MB_MENU_LEAVE (-2)
85 #define MB_LEFTBUTTON 1
86 #define MB_MIDDLEBUTTON 2
87 #define MB_RIGHTBUTTON 3
90 /* values for move directions */
92 #define MV_BIT_RIGHT 1
96 #define NUM_DIRECTIONS 4
98 /* diagonal movement directions are used in a different contect than buttons */
99 #define MV_BIT_UPLEFT 4
100 #define MV_BIT_UPRIGHT 5
101 #define MV_BIT_DOWNLEFT 6
102 #define MV_BIT_DOWNRIGHT 7
104 #define NUM_DIRECTIONS_FULL 8
106 /* values for special "button" bitmasks */
110 /* values for move directions and special "button" key bitmasks */
112 #define MV_LEFT (1 << MV_BIT_LEFT)
113 #define MV_RIGHT (1 << MV_BIT_RIGHT)
114 #define MV_UP (1 << MV_BIT_UP)
115 #define MV_DOWN (1 << MV_BIT_DOWN)
117 #define MV_UPLEFT (MV_UP | MV_LEFT)
118 #define MV_UPRIGHT (MV_UP | MV_RIGHT)
119 #define MV_DOWNLEFT (MV_DOWN | MV_LEFT)
120 #define MV_DOWNRIGHT (MV_DOWN | MV_RIGHT)
122 #define MV_HORIZONTAL (MV_LEFT | MV_RIGHT)
123 #define MV_VERTICAL (MV_UP | MV_DOWN)
124 #define MV_ALL_DIRECTIONS (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
125 #define MV_ANY_DIRECTION (MV_ALL_DIRECTIONS)
126 #define MV_NO_DIRECTION (MV_NONE)
128 #define KEY_BUTTON_1 (1 << BUTTON_1)
129 #define KEY_BUTTON_2 (1 << BUTTON_2)
130 #define KEY_MOTION (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
131 #define KEY_BUTTON (KEY_BUTTON_1 | KEY_BUTTON_2)
132 #define KEY_ACTION (KEY_MOTION | KEY_BUTTON)
134 #define MV_DIR_FROM_BIT(x) ((x) < NUM_DIRECTIONS ? 1 << (x) : \
135 (x) == MV_BIT_UPLEFT ? MV_UPLEFT : \
136 (x) == MV_BIT_UPRIGHT ? MV_UPRIGHT : \
137 (x) == MV_BIT_DOWNLEFT ? MV_DOWNLEFT : \
138 (x) == MV_BIT_DOWNRIGHT ? MV_DOWNRIGHT : \
141 #define MV_DIR_TO_BIT(x) ((x) == MV_LEFT ? MV_BIT_LEFT : \
142 (x) == MV_RIGHT ? MV_BIT_RIGHT : \
143 (x) == MV_UP ? MV_BIT_UP : \
144 (x) == MV_DOWN ? MV_BIT_DOWN : \
145 (x) == MV_UPLEFT ? MV_BIT_UPLEFT : \
146 (x) == MV_UPRIGHT ? MV_BIT_UPRIGHT : \
147 (x) == MV_DOWNLEFT ? MV_BIT_DOWNLEFT : \
148 (x) == MV_DOWNRIGHT ? MV_BIT_DOWNRIGHT : \
151 #define MV_DIR_OPPOSITE(x) ((x) == MV_LEFT ? MV_RIGHT : \
152 (x) == MV_RIGHT ? MV_LEFT : \
153 (x) == MV_UP ? MV_DOWN : \
154 (x) == MV_DOWN ? MV_UP : \
155 (x) == MV_UPLEFT ? MV_DOWNRIGHT : \
156 (x) == MV_UPRIGHT ? MV_DOWNLEFT : \
157 (x) == MV_DOWNLEFT ? MV_UPRIGHT : \
158 (x) == MV_DOWNRIGHT ? MV_UPLEFT : \
161 /* values for animation mode (frame order and direction) */
163 #define ANIM_LOOP (1 << 0)
164 #define ANIM_LINEAR (1 << 1)
165 #define ANIM_PINGPONG (1 << 2)
166 #define ANIM_PINGPONG2 (1 << 3)
167 #define ANIM_RANDOM (1 << 4)
168 #define ANIM_CE_VALUE (1 << 5)
169 #define ANIM_CE_SCORE (1 << 6)
170 #define ANIM_REVERSE (1 << 7)
172 /* values for special (non game element) animation modes */
173 #define ANIM_HORIZONTAL (1 << 8)
174 #define ANIM_VERTICAL (1 << 9)
175 #define ANIM_STATIC_PANEL (1 << 10)
177 #define ANIM_DEFAULT ANIM_LOOP
179 /* values for redraw_mask */
180 #define REDRAW_NONE (0)
181 #define REDRAW_ALL (1 << 0)
182 #define REDRAW_FIELD (1 << 1)
183 #define REDRAW_TILES (1 << 2)
184 #define REDRAW_DOOR_1 (1 << 3)
185 #define REDRAW_VIDEO_1 (1 << 4)
186 #define REDRAW_VIDEO_2 (1 << 5)
187 #define REDRAW_VIDEO_3 (1 << 6)
188 #define REDRAW_MICROLEVEL (1 << 7)
189 #define REDRAW_MICROLABEL (1 << 8)
190 #define REDRAW_FROM_BACKBUFFER (1 << 9)
191 #define REDRAW_DOOR_2 (REDRAW_VIDEO_1 | \
194 #define REDRAW_DOOR_3 (1 << 10)
195 #define REDRAW_DOORS (REDRAW_DOOR_1 | \
198 #define REDRAW_MAIN (REDRAW_FIELD | \
201 #define REDRAW_FPS (1 << 11)
202 #define REDRAWTILES_THRESHOLD (SCR_FIELDX * SCR_FIELDY / 2)
204 #define IN_GFX_SCREEN(x, y) (x >= gfx.sx && x < gfx.sx + gfx.sxsize && \
205 y >= gfx.sy && y < gfx.sy + gfx.sysize)
206 #define IN_GFX_DOOR(x, y) (x >= gfx.dx && x < gfx.dx + gfx.dxsize && \
207 y >= gfx.dy && y < gfx.dy + gfx.dysize)
208 #define IN_GFX_VIDEO(x, y) (x >= gfx.vx && x < gfx.vx + gfx.vxsize && \
209 y >= gfx.vy && y < gfx.vy + gfx.vysize)
211 /* values for mouse cursor */
212 #define CURSOR_DEFAULT 0
213 #define CURSOR_PLAYFIELD 1
216 /* maximum playfield size supported by libgame functions */
217 #define MAX_PLAYFIELD_WIDTH 128
218 #define MAX_PLAYFIELD_HEIGHT 128
220 /* maximum number of parallel players supported by libgame functions */
221 #define MAX_PLAYERS 4
223 /* maximum allowed length of player name */
224 #define MAX_PLAYER_NAME_LEN 10
226 /* default name for empty highscore entry */
227 #define EMPTY_PLAYER_NAME "no name"
229 /* default name for unknown player names */
230 #define ANONYMOUS_NAME "anonymous"
232 /* default for other unknown names */
233 #define UNKNOWN_NAME "unknown"
235 /* default name for new levels */
236 #define NAMELESS_LEVEL_NAME "nameless level"
238 /* default text for non-existant artwork */
239 #define NOT_AVAILABLE "(not available)"
241 /* default value for undefined filename */
242 #define UNDEFINED_FILENAME "[NONE]"
244 /* default value for undefined parameter */
245 #define ARG_DEFAULT "[DEFAULT]"
247 /* default values for undefined configuration file parameters */
248 #define ARG_UNDEFINED "-1000000"
249 #define ARG_UNDEFINED_VALUE (atoi(ARG_UNDEFINED))
251 /* definitions for game sub-directories */
253 #define RO_GAME_DIR "."
257 #define RW_GAME_DIR "."
260 #define RO_BASE_PATH RO_GAME_DIR
261 #define RW_BASE_PATH RW_GAME_DIR
263 /* directory names */
264 #define GRAPHICS_DIRECTORY "graphics"
265 #define SOUNDS_DIRECTORY "sounds"
266 #define MUSIC_DIRECTORY "music"
267 #define LEVELS_DIRECTORY "levels"
268 #define TAPES_DIRECTORY "tapes"
269 #define SCORES_DIRECTORY "scores"
270 #define DOCS_DIRECTORY "docs"
272 #if !defined(PLATFORM_MSDOS)
273 #define GFX_CLASSIC_SUBDIR "gfx_classic"
274 #define SND_CLASSIC_SUBDIR "snd_classic"
275 #define MUS_CLASSIC_SUBDIR "mus_classic"
277 #define GFX_CLASSIC_SUBDIR "gfx_orig"
278 #define SND_CLASSIC_SUBDIR "snd_orig"
279 #define MUS_CLASSIC_SUBDIR "mus_orig"
282 /* file names and filename extensions */
283 #if !defined(PLATFORM_MSDOS)
284 #define LEVELSETUP_DIRECTORY "levelsetup"
285 #define SETUP_FILENAME "setup.conf"
286 #define LEVELSETUP_FILENAME "levelsetup.conf"
287 #define EDITORSETUP_FILENAME "editorsetup.conf"
288 #define EDITORCASCADE_FILENAME "editorcascade.conf"
289 #define HELPANIM_FILENAME "helpanim.conf"
290 #define HELPTEXT_FILENAME "helptext.conf"
291 #define LEVELINFO_FILENAME "levelinfo.conf"
292 #define GRAPHICSINFO_FILENAME "graphicsinfo.conf"
293 #define SOUNDSINFO_FILENAME "soundsinfo.conf"
294 #define MUSICINFO_FILENAME "musicinfo.conf"
295 #define LEVELFILE_EXTENSION "level"
296 #define TAPEFILE_EXTENSION "tape"
297 #define SCOREFILE_EXTENSION "score"
299 #define LEVELSETUP_DIRECTORY "lvlsetup"
300 #define SETUP_FILENAME "setup.cnf"
301 #define LEVELSETUP_FILENAME "lvlsetup.cnf"
302 #define EDITORSETUP_FILENAME "edsetup.cnf"
303 #define EDITORCASCADE_FILENAME "edcascad.conf"
304 #define HELPANIM_FILENAME "helpanim.cnf"
305 #define HELPTEXT_FILENAME "helptext.cnf"
306 #define LEVELINFO_FILENAME "lvlinfo.cnf"
307 #define GRAPHICSINFO_FILENAME "gfxinfo.cnf"
308 #define SOUNDSINFO_FILENAME "sndinfo.cnf"
309 #define MUSICINFO_FILENAME "musinfo.cnf"
310 #define LEVELFILE_EXTENSION "lvl"
311 #define TAPEFILE_EXTENSION "tap"
312 #define SCOREFILE_EXTENSION "sco"
316 /* areas in bitmap PIX_DOOR */
317 /* meaning in PIX_DB_DOOR: (3 PAGEs)
318 PAGEX1: 1. buffer for DOOR_1
319 PAGEX2: 2. buffer for DOOR_1
320 PAGEX3: buffer for animations
323 /* these values are hard-coded to be able to use them in initialization */
324 #define DOOR_GFX_PAGE_WIDTH 100 /* should be set to "gfx.dxsize" */
325 #define DOOR_GFX_PAGE_HEIGHT 280 /* should be set to "gfx.dysize" */
327 #define DOOR_GFX_PAGESIZE (DOOR_GFX_PAGE_WIDTH)
328 #define DOOR_GFX_PAGEX1 (0 * DOOR_GFX_PAGESIZE)
329 #define DOOR_GFX_PAGEX2 (1 * DOOR_GFX_PAGESIZE)
330 #define DOOR_GFX_PAGEX3 (2 * DOOR_GFX_PAGESIZE)
331 #define DOOR_GFX_PAGEX4 (3 * DOOR_GFX_PAGESIZE)
332 #define DOOR_GFX_PAGEX5 (4 * DOOR_GFX_PAGESIZE)
333 #define DOOR_GFX_PAGEX6 (5 * DOOR_GFX_PAGESIZE)
334 #define DOOR_GFX_PAGEX7 (6 * DOOR_GFX_PAGESIZE)
335 #define DOOR_GFX_PAGEX8 (7 * DOOR_GFX_PAGESIZE)
336 #define DOOR_GFX_PAGEY1 (0)
337 #define DOOR_GFX_PAGEY2 (DOOR_GFX_PAGE_HEIGHT)
340 /* macros for version handling */
341 #define VERSION_MAJOR(x) ((x) / 1000000)
342 #define VERSION_MINOR(x) (((x) % 1000000) / 10000)
343 #define VERSION_PATCH(x) (((x) % 10000) / 100)
344 #define VERSION_BUILD(x) ((x) % 100)
345 #define VERSION_IDENT(a,b,c,d) ((a) * 1000000 + (b) * 10000 + (c) * 100 + (d))
348 /* macros for parent/child process identification */
349 #if defined(PLATFORM_UNIX)
350 #define IS_PARENT_PROCESS() (audio.mixer_pid != getpid())
351 #define IS_CHILD_PROCESS() (audio.mixer_pid == getpid())
352 #define HAS_CHILD_PROCESS() (audio.mixer_pid > 0)
354 #define IS_PARENT_PROCESS() TRUE
355 #define IS_CHILD_PROCESS() FALSE
356 #define HAS_CHILD_PROCESS() FALSE
360 /* values for artwork type */
361 #define ARTWORK_TYPE_GRAPHICS 0
362 #define ARTWORK_TYPE_SOUNDS 1
363 #define ARTWORK_TYPE_MUSIC 2
365 #define NUM_ARTWORK_TYPES 3
368 /* values for tree type (chosen to match artwork type) */
369 #define TREE_TYPE_UNDEFINED -1
370 #define TREE_TYPE_GRAPHICS_DIR ARTWORK_TYPE_GRAPHICS
371 #define TREE_TYPE_SOUNDS_DIR ARTWORK_TYPE_SOUNDS
372 #define TREE_TYPE_MUSIC_DIR ARTWORK_TYPE_MUSIC
373 #define TREE_TYPE_LEVEL_DIR 3
375 #define NUM_TREE_TYPES 4
378 /* values for artwork handling */
379 #define LEVELDIR_ARTWORK_SET_PTR(leveldir, type) \
380 ((type) == ARTWORK_TYPE_GRAPHICS ? \
381 &(leveldir)->graphics_set : \
382 (type) == ARTWORK_TYPE_SOUNDS ? \
383 &(leveldir)->sounds_set : \
384 &(leveldir)->music_set)
386 #define LEVELDIR_ARTWORK_SET(leveldir, type) \
387 ((type) == ARTWORK_TYPE_GRAPHICS ? \
388 (leveldir)->graphics_set : \
389 (type) == ARTWORK_TYPE_SOUNDS ? \
390 (leveldir)->sounds_set : \
391 (leveldir)->music_set)
393 #define LEVELDIR_ARTWORK_PATH_PTR(leveldir, type) \
394 ((type) == ARTWORK_TYPE_GRAPHICS ? \
395 &(leveldir)->graphics_path : \
396 (type) == ARTWORK_TYPE_SOUNDS ? \
397 &(leveldir)->sounds_path : \
398 &(leveldir)->music_path)
400 #define LEVELDIR_ARTWORK_PATH(leveldir, type) \
401 ((type) == ARTWORK_TYPE_GRAPHICS ? \
402 (leveldir)->graphics_path : \
403 (type) == ARTWORK_TYPE_SOUNDS ? \
404 (leveldir)->sounds_path : \
405 (leveldir)->music_path)
407 #define SETUP_ARTWORK_SET(setup, type) \
408 ((type) == ARTWORK_TYPE_GRAPHICS ? \
409 (setup).graphics_set : \
410 (type) == ARTWORK_TYPE_SOUNDS ? \
411 (setup).sounds_set : \
414 #define SETUP_OVERRIDE_ARTWORK(setup, type) \
415 ((type) == ARTWORK_TYPE_GRAPHICS ? \
416 (setup).override_level_graphics : \
417 (type) == ARTWORK_TYPE_SOUNDS ? \
418 (setup).override_level_sounds : \
419 (setup).override_level_music)
421 #define ARTWORK_FIRST_NODE(artwork, type) \
422 ((type) == ARTWORK_TYPE_GRAPHICS ? \
423 (artwork).gfx_first : \
424 (type) == ARTWORK_TYPE_SOUNDS ? \
425 (artwork).snd_first : \
428 #define ARTWORK_CURRENT_IDENTIFIER_PTR(artwork, type) \
429 ((type) == ARTWORK_TYPE_GRAPHICS ? \
430 &(artwork).gfx_current_identifier : \
431 (type) == ARTWORK_TYPE_SOUNDS ? \
432 &(artwork).snd_current_identifier : \
433 &(artwork).mus_current_identifier)
435 #define ARTWORK_CURRENT_IDENTIFIER(artwork, type) \
436 ((type) == ARTWORK_TYPE_GRAPHICS ? \
437 (artwork).gfx_current_identifier : \
438 (type) == ARTWORK_TYPE_SOUNDS ? \
439 (artwork).snd_current_identifier : \
440 (artwork).mus_current_identifier)
442 #define ARTWORKINFO_FILENAME(type) \
443 ((type) == ARTWORK_TYPE_GRAPHICS ? \
444 GRAPHICSINFO_FILENAME : \
445 (type) == ARTWORK_TYPE_SOUNDS ? \
446 SOUNDSINFO_FILENAME : \
447 (type) == ARTWORK_TYPE_MUSIC ? \
448 MUSICINFO_FILENAME : "")
450 #define ARTWORK_DIRECTORY(type) \
451 ((type) == ARTWORK_TYPE_GRAPHICS ? \
452 GRAPHICS_DIRECTORY : \
453 (type) == ARTWORK_TYPE_SOUNDS ? \
455 (type) == ARTWORK_TYPE_MUSIC ? \
456 MUSIC_DIRECTORY : "")
458 #define OPTIONS_ARTWORK_DIRECTORY(type) \
459 ((type) == ARTWORK_TYPE_GRAPHICS ? \
460 options.graphics_directory : \
461 (type) == ARTWORK_TYPE_SOUNDS ? \
462 options.sounds_directory : \
463 (type) == ARTWORK_TYPE_MUSIC ? \
464 options.music_directory : "")
467 /* type definitions */
468 typedef int (*EventFilter)(const Event *);
471 /* structure definitions */
475 char *command_basepath; /* directory that contains the program */
476 char *command_basename; /* base filename of the program binary */
477 char *userdata_directory; /* personal user data directory */
483 char *x11_icon_filename;
484 char *x11_iconmask_filename;
485 char *msdos_cursor_filename;
488 char *filename_prefix; /* prefix to cut off from DOS filenames */
494 void (*exit_function)(int);
503 char *ro_base_directory;
504 char *rw_base_directory;
505 char *level_directory;
506 char *graphics_directory;
507 char *sounds_directory;
508 char *music_directory;
509 char *docs_directory;
510 char *execute_command;
518 struct VideoSystemInfo
521 int width, height, depth;
522 boolean fullscreen_available;
523 boolean fullscreen_enabled;
526 struct AudioSystemInfo
528 boolean sound_available;
529 boolean loops_available;
530 boolean music_available;
532 boolean sound_enabled;
533 boolean sound_deactivated; /* for temporarily disabling sound */
542 int first_sound_channel;
545 struct FontBitmapInfo
548 int src_x, src_y; /* start position of animation frames */
549 int width, height; /* width/height of each animation frame */
550 int draw_x, draw_y; /* offset for drawing font characters */
552 int num_chars_per_line;
554 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
555 Pixmap *clip_mask; /* single-char-only clip mask array for X11 */
563 int real_sx, real_sy;
564 int full_sxsize, full_sysize;
565 int scrollbuffer_width, scrollbuffer_height;
573 int draw_deactivation_mask;
574 int draw_background_mask;
576 Bitmap *field_save_buffer;
578 Bitmap *background_bitmap;
579 int background_bitmap_mask;
582 struct FontBitmapInfo *font_bitmap_info;
583 int (*select_font_function)(int);
585 int anim_random_frame;
591 int fd[MAX_PLAYERS]; /* file descriptor of player's joystick */
594 struct SetupJoystickInfo
596 char *device_name; /* device name of player's joystick */
598 int xleft, xmiddle, xright;
599 int yupper, ymiddle, ylower;
603 struct SetupKeyboardInfo
605 Key left, right, up, down;
609 struct SetupInputInfo
611 boolean use_joystick;
612 struct SetupJoystickInfo joy;
613 struct SetupKeyboardInfo key;
616 struct SetupEditorInfo
618 boolean el_boulderdash;
619 boolean el_emerald_mine;
620 boolean el_emerald_mine_club;
624 boolean el_diamond_caves;
625 boolean el_dx_boulderdash;
628 boolean el_user_defined;
631 boolean el_headlines;
634 struct SetupEditorCascadeInfo
652 struct SetupShortcutInfo
659 struct SetupSystemInfo
661 char *sdl_audiodriver;
662 int audio_fragment_size;
672 boolean sound_simple;
674 boolean double_buffering;
675 boolean direct_draw; /* !double_buffering (redundant!) */
676 boolean scroll_delay;
677 boolean soft_scrolling;
686 boolean ask_on_escape;
691 boolean override_level_graphics;
692 boolean override_level_sounds;
693 boolean override_level_music;
695 struct SetupEditorInfo editor;
696 struct SetupEditorCascadeInfo editor_cascade;
697 struct SetupShortcutInfo shortcut;
698 struct SetupInputInfo input[MAX_PLAYERS];
699 struct SetupSystemInfo system;
700 struct OptionInfo options;
705 struct TreeInfo **node_top; /* topmost node in tree */
706 struct TreeInfo *node_parent; /* parent level directory info */
707 struct TreeInfo *node_group; /* level group sub-directory info */
708 struct TreeInfo *next; /* next level series structure node */
710 int cl_first; /* internal control field for setup screen */
711 int cl_cursor; /* internal control field for setup screen */
713 int type; /* type of tree content */
715 /* fields for "type == TREE_TYPE_LEVEL_DIR" */
717 char *subdir; /* tree info sub-directory basename (may be ".") */
718 char *fullpath; /* complete path relative to tree base directory */
719 char *basepath; /* absolute base path of tree base directory */
720 char *identifier; /* identifier string for configuration files */
721 char *name; /* tree info name, as displayed in selection menues */
722 char *name_sorting; /* optional sorting name for correct name sorting */
723 char *author; /* level or artwork author name */
724 char *imported_from; /* optional comment for imported levels or artwork */
725 char *imported_by; /* optional comment for imported levels or artwork */
727 char *graphics_set; /* optional custom graphics set (level tree only) */
728 char *sounds_set; /* optional custom sounds set (level tree only) */
729 char *music_set; /* optional custom music set (level tree only) */
730 char *graphics_path; /* path to optional custom graphics set (level only) */
731 char *sounds_path; /* path to optional custom sounds set (level only) */
732 char *music_path; /* path to optional custom music set (level only) */
734 char *level_filename; /* filename of level file (for packed level file) */
735 char *level_filetype; /* type of levels in level directory or level file */
737 int levels; /* number of levels in level series */
738 int first_level; /* first level number (to allow start with 0 or 1) */
739 int last_level; /* last level number (automatically calculated) */
740 int sort_priority; /* sort levels by 'sort_priority' and then by name */
742 boolean latest_engine;/* force level set to use the latest game engine */
744 boolean level_group; /* directory contains more level series directories */
745 boolean parent_link; /* entry links back to parent directory */
746 boolean in_user_dir; /* user defined levels are stored in home directory */
747 boolean user_defined; /* levels in user directory and marked as "private" */
748 boolean readonly; /* readonly levels can not be changed with editor */
749 boolean handicap; /* level set has no handicap when set to "false" */
750 boolean skip_levels; /* levels can be skipped when set to "true" */
752 int color; /* color to use on selection screen for this level */
753 char *class_desc; /* description of level series class */
754 int handicap_level; /* number of the lowest unsolved level */
757 typedef struct TreeInfo TreeInfo;
758 typedef struct TreeInfo LevelDirTree;
759 typedef struct TreeInfo ArtworkDirTree;
760 typedef struct TreeInfo GraphicsDirTree;
761 typedef struct TreeInfo SoundsDirTree;
762 typedef struct TreeInfo MusicDirTree;
766 GraphicsDirTree *gfx_first;
767 GraphicsDirTree *gfx_current;
768 SoundsDirTree *snd_first;
769 SoundsDirTree *snd_current;
770 MusicDirTree *mus_first;
771 MusicDirTree *mus_current;
773 char *gfx_current_identifier;
774 char *snd_current_identifier;
775 char *mus_current_identifier;
790 struct ConfigTypeInfo
797 struct TokenIntPtrInfo
807 char *default_filename;
810 char **default_parameter; /* array of file parameters */
811 char **parameter; /* array of file parameters */
814 boolean fallback_to_default;
822 struct SetupFileList *next;
827 char *source_filename; /* primary key for node list */
831 struct PropertyMapping
841 struct ArtworkListInfo
843 int type; /* type of artwork */
845 int num_file_list_entries;
846 int num_dynamic_file_list_entries;
847 struct FileInfo *file_list; /* static artwork file array */
848 struct FileInfo *dynamic_file_list; /* dynamic artwrk file array */
850 int num_suffix_list_entries;
851 struct ConfigTypeInfo *suffix_list; /* parameter suffixes array */
853 int num_base_prefixes;
854 int num_ext1_suffixes;
855 int num_ext2_suffixes;
856 int num_ext3_suffixes;
857 char **base_prefixes; /* base token prefixes array */
858 char **ext1_suffixes; /* property suffixes array 1 */
859 char **ext2_suffixes; /* property suffixes array 2 */
860 char **ext3_suffixes; /* property suffixes array 3 */
862 int num_ignore_tokens;
863 char **ignore_tokens; /* file tokens to be ignored */
865 int num_property_mapping_entries;
866 struct PropertyMapping *property_mapping; /* mapping token -> artwork */
868 int sizeof_artwork_list_entry;
870 struct ListNodeInfo **artwork_list; /* static artwork node array */
871 struct ListNodeInfo **dynamic_artwork_list; /* dynamic artwrk node array */
872 struct ListNode *content_list; /* dynamic artwork node list */
874 void *(*load_artwork)(char *); /* constructor function */
875 void (*free_artwork)(void *); /* destructor function */
879 /* ========================================================================= */
880 /* exported variables */
881 /* ========================================================================= */
883 extern struct ProgramInfo program;
884 extern struct OptionInfo options;
885 extern struct VideoSystemInfo video;
886 extern struct AudioSystemInfo audio;
887 extern struct GfxInfo gfx;
888 extern struct AnimInfo anim;
889 extern struct ArtworkInfo artwork;
890 extern struct JoystickInfo joystick;
891 extern struct SetupInfo setup;
893 extern LevelDirTree *leveldir_first;
894 extern LevelDirTree *leveldir_current;
897 extern Display *display;
898 extern Visual *visual;
900 extern Colormap cmap;
902 extern DrawWindow *window;
903 extern DrawBuffer *backbuffer;
904 extern DrawBuffer *drawto;
906 extern int button_status;
907 extern boolean motion_status;
909 extern int redraw_mask;
910 extern int redraw_tiles;
912 extern int FrameCounter;
915 /* function definitions */
917 void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
918 char *, char *, char *, int);
920 void InitExitFunction(void (*exit_function)(int));
921 void InitPlatformDependentStuff(void);
922 void ClosePlatformDependentStuff(void);
924 void InitGfxFieldInfo(int, int, int, int, int, int, int, int, Bitmap *);
925 void InitGfxDoor1Info(int, int, int, int);
926 void InitGfxDoor2Info(int, int, int, int);
927 void InitGfxScrollbufferInfo(int, int);
928 void SetDrawDeactivationMask(int);
929 void SetDrawBackgroundMask(int);
930 void SetMainBackgroundBitmap(Bitmap *);
931 void SetDoorBackgroundBitmap(Bitmap *);
933 inline void InitVideoDisplay(void);
934 inline void CloseVideoDisplay(void);
935 inline void InitVideoBuffer(DrawBuffer **,DrawWindow **, int,int,int, boolean);
936 inline Bitmap *CreateBitmapStruct(void);
937 inline Bitmap *CreateBitmap(int, int, int);
938 inline void FreeBitmap(Bitmap *);
939 inline void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
940 inline void FillRectangle(Bitmap *, int, int, int, int, Pixel);
941 inline void ClearRectangle(Bitmap *, int, int, int, int);
942 inline void ClearRectangleOnBackground(Bitmap *, int, int, int, int);
943 inline void SetClipMask(Bitmap *, GC, Pixmap);
944 inline void SetClipOrigin(Bitmap *, GC, int, int);
945 inline void BlitBitmapMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
946 inline boolean DrawingOnBackground(int, int);
947 inline void BlitBitmapOnBackground(Bitmap *, Bitmap *, int, int, int, int, int,
949 inline void DrawSimpleBlackLine(Bitmap *, int, int, int, int);
950 inline void DrawSimpleWhiteLine(Bitmap *, int, int, int, int);
951 inline void DrawLines(Bitmap *, struct XY *, int, Pixel);
952 inline Pixel GetPixel(Bitmap *, int, int);
953 inline Pixel GetPixelFromRGB(Bitmap *, unsigned int,unsigned int,unsigned int);
954 inline Pixel GetPixelFromRGBcompact(Bitmap *, unsigned int);
956 inline void FlushDisplay(void);
957 inline void SyncDisplay(void);
958 inline void KeyboardAutoRepeatOn(void);
959 inline void KeyboardAutoRepeatOff(void);
960 inline boolean PointerInWindow(DrawWindow *);
961 inline boolean SetVideoMode(boolean);
962 inline boolean ChangeVideoModeIfNeeded(boolean);
964 Bitmap *LoadImage(char *);
965 Bitmap *LoadCustomImage(char *);
966 void ReloadCustomImage(Bitmap *, char *);
968 Bitmap *ZoomBitmap(Bitmap *, int, int);
969 void CreateBitmapWithSmallBitmaps(Bitmap *, int);
971 void SetMouseCursor(int);
973 inline void OpenAudio(void);
974 inline void CloseAudio(void);
975 inline void SetAudioMode(boolean);
977 inline void InitEventFilter(EventFilter);
978 inline boolean PendingEvent(void);
979 inline void NextEvent(Event *event);
980 inline void PeekEvent(Event *event);
981 inline Key GetEventKey(KeyEvent *, boolean);
982 inline KeyMod HandleKeyModState(Key, int);
983 inline KeyMod GetKeyModState();
984 inline boolean CheckCloseWindowEvent(ClientMessageEvent *);
986 inline void InitJoysticks();
987 inline boolean ReadJoystick(int, int *, int *, boolean *, boolean *);
989 #endif /* SYSTEM_H */