moved setting preferred network player from game start to setup menu
[rocksndiamonds.git] / src / libgame / system.h
1 // ============================================================================
2 // Artsoft Retro-Game Library
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  http://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // system.h
10 // ============================================================================
11
12 #ifndef SYSTEM_H
13 #define SYSTEM_H
14
15 #include "platform.h"
16 #include "types.h"
17
18
19 #if defined(PLATFORM_MACOSX)
20 #include "macosx.h"
21 #elif defined(PLATFORM_WIN32)
22 #include "windows.h"
23 #elif defined(PLATFORM_ANDROID)
24 #include "android.h"
25 #endif
26
27 #include "sdl.h"
28
29
30 /* the additional 'b' is needed for Win32 to open files in binary mode */
31 #define MODE_READ                       "rb"
32 #define MODE_WRITE                      "wb"
33 #define MODE_APPEND                     "ab"
34
35 #define DEFAULT_DEPTH                   0
36
37 #define BLIT_OPAQUE                     0
38 #define BLIT_MASKED                     1
39 #define BLIT_INVERSE                    2
40 #define BLIT_ON_BACKGROUND              3
41
42 /* values for fullscreen status */
43 #define FULLSCREEN_NOT_AVAILABLE        FALSE
44 #define FULLSCREEN_AVAILABLE            TRUE
45
46 /* values for window scaling */
47 #define WINDOW_SCALING_NOT_AVAILABLE    FALSE
48 #define WINDOW_SCALING_AVAILABLE        TRUE
49
50 #define MIN_WINDOW_SCALING_PERCENT      30
51 #define STD_WINDOW_SCALING_PERCENT      100
52 #define MAX_WINDOW_SCALING_PERCENT      400
53 #define STEP_WINDOW_SCALING_PERCENT     10
54
55 /* values for window scaling quality */
56 #define SCALING_QUALITY_NEAREST         "nearest"
57 #define SCALING_QUALITY_LINEAR          "linear"
58 #define SCALING_QUALITY_BEST            "best"
59
60 #define SCALING_QUALITY_DEFAULT         SCALING_QUALITY_LINEAR
61
62 /* values for screen rendering mode */
63 #define STR_SPECIAL_RENDERING_OFF       "stream_texture_only"
64 #define STR_SPECIAL_RENDERING_BITMAP    "bitmap_and_stream_texture"
65 #define STR_SPECIAL_RENDERING_TARGET    "target_texture_only"
66 #define STR_SPECIAL_RENDERING_DOUBLE    "stream_and_target_texture"
67
68 #if defined(TARGET_SDL2)
69 #define STR_SPECIAL_RENDERING_DEFAULT   STR_SPECIAL_RENDERING_DOUBLE
70 #else
71 #define STR_SPECIAL_RENDERING_DEFAULT   STR_SPECIAL_RENDERING_BITMAP
72 #endif
73
74 #define SPECIAL_RENDERING_OFF           0
75 #define SPECIAL_RENDERING_BITMAP        1
76 #define SPECIAL_RENDERING_TARGET        2
77 #define SPECIAL_RENDERING_DOUBLE        3
78
79 #if defined(TARGET_SDL2)
80 #define SPECIAL_RENDERING_DEFAULT       SPECIAL_RENDERING_DOUBLE
81 #else
82 #define SPECIAL_RENDERING_DEFAULT       SPECIAL_RENDERING_BITMAP
83 #endif
84
85 /* values for touch control */
86 #define TOUCH_CONTROL_OFF               "off"
87 #define TOUCH_CONTROL_VIRTUAL_BUTTONS   "virtual_buttons"
88 #define TOUCH_CONTROL_WIPE_GESTURES     "wipe_gestures"
89 #define TOUCH_CONTROL_FOLLOW_FINGER     "follow_finger"
90
91 #if defined(PLATFORM_ANDROID)
92 #define TOUCH_CONTROL_DEFAULT           TOUCH_CONTROL_VIRTUAL_BUTTONS
93 #else
94 #define TOUCH_CONTROL_DEFAULT           TOUCH_CONTROL_OFF
95 #endif
96
97 #define TOUCH_MOVE_DISTANCE_DEFAULT     2
98 #define TOUCH_DROP_DISTANCE_DEFAULT     5
99 #define TOUCH_TRANSPARENCY_DEFAULT      50
100
101 #define ALPHA_FROM_TRANSPARENCY(x)      ((100 - x) * SDL_ALPHA_OPAQUE / 100)
102 #define ALPHA_FADING_STEPSIZE(x)        ((x) / 25)
103
104 /* values for special settings for mobile devices */
105 #if defined(PLATFORM_ANDROID)
106 #define USE_TOUCH_INPUT_OVERLAY
107 #define USE_COMPLETE_DISPLAY
108 #define HAS_SCREEN_KEYBOARD
109 #define SCREEN_KEYBOARD_POS(h)          ((h) / 2)
110 #endif
111
112 /* default input keys */
113 #define DEFAULT_KEY_LEFT                KSYM_Left
114 #define DEFAULT_KEY_RIGHT               KSYM_Right
115 #define DEFAULT_KEY_UP                  KSYM_Up
116 #define DEFAULT_KEY_DOWN                KSYM_Down
117 #if defined(PLATFORM_MACOSX)
118 #define DEFAULT_KEY_SNAP                KSYM_Control_L
119 #define DEFAULT_KEY_DROP                KSYM_KP_Enter
120 #else
121 #define DEFAULT_KEY_SNAP                KSYM_Control_L
122 #define DEFAULT_KEY_DROP                KSYM_Control_R
123 #endif
124 #define DEFAULT_KEY_OKAY                KSYM_Return
125 #define DEFAULT_KEY_CANCEL              KSYM_Escape
126
127 /* default shortcut keys */
128 #define DEFAULT_KEY_SAVE_GAME           KSYM_F1
129 #define DEFAULT_KEY_LOAD_GAME           KSYM_F2
130 #define DEFAULT_KEY_TOGGLE_PAUSE        KSYM_space
131 #define DEFAULT_KEY_FOCUS_PLAYER_1      KSYM_F5
132 #define DEFAULT_KEY_FOCUS_PLAYER_2      KSYM_F6
133 #define DEFAULT_KEY_FOCUS_PLAYER_3      KSYM_F7
134 #define DEFAULT_KEY_FOCUS_PLAYER_4      KSYM_F8
135 #define DEFAULT_KEY_FOCUS_PLAYER_ALL    KSYM_F9
136 #define DEFAULT_KEY_TAPE_EJECT          KSYM_UNDEFINED
137 #define DEFAULT_KEY_TAPE_EXTRA          KSYM_UNDEFINED
138 #define DEFAULT_KEY_TAPE_STOP           KSYM_UNDEFINED
139 #define DEFAULT_KEY_TAPE_PAUSE          KSYM_UNDEFINED
140 #define DEFAULT_KEY_TAPE_RECORD         KSYM_UNDEFINED
141 #define DEFAULT_KEY_TAPE_PLAY           KSYM_UNDEFINED
142 #define DEFAULT_KEY_SOUND_SIMPLE        KSYM_UNDEFINED
143 #define DEFAULT_KEY_SOUND_LOOPS         KSYM_UNDEFINED
144 #define DEFAULT_KEY_SOUND_MUSIC         KSYM_UNDEFINED
145 #define DEFAULT_KEY_SNAP_LEFT           KSYM_UNDEFINED
146 #define DEFAULT_KEY_SNAP_RIGHT          KSYM_UNDEFINED
147 #define DEFAULT_KEY_SNAP_UP             KSYM_UNDEFINED
148 #define DEFAULT_KEY_SNAP_DOWN           KSYM_UNDEFINED
149
150 /* default debug setup keys and values */
151 #define DEFAULT_FRAME_DELAY_0           20              // 100 % speed
152 #define DEFAULT_FRAME_DELAY_1           500             // 4 % speed
153 #define DEFAULT_FRAME_DELAY_2           250             // 8 % speed
154 #define DEFAULT_FRAME_DELAY_3           125             // 16 % speed
155 #define DEFAULT_FRAME_DELAY_4           60              // 33 % speed
156 #define DEFAULT_FRAME_DELAY_5           40              // 50 % speed
157 #define DEFAULT_FRAME_DELAY_6           30              // 66 % speed
158 #define DEFAULT_FRAME_DELAY_7           10              // 200 % speed
159 #define DEFAULT_FRAME_DELAY_8           5               // 400 % speed
160 #define DEFAULT_FRAME_DELAY_9           0               // maximum speed
161
162 #define DEFAULT_KEY_FRAME_DELAY_0       KSYM_0
163 #define DEFAULT_KEY_FRAME_DELAY_1       KSYM_1
164 #define DEFAULT_KEY_FRAME_DELAY_2       KSYM_2
165 #define DEFAULT_KEY_FRAME_DELAY_3       KSYM_3
166 #define DEFAULT_KEY_FRAME_DELAY_4       KSYM_4
167 #define DEFAULT_KEY_FRAME_DELAY_5       KSYM_5
168 #define DEFAULT_KEY_FRAME_DELAY_6       KSYM_6
169 #define DEFAULT_KEY_FRAME_DELAY_7       KSYM_7
170 #define DEFAULT_KEY_FRAME_DELAY_8       KSYM_8
171 #define DEFAULT_KEY_FRAME_DELAY_9       KSYM_9
172
173 #define NUM_DEBUG_FRAME_DELAY_KEYS      10
174
175 #define DEFAULT_FRAME_DELAY_USE_MOD_KEY FALSE
176 #define DEFAULT_FRAME_DELAY_GAME_ONLY   TRUE
177
178 /* values for key_status */
179 #define KEY_NOT_PRESSED                 FALSE
180 #define KEY_RELEASED                    FALSE
181 #define KEY_PRESSED                     TRUE
182
183 /* values for button status */
184 #define MB_NOT_PRESSED                  FALSE
185 #define MB_NOT_RELEASED                 TRUE
186 #define MB_RELEASED                     FALSE
187 #define MB_PRESSED                      TRUE
188 #define MB_MENU_CHOICE                  FALSE
189 #define MB_MENU_MARK                    TRUE
190 #define MB_MENU_INITIALIZE              (-1)
191 #define MB_MENU_LEAVE                   (-2)
192 #define MB_LEFTBUTTON                   1
193 #define MB_MIDDLEBUTTON                 2
194 #define MB_RIGHTBUTTON                  3
195 #define MB_WHEEL_UP                     4
196 #define MB_WHEEL_DOWN                   5
197 #define MB_WHEEL_LEFT                   6
198 #define MB_WHEEL_RIGHT                  7
199 #define IS_WHEEL_BUTTON_VERTICAL(b)     ((b) == MB_WHEEL_UP ||          \
200                                          (b) == MB_WHEEL_DOWN)
201 #define IS_WHEEL_BUTTON_HORIZONTAL(b)   ((b) == MB_WHEEL_LEFT ||        \
202                                          (b) == MB_WHEEL_RIGHT)
203 #define IS_WHEEL_BUTTON(b)              (IS_WHEEL_BUTTON_VERTICAL(b) || \
204                                          IS_WHEEL_BUTTON_HORIZONTAL(b))
205 #define DEFAULT_WHEEL_STEPS             3
206
207 #define BUTTON_STEPSIZE(b)              ((b) == MB_LEFTBUTTON   ?  1 :  \
208                                          (b) == MB_MIDDLEBUTTON ?  5 :  \
209                                          (b) == MB_RIGHTBUTTON  ? 10 : 1)
210
211 /* values for move directions */
212 #define MV_BIT_LEFT                     0
213 #define MV_BIT_RIGHT                    1
214 #define MV_BIT_UP                       2
215 #define MV_BIT_DOWN                     3
216
217 #define NUM_DIRECTIONS                  4
218
219 /* diagonal movement directions are used in a different contect than buttons */
220 #define MV_BIT_UPLEFT                   4
221 #define MV_BIT_UPRIGHT                  5
222 #define MV_BIT_DOWNLEFT                 6
223 #define MV_BIT_DOWNRIGHT                7
224
225 #define NUM_DIRECTIONS_FULL             8
226
227 /* values for special "button" bitmasks */
228 #define BUTTON_1                        4
229 #define BUTTON_2                        5
230
231 #define NUM_PLAYER_ACTIONS              6
232
233 /* values for special "focus player" bitmasks */
234 #define BIT_SET_FOCUS                   6
235
236 /* values for drawing stages for global animations */
237 #define DRAW_GLOBAL_ANIM_STAGE_1        1
238 #define DRAW_GLOBAL_ANIM_STAGE_2        2
239
240 /* values for drawing target (various functions) */
241 #define DRAW_TO_BACKBUFFER              0
242 #define DRAW_TO_FIELDBUFFER             1
243 #define DRAW_TO_SCREEN                  2
244 #define DRAW_TO_FADE_SOURCE             3
245 #define DRAW_TO_FADE_TARGET             4
246
247 /* values for move directions and special "button" key bitmasks */
248 #define MV_NONE                 0
249 #define MV_LEFT                 (1 << MV_BIT_LEFT)
250 #define MV_RIGHT                (1 << MV_BIT_RIGHT)
251 #define MV_UP                   (1 << MV_BIT_UP)
252 #define MV_DOWN                 (1 << MV_BIT_DOWN)
253
254 #define MV_UPLEFT               (MV_UP   | MV_LEFT)
255 #define MV_UPRIGHT              (MV_UP   | MV_RIGHT)
256 #define MV_DOWNLEFT             (MV_DOWN | MV_LEFT)
257 #define MV_DOWNRIGHT            (MV_DOWN | MV_RIGHT)
258
259 #define MV_HORIZONTAL           (MV_LEFT | MV_RIGHT)
260 #define MV_VERTICAL             (MV_UP   | MV_DOWN)
261 #define MV_ALL_DIRECTIONS       (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
262 #define MV_ANY_DIRECTION        (MV_ALL_DIRECTIONS)
263 #define MV_NO_DIRECTION         (MV_NONE)
264
265 #define KEY_BUTTON_1            (1 << BUTTON_1)
266 #define KEY_BUTTON_2            (1 << BUTTON_2)
267 #define KEY_BUTTON_SNAP         KEY_BUTTON_1
268 #define KEY_BUTTON_DROP         KEY_BUTTON_2
269 #define KEY_MOTION              (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
270 #define KEY_BUTTON              (KEY_BUTTON_1 | KEY_BUTTON_2)
271 #define KEY_ACTION              (KEY_MOTION | KEY_BUTTON)
272
273 #define KEY_SET_FOCUS           (1 << BIT_SET_FOCUS)
274
275 #define MV_DIR_FROM_BIT(x)      ((x) < NUM_DIRECTIONS ? 1 << (x) :        \
276                                  (x) == MV_BIT_UPLEFT    ? MV_UPLEFT    : \
277                                  (x) == MV_BIT_UPRIGHT   ? MV_UPRIGHT   : \
278                                  (x) == MV_BIT_DOWNLEFT  ? MV_DOWNLEFT  : \
279                                  (x) == MV_BIT_DOWNRIGHT ? MV_DOWNRIGHT : \
280                                  MV_NONE)
281
282 #define MV_DIR_TO_BIT(x)        ((x) == MV_LEFT      ? MV_BIT_LEFT      : \
283                                  (x) == MV_RIGHT     ? MV_BIT_RIGHT     : \
284                                  (x) == MV_UP        ? MV_BIT_UP        : \
285                                  (x) == MV_DOWN      ? MV_BIT_DOWN      : \
286                                  (x) == MV_UPLEFT    ? MV_BIT_UPLEFT    : \
287                                  (x) == MV_UPRIGHT   ? MV_BIT_UPRIGHT   : \
288                                  (x) == MV_DOWNLEFT  ? MV_BIT_DOWNLEFT  : \
289                                  (x) == MV_DOWNRIGHT ? MV_BIT_DOWNRIGHT : \
290                                  MV_BIT_DOWN)
291
292 #define MV_DIR_OPPOSITE(x)      ((x) == MV_LEFT      ? MV_RIGHT     : \
293                                  (x) == MV_RIGHT     ? MV_LEFT      : \
294                                  (x) == MV_UP        ? MV_DOWN      : \
295                                  (x) == MV_DOWN      ? MV_UP        : \
296                                  (x) == MV_UPLEFT    ? MV_DOWNRIGHT : \
297                                  (x) == MV_UPRIGHT   ? MV_DOWNLEFT  : \
298                                  (x) == MV_DOWNLEFT  ? MV_UPRIGHT   : \
299                                  (x) == MV_DOWNRIGHT ? MV_UPLEFT    : \
300                                  MV_NONE)
301
302 /* values for animation mode (frame order and direction) */
303 /* (stored in level files -- never change existing values) */
304 #define ANIM_NONE               0
305 #define ANIM_LOOP               (1 << 0)
306 #define ANIM_LINEAR             (1 << 1)
307 #define ANIM_PINGPONG           (1 << 2)
308 #define ANIM_PINGPONG2          (1 << 3)
309 #define ANIM_RANDOM             (1 << 4)
310 #define ANIM_CE_VALUE           (1 << 5)
311 #define ANIM_CE_SCORE           (1 << 6)
312 #define ANIM_CE_DELAY           (1 << 7)
313 #define ANIM_REVERSE            (1 << 8)
314 #define ANIM_OPAQUE_PLAYER      (1 << 9)
315
316 /* values for special (non game element) animation modes */
317 /* (not stored in level files -- can be changed, if needed) */
318 #define ANIM_HORIZONTAL         (1 << 10)
319 #define ANIM_VERTICAL           (1 << 11)
320 #define ANIM_CENTERED           (1 << 12)
321 #define ANIM_STATIC_PANEL       (1 << 13)
322 #define ANIM_ALL                (1 << 14)
323 #define ANIM_ONCE               (1 << 15)
324
325 #define ANIM_DEFAULT            ANIM_LOOP
326
327 /* values for special drawing styles (currently only for crumbled graphics) */
328 #define STYLE_NONE              0
329 #define STYLE_ACCURATE_BORDERS  (1 << 0)
330 #define STYLE_INNER_CORNERS     (1 << 1)
331 #define STYLE_REVERSE           (1 << 2)
332
333 /* values for special event handling style (used for global animation) */
334 #define STYLE_PASSTHROUGH       (1 << 3)
335 #define STYLE_MULTIPLE_ACTIONS  (1 << 4)
336
337 #define STYLE_DEFAULT           STYLE_NONE
338
339 /* values for special global animation events */
340 #define ANIM_EVENT_NONE         0
341 #define ANIM_EVENT_SELF         (1 << 16)
342 #define ANIM_EVENT_ANY          (1 << 17)
343
344 #define ANIM_EVENT_ANIM_BIT     0
345 #define ANIM_EVENT_PART_BIT     8
346
347 #define ANIM_EVENT_ANIM_MASK    (0xff << ANIM_EVENT_ANIM_BIT)
348 #define ANIM_EVENT_PART_MASK    (0xff << ANIM_EVENT_PART_BIT)
349
350 #define ANIM_EVENT_DEFAULT      ANIM_EVENT_NONE
351
352 /* values for special global animation event actions */
353 #define ANIM_EVENT_ACTION_NONE  -1
354
355 /* values for fade mode */
356 #define FADE_TYPE_NONE          0
357 #define FADE_TYPE_FADE_IN       (1 << 0)
358 #define FADE_TYPE_FADE_OUT      (1 << 1)
359 #define FADE_TYPE_TRANSFORM     (1 << 2)
360 #define FADE_TYPE_CROSSFADE     (1 << 3)
361 #define FADE_TYPE_MELT          (1 << 4)
362 #define FADE_TYPE_CURTAIN       (1 << 5)
363 #define FADE_TYPE_SKIP          (1 << 6)
364
365 #define FADE_MODE_NONE          (FADE_TYPE_NONE)
366 #define FADE_MODE_FADE_IN       (FADE_TYPE_FADE_IN)
367 #define FADE_MODE_FADE_OUT      (FADE_TYPE_FADE_OUT)
368 #define FADE_MODE_FADE          (FADE_TYPE_FADE_IN | FADE_TYPE_FADE_OUT)
369 #define FADE_MODE_TRANSFORM     (FADE_TYPE_TRANSFORM | FADE_TYPE_FADE_IN)
370 #define FADE_MODE_CROSSFADE     (FADE_MODE_TRANSFORM | FADE_TYPE_CROSSFADE)
371 #define FADE_MODE_MELT          (FADE_MODE_TRANSFORM | FADE_TYPE_MELT)
372 #define FADE_MODE_CURTAIN       (FADE_MODE_TRANSFORM | FADE_TYPE_CURTAIN)
373 #define FADE_MODE_SKIP_FADE_IN  (FADE_TYPE_SKIP | FADE_TYPE_FADE_IN)
374 #define FADE_MODE_SKIP_FADE_OUT (FADE_TYPE_SKIP | FADE_TYPE_FADE_OUT)
375
376 #define FADE_MODE_DEFAULT       FADE_MODE_FADE
377
378 /* values for toon positions */
379 #define POS_UNDEFINED           -1
380 #define POS_LEFT                0
381 #define POS_RIGHT               1
382 #define POS_TOP                 2
383 #define POS_UPPER               3
384 #define POS_MIDDLE              4
385 #define POS_LOWER               5
386 #define POS_BOTTOM              6
387 #define POS_ANY                 7
388 #define POS_LAST                8
389
390 /* values for text alignment */
391 #define ALIGN_LEFT              (1 << 0)
392 #define ALIGN_RIGHT             (1 << 1)
393 #define ALIGN_CENTER            (1 << 2)
394 #define ALIGN_DEFAULT           ALIGN_LEFT
395
396 #define VALIGN_TOP              (1 << 0)
397 #define VALIGN_BOTTOM           (1 << 1)
398 #define VALIGN_MIDDLE           (1 << 2)
399 #define VALIGN_DEFAULT          VALIGN_TOP
400
401 #define ALIGNED_XPOS(x,w,a)     ((a) == ALIGN_CENTER  ? (x) - (w) / 2 : \
402                                  (a) == ALIGN_RIGHT   ? (x) - (w) : (x))
403 #define ALIGNED_YPOS(y,h,v)     ((v) == VALIGN_MIDDLE ? (y) - (h) / 2 : \
404                                  (v) == VALIGN_BOTTOM ? (y) - (h) : (y))
405 #define ALIGNED_TEXT_XPOS(p)    ALIGNED_XPOS((p)->x, (p)->width,  (p)->align)
406 #define ALIGNED_TEXT_YPOS(p)    ALIGNED_YPOS((p)->y, (p)->height, (p)->valign)
407
408 /* values for redraw_mask */
409 #define REDRAW_NONE             (0)
410 #define REDRAW_ALL              (1 << 0)
411 #define REDRAW_FIELD            (1 << 1)
412 #define REDRAW_DOOR_1           (1 << 2)
413 #define REDRAW_DOOR_2           (1 << 3)
414 #define REDRAW_DOOR_3           (1 << 4)
415 #define REDRAW_FPS              (1 << 5)
416
417 #define REDRAW_DOORS            (REDRAW_DOOR_1 | \
418                                  REDRAW_DOOR_2 | \
419                                  REDRAW_DOOR_3)
420
421 #define IN_GFX_FIELD_PLAY(x, y) (x >= gfx.sx && x < gfx.sx + gfx.sxsize && \
422                                  y >= gfx.sy && y < gfx.sy + gfx.sysize)
423 #define IN_GFX_FIELD_FULL(x, y) (x >= gfx.real_sx && \
424                                  x <  gfx.real_sx + gfx.full_sxsize && \
425                                  y >= gfx.real_sy && \
426                                  y <  gfx.real_sy + gfx.full_sysize)
427 #define IN_GFX_DOOR_1(x, y)     (x >= gfx.dx && x < gfx.dx + gfx.dxsize && \
428                                  y >= gfx.dy && y < gfx.dy + gfx.dysize)
429 #define IN_GFX_DOOR_2(x, y)     (x >= gfx.vx && x < gfx.vx + gfx.vxsize && \
430                                  y >= gfx.vy && y < gfx.vy + gfx.vysize)
431 #define IN_GFX_DOOR_3(x, y)     (x >= gfx.ex && x < gfx.ex + gfx.exsize && \
432                                  y >= gfx.ey && y < gfx.ey + gfx.eysize)
433
434 /* values for mouse cursor */
435 #define CURSOR_DEFAULT          0
436 #define CURSOR_NONE             1
437 #define CURSOR_PLAYFIELD        2
438
439 /* fundamental game speed values */
440 #define ONE_SECOND_DELAY        1000    /* delay value for one second */
441 #define MENU_FRAME_DELAY        20      /* frame delay in milliseconds */
442 #define GAME_FRAME_DELAY        20      /* frame delay in milliseconds */
443 #define FFWD_FRAME_DELAY        10      /* 200% speed for fast forward */
444 #define FRAMES_PER_SECOND       (ONE_SECOND_DELAY / GAME_FRAME_DELAY)
445 #define FRAMES_PER_SECOND_SP    35
446
447 /* maximum playfield size supported by libgame functions */
448 #define MAX_PLAYFIELD_WIDTH     128
449 #define MAX_PLAYFIELD_HEIGHT    128
450
451 /* maximum number of parallel players supported by libgame functions */
452 #define MAX_PLAYERS             4
453
454 /* maximum allowed length of player name */
455 #define MAX_PLAYER_NAME_LEN     10
456
457 /* maximum number of levels in a level set */
458 #define MAX_LEVELS              1000
459
460 /* maximum number of global animation and parts */
461 #define MAX_GLOBAL_ANIMS                32
462 #define MAX_GLOBAL_ANIM_PARTS           32
463
464 /* minimum/maximum/default x/y grid size for virtual buttons */
465 #define MIN_GRID_XSIZE                  3
466 #define MIN_GRID_YSIZE                  3
467 #define MAX_GRID_XSIZE                  32
468 #define MAX_GRID_YSIZE                  32
469 #define GRID_REAL_WIDTH                 MAX(1, MAX(video.screen_width,  \
470                                                    video.screen_height))
471 #define GRID_REAL_HEIGHT                MAX(1, MIN(video.screen_width,  \
472                                                    video.screen_height))
473 #define DEFAULT_GRID_XSIZE_0            18
474 #define DEFAULT_GRID_YSIZE_0            MIN(MAX(MIN_GRID_YSIZE,         \
475                                                 DEFAULT_GRID_XSIZE_0 *  \
476                                                 GRID_REAL_HEIGHT /      \
477                                                 GRID_REAL_WIDTH),       \
478                                             MAX_GRID_YSIZE)
479 #define DEFAULT_GRID_XSIZE_1            13
480 #define DEFAULT_GRID_YSIZE_1            MIN(MAX(MIN_GRID_YSIZE,         \
481                                                 DEFAULT_GRID_XSIZE_1 *  \
482                                                 GRID_REAL_WIDTH /       \
483                                                 GRID_REAL_HEIGHT),      \
484                                             MAX_GRID_YSIZE)
485
486 #define DEFAULT_GRID_XSIZE(n)           ((n) == 0 ? DEFAULT_GRID_XSIZE_0 : \
487                                          DEFAULT_GRID_XSIZE_1)
488 #define DEFAULT_GRID_YSIZE(n)           ((n) == 0 ? DEFAULT_GRID_YSIZE_0 : \
489                                          DEFAULT_GRID_YSIZE_1)
490
491 #define GRID_ACTIVE_NR()                (video.screen_width >   \
492                                          video.screen_height ? 0 : 1)
493
494 /* values for grid button characters for virtual buttons */
495 #define CHAR_GRID_BUTTON_NONE           ' '
496 #define CHAR_GRID_BUTTON_LEFT           '<'
497 #define CHAR_GRID_BUTTON_RIGHT          '>'
498 #define CHAR_GRID_BUTTON_UP             '^'
499 #define CHAR_GRID_BUTTON_DOWN           'v'
500 #define CHAR_GRID_BUTTON_SNAP           '1'
501 #define CHAR_GRID_BUTTON_DROP           '2'
502
503 #define GET_ACTION_FROM_GRID_BUTTON(c)  ((c) == CHAR_GRID_BUTTON_LEFT ?  \
504                                          JOY_LEFT :                      \
505                                          (c) == CHAR_GRID_BUTTON_RIGHT ? \
506                                          JOY_RIGHT :                     \
507                                          (c) == CHAR_GRID_BUTTON_UP ?    \
508                                          JOY_UP :                        \
509                                          (c) == CHAR_GRID_BUTTON_DOWN ?  \
510                                          JOY_DOWN :                      \
511                                          (c) == CHAR_GRID_BUTTON_SNAP ?  \
512                                          JOY_BUTTON_1 :                  \
513                                          (c) == CHAR_GRID_BUTTON_DROP ?  \
514                                          JOY_BUTTON_2 :                  \
515                                          JOY_NO_ACTION)
516
517 /* default name for empty highscore entry */
518 #define EMPTY_PLAYER_NAME       "no name"
519
520 /* default name for unknown player names */
521 #define ANONYMOUS_NAME          "anonymous"
522
523 /* default for other unknown names */
524 #define UNKNOWN_NAME            "unknown"
525
526 /* default name for new levels */
527 #define NAMELESS_LEVEL_NAME     "nameless level"
528
529 /* default text for non-existant artwork */
530 #define NOT_AVAILABLE           "(not available)"
531
532 /* default value for undefined filename */
533 #define UNDEFINED_FILENAME      "[NONE]"
534
535 /* default value for undefined levelset */
536 #define UNDEFINED_LEVELSET      "[NONE]"
537
538 /* default value for undefined parameter */
539 #define ARG_DEFAULT             "[DEFAULT]"
540
541 /* default values for undefined configuration file parameters */
542 #define ARG_UNDEFINED           "-1000000"
543 #define ARG_UNDEFINED_VALUE     (-1000000)
544
545 /* default value for off-screen positions */
546 #define POS_OFFSCREEN           (-1000000)
547
548 /* definitions for game sub-directories */
549 #ifndef RO_GAME_DIR
550 #define RO_GAME_DIR             "."
551 #endif
552
553 #ifndef RW_GAME_DIR
554 #define RW_GAME_DIR             "."
555 #endif
556
557 #define RO_BASE_PATH            RO_GAME_DIR
558 #define RW_BASE_PATH            RW_GAME_DIR
559
560 /* directory names */
561 #define GRAPHICS_DIRECTORY      "graphics"
562 #define SOUNDS_DIRECTORY        "sounds"
563 #define MUSIC_DIRECTORY         "music"
564 #define LEVELS_DIRECTORY        "levels"
565 #define TAPES_DIRECTORY         "tapes"
566 #define SCORES_DIRECTORY        "scores"
567 #define DOCS_DIRECTORY          "docs"
568 #define CACHE_DIRECTORY         "cache"
569 #define CONF_DIRECTORY          "conf"
570
571 #define GFX_CLASSIC_SUBDIR      "gfx_classic"
572 #define SND_CLASSIC_SUBDIR      "snd_classic"
573 #define MUS_CLASSIC_SUBDIR      "mus_classic"
574
575 #define GFX_DEFAULT_SUBDIR      (setup.internal.default_graphics_set)
576 #define SND_DEFAULT_SUBDIR      (setup.internal.default_sounds_set)
577 #define MUS_DEFAULT_SUBDIR      (setup.internal.default_music_set)
578
579 #define GFX_FALLBACK_FILENAME   (setup.internal.fallback_graphics_file)
580 #define SND_FALLBACK_FILENAME   (setup.internal.fallback_sounds_file)
581 #define MUS_FALLBACK_FILENAME   (setup.internal.fallback_music_file)
582
583 #define DEFAULT_LEVELSET        (setup.internal.default_level_series)
584
585 /* file names and filename extensions */
586 #define LEVELSETUP_DIRECTORY    "levelsetup"
587 #define SETUP_FILENAME          "setup.conf"
588 #define AUTOSETUP_FILENAME      "autosetup.conf"
589 #define LEVELSETUP_FILENAME     "levelsetup.conf"
590 #define EDITORSETUP_FILENAME    "editorsetup.conf"
591 #define EDITORCASCADE_FILENAME  "editorcascade.conf"
592 #define HELPANIM_FILENAME       "helpanim.conf"
593 #define HELPTEXT_FILENAME       "helptext.conf"
594 #define LEVELINFO_FILENAME      "levelinfo.conf"
595 #define GRAPHICSINFO_FILENAME   "graphicsinfo.conf"
596 #define SOUNDSINFO_FILENAME     "soundsinfo.conf"
597 #define MUSICINFO_FILENAME      "musicinfo.conf"
598 #define ARTWORKINFO_CACHE_FILE  "artworkinfo.cache"
599 #define LEVELTEMPLATE_FILENAME  "template.level"
600 #define LEVELFILE_EXTENSION     "level"
601 #define TAPEFILE_EXTENSION      "tape"
602 #define SCOREFILE_EXTENSION     "score"
603
604 #define GAMECONTROLLER_BASENAME "gamecontrollerdb.txt"
605
606 #define LOG_OUT_BASENAME        "stdout.txt"
607 #define LOG_ERR_BASENAME        "stderr.txt"
608
609 #define LOG_OUT_ID              0
610 #define LOG_ERR_ID              1
611 #define NUM_LOGS                2
612
613 #define STRING_PARENT_DIRECTORY         ".."
614 #define STRING_TOP_DIRECTORY            "/"
615
616 #define CHAR_PATH_SEPARATOR_UNIX        '/'
617 #define CHAR_PATH_SEPARATOR_DOS         '\\'
618
619 #define STRING_PATH_SEPARATOR_UNIX      "/"
620 #define STRING_PATH_SEPARATOR_DOS       "\\"
621
622 #define STRING_NEWLINE_UNIX             "\n"
623 #define STRING_NEWLINE_DOS              "\r\n"
624
625 #if defined(PLATFORM_WIN32)
626 #define CHAR_PATH_SEPARATOR     CHAR_PATH_SEPARATOR_DOS
627 #define STRING_PATH_SEPARATOR   STRING_PATH_SEPARATOR_DOS
628 #define STRING_NEWLINE          STRING_NEWLINE_DOS
629 #else
630 #define CHAR_PATH_SEPARATOR     CHAR_PATH_SEPARATOR_UNIX
631 #define STRING_PATH_SEPARATOR   STRING_PATH_SEPARATOR_UNIX
632 #define STRING_NEWLINE          STRING_NEWLINE_UNIX
633 #endif
634
635
636 /* areas in bitmap PIX_DOOR */
637 /* meaning in PIX_DB_DOOR: (3 PAGEs)
638    PAGEX1: 1. buffer for DOOR_1
639    PAGEX2: 2. buffer for DOOR_1
640    PAGEX3: buffer for animations
641 */
642
643 /* these values are hard-coded to be able to use them in initialization */
644 #define DOOR_GFX_PAGE_WIDTH     100     /* should be set to "gfx.dxsize" */
645 #define DOOR_GFX_PAGE_HEIGHT    280     /* should be set to "gfx.dysize" */
646
647 #define DOOR_GFX_PAGESIZE       (DOOR_GFX_PAGE_WIDTH)
648 #define DOOR_GFX_PAGEX1         (0 * DOOR_GFX_PAGESIZE)
649 #define DOOR_GFX_PAGEX2         (1 * DOOR_GFX_PAGESIZE)
650 #define DOOR_GFX_PAGEX3         (2 * DOOR_GFX_PAGESIZE)
651 #define DOOR_GFX_PAGEX4         (3 * DOOR_GFX_PAGESIZE)
652 #define DOOR_GFX_PAGEX5         (4 * DOOR_GFX_PAGESIZE)
653 #define DOOR_GFX_PAGEX6         (5 * DOOR_GFX_PAGESIZE)
654 #define DOOR_GFX_PAGEX7         (6 * DOOR_GFX_PAGESIZE)
655 #define DOOR_GFX_PAGEX8         (7 * DOOR_GFX_PAGESIZE)
656 #define DOOR_GFX_PAGEY1         (0)
657 #define DOOR_GFX_PAGEY2         (DOOR_GFX_PAGE_HEIGHT)
658
659
660 /* macros for version handling */
661 #define VERSION_PART_1(x)       ((x) / 1000000)
662 #define VERSION_PART_2(x)       (((x) % 1000000) / 10000)
663 #define VERSION_PART_3(x)       (((x) % 10000) / 100)
664 #define VERSION_PART_4(x)       ((x) % 100)
665
666 #define VERSION_SUPER(x)        VERSION_PART_1(x)
667 #define VERSION_MAJOR(x)        VERSION_PART_2(x)
668 #define VERSION_MINOR(x)        VERSION_PART_3(x)
669 #define VERSION_PATCH(x)        VERSION_PART_4(x)
670 #define VERSION_IDENT(a,b,c,d)  ((a) * 1000000 + (b) * 10000 + (c) * 100 + (d))
671
672
673 /* macros for parent/child process identification */
674 #if defined(PLATFORM_UNIX)
675 #define IS_PARENT_PROCESS()     (audio.mixer_pid != getpid())
676 #define IS_CHILD_PROCESS()      (audio.mixer_pid == getpid())
677 #define HAS_CHILD_PROCESS()     (audio.mixer_pid > 0)
678 #else
679 #define IS_PARENT_PROCESS()     TRUE
680 #define IS_CHILD_PROCESS()      FALSE
681 #define HAS_CHILD_PROCESS()     FALSE
682 #endif
683
684
685 /* values for artwork type */
686 #define ARTWORK_TYPE_GRAPHICS   0
687 #define ARTWORK_TYPE_SOUNDS     1
688 #define ARTWORK_TYPE_MUSIC      2
689
690 #define NUM_ARTWORK_TYPES       3
691
692
693 /* values for tree type (chosen to match artwork type) */
694 #define TREE_TYPE_UNDEFINED     -1
695 #define TREE_TYPE_GRAPHICS_DIR  ARTWORK_TYPE_GRAPHICS
696 #define TREE_TYPE_SOUNDS_DIR    ARTWORK_TYPE_SOUNDS
697 #define TREE_TYPE_MUSIC_DIR     ARTWORK_TYPE_MUSIC
698 #define TREE_TYPE_LEVEL_DIR     3
699 #define TREE_TYPE_LEVEL_NR      4
700
701 #define NUM_TREE_TYPES          5
702
703 #define INFOTEXT_UNDEFINED      ""
704 #define INFOTEXT_GRAPHICS_DIR   "Custom Graphics"
705 #define INFOTEXT_SOUNDS_DIR     "Custom Sounds"
706 #define INFOTEXT_MUSIC_DIR      "Custom Music"
707 #define INFOTEXT_LEVEL_DIR      "Level Sets"
708 #define INFOTEXT_LEVEL_NR       "Levels"
709
710 #define TREE_INFOTEXT(t)        ((t) == TREE_TYPE_LEVEL_NR ?            \
711                                  INFOTEXT_LEVEL_NR :                    \
712                                  (t) == TREE_TYPE_LEVEL_DIR ?           \
713                                  INFOTEXT_LEVEL_DIR :                   \
714                                  (t) == TREE_TYPE_GRAPHICS_DIR ?        \
715                                  INFOTEXT_GRAPHICS_DIR :                \
716                                  (t) == TREE_TYPE_SOUNDS_DIR ?          \
717                                  INFOTEXT_SOUNDS_DIR :                  \
718                                  (t) == TREE_TYPE_MUSIC_DIR ?           \
719                                  INFOTEXT_MUSIC_DIR :                   \
720                                  INFOTEXT_UNDEFINED)
721
722 /* values for artwork handling */
723 #define LEVELDIR_ARTWORK_SET_PTR(leveldir, type)                        \
724                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
725                                  &(leveldir)->graphics_set :            \
726                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
727                                  &(leveldir)->sounds_set :              \
728                                  &(leveldir)->music_set)
729
730 #define LEVELDIR_ARTWORK_SET(leveldir, type)                            \
731                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
732                                  (leveldir)->graphics_set :             \
733                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
734                                  (leveldir)->sounds_set :               \
735                                  (leveldir)->music_set)
736
737 #define LEVELDIR_ARTWORK_PATH_PTR(leveldir, type)                       \
738                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
739                                  &(leveldir)->graphics_path :           \
740                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
741                                  &(leveldir)->sounds_path :             \
742                                  &(leveldir)->music_path)
743
744 #define LEVELDIR_ARTWORK_PATH(leveldir, type)                           \
745                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
746                                  (leveldir)->graphics_path :            \
747                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
748                                  (leveldir)->sounds_path :              \
749                                  (leveldir)->music_path)
750
751 #define SETUP_ARTWORK_SET(setup, type)                                  \
752                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
753                                  (setup).graphics_set :                 \
754                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
755                                  (setup).sounds_set :                   \
756                                  (setup).music_set)
757
758 #define SETUP_OVERRIDE_ARTWORK(setup, type)                             \
759                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
760                                  (setup).override_level_graphics :      \
761                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
762                                  (setup).override_level_sounds :        \
763                                  (setup).override_level_music)
764
765 #define GFX_OVERRIDE_ARTWORK(type)                                      \
766                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
767                                  gfx.override_level_graphics :          \
768                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
769                                  gfx.override_level_sounds :            \
770                                  gfx.override_level_music)
771
772 #define ARTWORK_FIRST_NODE(artwork, type)                               \
773                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
774                                  (artwork).gfx_first :                  \
775                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
776                                  (artwork).snd_first :                  \
777                                  (artwork).mus_first)
778
779 #define ARTWORK_CURRENT_IDENTIFIER_PTR(artwork, type)                   \
780                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
781                                  &(artwork).gfx_current_identifier :    \
782                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
783                                  &(artwork).snd_current_identifier :    \
784                                  &(artwork).mus_current_identifier)
785
786 #define ARTWORK_CURRENT_IDENTIFIER(artwork, type)                       \
787                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
788                                  (artwork).gfx_current_identifier :     \
789                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
790                                  (artwork).snd_current_identifier :     \
791                                  (artwork).mus_current_identifier)
792
793 #define ARTWORKINFO_FILENAME(type)                                      \
794                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
795                                  GRAPHICSINFO_FILENAME :                \
796                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
797                                  SOUNDSINFO_FILENAME :                  \
798                                  (type) == ARTWORK_TYPE_MUSIC ?         \
799                                  MUSICINFO_FILENAME : "")
800
801 #define ARTWORK_DIRECTORY(type)                                         \
802                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
803                                  GRAPHICS_DIRECTORY :                   \
804                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
805                                  SOUNDS_DIRECTORY :                     \
806                                  (type) == ARTWORK_TYPE_MUSIC ?         \
807                                  MUSIC_DIRECTORY : "")
808
809 #define OPTIONS_ARTWORK_DIRECTORY(type)                                 \
810                                 ((type) == ARTWORK_TYPE_GRAPHICS ?      \
811                                  options.graphics_directory :           \
812                                  (type) == ARTWORK_TYPE_SOUNDS ?        \
813                                  options.sounds_directory :             \
814                                  (type) == ARTWORK_TYPE_MUSIC ?         \
815                                  options.music_directory : "")
816
817 #define UPDATE_BUSY_STATE()                     \
818 {                                               \
819   if (gfx.draw_busy_anim_function != NULL)      \
820     gfx.draw_busy_anim_function();              \
821 }
822
823
824 /* structure definitions */
825
826 struct ProgramInfo
827 {
828   char *command_basepath;       /* path to the program binary */
829   char *command_basename;       /* base filename of the program binary */
830
831   char *config_filename;        /* optional global program config filename */
832
833   char *maindata_path;          /* main game data (installation) directory */
834
835   char *userdata_subdir;        /* personal user game data directory */
836   char *userdata_path;          /* resulting full path to game data directory */
837
838   char *program_title;
839   char *window_title;
840   char *icon_title;
841
842   char *icon_filename;
843
844   char *cookie_prefix;
845
846   char *log_filename[NUM_LOGS];         /* log filenames for out/err messages */
847   FILE *log_file[NUM_LOGS];             /* log file handles for out/err files */
848   FILE *log_file_default[NUM_LOGS];     /* default log file handles (out/err) */
849
850   int version_super;
851   int version_major;
852   int version_minor;
853   int version_patch;
854   int version_ident;
855
856   char *version_string;
857
858   char *(*window_title_function)(void);
859   void (*exit_message_function)(char *, va_list);
860   void (*exit_function)(int);
861
862   boolean global_scores;
863   boolean many_scores_per_name;
864
865   boolean headless;
866 };
867
868 struct OptionInfo
869 {
870   char *server_host;
871   int server_port;
872
873   char *ro_base_directory;
874   char *rw_base_directory;
875   char *level_directory;
876   char *graphics_directory;
877   char *sounds_directory;
878   char *music_directory;
879   char *docs_directory;
880   char *conf_directory;
881
882   char *execute_command;
883
884   char *special_flags;
885
886   boolean mytapes;
887   boolean serveronly;
888   boolean network;
889   boolean verbose;
890   boolean debug;
891 };
892
893 struct VideoSystemInfo
894 {
895   int default_depth;
896   int width, height, depth;
897   int window_width, window_height;
898   int display_width, display_height;
899   int screen_width, screen_height;
900   int screen_xoffset, screen_yoffset;
901
902   boolean fullscreen_available;
903   boolean fullscreen_enabled;
904   boolean fullscreen_initial;
905
906   boolean window_scaling_available;
907   int window_scaling_percent;
908   char *window_scaling_quality;
909   int screen_rendering_mode;
910
911   unsigned int frame_delay;
912   unsigned int frame_delay_value;
913
914   boolean shifted_up;
915   int shifted_up_pos;
916   int shifted_up_pos_last;
917   unsigned int shifted_up_delay;
918   unsigned int shifted_up_delay_value;
919
920   boolean initialized;
921 };
922
923 struct AudioSystemInfo
924 {
925   boolean sound_available;
926   boolean loops_available;
927   boolean music_available;
928
929   boolean sound_enabled;
930   boolean sound_deactivated;    /* for temporarily disabling sound */
931
932   int mixer_pipe[2];
933   int mixer_pid;
934   char *device_name;
935   int device_fd;
936
937   int num_channels;
938   int music_channel;
939   int first_sound_channel;
940 };
941
942 struct FontBitmapInfo
943 {
944   Bitmap *bitmap;
945
946   int src_x, src_y;             /* start position of font characters */
947   int width, height;            /* width / height of font characters */
948
949   int offset_x;                 /* offset to next font character */
950   int offset_y;                 /* offset to next font character */
951
952   int draw_xoffset;             /* offset for drawing font characters */
953   int draw_yoffset;             /* offset for drawing font characters */
954
955   int num_chars;
956   int num_chars_per_line;
957 };
958
959 struct GfxInfo
960 {
961   int sx, sy;
962   int sxsize, sysize;
963   int real_sx, real_sy;
964   int full_sxsize, full_sysize;
965   int scrollbuffer_width, scrollbuffer_height;
966
967   int game_tile_size, standard_tile_size;
968
969   int dx, dy;
970   int dxsize, dysize;
971
972   int vx, vy;
973   int vxsize, vysize;
974
975   int ex, ey;
976   int exsize, eysize;
977
978   int win_xsize, win_ysize;
979
980   int draw_deactivation_mask;
981   int draw_background_mask;
982
983   Bitmap *field_save_buffer;
984
985   Bitmap *background_bitmap;
986   int background_bitmap_mask;
987
988   Bitmap *fade_bitmap_backup;
989   Bitmap *fade_bitmap_source;
990   Bitmap *fade_bitmap_target;
991   Bitmap *fade_bitmap_black;
992
993   int fade_border_source_status;
994   int fade_border_target_status;
995   Bitmap *masked_border_bitmap_ptr;
996
997   Bitmap *final_screen_bitmap;
998
999   boolean clipping_enabled;
1000   int clip_x, clip_y;
1001   int clip_width, clip_height;
1002
1003   boolean override_level_graphics;
1004   boolean override_level_sounds;
1005   boolean override_level_music;
1006
1007   boolean draw_init_text;
1008
1009   int num_fonts;
1010   struct FontBitmapInfo *font_bitmap_info;
1011   int (*select_font_function)(int);
1012   int (*get_font_from_token_function)(char *);
1013
1014   int anim_random_frame;
1015
1016   void (*draw_busy_anim_function)(void);
1017   void (*draw_global_anim_function)(int, int);
1018   void (*draw_global_border_function)(int);
1019   void (*draw_tile_cursor_function)(int);
1020
1021   int cursor_mode;
1022 };
1023
1024 struct TileCursorInfo
1025 {
1026   boolean enabled;              /* tile cursor generally enabled or disabled */
1027   boolean active;               /* tile cursor activated (depending on game) */
1028   boolean moving;               /* tile cursor moving to target position */
1029
1030   int xpos, ypos;               /* tile cursor level playfield position */
1031   int x, y;                     /* tile cursor current screen position */
1032   int target_x, target_y;       /* tile cursor target screen position */
1033
1034   int sx, sy;                   /* tile cursor screen start position */
1035 };
1036
1037 struct OverlayInfo
1038 {
1039   boolean enabled;              /* overlay generally enabled or disabled */
1040   boolean active;               /* overlay activated (depending on game mode) */
1041
1042   boolean show_grid;
1043
1044   int grid_xsize;
1045   int grid_ysize;
1046
1047   char grid_button[MAX_GRID_XSIZE][MAX_GRID_YSIZE];
1048   char grid_button_highlight;
1049
1050   int grid_button_action;
1051 };
1052
1053 struct JoystickInfo
1054 {
1055   int status;
1056   int nr[MAX_PLAYERS];          /* joystick number for each player */
1057 };
1058
1059 struct SetupJoystickInfo
1060 {
1061   char *device_name;            /* device name of player's joystick */
1062
1063   int xleft, xmiddle, xright;
1064   int yupper, ymiddle, ylower;
1065   int snap, drop;
1066 };
1067
1068 struct SetupKeyboardInfo
1069 {
1070   Key left, right, up, down;
1071   Key snap, drop;
1072 };
1073
1074 struct SetupTouchInfo
1075 {
1076   char *control_type;
1077   int move_distance;
1078   int drop_distance;
1079
1080   int grid_xsize[2];
1081   int grid_ysize[2];
1082
1083   char grid_button[2][MAX_GRID_XSIZE][MAX_GRID_YSIZE];
1084
1085   int transparency;             /* in percent (0 == opaque, 100 == invisible) */
1086   boolean draw_outlined;
1087   boolean draw_pressed;
1088
1089   boolean grid_initialized;
1090 };
1091
1092 struct SetupInputInfo
1093 {
1094   boolean use_joystick;
1095   struct SetupJoystickInfo joy;
1096   struct SetupKeyboardInfo key;
1097 };
1098
1099 struct SetupEditorInfo
1100 {
1101   boolean el_boulderdash;
1102   boolean el_emerald_mine;
1103   boolean el_emerald_mine_club;
1104   boolean el_more;
1105   boolean el_sokoban;
1106   boolean el_supaplex;
1107   boolean el_diamond_caves;
1108   boolean el_dx_boulderdash;
1109
1110   boolean el_mirror_magic;
1111   boolean el_deflektor;
1112
1113   boolean el_chars;
1114   boolean el_steel_chars;
1115
1116   boolean el_classic;
1117   boolean el_custom;
1118   boolean el_user_defined;
1119   boolean el_dynamic;
1120
1121   boolean el_headlines;
1122
1123   boolean el_by_game;
1124   boolean el_by_type;
1125
1126   boolean show_element_token;
1127
1128   boolean use_template_for_new_levels;
1129 };
1130
1131 struct SetupAutoSetupInfo
1132 {
1133   int editor_zoom_tilesize;
1134 };
1135
1136 struct SetupEditorCascadeInfo
1137 {
1138   boolean el_bd;
1139   boolean el_em;
1140   boolean el_emc;
1141   boolean el_rnd;
1142   boolean el_sb;
1143   boolean el_sp;
1144   boolean el_dc;
1145   boolean el_dx;
1146   boolean el_mm;
1147   boolean el_df;
1148   boolean el_chars;
1149   boolean el_steel_chars;
1150   boolean el_ce;
1151   boolean el_ge;
1152   boolean el_ref;
1153   boolean el_user;
1154   boolean el_dynamic;
1155 };
1156
1157 struct SetupShortcutInfo
1158 {
1159   Key save_game;
1160   Key load_game;
1161   Key toggle_pause;
1162
1163   Key focus_player[MAX_PLAYERS];
1164   Key focus_player_all;
1165
1166   Key tape_eject;
1167   Key tape_extra;
1168   Key tape_stop;
1169   Key tape_pause;
1170   Key tape_record;
1171   Key tape_play;
1172
1173   Key sound_simple;
1174   Key sound_loops;
1175   Key sound_music;
1176
1177   Key snap_left;
1178   Key snap_right;
1179   Key snap_up;
1180   Key snap_down;
1181 };
1182
1183 struct SetupSystemInfo
1184 {
1185   char *sdl_videodriver;
1186   char *sdl_audiodriver;
1187   int audio_fragment_size;
1188 };
1189
1190 struct SetupInternalInfo
1191 {
1192   char *program_title;
1193   char *program_version;
1194   char *program_author;
1195   char *program_email;
1196   char *program_website;
1197   char *program_copyright;
1198   char *program_company;
1199
1200   char *program_icon_file;
1201
1202   char *default_graphics_set;
1203   char *default_sounds_set;
1204   char *default_music_set;
1205
1206   char *fallback_graphics_file;
1207   char *fallback_sounds_file;
1208   char *fallback_music_file;
1209
1210   char *default_level_series;
1211
1212   int default_window_width;
1213   int default_window_height;
1214
1215   boolean choose_from_top_leveldir;
1216   boolean show_scaling_in_title;
1217 };
1218
1219 struct SetupDebugInfo
1220 {
1221   int frame_delay[10];
1222   Key frame_delay_key[10];
1223   boolean frame_delay_use_mod_key;
1224   boolean frame_delay_game_only;
1225   boolean show_frames_per_second;
1226 };
1227
1228 struct SetupInfo
1229 {
1230   char *player_name;
1231
1232   boolean sound;
1233   boolean sound_loops;
1234   boolean sound_music;
1235   boolean sound_simple;
1236   boolean toons;
1237   boolean scroll_delay;
1238   boolean scroll_delay_value;
1239   char *engine_snapshot_mode;
1240   int engine_snapshot_memory;
1241   boolean fade_screens;
1242   boolean autorecord;
1243   boolean show_titlescreen;
1244   boolean quick_doors;
1245   boolean team_mode;
1246   boolean handicap;
1247   boolean skip_levels;
1248   boolean increment_levels;
1249   boolean time_limit;
1250   boolean fullscreen;
1251   int window_scaling_percent;
1252   char *window_scaling_quality;
1253   char *screen_rendering_mode;
1254   boolean ask_on_escape;
1255   boolean ask_on_escape_editor;
1256   boolean quick_switch;
1257   boolean input_on_focus;
1258   boolean prefer_aga_graphics;
1259   int game_frame_delay;
1260   boolean sp_show_border_elements;
1261   boolean small_game_graphics;
1262   boolean show_snapshot_buttons;
1263
1264   char *graphics_set;
1265   char *sounds_set;
1266   char *music_set;
1267   int override_level_graphics;          /* not boolean -- can also be "AUTO" */
1268   int override_level_sounds;            /* not boolean -- can also be "AUTO" */
1269   int override_level_music;             /* not boolean -- can also be "AUTO" */
1270
1271   int volume_simple;
1272   int volume_loops;
1273   int volume_music;
1274
1275   boolean network_mode;
1276   int network_player_nr;
1277
1278   struct SetupAutoSetupInfo auto_setup;
1279   struct SetupEditorInfo editor;
1280   struct SetupEditorCascadeInfo editor_cascade;
1281   struct SetupShortcutInfo shortcut;
1282   struct SetupInputInfo input[MAX_PLAYERS];
1283   struct SetupTouchInfo touch;
1284   struct SetupSystemInfo system;
1285   struct SetupInternalInfo internal;
1286   struct SetupDebugInfo debug;
1287
1288   struct OptionInfo options;
1289 };
1290
1291 struct TreeInfo
1292 {
1293   struct TreeInfo **node_top;           /* topmost node in tree */
1294   struct TreeInfo *node_parent;         /* parent level directory info */
1295   struct TreeInfo *node_group;          /* level group sub-directory info */
1296   struct TreeInfo *next;                /* next level series structure node */
1297
1298   int cl_first;         /* internal control field for setup screen */
1299   int cl_cursor;        /* internal control field for setup screen */
1300
1301   int type;             /* type of tree content */
1302
1303   /* fields for "type == TREE_TYPE_LEVEL_DIR" */
1304
1305   char *subdir;         /* tree info sub-directory basename (may be ".") */
1306   char *fullpath;       /* complete path relative to tree base directory */
1307   char *basepath;       /* absolute base path of tree base directory */
1308   char *identifier;     /* identifier string for configuration files */
1309   char *name;           /* tree info name, as displayed in selection menues */
1310   char *name_sorting;   /* optional sorting name for correct name sorting */
1311   char *author;         /* level or artwork author name */
1312   char *year;           /* optional year of creation for levels or artwork */
1313
1314   char *program_title;     /* optional alternative text for program title */
1315   char *program_copyright; /* optional alternative text for program copyright */
1316   char *program_company;   /* optional alternative text for program company */
1317
1318   char *imported_from;  /* optional comment for imported levels or artwork */
1319   char *imported_by;    /* optional comment for imported levels or artwork */
1320   char *tested_by;      /* optional comment to name people who tested a set */
1321
1322   char *graphics_set_ecs; /* special EMC custom graphics set (ECS graphics) */
1323   char *graphics_set_aga; /* special EMC custom graphics set (AGA graphics) */
1324   char *graphics_set;   /* optional custom graphics set (level tree only) */
1325   char *sounds_set;     /* optional custom sounds set (level tree only) */
1326   char *music_set;      /* optional custom music set (level tree only) */
1327   char *graphics_path;  /* path to optional custom graphics set (level only) */
1328   char *sounds_path;    /* path to optional custom sounds set (level only) */
1329   char *music_path;     /* path to optional custom music set (level only) */
1330
1331   char *level_filename; /* filename of level file (for packed level file) */
1332   char *level_filetype; /* type of levels in level directory or level file */
1333
1334   char *special_flags;  /* flags for special actions performed on level file */
1335
1336   int levels;           /* number of levels in level series */
1337   int first_level;      /* first level number (to allow start with 0 or 1) */
1338   int last_level;       /* last level number (automatically calculated) */
1339   int sort_priority;    /* sort levels by 'sort_priority' and then by name */
1340
1341   boolean latest_engine;/* force level set to use the latest game engine */
1342
1343   boolean level_group;  /* directory contains more level series directories */
1344   boolean parent_link;  /* entry links back to parent directory */
1345   boolean in_user_dir;  /* user defined levels are stored in home directory */
1346   boolean user_defined; /* levels in user directory and marked as "private" */
1347   boolean readonly;     /* readonly levels can not be changed with editor */
1348   boolean handicap;     /* level set has no handicap when set to "false" */
1349   boolean skip_levels;  /* levels can be skipped when set to "true" */
1350
1351   int color;            /* color to use on selection screen for this level */
1352   char *class_desc;     /* description of level series class */
1353   int handicap_level;   /* number of the lowest unsolved level */
1354
1355   char *infotext;       /* optional text to describe the tree type (headline) */
1356 };
1357
1358 typedef struct TreeInfo TreeInfo;
1359 typedef struct TreeInfo LevelDirTree;
1360 typedef struct TreeInfo ArtworkDirTree;
1361 typedef struct TreeInfo GraphicsDirTree;
1362 typedef struct TreeInfo SoundsDirTree;
1363 typedef struct TreeInfo MusicDirTree;
1364
1365 struct ArtworkInfo
1366 {
1367   GraphicsDirTree *gfx_first;
1368   GraphicsDirTree *gfx_current;
1369   SoundsDirTree *snd_first;
1370   SoundsDirTree *snd_current;
1371   MusicDirTree *mus_first;
1372   MusicDirTree *mus_current;
1373
1374   char *gfx_current_identifier;
1375   char *snd_current_identifier;
1376   char *mus_current_identifier;
1377 };
1378
1379 struct ValueTextInfo
1380 {
1381   int value;
1382   char *text;
1383 };
1384
1385 struct ConfigInfo
1386 {
1387   char *token;
1388   char *value;
1389 };
1390
1391 struct ConfigTypeInfo
1392 {
1393   char *token;
1394   char *value;
1395   int type;
1396 };
1397
1398 struct TokenIntPtrInfo
1399 {
1400   char *token;
1401   int *value;
1402 };
1403
1404 struct FileInfo
1405 {
1406   char *token;
1407
1408   char *default_filename;
1409   char *filename;
1410
1411   char **default_parameter;                     /* array of file parameters */
1412   char **parameter;                             /* array of file parameters */
1413
1414   boolean redefined;
1415   boolean fallback_to_default;
1416   boolean default_is_cloned;
1417 };
1418
1419 struct SetupFileList
1420 {
1421   char *token;
1422   char *value;
1423
1424   struct SetupFileList *next;
1425 };
1426
1427 struct ListNodeInfo
1428 {
1429   char *source_filename;                        /* primary key for node list */
1430   int num_references;
1431 };
1432
1433 struct PropertyMapping
1434 {
1435   int base_index;
1436   int ext1_index;
1437   int ext2_index;
1438   int ext3_index;
1439
1440   int artwork_index;
1441 };
1442
1443 struct ArtworkListInfo
1444 {
1445   int type;                                     /* type of artwork */
1446
1447   int num_file_list_entries;
1448   int num_dynamic_file_list_entries;
1449   struct FileInfo *file_list;                   /* static artwork file array */
1450   struct FileInfo *dynamic_file_list;           /* dynamic artwrk file array */
1451
1452   int num_suffix_list_entries;
1453   struct ConfigTypeInfo *suffix_list;           /* parameter suffixes array */
1454
1455   int num_base_prefixes;
1456   int num_ext1_suffixes;
1457   int num_ext2_suffixes;
1458   int num_ext3_suffixes;
1459   char **base_prefixes;                         /* base token prefixes array */
1460   char **ext1_suffixes;                         /* property suffixes array 1 */
1461   char **ext2_suffixes;                         /* property suffixes array 2 */
1462   char **ext3_suffixes;                         /* property suffixes array 3 */
1463
1464   int num_ignore_tokens;
1465   char **ignore_tokens;                         /* file tokens to be ignored */
1466
1467   int num_property_mapping_entries;
1468   struct PropertyMapping *property_mapping;     /* mapping token -> artwork */
1469
1470   int sizeof_artwork_list_entry;
1471
1472   struct ListNodeInfo **artwork_list;           /* static artwork node array */
1473   struct ListNodeInfo **dynamic_artwork_list;   /* dynamic artwrk node array */
1474   struct ListNode *content_list;                /* dynamic artwork node list */
1475
1476   void *(*load_artwork)(char *);                /* constructor function */
1477   void (*free_artwork)(void *);                 /* destructor function */
1478 };
1479
1480 struct XY
1481 {
1482   int x, y;
1483 };
1484
1485 struct XYTileSize
1486 {
1487   int x, y;
1488   int tile_size;
1489 };
1490
1491 struct Rect
1492 {
1493   int x, y;
1494   int width, height;
1495 };
1496
1497 struct RectWithBorder
1498 {
1499   int x, y;
1500   int width, height;
1501   int border_size;
1502 };
1503
1504 struct MenuPosInfo
1505 {
1506   int x, y;
1507   int width, height;
1508   int align, valign;
1509 };
1510
1511 struct DoorPartPosInfo
1512 {
1513   int x, y;
1514   int step_xoffset;
1515   int step_yoffset;
1516   int step_delay;
1517   int start_step;
1518   int start_step_opening;
1519   int start_step_closing;
1520   boolean draw_masked;
1521   int sort_priority;
1522 };
1523
1524 struct TextPosInfo
1525 {
1526   int x, y;
1527   int xoffset;                  /* special case for tape date and time */
1528   int xoffset2;                 /* special case for tape date */
1529   int width, height;
1530   int align, valign;
1531   int size;                     /* also used for suffix ".digits" */
1532   int font, font_alt;
1533   boolean draw_masked;
1534   boolean draw_player;          /* special case for network player buttons */
1535   int sort_priority;            /* also used for suffix ".draw_order" */
1536   int id;
1537
1538   int direction;                /* needed for panel time/health graphics */
1539   int class;                    /* needed for panel time/health graphics */
1540   int style;                    /* needed for panel time/health graphics */
1541 };
1542
1543 struct MouseActionInfo
1544 {
1545   int lx, ly;
1546   int button;
1547   int button_hint;
1548 };
1549
1550 struct LevelStats
1551 {
1552   int played;
1553   int solved;
1554 };
1555
1556
1557 /* ========================================================================= */
1558 /* exported variables                                                        */
1559 /* ========================================================================= */
1560
1561 extern struct ProgramInfo       program;
1562 extern struct OptionInfo        options;
1563 extern struct VideoSystemInfo   video;
1564 extern struct AudioSystemInfo   audio;
1565 extern struct GfxInfo           gfx;
1566 extern struct TileCursorInfo    tile_cursor;
1567 extern struct OverlayInfo       overlay;
1568 extern struct AnimInfo          anim;
1569 extern struct ArtworkInfo       artwork;
1570 extern struct JoystickInfo      joystick;
1571 extern struct SetupInfo         setup;
1572
1573 extern LevelDirTree            *leveldir_first_all;
1574 extern LevelDirTree            *leveldir_first;
1575 extern LevelDirTree            *leveldir_current;
1576 extern int                      level_nr;
1577
1578 extern struct LevelStats        level_stats[];
1579
1580 extern DrawWindow              *window;
1581 extern DrawBuffer              *backbuffer;
1582 extern DrawBuffer              *drawto;
1583
1584 extern int                      button_status;
1585 extern boolean                  motion_status;
1586 extern int                      wheel_steps;
1587 #if defined(TARGET_SDL2)
1588 extern boolean                  keyrepeat_status;
1589 #endif
1590
1591 extern int                      redraw_mask;
1592
1593 extern int                      FrameCounter;
1594
1595
1596 /* function definitions */
1597
1598 void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
1599                      char *, int);
1600
1601 void InitScoresInfo();
1602 void SetWindowTitle();
1603
1604 void InitWindowTitleFunction(char *(*window_title_function)(void));
1605 void InitExitMessageFunction(void (*exit_message_function)(char *, va_list));
1606 void InitExitFunction(void (*exit_function)(int));
1607 void InitPlatformDependentStuff(void);
1608 void ClosePlatformDependentStuff(void);
1609
1610 void InitGfxFieldInfo(int, int, int, int, int, int, int, int, Bitmap *);
1611 void InitGfxTileSizeInfo(int, int);
1612 void InitGfxDoor1Info(int, int, int, int);
1613 void InitGfxDoor2Info(int, int, int, int);
1614 void InitGfxDoor3Info(int, int, int, int);
1615 void InitGfxWindowInfo(int, int);
1616 void InitGfxScrollbufferInfo(int, int);
1617 void InitGfxClipRegion(boolean, int, int, int, int);
1618 void InitGfxDrawBusyAnimFunction(void (*draw_busy_anim_function)(void));
1619 void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(int, int));
1620 void InitGfxDrawGlobalBorderFunction(void (*draw_global_border_function)(int));
1621 void InitGfxDrawTileCursorFunction(void (*draw_tile_cursor_function)(int));
1622 void InitGfxCustomArtworkInfo();
1623 void InitGfxOtherSettings();
1624 void InitTileCursorInfo();
1625 void InitOverlayInfo();
1626 void SetTileCursorEnabled(boolean);
1627 void SetTileCursorActive(boolean);
1628 void SetTileCursorTargetXY(int, int);
1629 void SetTileCursorXY(int, int);
1630 void SetTileCursorSXSY(int, int);
1631 void SetOverlayEnabled(boolean);
1632 void SetOverlayActive(boolean);
1633 void SetOverlayShowGrid(boolean);
1634 boolean GetOverlayActive();
1635 void SetDrawDeactivationMask(int);
1636 int GetDrawDeactivationMask(void);
1637 void SetDrawBackgroundMask(int);
1638 void SetWindowBackgroundBitmap(Bitmap *);
1639 void SetMainBackgroundBitmap(Bitmap *);
1640 void SetDoorBackgroundBitmap(Bitmap *);
1641 void SetRedrawMaskFromArea(int, int, int, int);
1642
1643 void LimitScreenUpdates(boolean);
1644
1645 void InitVideoDefaults(void);
1646 void InitVideoDisplay(void);
1647 void CloseVideoDisplay(void);
1648 void InitVideoBuffer(int, int, int, boolean);
1649 Bitmap *CreateBitmapStruct(void);
1650 Bitmap *CreateBitmap(int, int, int);
1651 void ReCreateBitmap(Bitmap **, int, int);
1652 void FreeBitmap(Bitmap *);
1653 void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
1654 void BlitBitmapTiled(Bitmap *, Bitmap *, int, int, int, int, int, int, int,int);
1655 void FadeRectangle(int, int, int, int, int, int, int,
1656                    void (*draw_border_function)(void));
1657 void FillRectangle(Bitmap *, int, int, int, int, Pixel);
1658 void ClearRectangle(Bitmap *, int, int, int, int);
1659 void ClearRectangleOnBackground(Bitmap *, int, int, int, int);
1660 void BlitBitmapMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
1661 boolean DrawingDeactivatedField(void);
1662 boolean DrawingDeactivated(int, int, int, int);
1663 boolean DrawingOnBackground(int, int);
1664 boolean DrawingAreaChanged();
1665 void BlitBitmapOnBackground(Bitmap *, Bitmap *, int, int, int, int, int, int);
1666 void BlitTexture(Bitmap *, int, int, int, int, int, int);
1667 void BlitTextureMasked(Bitmap *, int, int, int, int, int, int);
1668 void BlitToScreen(Bitmap *, int, int, int, int, int, int);
1669 void BlitToScreenMasked(Bitmap *, int, int, int, int, int, int);
1670 void DrawSimpleBlackLine(Bitmap *, int, int, int, int);
1671 void DrawSimpleWhiteLine(Bitmap *, int, int, int, int);
1672 void DrawLines(Bitmap *, struct XY *, int, Pixel);
1673 Pixel GetPixel(Bitmap *, int, int);
1674 Pixel GetPixelFromRGB(Bitmap *, unsigned int,unsigned int,unsigned int);
1675 Pixel GetPixelFromRGBcompact(Bitmap *, unsigned int);
1676
1677 void KeyboardAutoRepeatOn(void);
1678 void KeyboardAutoRepeatOff(void);
1679 boolean SetVideoMode(boolean);
1680 void SetVideoFrameDelay(unsigned int);
1681 unsigned int GetVideoFrameDelay();
1682 boolean ChangeVideoModeIfNeeded(boolean);
1683
1684 Bitmap *LoadImage(char *);
1685 Bitmap *LoadCustomImage(char *);
1686 void ReloadCustomImage(Bitmap *, char *);
1687
1688 void ReCreateGameTileSizeBitmap(Bitmap **);
1689 void CreateBitmapWithSmallBitmaps(Bitmap **, int, int);
1690 void CreateBitmapTextures(Bitmap **);
1691 void FreeBitmapTextures(Bitmap **);
1692 void ScaleBitmap(Bitmap **, int);
1693
1694 void SetMouseCursor(int);
1695
1696 void OpenAudio(void);
1697 void CloseAudio(void);
1698 void SetAudioMode(boolean);
1699
1700 boolean PendingEvent(void);
1701 void WaitEvent(Event *event);
1702 void PeekEvent(Event *event);
1703 void CheckQuitEvent(void);
1704 Key GetEventKey(KeyEvent *, boolean);
1705 KeyMod HandleKeyModState(Key, int);
1706 KeyMod GetKeyModState();
1707 KeyMod GetKeyModStateFromEvents();
1708 void StartTextInput(int, int, int, int);
1709 void StopTextInput();
1710 boolean CheckCloseWindowEvent(ClientMessageEvent *);
1711
1712 void InitJoysticks();
1713 boolean ReadJoystick(int, int *, int *, boolean *, boolean *);
1714 boolean CheckJoystickOpened(int);
1715 void ClearJoystickState();
1716
1717 #endif /* SYSTEM_H */