a9f1efa1786ad01efeb85cb7b8d2321da3640dee
[rocksndiamonds.git] / src / libgame / system.h
1 /***********************************************************
2 * Artsoft Retro-Game Library                               *
3 *----------------------------------------------------------*
4 * (c) 1994-2002 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * system.h                                                 *
12 ***********************************************************/
13
14 #ifndef SYSTEM_H
15 #define SYSTEM_H
16
17 #include "platform.h"
18 #include "types.h"
19
20
21 #if defined(PLATFORM_MACOSX)
22 #include "macosx.h"
23 #elif defined(PLATFORM_WIN32)
24 #include "windows.h"
25 #elif defined(PLATFORM_MSDOS)
26 #include "msdos.h"
27 #endif
28
29 #if defined(TARGET_SDL)
30 #include "sdl.h"
31 #elif defined(TARGET_X11)
32 #include "x11.h"
33 #endif
34
35
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"
40
41 #define DEFAULT_DEPTH           0
42
43 #define BLIT_OPAQUE             0
44 #define BLIT_MASKED             1
45 #define BLIT_INVERSE            2
46 #define BLIT_ON_BACKGROUND      3
47
48 #define FULLSCREEN_NOT_AVAILABLE FALSE
49 #define FULLSCREEN_AVAILABLE     TRUE
50
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_BOMB        KSYM_KP_Enter
59 #else
60 #define DEFAULT_KEY_SNAP        KSYM_Shift_L
61 #define DEFAULT_KEY_BOMB        KSYM_Shift_R
62 #endif
63 #define DEFAULT_KEY_OKAY        KSYM_Return
64 #define DEFAULT_KEY_CANCEL      KSYM_Escape
65
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
71 /* values for key_status */
72 #define KEY_NOT_PRESSED         FALSE
73 #define KEY_RELEASED            FALSE
74 #define KEY_PRESSED             TRUE
75
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
88
89
90 /* values for move directions */
91 #define MV_BIT_LEFT             0
92 #define MV_BIT_RIGHT            1
93 #define MV_BIT_UP               2
94 #define MV_BIT_DOWN             3
95
96 #define NUM_DIRECTIONS          4
97
98 /* values for special "button" bitmasks */
99 #define BUTTON_1                4
100 #define BUTTON_2                5
101
102 /* values for move direction and special "button" key bitmasks */
103 #define MV_NO_MOVING            0
104 #define MV_LEFT                 (1 << MV_BIT_LEFT)
105 #define MV_RIGHT                (1 << MV_BIT_RIGHT)
106 #define MV_UP                   (1 << MV_BIT_UP)
107 #define MV_DOWN                 (1 << MV_BIT_DOWN)
108
109 #define KEY_BUTTON_1            (1 << BUTTON_1)
110 #define KEY_BUTTON_2            (1 << BUTTON_2)
111 #define KEY_MOTION              (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
112 #define KEY_BUTTON              (KEY_BUTTON_1 | KEY_BUTTON_2)
113 #define KEY_ACTION              (KEY_MOTION | KEY_BUTTON)
114
115 #define MV_DIR_BIT(x)           ((x) == MV_LEFT  ? MV_BIT_LEFT  :       \
116                                  (x) == MV_RIGHT ? MV_BIT_RIGHT :       \
117                                  (x) == MV_UP    ? MV_BIT_UP    : MV_BIT_DOWN)
118
119
120 /* values for animation mode (frame order and direction) */
121 #define ANIM_NONE               0
122 #define ANIM_LOOP               (1 << 0)
123 #define ANIM_LINEAR             (1 << 1)
124 #define ANIM_PINGPONG           (1 << 2)
125 #define ANIM_PINGPONG2          (1 << 3)
126 #define ANIM_RANDOM             (1 << 4)
127 #define ANIM_REVERSE            (1 << 5)
128
129
130 /* values for redraw_mask */
131 #define REDRAW_NONE             (0)
132 #define REDRAW_ALL              (1 << 0)
133 #define REDRAW_FIELD            (1 << 1)
134 #define REDRAW_TILES            (1 << 2)
135 #define REDRAW_DOOR_1           (1 << 3)
136 #define REDRAW_VIDEO_1          (1 << 4)
137 #define REDRAW_VIDEO_2          (1 << 5)
138 #define REDRAW_VIDEO_3          (1 << 6)
139 #define REDRAW_MICROLEVEL       (1 << 7)
140 #define REDRAW_MICROLABEL       (1 << 8)
141 #define REDRAW_FROM_BACKBUFFER  (1 << 9)
142 #define REDRAW_DOOR_2           (REDRAW_VIDEO_1 | \
143                                  REDRAW_VIDEO_2 | \
144                                  REDRAW_VIDEO_3)
145 #define REDRAW_DOOR_3           (1 << 10)
146 #define REDRAW_DOORS            (REDRAW_DOOR_1 | \
147                                  REDRAW_DOOR_2 | \
148                                  REDRAW_DOOR_3)
149 #define REDRAW_MAIN             (REDRAW_FIELD | \
150                                  REDRAW_TILES | \
151                                  REDRAW_MICROLEVEL)
152 #define REDRAW_FPS              (1 << 11)
153 #define REDRAWTILES_THRESHOLD   (SCR_FIELDX * SCR_FIELDY / 2)
154
155
156 /* values for mouse cursor */
157 #define CURSOR_DEFAULT          0
158 #define CURSOR_PLAYFIELD        1
159
160
161 /* maximum number of parallel players supported by libgame functions */
162 #define MAX_PLAYERS             4
163
164 /* maximum allowed length of player name */
165 #define MAX_PLAYER_NAME_LEN     10
166
167 /* default name for empty highscore entry */
168 #define EMPTY_PLAYER_NAME       "no name"
169
170 /* default name for unknown player names */
171 #define ANONYMOUS_NAME          "anonymous"
172
173 /* default name for new levels */
174 #define NAMELESS_LEVEL_NAME     "nameless level"
175
176 /* default text for non-existant artwork */
177 #define NOT_AVAILABLE           "(not available)"
178
179 /* default value for undefined filename */
180 #define UNDEFINED_FILENAME      "[NONE]"
181
182 /* default value for undefined parameter */
183 #define ARG_DEFAULT             "[DEFAULT]"
184
185 /* default values for undefined configuration file parameters */
186 #define ARG_UNDEFINED           "-1000000"
187 #define ARG_UNDEFINED_VALUE     (atoi(ARG_UNDEFINED))
188
189 /* definitions for game sub-directories */
190 #ifndef RO_GAME_DIR
191 #define RO_GAME_DIR             "."
192 #endif
193
194 #ifndef RW_GAME_DIR
195 #define RW_GAME_DIR             "."
196 #endif
197
198 #define RO_BASE_PATH            RO_GAME_DIR
199 #define RW_BASE_PATH            RW_GAME_DIR
200
201 #define GRAPHICS_DIRECTORY      "graphics"
202 #define SOUNDS_DIRECTORY        "sounds"
203 #define MUSIC_DIRECTORY         "music"
204 #define LEVELS_DIRECTORY        "levels"
205 #define TAPES_DIRECTORY         "tapes"
206 #define SCORES_DIRECTORY        "scores"
207 #define DOCS_DIRECTORY          "docs"
208
209 #if !defined(PLATFORM_MSDOS)
210 #define GFX_CLASSIC_SUBDIR      "gfx_classic"
211 #define SND_CLASSIC_SUBDIR      "snd_classic"
212 #define MUS_CLASSIC_SUBDIR      "mus_classic"
213 #else
214 #define GFX_CLASSIC_SUBDIR      "gfx_orig"
215 #define SND_CLASSIC_SUBDIR      "snd_orig"
216 #define MUS_CLASSIC_SUBDIR      "mus_orig"
217 #endif
218
219
220 /* areas in bitmap PIX_DOOR */
221 /* meaning in PIX_DB_DOOR: (3 PAGEs)
222    PAGEX1: 1. buffer for DOOR_1
223    PAGEX2: 2. buffer for DOOR_1
224    PAGEX3: buffer for animations
225 */
226
227 #define DOOR_GFX_PAGESIZE       (gfx.dxsize)
228 #define DOOR_GFX_PAGEX1         (0 * DOOR_GFX_PAGESIZE)
229 #define DOOR_GFX_PAGEX2         (1 * DOOR_GFX_PAGESIZE)
230 #define DOOR_GFX_PAGEX3         (2 * DOOR_GFX_PAGESIZE)
231 #define DOOR_GFX_PAGEX4         (3 * DOOR_GFX_PAGESIZE)
232 #define DOOR_GFX_PAGEX5         (4 * DOOR_GFX_PAGESIZE)
233 #define DOOR_GFX_PAGEX6         (5 * DOOR_GFX_PAGESIZE)
234 #define DOOR_GFX_PAGEX7         (6 * DOOR_GFX_PAGESIZE)
235 #define DOOR_GFX_PAGEX8         (7 * DOOR_GFX_PAGESIZE)
236 #define DOOR_GFX_PAGEY1         (0)
237 #define DOOR_GFX_PAGEY2         (gfx.dysize)
238
239
240 /* macros for version handling */
241 #define VERSION_IDENT(x,y,z)    ((x) * 1000000 + (y) * 10000 + (z) * 100)
242 #define RELEASE_IDENT(x,y,z,r)  (VERSION_IDENT(x,y,z) + (r))
243 #define VERSION_MAJOR(x)        ((x) / 1000000)
244 #define VERSION_MINOR(x)        (((x) % 1000000) / 10000)
245 #define VERSION_PATCH(x)        (((x) % 10000) / 100)
246 #define VERSION_RELEASE(x)      ((x) % 100)
247
248
249 /* macros for parent/child process identification */
250 #if defined(PLATFORM_UNIX)
251 #define IS_PARENT_PROCESS()     (audio.mixer_pid != getpid())
252 #define IS_CHILD_PROCESS()      (audio.mixer_pid == getpid())
253 #define HAS_CHILD_PROCESS()     (audio.mixer_pid > 0)
254 #else
255 #define IS_PARENT_PROCESS()     TRUE
256 #define IS_CHILD_PROCESS()      FALSE
257 #define HAS_CHILD_PROCESS()     FALSE
258 #endif
259
260
261 /* values for artwork type */
262 #define ARTWORK_TYPE_GRAPHICS   0
263 #define ARTWORK_TYPE_SOUNDS     1
264 #define ARTWORK_TYPE_MUSIC      2
265
266 #define NUM_ARTWORK_TYPES       3
267
268
269 /* values for tree type (chosen to match artwork type) */
270 #define TREE_TYPE_UNDEFINED     -1
271 #define TREE_TYPE_GRAPHICS_DIR  ARTWORK_TYPE_GRAPHICS
272 #define TREE_TYPE_SOUNDS_DIR    ARTWORK_TYPE_SOUNDS
273 #define TREE_TYPE_MUSIC_DIR     ARTWORK_TYPE_MUSIC
274 #define TREE_TYPE_LEVEL_DIR     3
275
276 #define NUM_TREE_TYPES          4
277
278
279 /* values for artwork handling */
280 #define LEVELDIR_ARTWORK_SET(leveldir, type)                            \
281                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
282                                  (leveldir)->graphics_set :             \
283                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
284                                  (leveldir)->sounds_set :               \
285                                  (leveldir)->music_set)
286
287 #define LEVELDIR_ARTWORK_PATH(leveldir, type)                           \
288                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
289                                  (leveldir)->graphics_path :            \
290                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
291                                  (leveldir)->sounds_path :              \
292                                  (leveldir)->music_path)
293
294 #define SETUP_ARTWORK_SET(setup, type)                                  \
295                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
296                                  (setup).graphics_set :                 \
297                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
298                                  (setup).sounds_set :                   \
299                                  (setup).music_set)
300
301 #define SETUP_OVERRIDE_ARTWORK(setup, type)                             \
302                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
303                                  (setup).override_level_graphics :      \
304                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
305                                  (setup).override_level_sounds :        \
306                                  (setup).override_level_music)
307
308 #define ARTWORK_FIRST_NODE(artwork, type)                               \
309                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
310                                  (artwork).gfx_first :  \
311                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
312                                  (artwork).snd_first :  \
313                                  (artwork).mus_first)
314
315 #define ARTWORK_CURRENT_IDENTIFIER(artwork, type)                       \
316                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
317                                  (artwork).gfx_current_identifier :     \
318                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
319                                  (artwork).snd_current_identifier :     \
320                                  (artwork).mus_current_identifier)
321
322
323 /* type definitions */
324 typedef int (*EventFilter)(const Event *);
325
326
327 /* structure definitions */
328
329 struct ProgramInfo
330 {
331   char *command_basename;
332   char *userdata_directory;
333
334   char *program_title;
335   char *window_title;
336   char *icon_title;
337
338   char *x11_icon_filename;
339   char *x11_iconmask_filename;
340   char *msdos_cursor_filename;
341
342   char *cookie_prefix;
343   char *filename_prefix;        /* prefix to cut off from DOS filenames */
344
345   int version_major;
346   int version_minor;
347   int version_patch;
348
349   void (*exit_function)(int);
350 };
351
352 struct OptionInfo
353 {
354   char *display_name;
355   char *server_host;
356   int server_port;
357
358   char *ro_base_directory;
359   char *rw_base_directory;
360   char *level_directory;
361   char *graphics_directory;
362   char *sounds_directory;
363   char *music_directory;
364   char *docs_directory;
365   char *execute_command;
366
367   boolean serveronly;
368   boolean network;
369   boolean verbose;
370   boolean debug;
371 };
372
373 struct VideoSystemInfo
374 {
375   int default_depth;
376   int width, height, depth;
377   boolean fullscreen_available;
378   boolean fullscreen_enabled;
379 };
380
381 struct AudioSystemInfo
382 {
383   boolean sound_available;
384   boolean loops_available;
385   boolean music_available;
386
387   boolean sound_enabled;
388   boolean sound_deactivated;    /* for temporarily disabling sound */
389
390   int mixer_pipe[2];
391   int mixer_pid;
392   char *device_name;
393   int device_fd;
394
395   int num_channels;
396   int music_channel;
397   int first_sound_channel;
398 };
399
400 struct FontBitmapInfo
401 {
402   Bitmap *bitmap;
403   int src_x, src_y;             /* start position of animation frames */
404   int width, height;            /* width/height of each animation frame */
405   int draw_x, draw_y;           /* offset for drawing font characters */
406   int num_chars;
407   int num_chars_per_line;
408
409 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
410   Pixmap *clip_mask;            /* single-char-only clip mask array for X11 */
411 #endif
412 };
413
414 struct GfxInfo
415 {
416   int sx, sy;
417   int sxsize, sysize;
418   int real_sx, real_sy;
419   int full_sxsize, full_sysize;
420   int scrollbuffer_width, scrollbuffer_height;
421
422   int dx, dy;
423   int dxsize, dysize;
424
425   int vx, vy;
426   int vxsize, vysize;
427
428   int draw_deactivation_mask;
429   int draw_background_mask;
430
431   Bitmap *field_save_buffer;
432
433   Bitmap *background_bitmap;
434   int background_bitmap_mask;
435
436   int num_fonts;
437   struct FontBitmapInfo *font_bitmap_info;
438   int (*select_font_function)(int);
439
440   int anim_random_frame;
441 };
442
443 struct JoystickInfo
444 {
445   int status;
446   int fd[MAX_PLAYERS];          /* file descriptor of player's joystick */
447 };
448
449 struct SetupJoystickInfo
450 {
451   char *device_name;            /* device name of player's joystick */
452
453   int xleft, xmiddle, xright;
454   int yupper, ymiddle, ylower;
455   int snap;
456   int bomb;
457 };
458
459 struct SetupKeyboardInfo
460 {
461   Key left;
462   Key right;
463   Key up;
464   Key down;
465   Key snap;
466   Key bomb;
467 };
468
469 struct SetupInputInfo
470 {
471   boolean use_joystick;
472   struct SetupJoystickInfo joy;
473   struct SetupKeyboardInfo key;
474 };
475
476 struct SetupEditorInfo
477 {
478   boolean el_boulderdash;
479   boolean el_emerald_mine;
480   boolean el_more;
481   boolean el_sokoban;
482   boolean el_supaplex;
483   boolean el_diamond_caves;
484   boolean el_dx_boulderdash;
485   boolean el_chars;
486   boolean el_custom;
487   boolean el_custom_more;
488 };
489
490 struct SetupShortcutInfo
491 {
492   Key save_game;
493   Key load_game;
494   Key toggle_pause;
495 };
496
497 struct SetupSystemInfo
498 {
499   char *sdl_audiodriver;
500   int audio_fragment_size;
501 };
502
503 struct SetupInfo
504 {
505   char *player_name;
506
507   boolean sound;
508   boolean sound_loops;
509   boolean sound_music;
510   boolean sound_simple;
511   boolean toons;
512   boolean double_buffering;
513   boolean direct_draw;          /* !double_buffering (redundant!) */
514   boolean scroll_delay;
515   boolean soft_scrolling;
516   boolean fading;
517   boolean autorecord;
518   boolean quick_doors;
519   boolean team_mode;
520   boolean handicap;
521   boolean time_limit;
522   boolean fullscreen;
523   boolean ask_on_escape;
524
525   char *graphics_set;
526   char *sounds_set;
527   char *music_set;
528   boolean override_level_graphics;
529   boolean override_level_sounds;
530   boolean override_level_music;
531
532   struct SetupEditorInfo editor;
533   struct SetupShortcutInfo shortcut;
534   struct SetupInputInfo input[MAX_PLAYERS];
535   struct SetupSystemInfo system;
536   struct OptionInfo options;
537 };
538
539 struct TreeInfo
540 {
541   struct TreeInfo **node_top;           /* topmost node in tree */
542   struct TreeInfo *node_parent;         /* parent level directory info */
543   struct TreeInfo *node_group;          /* level group sub-directory info */
544   struct TreeInfo *next;                /* next level series structure node */
545
546   int cl_first;         /* internal control field for setup screen */
547   int cl_cursor;        /* internal control field for setup screen */
548
549   int type;             /* type of tree content */
550
551   /* fields for "type == TREE_TYPE_LEVEL_DIR" */
552
553   char *filename;       /* tree info sub-directory basename (may be ".") */
554   char *fullpath;       /* complete path relative to tree base directory */
555   char *basepath;       /* absolute base path of tree base directory */
556   char *identifier;     /* identifier string for configuration files */
557   char *name;           /* tree info name, as displayed in selection menues */
558   char *name_sorting;   /* optional sorting name for correct name sorting */
559   char *author;         /* level or artwork author name */
560   char *imported_from;  /* optional comment for imported levels or artwork */
561
562   char *graphics_set;   /* optional custom graphics set (level tree only) */
563   char *sounds_set;     /* optional custom sounds set (level tree only) */
564   char *music_set;      /* optional custom music set (level tree only) */
565   char *graphics_path;  /* path to optional custom graphics set (level only) */
566   char *sounds_path;    /* path to optional custom sounds set (level only) */
567   char *music_path;     /* path to optional custom music set (level only) */
568
569   int levels;           /* number of levels in level series */
570   int first_level;      /* first level number (to allow start with 0 or 1) */
571   int last_level;       /* last level number (automatically calculated) */
572   int sort_priority;    /* sort levels by 'sort_priority' and then by name */
573
574   boolean level_group;  /* directory contains more level series directories */
575   boolean parent_link;  /* entry links back to parent directory */
576   boolean user_defined; /* user defined levels are stored in home directory */
577   boolean readonly;     /* readonly levels can not be changed with editor */
578
579   int color;            /* color to use on selection screen for this level */
580   char *class_desc;     /* description of level series class */
581   int handicap_level;   /* number of the lowest unsolved level */
582 };
583
584 typedef struct TreeInfo TreeInfo;
585 typedef struct TreeInfo LevelDirTree;
586 typedef struct TreeInfo ArtworkDirTree;
587 typedef struct TreeInfo GraphicsDirTree;
588 typedef struct TreeInfo SoundsDirTree;
589 typedef struct TreeInfo MusicDirTree;
590
591 struct ArtworkInfo
592 {
593   GraphicsDirTree *gfx_first;
594   GraphicsDirTree *gfx_current;
595   SoundsDirTree *snd_first;
596   SoundsDirTree *snd_current;
597   MusicDirTree *mus_first;
598   MusicDirTree *mus_current;
599
600   char *gfx_current_identifier;
601   char *snd_current_identifier;
602   char *mus_current_identifier;
603 };
604
605 struct ValueTextInfo
606 {
607   int value;
608   char *text;
609 };
610
611 struct ConfigInfo
612 {
613   char *token;
614   char *value;
615   int type;
616 };
617
618 struct TokenIntPtrInfo
619 {
620   char *token;
621   int *value;
622 };
623
624 struct FileInfo
625 {
626   char *token;
627
628   char *default_filename;
629   char *filename;
630
631   char **default_parameter;                     /* array of file parameters */
632   char **parameter;                             /* array of file parameters */
633
634   boolean redefined;
635 };
636
637 struct SetupFileList
638 {
639   char *token;
640   char *value;
641
642   struct SetupFileList *next;
643 };
644
645 struct ListNodeInfo
646 {
647   char *source_filename;                        /* primary key for node list */
648   int num_references;
649 };
650
651 struct PropertyMapping
652 {
653   int base_index;
654   int ext1_index;
655   int ext2_index;
656   int ext3_index;
657
658   int artwork_index;
659 };
660
661 struct ArtworkListInfo
662 {
663   int type;                                     /* type of artwork */
664
665   int num_file_list_entries;
666   int num_dynamic_file_list_entries;
667   struct FileInfo *file_list;                   /* static artwork file array */
668   struct FileInfo *dynamic_file_list;           /* dynamic artwrk file array */
669
670   int num_suffix_list_entries;
671   struct ConfigInfo *suffix_list;               /* parameter suffixes array */
672
673   int num_base_prefixes;
674   int num_ext1_suffixes;
675   int num_ext2_suffixes;
676   int num_ext3_suffixes;
677   char **base_prefixes;                         /* base token prefixes array */
678   char **ext1_suffixes;                         /* property suffixes array 1 */
679   char **ext2_suffixes;                         /* property suffixes array 2 */
680   char **ext3_suffixes;                         /* property suffixes array 3 */
681
682   int num_ignore_tokens;
683   char **ignore_tokens;                         /* file tokens to be ignored */
684
685   int num_property_mapping_entries;
686   struct PropertyMapping *property_mapping;     /* mapping token -> artwork */
687
688   int sizeof_artwork_list_entry;
689
690   struct ListNodeInfo **artwork_list;           /* static artwork node array */
691   struct ListNodeInfo **dynamic_artwork_list;   /* dynamic artwrk node array */
692   struct ListNode *content_list;                /* dynamic artwork node list */
693
694   void *(*load_artwork)(char *);                /* constructor function */
695   void (*free_artwork)(void *);                 /* destructor function */
696 };
697
698
699 /* ========================================================================= */
700 /* exported variables                                                        */
701 /* ========================================================================= */
702
703 extern struct ProgramInfo       program;
704 extern struct OptionInfo        options;
705 extern struct VideoSystemInfo   video;
706 extern struct AudioSystemInfo   audio;
707 extern struct GfxInfo           gfx;
708 extern struct AnimInfo          anim;
709 extern struct ArtworkInfo       artwork;
710 extern struct JoystickInfo      joystick;
711 extern struct SetupInfo         setup;
712
713 extern LevelDirTree            *leveldir_first;
714 extern LevelDirTree            *leveldir_current;
715 extern int                      level_nr;
716
717 extern Display                 *display;
718 extern Visual                  *visual;
719 extern int                      screen;
720 extern Colormap                 cmap;
721
722 extern DrawWindow              *window;
723 extern DrawBuffer              *backbuffer;
724 extern DrawBuffer              *drawto;
725
726 extern int                      button_status;
727 extern boolean                  motion_status;
728
729 extern int                      redraw_mask;
730 extern int                      redraw_tiles;
731
732 extern int                      FrameCounter;
733
734
735 /* function definitions */
736
737 void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
738                      char *, char *, char *, int);
739
740 void InitExitFunction(void (*exit_function)(int));
741 void InitPlatformDependentStuff(void);
742 void ClosePlatformDependentStuff(void);
743
744 void InitGfxFieldInfo(int, int, int, int, int, int, int, int, Bitmap *);
745 void InitGfxDoor1Info(int, int, int, int);
746 void InitGfxDoor2Info(int, int, int, int);
747 void InitGfxScrollbufferInfo(int, int);
748 void SetDrawDeactivationMask(int);
749 void SetDrawBackgroundMask(int);
750 void SetMainBackgroundBitmap(Bitmap *);
751 void SetDoorBackgroundBitmap(Bitmap *);
752
753 inline void InitVideoDisplay(void);
754 inline void CloseVideoDisplay(void);
755 inline void InitVideoBuffer(DrawBuffer **,DrawWindow **, int,int,int, boolean);
756 inline Bitmap *CreateBitmapStruct(void);
757 inline Bitmap *CreateBitmap(int, int, int);
758 inline void FreeBitmap(Bitmap *);
759 inline void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
760 inline void FillRectangle(Bitmap *, int, int, int, int, Pixel);
761 inline void ClearRectangle(Bitmap *, int, int, int, int);
762 inline void ClearRectangleOnBackground(Bitmap *, int, int, int, int);
763 inline void SetClipMask(Bitmap *, GC, Pixmap);
764 inline void SetClipOrigin(Bitmap *, GC, int, int);
765 inline void BlitBitmapMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
766 inline boolean DrawingOnBackground(int, int);
767 inline void BlitBitmapOnBackground(Bitmap *, Bitmap *, int, int, int, int, int,
768                                    int);
769 inline void DrawSimpleWhiteLine(Bitmap *, int, int, int, int);
770 inline void DrawLines(Bitmap *, struct XY *, int, Pixel);
771 inline Pixel GetPixel(Bitmap *, int, int);
772 inline Pixel GetPixelFromRGB(Bitmap *, unsigned int,unsigned int,unsigned int);
773 inline Pixel GetPixelFromRGBcompact(Bitmap *, unsigned int);
774
775 inline void FlushDisplay(void);
776 inline void SyncDisplay(void);
777 inline void KeyboardAutoRepeatOn(void);
778 inline void KeyboardAutoRepeatOff(void);
779 inline boolean PointerInWindow(DrawWindow *);
780 inline boolean SetVideoMode(boolean);
781 inline boolean ChangeVideoModeIfNeeded(boolean);
782
783 Bitmap *LoadImage(char *);
784 Bitmap *LoadCustomImage(char *);
785 void ReloadCustomImage(Bitmap *, char *);
786
787 Bitmap *ZoomBitmap(Bitmap *, int, int);
788 void CreateBitmapWithSmallBitmaps(Bitmap *);
789
790 void SetMouseCursor(int);
791
792 inline void OpenAudio(void);
793 inline void CloseAudio(void);
794 inline void SetAudioMode(boolean);
795
796 inline void InitEventFilter(EventFilter);
797 inline boolean PendingEvent(void);
798 inline void NextEvent(Event *event);
799 inline Key GetEventKey(KeyEvent *, boolean);
800 inline KeyMod HandleKeyModState(Key, int);
801 inline KeyMod GetKeyModState();
802 inline boolean CheckCloseWindowEvent(ClientMessageEvent *);
803
804 inline void InitJoysticks();
805 inline boolean ReadJoystick(int, int *, int *, boolean *, boolean *);
806
807 #endif /* SYSTEM_H */