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