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 special "focus player" bitmasks */
116 #define BIT_SET_FOCUS 6
118 /* values for move directions and special "button" key bitmasks */
120 #define MV_LEFT (1 << MV_BIT_LEFT)
121 #define MV_RIGHT (1 << MV_BIT_RIGHT)
122 #define MV_UP (1 << MV_BIT_UP)
123 #define MV_DOWN (1 << MV_BIT_DOWN)
125 #define MV_UPLEFT (MV_UP | MV_LEFT)
126 #define MV_UPRIGHT (MV_UP | MV_RIGHT)
127 #define MV_DOWNLEFT (MV_DOWN | MV_LEFT)
128 #define MV_DOWNRIGHT (MV_DOWN | MV_RIGHT)
130 #define MV_HORIZONTAL (MV_LEFT | MV_RIGHT)
131 #define MV_VERTICAL (MV_UP | MV_DOWN)
132 #define MV_ALL_DIRECTIONS (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
133 #define MV_ANY_DIRECTION (MV_ALL_DIRECTIONS)
134 #define MV_NO_DIRECTION (MV_NONE)
136 #define KEY_BUTTON_1 (1 << BUTTON_1)
137 #define KEY_BUTTON_2 (1 << BUTTON_2)
138 #define KEY_MOTION (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
139 #define KEY_BUTTON (KEY_BUTTON_1 | KEY_BUTTON_2)
140 #define KEY_ACTION (KEY_MOTION | KEY_BUTTON)
142 #define KEY_SET_FOCUS (1 << BIT_SET_FOCUS)
144 #define MV_DIR_FROM_BIT(x) ((x) < NUM_DIRECTIONS ? 1 << (x) : \
145 (x) == MV_BIT_UPLEFT ? MV_UPLEFT : \
146 (x) == MV_BIT_UPRIGHT ? MV_UPRIGHT : \
147 (x) == MV_BIT_DOWNLEFT ? MV_DOWNLEFT : \
148 (x) == MV_BIT_DOWNRIGHT ? MV_DOWNRIGHT : \
151 #define MV_DIR_TO_BIT(x) ((x) == MV_LEFT ? MV_BIT_LEFT : \
152 (x) == MV_RIGHT ? MV_BIT_RIGHT : \
153 (x) == MV_UP ? MV_BIT_UP : \
154 (x) == MV_DOWN ? MV_BIT_DOWN : \
155 (x) == MV_UPLEFT ? MV_BIT_UPLEFT : \
156 (x) == MV_UPRIGHT ? MV_BIT_UPRIGHT : \
157 (x) == MV_DOWNLEFT ? MV_BIT_DOWNLEFT : \
158 (x) == MV_DOWNRIGHT ? MV_BIT_DOWNRIGHT : \
161 #define MV_DIR_OPPOSITE(x) ((x) == MV_LEFT ? MV_RIGHT : \
162 (x) == MV_RIGHT ? MV_LEFT : \
163 (x) == MV_UP ? MV_DOWN : \
164 (x) == MV_DOWN ? MV_UP : \
165 (x) == MV_UPLEFT ? MV_DOWNRIGHT : \
166 (x) == MV_UPRIGHT ? MV_DOWNLEFT : \
167 (x) == MV_DOWNLEFT ? MV_UPRIGHT : \
168 (x) == MV_DOWNRIGHT ? MV_UPLEFT : \
171 /* values for animation mode (frame order and direction) */
173 #define ANIM_LOOP (1 << 0)
174 #define ANIM_LINEAR (1 << 1)
175 #define ANIM_PINGPONG (1 << 2)
176 #define ANIM_PINGPONG2 (1 << 3)
177 #define ANIM_RANDOM (1 << 4)
178 #define ANIM_CE_VALUE (1 << 5)
179 #define ANIM_CE_SCORE (1 << 6)
180 #define ANIM_CE_DELAY (1 << 7)
181 #define ANIM_REVERSE (1 << 8)
182 #define ANIM_OPAQUE_PLAYER (1 << 9)
184 /* values for special (non game element) animation modes */
185 #define ANIM_HORIZONTAL (1 << 10)
186 #define ANIM_VERTICAL (1 << 11)
187 #define ANIM_STATIC_PANEL (1 << 12)
189 #define ANIM_DEFAULT ANIM_LOOP
191 /* values for redraw_mask */
192 #define REDRAW_NONE (0)
193 #define REDRAW_ALL (1 << 0)
194 #define REDRAW_FIELD (1 << 1)
195 #define REDRAW_TILES (1 << 2)
196 #define REDRAW_DOOR_1 (1 << 3)
197 #define REDRAW_VIDEO_1 (1 << 4)
198 #define REDRAW_VIDEO_2 (1 << 5)
199 #define REDRAW_VIDEO_3 (1 << 6)
200 #define REDRAW_MICROLEVEL (1 << 7)
201 #define REDRAW_MICROLABEL (1 << 8)
202 #define REDRAW_FROM_BACKBUFFER (1 << 9)
203 #define REDRAW_DOOR_2 (REDRAW_VIDEO_1 | \
206 #define REDRAW_DOOR_3 (1 << 10)
207 #define REDRAW_DOORS (REDRAW_DOOR_1 | \
210 #define REDRAW_MAIN (REDRAW_FIELD | \
213 #define REDRAW_FPS (1 << 11)
214 #define REDRAWTILES_THRESHOLD (SCR_FIELDX * SCR_FIELDY / 2)
216 #define FADE_MODE_FADE_IN 0
217 #define FADE_MODE_FADE_OUT 1
218 #define FADE_MODE_CROSSFADE 2
220 #define IN_GFX_SCREEN(x, y) (x >= gfx.sx && x < gfx.sx + gfx.sxsize && \
221 y >= gfx.sy && y < gfx.sy + gfx.sysize)
222 #define IN_GFX_DOOR(x, y) (x >= gfx.dx && x < gfx.dx + gfx.dxsize && \
223 y >= gfx.dy && y < gfx.dy + gfx.dysize)
224 #define IN_GFX_VIDEO(x, y) (x >= gfx.vx && x < gfx.vx + gfx.vxsize && \
225 y >= gfx.vy && y < gfx.vy + gfx.vysize)
227 /* values for mouse cursor */
228 #define CURSOR_DEFAULT 0
229 #define CURSOR_PLAYFIELD 1
231 /* fundamental game speed values */
232 #define ONE_SECOND_DELAY 1000 /* delay value for one second */
233 #define GAME_FRAME_DELAY 20 /* frame delay in milliseconds */
234 #define FFWD_FRAME_DELAY 10 /* 200% speed for fast forward */
235 #define FRAMES_PER_SECOND (ONE_SECOND_DELAY / GAME_FRAME_DELAY)
237 /* maximum playfield size supported by libgame functions */
238 #define MAX_PLAYFIELD_WIDTH 128
239 #define MAX_PLAYFIELD_HEIGHT 128
241 /* maximum number of parallel players supported by libgame functions */
242 #define MAX_PLAYERS 4
244 /* maximum allowed length of player name */
245 #define MAX_PLAYER_NAME_LEN 10
247 /* default name for empty highscore entry */
248 #define EMPTY_PLAYER_NAME "no name"
250 /* default name for unknown player names */
251 #define ANONYMOUS_NAME "anonymous"
253 /* default for other unknown names */
254 #define UNKNOWN_NAME "unknown"
256 /* default name for new levels */
257 #define NAMELESS_LEVEL_NAME "nameless level"
259 /* default text for non-existant artwork */
260 #define NOT_AVAILABLE "(not available)"
262 /* default value for undefined filename */
263 #define UNDEFINED_FILENAME "[NONE]"
265 /* default value for undefined parameter */
266 #define ARG_DEFAULT "[DEFAULT]"
268 /* default values for undefined configuration file parameters */
269 #define ARG_UNDEFINED "-1000000"
270 #define ARG_UNDEFINED_VALUE (atoi(ARG_UNDEFINED))
272 /* definitions for game sub-directories */
274 #define RO_GAME_DIR "."
278 #define RW_GAME_DIR "."
281 #define RO_BASE_PATH RO_GAME_DIR
282 #define RW_BASE_PATH RW_GAME_DIR
284 /* directory names */
285 #define GRAPHICS_DIRECTORY "graphics"
286 #define SOUNDS_DIRECTORY "sounds"
287 #define MUSIC_DIRECTORY "music"
288 #define LEVELS_DIRECTORY "levels"
289 #define TAPES_DIRECTORY "tapes"
290 #define SCORES_DIRECTORY "scores"
291 #define DOCS_DIRECTORY "docs"
293 #if !defined(PLATFORM_MSDOS)
294 #define GFX_CLASSIC_SUBDIR "gfx_classic"
295 #define SND_CLASSIC_SUBDIR "snd_classic"
296 #define MUS_CLASSIC_SUBDIR "mus_classic"
298 #define GFX_CLASSIC_SUBDIR "gfx_orig"
299 #define SND_CLASSIC_SUBDIR "snd_orig"
300 #define MUS_CLASSIC_SUBDIR "mus_orig"
303 /* file names and filename extensions */
304 #if !defined(PLATFORM_MSDOS)
305 #define LEVELSETUP_DIRECTORY "levelsetup"
306 #define SETUP_FILENAME "setup.conf"
307 #define LEVELSETUP_FILENAME "levelsetup.conf"
308 #define EDITORSETUP_FILENAME "editorsetup.conf"
309 #define EDITORCASCADE_FILENAME "editorcascade.conf"
310 #define HELPANIM_FILENAME "helpanim.conf"
311 #define HELPTEXT_FILENAME "helptext.conf"
312 #define LEVELINFO_FILENAME "levelinfo.conf"
313 #define GRAPHICSINFO_FILENAME "graphicsinfo.conf"
314 #define SOUNDSINFO_FILENAME "soundsinfo.conf"
315 #define MUSICINFO_FILENAME "musicinfo.conf"
316 #define LEVELFILE_EXTENSION "level"
317 #define TAPEFILE_EXTENSION "tape"
318 #define SCOREFILE_EXTENSION "score"
320 #define LEVELSETUP_DIRECTORY "lvlsetup"
321 #define SETUP_FILENAME "setup.cnf"
322 #define LEVELSETUP_FILENAME "lvlsetup.cnf"
323 #define EDITORSETUP_FILENAME "edsetup.cnf"
324 #define EDITORCASCADE_FILENAME "edcascad.conf"
325 #define HELPANIM_FILENAME "helpanim.cnf"
326 #define HELPTEXT_FILENAME "helptext.cnf"
327 #define LEVELINFO_FILENAME "lvlinfo.cnf"
328 #define GRAPHICSINFO_FILENAME "gfxinfo.cnf"
329 #define SOUNDSINFO_FILENAME "sndinfo.cnf"
330 #define MUSICINFO_FILENAME "musinfo.cnf"
331 #define LEVELFILE_EXTENSION "lvl"
332 #define TAPEFILE_EXTENSION "tap"
333 #define SCOREFILE_EXTENSION "sco"
337 /* areas in bitmap PIX_DOOR */
338 /* meaning in PIX_DB_DOOR: (3 PAGEs)
339 PAGEX1: 1. buffer for DOOR_1
340 PAGEX2: 2. buffer for DOOR_1
341 PAGEX3: buffer for animations
344 /* these values are hard-coded to be able to use them in initialization */
345 #define DOOR_GFX_PAGE_WIDTH 100 /* should be set to "gfx.dxsize" */
346 #define DOOR_GFX_PAGE_HEIGHT 280 /* should be set to "gfx.dysize" */
348 #define DOOR_GFX_PAGESIZE (DOOR_GFX_PAGE_WIDTH)
349 #define DOOR_GFX_PAGEX1 (0 * DOOR_GFX_PAGESIZE)
350 #define DOOR_GFX_PAGEX2 (1 * DOOR_GFX_PAGESIZE)
351 #define DOOR_GFX_PAGEX3 (2 * DOOR_GFX_PAGESIZE)
352 #define DOOR_GFX_PAGEX4 (3 * DOOR_GFX_PAGESIZE)
353 #define DOOR_GFX_PAGEX5 (4 * DOOR_GFX_PAGESIZE)
354 #define DOOR_GFX_PAGEX6 (5 * DOOR_GFX_PAGESIZE)
355 #define DOOR_GFX_PAGEX7 (6 * DOOR_GFX_PAGESIZE)
356 #define DOOR_GFX_PAGEX8 (7 * DOOR_GFX_PAGESIZE)
357 #define DOOR_GFX_PAGEY1 (0)
358 #define DOOR_GFX_PAGEY2 (DOOR_GFX_PAGE_HEIGHT)
361 /* macros for version handling */
362 #define VERSION_MAJOR(x) ((x) / 1000000)
363 #define VERSION_MINOR(x) (((x) % 1000000) / 10000)
364 #define VERSION_PATCH(x) (((x) % 10000) / 100)
365 #define VERSION_BUILD(x) ((x) % 100)
366 #define VERSION_IDENT(a,b,c,d) ((a) * 1000000 + (b) * 10000 + (c) * 100 + (d))
369 /* macros for parent/child process identification */
370 #if defined(PLATFORM_UNIX)
371 #define IS_PARENT_PROCESS() (audio.mixer_pid != getpid())
372 #define IS_CHILD_PROCESS() (audio.mixer_pid == getpid())
373 #define HAS_CHILD_PROCESS() (audio.mixer_pid > 0)
375 #define IS_PARENT_PROCESS() TRUE
376 #define IS_CHILD_PROCESS() FALSE
377 #define HAS_CHILD_PROCESS() FALSE
381 /* values for artwork type */
382 #define ARTWORK_TYPE_GRAPHICS 0
383 #define ARTWORK_TYPE_SOUNDS 1
384 #define ARTWORK_TYPE_MUSIC 2
386 #define NUM_ARTWORK_TYPES 3
389 /* values for tree type (chosen to match artwork type) */
390 #define TREE_TYPE_UNDEFINED -1
391 #define TREE_TYPE_GRAPHICS_DIR ARTWORK_TYPE_GRAPHICS
392 #define TREE_TYPE_SOUNDS_DIR ARTWORK_TYPE_SOUNDS
393 #define TREE_TYPE_MUSIC_DIR ARTWORK_TYPE_MUSIC
394 #define TREE_TYPE_LEVEL_DIR 3
396 #define NUM_TREE_TYPES 4
399 /* values for artwork handling */
400 #define LEVELDIR_ARTWORK_SET_PTR(leveldir, type) \
401 ((type) == ARTWORK_TYPE_GRAPHICS ? \
402 &(leveldir)->graphics_set : \
403 (type) == ARTWORK_TYPE_SOUNDS ? \
404 &(leveldir)->sounds_set : \
405 &(leveldir)->music_set)
407 #define LEVELDIR_ARTWORK_SET(leveldir, type) \
408 ((type) == ARTWORK_TYPE_GRAPHICS ? \
409 (leveldir)->graphics_set : \
410 (type) == ARTWORK_TYPE_SOUNDS ? \
411 (leveldir)->sounds_set : \
412 (leveldir)->music_set)
414 #define LEVELDIR_ARTWORK_PATH_PTR(leveldir, type) \
415 ((type) == ARTWORK_TYPE_GRAPHICS ? \
416 &(leveldir)->graphics_path : \
417 (type) == ARTWORK_TYPE_SOUNDS ? \
418 &(leveldir)->sounds_path : \
419 &(leveldir)->music_path)
421 #define LEVELDIR_ARTWORK_PATH(leveldir, type) \
422 ((type) == ARTWORK_TYPE_GRAPHICS ? \
423 (leveldir)->graphics_path : \
424 (type) == ARTWORK_TYPE_SOUNDS ? \
425 (leveldir)->sounds_path : \
426 (leveldir)->music_path)
428 #define SETUP_ARTWORK_SET(setup, type) \
429 ((type) == ARTWORK_TYPE_GRAPHICS ? \
430 (setup).graphics_set : \
431 (type) == ARTWORK_TYPE_SOUNDS ? \
432 (setup).sounds_set : \
435 #define SETUP_OVERRIDE_ARTWORK(setup, type) \
436 ((type) == ARTWORK_TYPE_GRAPHICS ? \
437 (setup).override_level_graphics : \
438 (type) == ARTWORK_TYPE_SOUNDS ? \
439 (setup).override_level_sounds : \
440 (setup).override_level_music)
442 #define ARTWORK_FIRST_NODE(artwork, type) \
443 ((type) == ARTWORK_TYPE_GRAPHICS ? \
444 (artwork).gfx_first : \
445 (type) == ARTWORK_TYPE_SOUNDS ? \
446 (artwork).snd_first : \
449 #define ARTWORK_CURRENT_IDENTIFIER_PTR(artwork, type) \
450 ((type) == ARTWORK_TYPE_GRAPHICS ? \
451 &(artwork).gfx_current_identifier : \
452 (type) == ARTWORK_TYPE_SOUNDS ? \
453 &(artwork).snd_current_identifier : \
454 &(artwork).mus_current_identifier)
456 #define ARTWORK_CURRENT_IDENTIFIER(artwork, type) \
457 ((type) == ARTWORK_TYPE_GRAPHICS ? \
458 (artwork).gfx_current_identifier : \
459 (type) == ARTWORK_TYPE_SOUNDS ? \
460 (artwork).snd_current_identifier : \
461 (artwork).mus_current_identifier)
463 #define ARTWORKINFO_FILENAME(type) \
464 ((type) == ARTWORK_TYPE_GRAPHICS ? \
465 GRAPHICSINFO_FILENAME : \
466 (type) == ARTWORK_TYPE_SOUNDS ? \
467 SOUNDSINFO_FILENAME : \
468 (type) == ARTWORK_TYPE_MUSIC ? \
469 MUSICINFO_FILENAME : "")
471 #define ARTWORK_DIRECTORY(type) \
472 ((type) == ARTWORK_TYPE_GRAPHICS ? \
473 GRAPHICS_DIRECTORY : \
474 (type) == ARTWORK_TYPE_SOUNDS ? \
476 (type) == ARTWORK_TYPE_MUSIC ? \
477 MUSIC_DIRECTORY : "")
479 #define OPTIONS_ARTWORK_DIRECTORY(type) \
480 ((type) == ARTWORK_TYPE_GRAPHICS ? \
481 options.graphics_directory : \
482 (type) == ARTWORK_TYPE_SOUNDS ? \
483 options.sounds_directory : \
484 (type) == ARTWORK_TYPE_MUSIC ? \
485 options.music_directory : "")
488 /* type definitions */
489 typedef int (*EventFilter)(const Event *);
492 /* structure definitions */
496 char *command_basepath; /* directory that contains the program */
497 char *command_basename; /* base filename of the program binary */
498 char *userdata_directory; /* personal user data directory */
504 char *x11_icon_filename;
505 char *x11_iconmask_filename;
506 char *msdos_cursor_filename;
509 char *filename_prefix; /* prefix to cut off from DOS filenames */
515 void (*exit_function)(int);
524 char *ro_base_directory;
525 char *rw_base_directory;
526 char *level_directory;
527 char *graphics_directory;
528 char *sounds_directory;
529 char *music_directory;
530 char *docs_directory;
531 char *execute_command;
539 struct VideoSystemInfo
542 int width, height, depth;
543 boolean fullscreen_available;
544 boolean fullscreen_enabled;
547 struct AudioSystemInfo
549 boolean sound_available;
550 boolean loops_available;
551 boolean music_available;
553 boolean sound_enabled;
554 boolean sound_deactivated; /* for temporarily disabling sound */
563 int first_sound_channel;
566 struct FontBitmapInfo
570 int src_x, src_y; /* start position of animation frames */
571 int width, height; /* width/height of each animation frame */
573 int draw_xoffset; /* offset for drawing font characters */
574 int draw_yoffset; /* offset for drawing font characters */
577 int num_chars_per_line;
579 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
580 Pixmap *clip_mask; /* single-char-only clip mask array for X11 */
588 int real_sx, real_sy;
589 int full_sxsize, full_sysize;
590 int scrollbuffer_width, scrollbuffer_height;
598 int draw_deactivation_mask;
599 int draw_background_mask;
601 Bitmap *field_save_buffer;
603 Bitmap *background_bitmap;
604 int background_bitmap_mask;
607 struct FontBitmapInfo *font_bitmap_info;
608 int (*select_font_function)(int);
610 int anim_random_frame;
616 int fd[MAX_PLAYERS]; /* file descriptor of player's joystick */
619 struct SetupJoystickInfo
621 char *device_name; /* device name of player's joystick */
623 int xleft, xmiddle, xright;
624 int yupper, ymiddle, ylower;
628 struct SetupKeyboardInfo
630 Key left, right, up, down;
634 struct SetupInputInfo
636 boolean use_joystick;
637 struct SetupJoystickInfo joy;
638 struct SetupKeyboardInfo key;
641 struct SetupEditorInfo
643 boolean el_boulderdash;
644 boolean el_emerald_mine;
645 boolean el_emerald_mine_club;
649 boolean el_diamond_caves;
650 boolean el_dx_boulderdash;
653 boolean el_user_defined;
656 boolean el_headlines;
658 boolean show_element_token;
661 struct SetupEditorCascadeInfo
678 struct SetupShortcutInfo
684 Key focus_player[MAX_PLAYERS];
685 Key focus_player_all;
688 struct SetupSystemInfo
690 char *sdl_audiodriver;
691 int audio_fragment_size;
701 boolean sound_simple;
703 boolean double_buffering;
704 boolean direct_draw; /* !double_buffering (redundant!) */
705 boolean scroll_delay;
706 boolean soft_scrolling;
709 boolean show_titlescreen;
716 boolean ask_on_escape;
717 boolean ask_on_escape_editor;
718 boolean quick_switch;
719 boolean input_on_focus;
720 boolean prefer_aga_graphics;
725 boolean override_level_graphics;
726 boolean override_level_sounds;
727 boolean override_level_music;
729 struct SetupEditorInfo editor;
730 struct SetupEditorCascadeInfo editor_cascade;
731 struct SetupShortcutInfo shortcut;
732 struct SetupInputInfo input[MAX_PLAYERS];
733 struct SetupSystemInfo system;
734 struct OptionInfo options;
739 struct TreeInfo **node_top; /* topmost node in tree */
740 struct TreeInfo *node_parent; /* parent level directory info */
741 struct TreeInfo *node_group; /* level group sub-directory info */
742 struct TreeInfo *next; /* next level series structure node */
744 int cl_first; /* internal control field for setup screen */
745 int cl_cursor; /* internal control field for setup screen */
747 int type; /* type of tree content */
749 /* fields for "type == TREE_TYPE_LEVEL_DIR" */
751 char *subdir; /* tree info sub-directory basename (may be ".") */
752 char *fullpath; /* complete path relative to tree base directory */
753 char *basepath; /* absolute base path of tree base directory */
754 char *identifier; /* identifier string for configuration files */
755 char *name; /* tree info name, as displayed in selection menues */
756 char *name_sorting; /* optional sorting name for correct name sorting */
757 char *author; /* level or artwork author name */
758 char *imported_from; /* optional comment for imported levels or artwork */
759 char *imported_by; /* optional comment for imported levels or artwork */
761 char *graphics_set_ecs; /* special EMC custom graphics set (ECS graphics) */
762 char *graphics_set_aga; /* special EMC custom graphics set (AGA graphics) */
763 char *graphics_set; /* optional custom graphics set (level tree only) */
764 char *sounds_set; /* optional custom sounds set (level tree only) */
765 char *music_set; /* optional custom music set (level tree only) */
766 char *graphics_path; /* path to optional custom graphics set (level only) */
767 char *sounds_path; /* path to optional custom sounds set (level only) */
768 char *music_path; /* path to optional custom music set (level only) */
770 char *level_filename; /* filename of level file (for packed level file) */
771 char *level_filetype; /* type of levels in level directory or level file */
773 int levels; /* number of levels in level series */
774 int first_level; /* first level number (to allow start with 0 or 1) */
775 int last_level; /* last level number (automatically calculated) */
776 int sort_priority; /* sort levels by 'sort_priority' and then by name */
778 boolean latest_engine;/* force level set to use the latest game engine */
780 boolean level_group; /* directory contains more level series directories */
781 boolean parent_link; /* entry links back to parent directory */
782 boolean in_user_dir; /* user defined levels are stored in home directory */
783 boolean user_defined; /* levels in user directory and marked as "private" */
784 boolean readonly; /* readonly levels can not be changed with editor */
785 boolean handicap; /* level set has no handicap when set to "false" */
786 boolean skip_levels; /* levels can be skipped when set to "true" */
788 int color; /* color to use on selection screen for this level */
789 char *class_desc; /* description of level series class */
790 int handicap_level; /* number of the lowest unsolved level */
793 typedef struct TreeInfo TreeInfo;
794 typedef struct TreeInfo LevelDirTree;
795 typedef struct TreeInfo ArtworkDirTree;
796 typedef struct TreeInfo GraphicsDirTree;
797 typedef struct TreeInfo SoundsDirTree;
798 typedef struct TreeInfo MusicDirTree;
802 GraphicsDirTree *gfx_first;
803 GraphicsDirTree *gfx_current;
804 SoundsDirTree *snd_first;
805 SoundsDirTree *snd_current;
806 MusicDirTree *mus_first;
807 MusicDirTree *mus_current;
809 char *gfx_current_identifier;
810 char *snd_current_identifier;
811 char *mus_current_identifier;
826 struct ConfigTypeInfo
833 struct TokenIntPtrInfo
843 char *default_filename;
846 char **default_parameter; /* array of file parameters */
847 char **parameter; /* array of file parameters */
850 boolean fallback_to_default;
858 struct SetupFileList *next;
863 char *source_filename; /* primary key for node list */
867 struct PropertyMapping
877 struct ArtworkListInfo
879 int type; /* type of artwork */
881 int num_file_list_entries;
882 int num_dynamic_file_list_entries;
883 struct FileInfo *file_list; /* static artwork file array */
884 struct FileInfo *dynamic_file_list; /* dynamic artwrk file array */
886 int num_suffix_list_entries;
887 struct ConfigTypeInfo *suffix_list; /* parameter suffixes array */
889 int num_base_prefixes;
890 int num_ext1_suffixes;
891 int num_ext2_suffixes;
892 int num_ext3_suffixes;
893 char **base_prefixes; /* base token prefixes array */
894 char **ext1_suffixes; /* property suffixes array 1 */
895 char **ext2_suffixes; /* property suffixes array 2 */
896 char **ext3_suffixes; /* property suffixes array 3 */
898 int num_ignore_tokens;
899 char **ignore_tokens; /* file tokens to be ignored */
901 int num_property_mapping_entries;
902 struct PropertyMapping *property_mapping; /* mapping token -> artwork */
904 int sizeof_artwork_list_entry;
906 struct ListNodeInfo **artwork_list; /* static artwork node array */
907 struct ListNodeInfo **dynamic_artwork_list; /* dynamic artwrk node array */
908 struct ListNode *content_list; /* dynamic artwork node list */
910 void *(*load_artwork)(char *); /* constructor function */
911 void (*free_artwork)(void *); /* destructor function */
915 /* ========================================================================= */
916 /* exported variables */
917 /* ========================================================================= */
919 extern struct ProgramInfo program;
920 extern struct OptionInfo options;
921 extern struct VideoSystemInfo video;
922 extern struct AudioSystemInfo audio;
923 extern struct GfxInfo gfx;
924 extern struct AnimInfo anim;
925 extern struct ArtworkInfo artwork;
926 extern struct JoystickInfo joystick;
927 extern struct SetupInfo setup;
929 extern LevelDirTree *leveldir_first_all;
930 extern LevelDirTree *leveldir_first;
931 extern LevelDirTree *leveldir_current;
934 extern Display *display;
935 extern Visual *visual;
937 extern Colormap cmap;
939 extern DrawWindow *window;
940 extern DrawBuffer *backbuffer;
941 extern DrawBuffer *drawto;
943 extern int button_status;
944 extern boolean motion_status;
946 extern int redraw_mask;
947 extern int redraw_tiles;
949 extern int FrameCounter;
952 /* function definitions */
954 void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
955 char *, char *, char *, int);
957 void InitExitFunction(void (*exit_function)(int));
958 void InitPlatformDependentStuff(void);
959 void ClosePlatformDependentStuff(void);
961 void InitGfxFieldInfo(int, int, int, int, int, int, int, int, Bitmap *);
962 void InitGfxDoor1Info(int, int, int, int);
963 void InitGfxDoor2Info(int, int, int, int);
964 void InitGfxScrollbufferInfo(int, int);
965 void SetDrawDeactivationMask(int);
966 void SetDrawBackgroundMask(int);
967 void SetMainBackgroundBitmap(Bitmap *);
968 void SetDoorBackgroundBitmap(Bitmap *);
970 void InitVideoDisplay(void);
971 void CloseVideoDisplay(void);
972 void InitVideoBuffer(DrawBuffer **,DrawWindow **, int,int,int, boolean);
973 Bitmap *CreateBitmapStruct(void);
974 Bitmap *CreateBitmap(int, int, int);
975 void FreeBitmap(Bitmap *);
976 void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
977 void FadeScreen(Bitmap *bitmap, int, int, int);
978 void FillRectangle(Bitmap *, int, int, int, int, Pixel);
979 void ClearRectangle(Bitmap *, int, int, int, int);
980 void ClearRectangleOnBackground(Bitmap *, int, int, int, int);
981 void SetClipMask(Bitmap *, GC, Pixmap);
982 void SetClipOrigin(Bitmap *, GC, int, int);
983 void BlitBitmapMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
984 boolean DrawingOnBackground(int, int);
985 void BlitBitmapOnBackground(Bitmap *, Bitmap *, int, int, int, int, int, int);
986 void DrawSimpleBlackLine(Bitmap *, int, int, int, int);
987 void DrawSimpleWhiteLine(Bitmap *, int, int, int, int);
988 void DrawLines(Bitmap *, struct XY *, int, Pixel);
989 Pixel GetPixel(Bitmap *, int, int);
990 Pixel GetPixelFromRGB(Bitmap *, unsigned int,unsigned int,unsigned int);
991 Pixel GetPixelFromRGBcompact(Bitmap *, unsigned int);
993 void FlushDisplay(void);
994 void SyncDisplay(void);
995 void KeyboardAutoRepeatOn(void);
996 void KeyboardAutoRepeatOff(void);
997 boolean PointerInWindow(DrawWindow *);
998 boolean SetVideoMode(boolean);
999 boolean ChangeVideoModeIfNeeded(boolean);
1001 Bitmap *LoadImage(char *);
1002 Bitmap *LoadCustomImage(char *);
1003 void ReloadCustomImage(Bitmap *, char *);
1005 Bitmap *ZoomBitmap(Bitmap *, int, int);
1006 void CreateBitmapWithSmallBitmaps(Bitmap *, int);
1007 void ScaleBitmap(Bitmap *, int);
1009 void SetMouseCursor(int);
1011 void OpenAudio(void);
1012 void CloseAudio(void);
1013 void SetAudioMode(boolean);
1015 void InitEventFilter(EventFilter);
1016 boolean PendingEvent(void);
1017 void NextEvent(Event *event);
1018 void PeekEvent(Event *event);
1019 Key GetEventKey(KeyEvent *, boolean);
1020 KeyMod HandleKeyModState(Key, int);
1021 KeyMod GetKeyModState();
1022 boolean CheckCloseWindowEvent(ClientMessageEvent *);
1024 void InitJoysticks();
1025 boolean ReadJoystick(int, int *, int *, boolean *, boolean *);
1027 #endif /* SYSTEM_H */