1 // ============================================================================
2 // Artsoft Retro-Game Library
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
7 // http://www.artsoft.org/
8 // ----------------------------------------------------------------------------
10 // ============================================================================
19 #if defined(PLATFORM_MACOSX)
21 #elif defined(PLATFORM_WIN32)
23 #elif defined(PLATFORM_ANDROID)
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"
35 #define DEFAULT_DEPTH 0
39 #define BLIT_INVERSE 2
40 #define BLIT_ON_BACKGROUND 3
42 /* values for fullscreen status */
43 #define FULLSCREEN_NOT_AVAILABLE FALSE
44 #define FULLSCREEN_AVAILABLE TRUE
46 /* values for window scaling */
47 #define WINDOW_SCALING_NOT_AVAILABLE FALSE
48 #define WINDOW_SCALING_AVAILABLE TRUE
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
55 /* values for window scaling quality */
56 #define SCALING_QUALITY_NEAREST "nearest"
57 #define SCALING_QUALITY_LINEAR "linear"
58 #define SCALING_QUALITY_BEST "best"
60 #define SCALING_QUALITY_DEFAULT SCALING_QUALITY_LINEAR
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"
68 #if defined(TARGET_SDL2)
69 #define STR_SPECIAL_RENDERING_DEFAULT STR_SPECIAL_RENDERING_DOUBLE
71 #define STR_SPECIAL_RENDERING_DEFAULT STR_SPECIAL_RENDERING_BITMAP
74 #define SPECIAL_RENDERING_OFF 0
75 #define SPECIAL_RENDERING_BITMAP 1
76 #define SPECIAL_RENDERING_TARGET 2
77 #define SPECIAL_RENDERING_DOUBLE 3
79 #if defined(TARGET_SDL2)
80 #define SPECIAL_RENDERING_DEFAULT SPECIAL_RENDERING_DOUBLE
82 #define SPECIAL_RENDERING_DEFAULT SPECIAL_RENDERING_BITMAP
85 /* values for touch control */
86 #define TOUCH_CONTROL_VIRTUAL_BUTTONS "virtual_buttons"
87 #define TOUCH_CONTROL_WIPE_GESTURES "wipe_gestures"
88 #define TOUCH_CONTROL_FOLLOW_FINGER "follow_finger"
90 #define TOUCH_CONTROL_DEFAULT TOUCH_CONTROL_VIRTUAL_BUTTONS
92 #define TOUCH_MOVE_DISTANCE_DEFAULT 2
93 #define TOUCH_DROP_DISTANCE_DEFAULT 5
96 /* values for special settings for mobile devices */
97 #if defined(PLATFORM_ANDROID)
98 #define USE_TOUCH_INPUT_OVERLAY
99 #define USE_COMPLETE_DISPLAY
100 #define HAS_SCREEN_KEYBOARD
101 #define SCREEN_KEYBOARD_POS(h) ((h) / 2)
105 /* default input keys */
106 #define DEFAULT_KEY_LEFT KSYM_Left
107 #define DEFAULT_KEY_RIGHT KSYM_Right
108 #define DEFAULT_KEY_UP KSYM_Up
109 #define DEFAULT_KEY_DOWN KSYM_Down
110 #if defined(PLATFORM_MACOSX)
111 #define DEFAULT_KEY_SNAP KSYM_Control_L
112 #define DEFAULT_KEY_DROP KSYM_KP_Enter
114 #define DEFAULT_KEY_SNAP KSYM_Control_L
115 #define DEFAULT_KEY_DROP KSYM_Control_R
117 #define DEFAULT_KEY_OKAY KSYM_Return
118 #define DEFAULT_KEY_CANCEL KSYM_Escape
120 /* default shortcut keys */
121 #define DEFAULT_KEY_SAVE_GAME KSYM_F1
122 #define DEFAULT_KEY_LOAD_GAME KSYM_F2
123 #define DEFAULT_KEY_TOGGLE_PAUSE KSYM_space
124 #define DEFAULT_KEY_FOCUS_PLAYER_1 KSYM_F5
125 #define DEFAULT_KEY_FOCUS_PLAYER_2 KSYM_F6
126 #define DEFAULT_KEY_FOCUS_PLAYER_3 KSYM_F7
127 #define DEFAULT_KEY_FOCUS_PLAYER_4 KSYM_F8
128 #define DEFAULT_KEY_FOCUS_PLAYER_ALL KSYM_F9
129 #define DEFAULT_KEY_TAPE_EJECT KSYM_UNDEFINED
130 #define DEFAULT_KEY_TAPE_EXTRA KSYM_UNDEFINED
131 #define DEFAULT_KEY_TAPE_STOP KSYM_UNDEFINED
132 #define DEFAULT_KEY_TAPE_PAUSE KSYM_UNDEFINED
133 #define DEFAULT_KEY_TAPE_RECORD KSYM_UNDEFINED
134 #define DEFAULT_KEY_TAPE_PLAY KSYM_UNDEFINED
135 #define DEFAULT_KEY_SOUND_SIMPLE KSYM_UNDEFINED
136 #define DEFAULT_KEY_SOUND_LOOPS KSYM_UNDEFINED
137 #define DEFAULT_KEY_SOUND_MUSIC KSYM_UNDEFINED
138 #define DEFAULT_KEY_SNAP_LEFT KSYM_UNDEFINED
139 #define DEFAULT_KEY_SNAP_RIGHT KSYM_UNDEFINED
140 #define DEFAULT_KEY_SNAP_UP KSYM_UNDEFINED
141 #define DEFAULT_KEY_SNAP_DOWN KSYM_UNDEFINED
143 /* default debug setup keys and values */
144 #define DEFAULT_FRAME_DELAY_0 20 // 100 % speed
145 #define DEFAULT_FRAME_DELAY_1 500 // 4 % speed
146 #define DEFAULT_FRAME_DELAY_2 250 // 8 % speed
147 #define DEFAULT_FRAME_DELAY_3 125 // 16 % speed
148 #define DEFAULT_FRAME_DELAY_4 60 // 33 % speed
149 #define DEFAULT_FRAME_DELAY_5 40 // 50 % speed
150 #define DEFAULT_FRAME_DELAY_6 30 // 66 % speed
151 #define DEFAULT_FRAME_DELAY_7 10 // 200 % speed
152 #define DEFAULT_FRAME_DELAY_8 5 // 400 % speed
153 #define DEFAULT_FRAME_DELAY_9 0 // maximum speed
155 #define DEFAULT_KEY_FRAME_DELAY_0 KSYM_0
156 #define DEFAULT_KEY_FRAME_DELAY_1 KSYM_1
157 #define DEFAULT_KEY_FRAME_DELAY_2 KSYM_2
158 #define DEFAULT_KEY_FRAME_DELAY_3 KSYM_3
159 #define DEFAULT_KEY_FRAME_DELAY_4 KSYM_4
160 #define DEFAULT_KEY_FRAME_DELAY_5 KSYM_5
161 #define DEFAULT_KEY_FRAME_DELAY_6 KSYM_6
162 #define DEFAULT_KEY_FRAME_DELAY_7 KSYM_7
163 #define DEFAULT_KEY_FRAME_DELAY_8 KSYM_8
164 #define DEFAULT_KEY_FRAME_DELAY_9 KSYM_9
166 #define NUM_DEBUG_FRAME_DELAY_KEYS 10
168 #define DEFAULT_FRAME_DELAY_USE_MOD_KEY FALSE
169 #define DEFAULT_FRAME_DELAY_GAME_ONLY TRUE
171 /* values for key_status */
172 #define KEY_NOT_PRESSED FALSE
173 #define KEY_RELEASED FALSE
174 #define KEY_PRESSED TRUE
176 /* values for button status */
177 #define MB_NOT_PRESSED FALSE
178 #define MB_NOT_RELEASED TRUE
179 #define MB_RELEASED FALSE
180 #define MB_PRESSED TRUE
181 #define MB_MENU_CHOICE FALSE
182 #define MB_MENU_MARK TRUE
183 #define MB_MENU_INITIALIZE (-1)
184 #define MB_MENU_LEAVE (-2)
185 #define MB_LEFTBUTTON 1
186 #define MB_MIDDLEBUTTON 2
187 #define MB_RIGHTBUTTON 3
188 #define MB_WHEEL_UP 4
189 #define MB_WHEEL_DOWN 5
190 #define MB_WHEEL_LEFT 6
191 #define MB_WHEEL_RIGHT 7
192 #define IS_WHEEL_BUTTON_VERTICAL(b) ((b) == MB_WHEEL_UP || \
193 (b) == MB_WHEEL_DOWN)
194 #define IS_WHEEL_BUTTON_HORIZONTAL(b) ((b) == MB_WHEEL_LEFT || \
195 (b) == MB_WHEEL_RIGHT)
196 #define IS_WHEEL_BUTTON(b) (IS_WHEEL_BUTTON_VERTICAL(b) || \
197 IS_WHEEL_BUTTON_HORIZONTAL(b))
198 #define DEFAULT_WHEEL_STEPS 3
200 #define BUTTON_STEPSIZE(b) ((b) == MB_LEFTBUTTON ? 1 : \
201 (b) == MB_MIDDLEBUTTON ? 5 : \
202 (b) == MB_RIGHTBUTTON ? 10 : 1)
204 /* values for move directions */
205 #define MV_BIT_LEFT 0
206 #define MV_BIT_RIGHT 1
208 #define MV_BIT_DOWN 3
210 #define NUM_DIRECTIONS 4
212 /* diagonal movement directions are used in a different contect than buttons */
213 #define MV_BIT_UPLEFT 4
214 #define MV_BIT_UPRIGHT 5
215 #define MV_BIT_DOWNLEFT 6
216 #define MV_BIT_DOWNRIGHT 7
218 #define NUM_DIRECTIONS_FULL 8
220 /* values for special "button" bitmasks */
224 #define NUM_PLAYER_ACTIONS 6
226 /* values for special "focus player" bitmasks */
227 #define BIT_SET_FOCUS 6
229 /* values for drawing stages for global animations */
230 #define DRAW_GLOBAL_ANIM_STAGE_1 1
231 #define DRAW_GLOBAL_ANIM_STAGE_2 2
233 /* values for drawing target (various functions) */
234 #define DRAW_TO_BACKBUFFER 0
235 #define DRAW_TO_FIELDBUFFER 1
236 #define DRAW_TO_SCREEN 2
237 #define DRAW_TO_FADE_SOURCE 3
238 #define DRAW_TO_FADE_TARGET 4
240 /* values for move directions and special "button" key bitmasks */
242 #define MV_LEFT (1 << MV_BIT_LEFT)
243 #define MV_RIGHT (1 << MV_BIT_RIGHT)
244 #define MV_UP (1 << MV_BIT_UP)
245 #define MV_DOWN (1 << MV_BIT_DOWN)
247 #define MV_UPLEFT (MV_UP | MV_LEFT)
248 #define MV_UPRIGHT (MV_UP | MV_RIGHT)
249 #define MV_DOWNLEFT (MV_DOWN | MV_LEFT)
250 #define MV_DOWNRIGHT (MV_DOWN | MV_RIGHT)
252 #define MV_HORIZONTAL (MV_LEFT | MV_RIGHT)
253 #define MV_VERTICAL (MV_UP | MV_DOWN)
254 #define MV_ALL_DIRECTIONS (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
255 #define MV_ANY_DIRECTION (MV_ALL_DIRECTIONS)
256 #define MV_NO_DIRECTION (MV_NONE)
258 #define KEY_BUTTON_1 (1 << BUTTON_1)
259 #define KEY_BUTTON_2 (1 << BUTTON_2)
260 #define KEY_BUTTON_SNAP KEY_BUTTON_1
261 #define KEY_BUTTON_DROP KEY_BUTTON_2
262 #define KEY_MOTION (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
263 #define KEY_BUTTON (KEY_BUTTON_1 | KEY_BUTTON_2)
264 #define KEY_ACTION (KEY_MOTION | KEY_BUTTON)
266 #define KEY_SET_FOCUS (1 << BIT_SET_FOCUS)
268 #define MV_DIR_FROM_BIT(x) ((x) < NUM_DIRECTIONS ? 1 << (x) : \
269 (x) == MV_BIT_UPLEFT ? MV_UPLEFT : \
270 (x) == MV_BIT_UPRIGHT ? MV_UPRIGHT : \
271 (x) == MV_BIT_DOWNLEFT ? MV_DOWNLEFT : \
272 (x) == MV_BIT_DOWNRIGHT ? MV_DOWNRIGHT : \
275 #define MV_DIR_TO_BIT(x) ((x) == MV_LEFT ? MV_BIT_LEFT : \
276 (x) == MV_RIGHT ? MV_BIT_RIGHT : \
277 (x) == MV_UP ? MV_BIT_UP : \
278 (x) == MV_DOWN ? MV_BIT_DOWN : \
279 (x) == MV_UPLEFT ? MV_BIT_UPLEFT : \
280 (x) == MV_UPRIGHT ? MV_BIT_UPRIGHT : \
281 (x) == MV_DOWNLEFT ? MV_BIT_DOWNLEFT : \
282 (x) == MV_DOWNRIGHT ? MV_BIT_DOWNRIGHT : \
285 #define MV_DIR_OPPOSITE(x) ((x) == MV_LEFT ? MV_RIGHT : \
286 (x) == MV_RIGHT ? MV_LEFT : \
287 (x) == MV_UP ? MV_DOWN : \
288 (x) == MV_DOWN ? MV_UP : \
289 (x) == MV_UPLEFT ? MV_DOWNRIGHT : \
290 (x) == MV_UPRIGHT ? MV_DOWNLEFT : \
291 (x) == MV_DOWNLEFT ? MV_UPRIGHT : \
292 (x) == MV_DOWNRIGHT ? MV_UPLEFT : \
295 /* values for animation mode (frame order and direction) */
296 /* (stored in level files -- never change existing values) */
298 #define ANIM_LOOP (1 << 0)
299 #define ANIM_LINEAR (1 << 1)
300 #define ANIM_PINGPONG (1 << 2)
301 #define ANIM_PINGPONG2 (1 << 3)
302 #define ANIM_RANDOM (1 << 4)
303 #define ANIM_CE_VALUE (1 << 5)
304 #define ANIM_CE_SCORE (1 << 6)
305 #define ANIM_CE_DELAY (1 << 7)
306 #define ANIM_REVERSE (1 << 8)
307 #define ANIM_OPAQUE_PLAYER (1 << 9)
309 /* values for special (non game element) animation modes */
310 /* (not stored in level files -- can be changed, if needed) */
311 #define ANIM_HORIZONTAL (1 << 10)
312 #define ANIM_VERTICAL (1 << 11)
313 #define ANIM_CENTERED (1 << 12)
314 #define ANIM_STATIC_PANEL (1 << 13)
315 #define ANIM_ALL (1 << 14)
316 #define ANIM_ONCE (1 << 15)
318 #define ANIM_DEFAULT ANIM_LOOP
320 /* values for special drawing styles (currently only for crumbled graphics) */
322 #define STYLE_ACCURATE_BORDERS (1 << 0)
323 #define STYLE_INNER_CORNERS (1 << 1)
325 #define STYLE_DEFAULT STYLE_NONE
327 #define ANIM_EVENT_NONE 0
328 #define ANIM_EVENT_CLICK_ANIM_1 (1 << 0)
329 #define ANIM_EVENT_CLICK_ANIM_2 (1 << 1)
330 #define ANIM_EVENT_CLICK_ANIM_3 (1 << 2)
331 #define ANIM_EVENT_CLICK_ANIM_4 (1 << 3)
332 #define ANIM_EVENT_CLICK_ANIM_5 (1 << 4)
333 #define ANIM_EVENT_CLICK_ANIM_6 (1 << 5)
334 #define ANIM_EVENT_CLICK_ANIM_7 (1 << 6)
335 #define ANIM_EVENT_CLICK_ANIM_8 (1 << 7)
336 #define ANIM_EVENT_CLICK_PART_1 (1 << 8)
337 #define ANIM_EVENT_CLICK_PART_2 (1 << 9)
338 #define ANIM_EVENT_CLICK_PART_3 (1 << 10)
339 #define ANIM_EVENT_CLICK_PART_4 (1 << 11)
340 #define ANIM_EVENT_CLICK_PART_5 (1 << 12)
341 #define ANIM_EVENT_CLICK_PART_6 (1 << 13)
342 #define ANIM_EVENT_CLICK_PART_7 (1 << 14)
343 #define ANIM_EVENT_CLICK_PART_8 (1 << 15)
344 #define ANIM_EVENT_CLICK_SELF (1 << 16)
346 #define ANIM_EVENT_CLICK_ANIM_ALL (ANIM_EVENT_CLICK_ANIM_1 | \
347 ANIM_EVENT_CLICK_ANIM_2 | \
348 ANIM_EVENT_CLICK_ANIM_3 | \
349 ANIM_EVENT_CLICK_ANIM_4 | \
350 ANIM_EVENT_CLICK_ANIM_5 | \
351 ANIM_EVENT_CLICK_ANIM_6 | \
352 ANIM_EVENT_CLICK_ANIM_7 | \
353 ANIM_EVENT_CLICK_ANIM_8)
355 #define ANIM_EVENT_CLICK_PART_ALL (ANIM_EVENT_CLICK_PART_1 | \
356 ANIM_EVENT_CLICK_PART_2 | \
357 ANIM_EVENT_CLICK_PART_3 | \
358 ANIM_EVENT_CLICK_PART_4 | \
359 ANIM_EVENT_CLICK_PART_5 | \
360 ANIM_EVENT_CLICK_PART_6 | \
361 ANIM_EVENT_CLICK_PART_7 | \
362 ANIM_EVENT_CLICK_PART_8)
364 #define ANIM_EVENT_DEFAULT ANIM_EVENT_NONE
366 /* values for fade mode */
367 #define FADE_TYPE_NONE 0
368 #define FADE_TYPE_FADE_IN (1 << 0)
369 #define FADE_TYPE_FADE_OUT (1 << 1)
370 #define FADE_TYPE_TRANSFORM (1 << 2)
371 #define FADE_TYPE_CROSSFADE (1 << 3)
372 #define FADE_TYPE_MELT (1 << 4)
373 #define FADE_TYPE_CURTAIN (1 << 5)
374 #define FADE_TYPE_SKIP (1 << 6)
376 #define FADE_MODE_NONE (FADE_TYPE_NONE)
377 #define FADE_MODE_FADE_IN (FADE_TYPE_FADE_IN)
378 #define FADE_MODE_FADE_OUT (FADE_TYPE_FADE_OUT)
379 #define FADE_MODE_FADE (FADE_TYPE_FADE_IN | FADE_TYPE_FADE_OUT)
380 #define FADE_MODE_TRANSFORM (FADE_TYPE_TRANSFORM | FADE_TYPE_FADE_IN)
381 #define FADE_MODE_CROSSFADE (FADE_MODE_TRANSFORM | FADE_TYPE_CROSSFADE)
382 #define FADE_MODE_MELT (FADE_MODE_TRANSFORM | FADE_TYPE_MELT)
383 #define FADE_MODE_CURTAIN (FADE_MODE_TRANSFORM | FADE_TYPE_CURTAIN)
384 #define FADE_MODE_SKIP_FADE_IN (FADE_TYPE_SKIP | FADE_TYPE_FADE_IN)
385 #define FADE_MODE_SKIP_FADE_OUT (FADE_TYPE_SKIP | FADE_TYPE_FADE_OUT)
387 #define FADE_MODE_DEFAULT FADE_MODE_FADE
389 /* values for toon positions */
390 #define POS_UNDEFINED -1
400 /* values for text alignment */
401 #define ALIGN_LEFT (1 << 0)
402 #define ALIGN_RIGHT (1 << 1)
403 #define ALIGN_CENTER (1 << 2)
404 #define ALIGN_DEFAULT ALIGN_LEFT
406 #define VALIGN_TOP (1 << 0)
407 #define VALIGN_BOTTOM (1 << 1)
408 #define VALIGN_MIDDLE (1 << 2)
409 #define VALIGN_DEFAULT VALIGN_TOP
411 #define ALIGNED_XPOS(x,w,a) ((a) == ALIGN_CENTER ? (x) - (w) / 2 : \
412 (a) == ALIGN_RIGHT ? (x) - (w) : (x))
413 #define ALIGNED_YPOS(y,h,v) ((v) == VALIGN_MIDDLE ? (y) - (h) / 2 : \
414 (v) == VALIGN_BOTTOM ? (y) - (h) : (y))
415 #define ALIGNED_TEXT_XPOS(p) ALIGNED_XPOS((p)->x, (p)->width, (p)->align)
416 #define ALIGNED_TEXT_YPOS(p) ALIGNED_YPOS((p)->y, (p)->height, (p)->valign)
418 /* values for redraw_mask */
419 #define REDRAW_NONE (0)
420 #define REDRAW_ALL (1 << 0)
421 #define REDRAW_FIELD (1 << 1)
422 #define REDRAW_DOOR_1 (1 << 2)
423 #define REDRAW_DOOR_2 (1 << 3)
424 #define REDRAW_DOOR_3 (1 << 4)
425 #define REDRAW_FPS (1 << 5)
427 #define REDRAW_DOORS (REDRAW_DOOR_1 | \
431 #define IN_GFX_FIELD_PLAY(x, y) (x >= gfx.sx && x < gfx.sx + gfx.sxsize && \
432 y >= gfx.sy && y < gfx.sy + gfx.sysize)
433 #define IN_GFX_FIELD_FULL(x, y) (x >= gfx.real_sx && \
434 x < gfx.real_sx + gfx.full_sxsize && \
435 y >= gfx.real_sy && \
436 y < gfx.real_sy + gfx.full_sysize)
437 #define IN_GFX_DOOR_1(x, y) (x >= gfx.dx && x < gfx.dx + gfx.dxsize && \
438 y >= gfx.dy && y < gfx.dy + gfx.dysize)
439 #define IN_GFX_DOOR_2(x, y) (x >= gfx.vx && x < gfx.vx + gfx.vxsize && \
440 y >= gfx.vy && y < gfx.vy + gfx.vysize)
441 #define IN_GFX_DOOR_3(x, y) (x >= gfx.ex && x < gfx.ex + gfx.exsize && \
442 y >= gfx.ey && y < gfx.ey + gfx.eysize)
444 /* values for mouse cursor */
445 #define CURSOR_DEFAULT 0
446 #define CURSOR_NONE 1
447 #define CURSOR_PLAYFIELD 2
449 /* fundamental game speed values */
450 #define ONE_SECOND_DELAY 1000 /* delay value for one second */
451 #define MENU_FRAME_DELAY 20 /* frame delay in milliseconds */
452 #define GAME_FRAME_DELAY 20 /* frame delay in milliseconds */
453 #define FFWD_FRAME_DELAY 10 /* 200% speed for fast forward */
454 #define FRAMES_PER_SECOND (ONE_SECOND_DELAY / GAME_FRAME_DELAY)
455 #define FRAMES_PER_SECOND_SP 35
457 /* maximum playfield size supported by libgame functions */
458 #define MAX_PLAYFIELD_WIDTH 128
459 #define MAX_PLAYFIELD_HEIGHT 128
461 /* maximum number of parallel players supported by libgame functions */
462 #define MAX_PLAYERS 4
464 /* maximum allowed length of player name */
465 #define MAX_PLAYER_NAME_LEN 10
467 /* maximum number of levels in a level set */
468 #define MAX_LEVELS 1000
470 /* default name for empty highscore entry */
471 #define EMPTY_PLAYER_NAME "no name"
473 /* default name for unknown player names */
474 #define ANONYMOUS_NAME "anonymous"
476 /* default for other unknown names */
477 #define UNKNOWN_NAME "unknown"
479 /* default name for new levels */
480 #define NAMELESS_LEVEL_NAME "nameless level"
482 /* default text for non-existant artwork */
483 #define NOT_AVAILABLE "(not available)"
485 /* default value for undefined filename */
486 #define UNDEFINED_FILENAME "[NONE]"
488 /* default value for undefined levelset */
489 #define UNDEFINED_LEVELSET "[NONE]"
491 /* default value for undefined parameter */
492 #define ARG_DEFAULT "[DEFAULT]"
494 /* default values for undefined configuration file parameters */
495 #define ARG_UNDEFINED "-1000000"
496 #define ARG_UNDEFINED_VALUE (-1000000)
498 /* default value for off-screen positions */
499 #define POS_OFFSCREEN (-1000000)
501 /* definitions for game sub-directories */
503 #define RO_GAME_DIR "."
507 #define RW_GAME_DIR "."
510 #define RO_BASE_PATH RO_GAME_DIR
511 #define RW_BASE_PATH RW_GAME_DIR
513 /* directory names */
514 #define GRAPHICS_DIRECTORY "graphics"
515 #define SOUNDS_DIRECTORY "sounds"
516 #define MUSIC_DIRECTORY "music"
517 #define LEVELS_DIRECTORY "levels"
518 #define TAPES_DIRECTORY "tapes"
519 #define SCORES_DIRECTORY "scores"
520 #define DOCS_DIRECTORY "docs"
521 #define CACHE_DIRECTORY "cache"
523 #define GFX_CLASSIC_SUBDIR "gfx_classic"
524 #define SND_CLASSIC_SUBDIR "snd_classic"
525 #define MUS_CLASSIC_SUBDIR "mus_classic"
527 #define GFX_DEFAULT_SUBDIR (setup.internal.default_graphics_set)
528 #define SND_DEFAULT_SUBDIR (setup.internal.default_sounds_set)
529 #define MUS_DEFAULT_SUBDIR (setup.internal.default_music_set)
531 #define GFX_FALLBACK_FILENAME (setup.internal.fallback_graphics_file)
532 #define SND_FALLBACK_FILENAME (setup.internal.fallback_sounds_file)
533 #define MUS_FALLBACK_FILENAME (setup.internal.fallback_music_file)
535 #define DEFAULT_LEVELSET (setup.internal.default_level_series)
537 /* file names and filename extensions */
538 #define LEVELSETUP_DIRECTORY "levelsetup"
539 #define SETUP_FILENAME "setup.conf"
540 #define LEVELSETUP_FILENAME "levelsetup.conf"
541 #define EDITORSETUP_FILENAME "editorsetup.conf"
542 #define EDITORCASCADE_FILENAME "editorcascade.conf"
543 #define HELPANIM_FILENAME "helpanim.conf"
544 #define HELPTEXT_FILENAME "helptext.conf"
545 #define LEVELINFO_FILENAME "levelinfo.conf"
546 #define GRAPHICSINFO_FILENAME "graphicsinfo.conf"
547 #define SOUNDSINFO_FILENAME "soundsinfo.conf"
548 #define MUSICINFO_FILENAME "musicinfo.conf"
549 #define ARTWORKINFO_CACHE_FILE "artworkinfo.cache"
550 #define LEVELTEMPLATE_FILENAME "template.level"
551 #define LEVELFILE_EXTENSION "level"
552 #define TAPEFILE_EXTENSION "tape"
553 #define SCOREFILE_EXTENSION "score"
555 #define LOG_OUT_BASENAME "stdout.txt"
556 #define LOG_ERR_BASENAME "stderr.txt"
562 #define STRING_PARENT_DIRECTORY ".."
563 #define STRING_TOP_DIRECTORY "/"
565 #define CHAR_PATH_SEPARATOR_UNIX '/'
566 #define CHAR_PATH_SEPARATOR_DOS '\\'
568 #define STRING_PATH_SEPARATOR_UNIX "/"
569 #define STRING_PATH_SEPARATOR_DOS "\\"
571 #define STRING_NEWLINE_UNIX "\n"
572 #define STRING_NEWLINE_DOS "\r\n"
574 #if defined(PLATFORM_WIN32)
575 #define CHAR_PATH_SEPARATOR CHAR_PATH_SEPARATOR_DOS
576 #define STRING_PATH_SEPARATOR STRING_PATH_SEPARATOR_DOS
577 #define STRING_NEWLINE STRING_NEWLINE_DOS
579 #define CHAR_PATH_SEPARATOR CHAR_PATH_SEPARATOR_UNIX
580 #define STRING_PATH_SEPARATOR STRING_PATH_SEPARATOR_UNIX
581 #define STRING_NEWLINE STRING_NEWLINE_UNIX
585 /* areas in bitmap PIX_DOOR */
586 /* meaning in PIX_DB_DOOR: (3 PAGEs)
587 PAGEX1: 1. buffer for DOOR_1
588 PAGEX2: 2. buffer for DOOR_1
589 PAGEX3: buffer for animations
592 /* these values are hard-coded to be able to use them in initialization */
593 #define DOOR_GFX_PAGE_WIDTH 100 /* should be set to "gfx.dxsize" */
594 #define DOOR_GFX_PAGE_HEIGHT 280 /* should be set to "gfx.dysize" */
596 #define DOOR_GFX_PAGESIZE (DOOR_GFX_PAGE_WIDTH)
597 #define DOOR_GFX_PAGEX1 (0 * DOOR_GFX_PAGESIZE)
598 #define DOOR_GFX_PAGEX2 (1 * DOOR_GFX_PAGESIZE)
599 #define DOOR_GFX_PAGEX3 (2 * DOOR_GFX_PAGESIZE)
600 #define DOOR_GFX_PAGEX4 (3 * DOOR_GFX_PAGESIZE)
601 #define DOOR_GFX_PAGEX5 (4 * DOOR_GFX_PAGESIZE)
602 #define DOOR_GFX_PAGEX6 (5 * DOOR_GFX_PAGESIZE)
603 #define DOOR_GFX_PAGEX7 (6 * DOOR_GFX_PAGESIZE)
604 #define DOOR_GFX_PAGEX8 (7 * DOOR_GFX_PAGESIZE)
605 #define DOOR_GFX_PAGEY1 (0)
606 #define DOOR_GFX_PAGEY2 (DOOR_GFX_PAGE_HEIGHT)
609 /* macros for version handling */
610 #define VERSION_MAJOR(x) ((x) / 1000000)
611 #define VERSION_MINOR(x) (((x) % 1000000) / 10000)
612 #define VERSION_PATCH(x) (((x) % 10000) / 100)
613 #define VERSION_BUILD(x) ((x) % 100)
614 #define VERSION_IDENT(a,b,c,d) ((a) * 1000000 + (b) * 10000 + (c) * 100 + (d))
617 /* macros for parent/child process identification */
618 #if defined(PLATFORM_UNIX)
619 #define IS_PARENT_PROCESS() (audio.mixer_pid != getpid())
620 #define IS_CHILD_PROCESS() (audio.mixer_pid == getpid())
621 #define HAS_CHILD_PROCESS() (audio.mixer_pid > 0)
623 #define IS_PARENT_PROCESS() TRUE
624 #define IS_CHILD_PROCESS() FALSE
625 #define HAS_CHILD_PROCESS() FALSE
629 /* values for artwork type */
630 #define ARTWORK_TYPE_GRAPHICS 0
631 #define ARTWORK_TYPE_SOUNDS 1
632 #define ARTWORK_TYPE_MUSIC 2
634 #define NUM_ARTWORK_TYPES 3
637 /* values for tree type (chosen to match artwork type) */
638 #define TREE_TYPE_UNDEFINED -1
639 #define TREE_TYPE_GRAPHICS_DIR ARTWORK_TYPE_GRAPHICS
640 #define TREE_TYPE_SOUNDS_DIR ARTWORK_TYPE_SOUNDS
641 #define TREE_TYPE_MUSIC_DIR ARTWORK_TYPE_MUSIC
642 #define TREE_TYPE_LEVEL_DIR 3
643 #define TREE_TYPE_LEVEL_NR 4
645 #define NUM_TREE_TYPES 5
647 #define INFOTEXT_UNDEFINED ""
648 #define INFOTEXT_GRAPHICS_DIR "Custom Graphics"
649 #define INFOTEXT_SOUNDS_DIR "Custom Sounds"
650 #define INFOTEXT_MUSIC_DIR "Custom Music"
651 #define INFOTEXT_LEVEL_DIR "Level Sets"
652 #define INFOTEXT_LEVEL_NR "Levels"
654 #define TREE_INFOTEXT(t) ((t) == TREE_TYPE_LEVEL_NR ? \
655 INFOTEXT_LEVEL_NR : \
656 (t) == TREE_TYPE_LEVEL_DIR ? \
657 INFOTEXT_LEVEL_DIR : \
658 (t) == TREE_TYPE_GRAPHICS_DIR ? \
659 INFOTEXT_GRAPHICS_DIR : \
660 (t) == TREE_TYPE_SOUNDS_DIR ? \
661 INFOTEXT_SOUNDS_DIR : \
662 (t) == TREE_TYPE_MUSIC_DIR ? \
663 INFOTEXT_MUSIC_DIR : \
666 /* values for artwork handling */
667 #define LEVELDIR_ARTWORK_SET_PTR(leveldir, type) \
668 ((type) == ARTWORK_TYPE_GRAPHICS ? \
669 &(leveldir)->graphics_set : \
670 (type) == ARTWORK_TYPE_SOUNDS ? \
671 &(leveldir)->sounds_set : \
672 &(leveldir)->music_set)
674 #define LEVELDIR_ARTWORK_SET(leveldir, type) \
675 ((type) == ARTWORK_TYPE_GRAPHICS ? \
676 (leveldir)->graphics_set : \
677 (type) == ARTWORK_TYPE_SOUNDS ? \
678 (leveldir)->sounds_set : \
679 (leveldir)->music_set)
681 #define LEVELDIR_ARTWORK_PATH_PTR(leveldir, type) \
682 ((type) == ARTWORK_TYPE_GRAPHICS ? \
683 &(leveldir)->graphics_path : \
684 (type) == ARTWORK_TYPE_SOUNDS ? \
685 &(leveldir)->sounds_path : \
686 &(leveldir)->music_path)
688 #define LEVELDIR_ARTWORK_PATH(leveldir, type) \
689 ((type) == ARTWORK_TYPE_GRAPHICS ? \
690 (leveldir)->graphics_path : \
691 (type) == ARTWORK_TYPE_SOUNDS ? \
692 (leveldir)->sounds_path : \
693 (leveldir)->music_path)
695 #define SETUP_ARTWORK_SET(setup, type) \
696 ((type) == ARTWORK_TYPE_GRAPHICS ? \
697 (setup).graphics_set : \
698 (type) == ARTWORK_TYPE_SOUNDS ? \
699 (setup).sounds_set : \
702 #define SETUP_OVERRIDE_ARTWORK(setup, type) \
703 ((type) == ARTWORK_TYPE_GRAPHICS ? \
704 (setup).override_level_graphics : \
705 (type) == ARTWORK_TYPE_SOUNDS ? \
706 (setup).override_level_sounds : \
707 (setup).override_level_music)
709 #define GFX_OVERRIDE_ARTWORK(type) \
710 ((type) == ARTWORK_TYPE_GRAPHICS ? \
711 gfx.override_level_graphics : \
712 (type) == ARTWORK_TYPE_SOUNDS ? \
713 gfx.override_level_sounds : \
714 gfx.override_level_music)
716 #define ARTWORK_FIRST_NODE(artwork, type) \
717 ((type) == ARTWORK_TYPE_GRAPHICS ? \
718 (artwork).gfx_first : \
719 (type) == ARTWORK_TYPE_SOUNDS ? \
720 (artwork).snd_first : \
723 #define ARTWORK_CURRENT_IDENTIFIER_PTR(artwork, type) \
724 ((type) == ARTWORK_TYPE_GRAPHICS ? \
725 &(artwork).gfx_current_identifier : \
726 (type) == ARTWORK_TYPE_SOUNDS ? \
727 &(artwork).snd_current_identifier : \
728 &(artwork).mus_current_identifier)
730 #define ARTWORK_CURRENT_IDENTIFIER(artwork, type) \
731 ((type) == ARTWORK_TYPE_GRAPHICS ? \
732 (artwork).gfx_current_identifier : \
733 (type) == ARTWORK_TYPE_SOUNDS ? \
734 (artwork).snd_current_identifier : \
735 (artwork).mus_current_identifier)
737 #define ARTWORKINFO_FILENAME(type) \
738 ((type) == ARTWORK_TYPE_GRAPHICS ? \
739 GRAPHICSINFO_FILENAME : \
740 (type) == ARTWORK_TYPE_SOUNDS ? \
741 SOUNDSINFO_FILENAME : \
742 (type) == ARTWORK_TYPE_MUSIC ? \
743 MUSICINFO_FILENAME : "")
745 #define ARTWORK_DIRECTORY(type) \
746 ((type) == ARTWORK_TYPE_GRAPHICS ? \
747 GRAPHICS_DIRECTORY : \
748 (type) == ARTWORK_TYPE_SOUNDS ? \
750 (type) == ARTWORK_TYPE_MUSIC ? \
751 MUSIC_DIRECTORY : "")
753 #define OPTIONS_ARTWORK_DIRECTORY(type) \
754 ((type) == ARTWORK_TYPE_GRAPHICS ? \
755 options.graphics_directory : \
756 (type) == ARTWORK_TYPE_SOUNDS ? \
757 options.sounds_directory : \
758 (type) == ARTWORK_TYPE_MUSIC ? \
759 options.music_directory : "")
761 #define UPDATE_BUSY_STATE() \
763 if (gfx.draw_busy_anim_function != NULL) \
764 gfx.draw_busy_anim_function(); \
768 /* structure definitions */
772 char *command_basepath; /* path to the program binary */
773 char *command_basename; /* base filename of the program binary */
775 char *config_filename; /* optional global program config filename */
777 char *maindata_path; /* main game data (installation) directory */
779 char *userdata_subdir; /* personal user game data directory */
780 char *userdata_path; /* resulting full path to game data directory */
790 char *log_filename[NUM_LOGS]; /* log filenames for out/err messages */
791 FILE *log_file[NUM_LOGS]; /* log file handles for out/err files */
792 FILE *log_file_default[NUM_LOGS]; /* default log file handles (out/err) */
800 char *(*window_title_function)(void);
801 void (*exit_message_function)(char *, va_list);
802 void (*exit_function)(int);
804 boolean global_scores;
805 boolean many_scores_per_name;
815 char *ro_base_directory;
816 char *rw_base_directory;
817 char *level_directory;
818 char *graphics_directory;
819 char *sounds_directory;
820 char *music_directory;
821 char *docs_directory;
823 char *execute_command;
834 struct VideoSystemInfo
837 int width, height, depth;
838 int window_width, window_height;
839 int display_width, display_height;
840 int screen_width, screen_height;
841 int screen_xoffset, screen_yoffset;
843 boolean fullscreen_available;
844 boolean fullscreen_enabled;
845 boolean fullscreen_initial;
847 boolean window_scaling_available;
848 int window_scaling_percent;
849 char *window_scaling_quality;
850 int screen_rendering_mode;
852 unsigned int frame_delay;
853 unsigned int frame_delay_value;
857 int shifted_up_pos_last;
858 unsigned int shifted_up_delay;
859 unsigned int shifted_up_delay_value;
864 struct AudioSystemInfo
866 boolean sound_available;
867 boolean loops_available;
868 boolean music_available;
870 boolean sound_enabled;
871 boolean sound_deactivated; /* for temporarily disabling sound */
880 int first_sound_channel;
883 struct FontBitmapInfo
887 int src_x, src_y; /* start position of animation frames */
888 int width, height; /* width/height of each animation frame */
890 int draw_xoffset; /* offset for drawing font characters */
891 int draw_yoffset; /* offset for drawing font characters */
894 int num_chars_per_line;
901 int real_sx, real_sy;
902 int full_sxsize, full_sysize;
903 int scrollbuffer_width, scrollbuffer_height;
905 int game_tile_size, standard_tile_size;
916 int win_xsize, win_ysize;
918 int draw_deactivation_mask;
919 int draw_background_mask;
921 Bitmap *field_save_buffer;
923 Bitmap *background_bitmap;
924 int background_bitmap_mask;
926 Bitmap *fade_bitmap_backup;
927 Bitmap *fade_bitmap_source;
928 Bitmap *fade_bitmap_target;
929 Bitmap *fade_bitmap_black;
931 int fade_border_source_status;
932 int fade_border_target_status;
933 Bitmap *masked_border_bitmap_ptr;
935 Bitmap *final_screen_bitmap;
937 boolean clipping_enabled;
939 int clip_width, clip_height;
941 boolean override_level_graphics;
942 boolean override_level_sounds;
943 boolean override_level_music;
945 boolean draw_init_text;
948 struct FontBitmapInfo *font_bitmap_info;
949 int (*select_font_function)(int);
950 int (*get_font_from_token_function)(char *);
952 int anim_random_frame;
954 void (*draw_busy_anim_function)(void);
955 void (*draw_global_anim_function)(int, int);
956 void (*draw_global_border_function)(int);
969 int fd[MAX_PLAYERS]; /* file descriptor of player's joystick */
972 struct SetupJoystickInfo
974 char *device_name; /* device name of player's joystick */
976 int xleft, xmiddle, xright;
977 int yupper, ymiddle, ylower;
981 struct SetupKeyboardInfo
983 Key left, right, up, down;
987 struct SetupTouchInfo
994 struct SetupInputInfo
996 boolean use_joystick;
997 struct SetupJoystickInfo joy;
998 struct SetupKeyboardInfo key;
1001 struct SetupEditorInfo
1003 boolean el_boulderdash;
1004 boolean el_emerald_mine;
1005 boolean el_emerald_mine_club;
1008 boolean el_supaplex;
1009 boolean el_diamond_caves;
1010 boolean el_dx_boulderdash;
1012 boolean el_steel_chars;
1016 boolean el_user_defined;
1019 boolean el_headlines;
1024 boolean show_element_token;
1026 boolean use_template_for_new_levels;
1029 struct SetupEditorCascadeInfo
1040 boolean el_steel_chars;
1048 struct SetupShortcutInfo
1054 Key focus_player[MAX_PLAYERS];
1055 Key focus_player_all;
1074 struct SetupSystemInfo
1076 char *sdl_videodriver;
1077 char *sdl_audiodriver;
1078 int audio_fragment_size;
1081 struct SetupInternalInfo
1083 char *program_title;
1084 char *program_author;
1085 char *program_email;
1086 char *program_website;
1087 char *program_copyright;
1088 char *program_company;
1090 char *program_icon_file;
1092 char *default_graphics_set;
1093 char *default_sounds_set;
1094 char *default_music_set;
1096 char *fallback_graphics_file;
1097 char *fallback_sounds_file;
1098 char *fallback_music_file;
1100 char *default_level_series;
1102 int default_window_width;
1103 int default_window_height;
1105 boolean choose_from_top_leveldir;
1108 struct SetupDebugInfo
1110 int frame_delay[10];
1111 Key frame_delay_key[10];
1112 boolean frame_delay_use_mod_key;
1113 boolean frame_delay_game_only;
1121 boolean sound_loops;
1122 boolean sound_music;
1123 boolean sound_simple;
1125 boolean scroll_delay;
1126 boolean scroll_delay_value;
1127 char *engine_snapshot_mode;
1128 int engine_snapshot_memory;
1129 boolean fade_screens;
1131 boolean show_titlescreen;
1132 boolean quick_doors;
1135 boolean skip_levels;
1136 boolean increment_levels;
1139 int window_scaling_percent;
1140 char *window_scaling_quality;
1141 char *screen_rendering_mode;
1142 boolean ask_on_escape;
1143 boolean ask_on_escape_editor;
1144 boolean quick_switch;
1145 boolean input_on_focus;
1146 boolean prefer_aga_graphics;
1147 int game_frame_delay;
1148 boolean sp_show_border_elements;
1149 boolean small_game_graphics;
1150 boolean show_snapshot_buttons;
1155 int override_level_graphics; /* not boolean -- can also be "AUTO" */
1156 int override_level_sounds; /* not boolean -- can also be "AUTO" */
1157 int override_level_music; /* not boolean -- can also be "AUTO" */
1163 struct SetupEditorInfo editor;
1164 struct SetupEditorCascadeInfo editor_cascade;
1165 struct SetupShortcutInfo shortcut;
1166 struct SetupInputInfo input[MAX_PLAYERS];
1167 struct SetupTouchInfo touch;
1168 struct SetupSystemInfo system;
1169 struct SetupInternalInfo internal;
1170 struct SetupDebugInfo debug;
1172 struct OptionInfo options;
1177 struct TreeInfo **node_top; /* topmost node in tree */
1178 struct TreeInfo *node_parent; /* parent level directory info */
1179 struct TreeInfo *node_group; /* level group sub-directory info */
1180 struct TreeInfo *next; /* next level series structure node */
1182 int cl_first; /* internal control field for setup screen */
1183 int cl_cursor; /* internal control field for setup screen */
1185 int type; /* type of tree content */
1187 /* fields for "type == TREE_TYPE_LEVEL_DIR" */
1189 char *subdir; /* tree info sub-directory basename (may be ".") */
1190 char *fullpath; /* complete path relative to tree base directory */
1191 char *basepath; /* absolute base path of tree base directory */
1192 char *identifier; /* identifier string for configuration files */
1193 char *name; /* tree info name, as displayed in selection menues */
1194 char *name_sorting; /* optional sorting name for correct name sorting */
1195 char *author; /* level or artwork author name */
1196 char *year; /* optional year of creation for levels or artwork */
1197 char *imported_from; /* optional comment for imported levels or artwork */
1198 char *imported_by; /* optional comment for imported levels or artwork */
1199 char *tested_by; /* optional comment to name people who tested a set */
1201 char *graphics_set_ecs; /* special EMC custom graphics set (ECS graphics) */
1202 char *graphics_set_aga; /* special EMC custom graphics set (AGA graphics) */
1203 char *graphics_set; /* optional custom graphics set (level tree only) */
1204 char *sounds_set; /* optional custom sounds set (level tree only) */
1205 char *music_set; /* optional custom music set (level tree only) */
1206 char *graphics_path; /* path to optional custom graphics set (level only) */
1207 char *sounds_path; /* path to optional custom sounds set (level only) */
1208 char *music_path; /* path to optional custom music set (level only) */
1210 char *level_filename; /* filename of level file (for packed level file) */
1211 char *level_filetype; /* type of levels in level directory or level file */
1213 char *special_flags; /* flags for special actions performed on level file */
1215 int levels; /* number of levels in level series */
1216 int first_level; /* first level number (to allow start with 0 or 1) */
1217 int last_level; /* last level number (automatically calculated) */
1218 int sort_priority; /* sort levels by 'sort_priority' and then by name */
1220 boolean latest_engine;/* force level set to use the latest game engine */
1222 boolean level_group; /* directory contains more level series directories */
1223 boolean parent_link; /* entry links back to parent directory */
1224 boolean in_user_dir; /* user defined levels are stored in home directory */
1225 boolean user_defined; /* levels in user directory and marked as "private" */
1226 boolean readonly; /* readonly levels can not be changed with editor */
1227 boolean handicap; /* level set has no handicap when set to "false" */
1228 boolean skip_levels; /* levels can be skipped when set to "true" */
1230 int color; /* color to use on selection screen for this level */
1231 char *class_desc; /* description of level series class */
1232 int handicap_level; /* number of the lowest unsolved level */
1234 char *infotext; /* optional text to describe the tree type (headline) */
1237 typedef struct TreeInfo TreeInfo;
1238 typedef struct TreeInfo LevelDirTree;
1239 typedef struct TreeInfo ArtworkDirTree;
1240 typedef struct TreeInfo GraphicsDirTree;
1241 typedef struct TreeInfo SoundsDirTree;
1242 typedef struct TreeInfo MusicDirTree;
1246 GraphicsDirTree *gfx_first;
1247 GraphicsDirTree *gfx_current;
1248 SoundsDirTree *snd_first;
1249 SoundsDirTree *snd_current;
1250 MusicDirTree *mus_first;
1251 MusicDirTree *mus_current;
1253 char *gfx_current_identifier;
1254 char *snd_current_identifier;
1255 char *mus_current_identifier;
1258 struct ValueTextInfo
1270 struct ConfigTypeInfo
1277 struct TokenIntPtrInfo
1287 char *default_filename;
1290 char **default_parameter; /* array of file parameters */
1291 char **parameter; /* array of file parameters */
1294 boolean fallback_to_default;
1295 boolean default_is_cloned;
1298 struct SetupFileList
1303 struct SetupFileList *next;
1308 char *source_filename; /* primary key for node list */
1312 struct PropertyMapping
1322 struct ArtworkListInfo
1324 int type; /* type of artwork */
1326 int num_file_list_entries;
1327 int num_dynamic_file_list_entries;
1328 struct FileInfo *file_list; /* static artwork file array */
1329 struct FileInfo *dynamic_file_list; /* dynamic artwrk file array */
1331 int num_suffix_list_entries;
1332 struct ConfigTypeInfo *suffix_list; /* parameter suffixes array */
1334 int num_base_prefixes;
1335 int num_ext1_suffixes;
1336 int num_ext2_suffixes;
1337 int num_ext3_suffixes;
1338 char **base_prefixes; /* base token prefixes array */
1339 char **ext1_suffixes; /* property suffixes array 1 */
1340 char **ext2_suffixes; /* property suffixes array 2 */
1341 char **ext3_suffixes; /* property suffixes array 3 */
1343 int num_ignore_tokens;
1344 char **ignore_tokens; /* file tokens to be ignored */
1346 int num_property_mapping_entries;
1347 struct PropertyMapping *property_mapping; /* mapping token -> artwork */
1349 int sizeof_artwork_list_entry;
1351 struct ListNodeInfo **artwork_list; /* static artwork node array */
1352 struct ListNodeInfo **dynamic_artwork_list; /* dynamic artwrk node array */
1353 struct ListNode *content_list; /* dynamic artwork node list */
1355 void *(*load_artwork)(char *); /* constructor function */
1356 void (*free_artwork)(void *); /* destructor function */
1376 struct RectWithBorder
1390 struct DoorPartPosInfo
1397 int start_step_opening;
1398 int start_step_closing;
1399 boolean draw_masked;
1406 int xoffset; /* special case for tape date and time */
1407 int xoffset2; /* special case for tape date */
1410 int size; /* also used for suffix ".digits" */
1412 boolean draw_masked;
1413 boolean draw_player; /* special case for network player buttons */
1414 int sort_priority; /* also used for suffix ".draw_order" */
1425 /* ========================================================================= */
1426 /* exported variables */
1427 /* ========================================================================= */
1429 extern struct ProgramInfo program;
1430 extern struct OptionInfo options;
1431 extern struct VideoSystemInfo video;
1432 extern struct AudioSystemInfo audio;
1433 extern struct GfxInfo gfx;
1434 extern struct OverlayInfo overlay;
1435 extern struct AnimInfo anim;
1436 extern struct ArtworkInfo artwork;
1437 extern struct JoystickInfo joystick;
1438 extern struct SetupInfo setup;
1440 extern LevelDirTree *leveldir_first_all;
1441 extern LevelDirTree *leveldir_first;
1442 extern LevelDirTree *leveldir_current;
1443 extern int level_nr;
1445 extern struct LevelStats level_stats[];
1447 extern DrawWindow *window;
1448 extern DrawBuffer *backbuffer;
1449 extern DrawBuffer *drawto;
1451 extern int button_status;
1452 extern boolean motion_status;
1453 extern int wheel_steps;
1454 #if defined(TARGET_SDL2)
1455 extern boolean keyrepeat_status;
1458 extern int redraw_mask;
1460 extern int FrameCounter;
1463 /* function definitions */
1465 void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
1468 void InitScoresInfo();
1469 void SetWindowTitle();
1471 void InitWindowTitleFunction(char *(*window_title_function)(void));
1472 void InitExitMessageFunction(void (*exit_message_function)(char *, va_list));
1473 void InitExitFunction(void (*exit_function)(int));
1474 void InitPlatformDependentStuff(void);
1475 void ClosePlatformDependentStuff(void);
1477 void InitGfxFieldInfo(int, int, int, int, int, int, int, int, Bitmap *);
1478 void InitGfxTileSizeInfo(int, int);
1479 void InitGfxDoor1Info(int, int, int, int);
1480 void InitGfxDoor2Info(int, int, int, int);
1481 void InitGfxDoor3Info(int, int, int, int);
1482 void InitGfxWindowInfo(int, int);
1483 void InitGfxScrollbufferInfo(int, int);
1484 void InitGfxClipRegion(boolean, int, int, int, int);
1485 void InitGfxDrawBusyAnimFunction(void (*draw_busy_anim_function)(void));
1486 void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(int, int));
1487 void InitGfxDrawGlobalBorderFunction(void (*draw_global_border_function)(int));
1488 void InitGfxCustomArtworkInfo();
1489 void InitGfxOtherSettings();
1490 void InitOverlayInfo();
1491 void SetOverlayActive(boolean);
1492 boolean GetOverlayActive();
1493 void SetDrawDeactivationMask(int);
1494 void SetDrawBackgroundMask(int);
1495 void SetWindowBackgroundBitmap(Bitmap *);
1496 void SetMainBackgroundBitmap(Bitmap *);
1497 void SetDoorBackgroundBitmap(Bitmap *);
1498 void SetRedrawMaskFromArea(int, int, int, int);
1500 void LimitScreenUpdates(boolean);
1502 void InitVideoDisplay(void);
1503 void CloseVideoDisplay(void);
1504 void InitVideoBuffer(int, int, int, boolean);
1505 Bitmap *CreateBitmapStruct(void);
1506 Bitmap *CreateBitmap(int, int, int);
1507 void ReCreateBitmap(Bitmap **, int, int);
1508 void FreeBitmap(Bitmap *);
1509 void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
1510 void BlitBitmapTiled(Bitmap *, Bitmap *, int, int, int, int, int, int, int,int);
1511 void FadeRectangle(int, int, int, int, int, int, int,
1512 void (*draw_border_function)(void));
1513 void FillRectangle(Bitmap *, int, int, int, int, Pixel);
1514 void ClearRectangle(Bitmap *, int, int, int, int);
1515 void ClearRectangleOnBackground(Bitmap *, int, int, int, int);
1516 void BlitBitmapMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
1517 boolean DrawingDeactivated(int, int, int, int);
1518 boolean DrawingOnBackground(int, int);
1519 boolean DrawingAreaChanged();
1520 void BlitBitmapOnBackground(Bitmap *, Bitmap *, int, int, int, int, int, int);
1521 void BlitTexture(Bitmap *, int, int, int, int, int, int);
1522 void BlitTextureMasked(Bitmap *, int, int, int, int, int, int);
1523 void BlitToScreen(Bitmap *, int, int, int, int, int, int);
1524 void BlitToScreenMasked(Bitmap *, int, int, int, int, int, int);
1525 void DrawSimpleBlackLine(Bitmap *, int, int, int, int);
1526 void DrawSimpleWhiteLine(Bitmap *, int, int, int, int);
1527 void DrawLines(Bitmap *, struct XY *, int, Pixel);
1528 Pixel GetPixel(Bitmap *, int, int);
1529 Pixel GetPixelFromRGB(Bitmap *, unsigned int,unsigned int,unsigned int);
1530 Pixel GetPixelFromRGBcompact(Bitmap *, unsigned int);
1532 void KeyboardAutoRepeatOn(void);
1533 void KeyboardAutoRepeatOff(void);
1534 boolean SetVideoMode(boolean);
1535 void SetVideoFrameDelay(unsigned int);
1536 unsigned int GetVideoFrameDelay();
1537 boolean ChangeVideoModeIfNeeded(boolean);
1539 Bitmap *LoadImage(char *);
1540 Bitmap *LoadCustomImage(char *);
1541 void ReloadCustomImage(Bitmap *, char *);
1543 void ReCreateGameTileSizeBitmap(Bitmap **);
1544 void CreateBitmapWithSmallBitmaps(Bitmap **, int, int);
1545 void CreateBitmapTextures(Bitmap **);
1546 void FreeBitmapTextures(Bitmap **);
1547 void ScaleBitmap(Bitmap **, int);
1549 void SetMouseCursor(int);
1551 void OpenAudio(void);
1552 void CloseAudio(void);
1553 void SetAudioMode(boolean);
1555 boolean PendingEvent(void);
1556 void NextEvent(Event *event);
1557 void PeekEvent(Event *event);
1558 Key GetEventKey(KeyEvent *, boolean);
1559 KeyMod HandleKeyModState(Key, int);
1560 KeyMod GetKeyModState();
1561 KeyMod GetKeyModStateFromEvents();
1562 void StartTextInput(int, int, int, int);
1563 void StopTextInput();
1564 boolean CheckCloseWindowEvent(ClientMessageEvent *);
1566 void InitJoysticks();
1567 boolean ReadJoystick(int, int *, int *, boolean *, boolean *);
1569 #endif /* SYSTEM_H */