#include "windows.h"
#elif defined(PLATFORM_MSDOS)
#include "msdos.h"
+#elif defined(PLATFORM_ANDROID)
+#include "android.h"
#endif
#if defined(TARGET_SDL)
#define BLIT_INVERSE 2
#define BLIT_ON_BACKGROUND 3
+/* values for fullscreen status */
#define FULLSCREEN_NOT_AVAILABLE FALSE
#define FULLSCREEN_AVAILABLE TRUE
+/* values for window scaling */
+#define WINDOW_SCALING_NOT_AVAILABLE FALSE
+#define WINDOW_SCALING_AVAILABLE TRUE
+
+#define MIN_WINDOW_SCALING_PERCENT 10
+#define STD_WINDOW_SCALING_PERCENT 100
+#define MAX_WINDOW_SCALING_PERCENT 300
+
/* default input keys */
#define DEFAULT_KEY_LEFT KSYM_Left
#define DEFAULT_KEY_RIGHT KSYM_Right
#define DEFAULT_KEY_FOCUS_PLAYER_4 KSYM_F8
#define DEFAULT_KEY_FOCUS_PLAYER_ALL KSYM_F9
#define DEFAULT_KEY_TAPE_EJECT KSYM_UNDEFINED
+#define DEFAULT_KEY_TAPE_EXTRA KSYM_UNDEFINED
#define DEFAULT_KEY_TAPE_STOP KSYM_UNDEFINED
#define DEFAULT_KEY_TAPE_PAUSE KSYM_UNDEFINED
#define DEFAULT_KEY_TAPE_RECORD KSYM_UNDEFINED
#define DEFAULT_KEY_SOUND_SIMPLE KSYM_UNDEFINED
#define DEFAULT_KEY_SOUND_LOOPS KSYM_UNDEFINED
#define DEFAULT_KEY_SOUND_MUSIC KSYM_UNDEFINED
+#define DEFAULT_KEY_SNAP_LEFT KSYM_UNDEFINED
+#define DEFAULT_KEY_SNAP_RIGHT KSYM_UNDEFINED
+#define DEFAULT_KEY_SNAP_UP KSYM_UNDEFINED
+#define DEFAULT_KEY_SNAP_DOWN KSYM_UNDEFINED
/* values for key_status */
#define KEY_NOT_PRESSED FALSE
#define BUTTON_1 4
#define BUTTON_2 5
+#define NUM_PLAYER_ACTIONS 6
+
/* values for special "focus player" bitmasks */
#define BIT_SET_FOCUS 6
#define KEY_BUTTON_1 (1 << BUTTON_1)
#define KEY_BUTTON_2 (1 << BUTTON_2)
+#define KEY_BUTTON_SNAP KEY_BUTTON_1
+#define KEY_BUTTON_DROP KEY_BUTTON_2
#define KEY_MOTION (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
#define KEY_BUTTON (KEY_BUTTON_1 | KEY_BUTTON_2)
#define KEY_ACTION (KEY_MOTION | KEY_BUTTON)
REDRAW_TILES | \
REDRAW_MICROLEVEL)
#define REDRAW_FPS (1 << 11)
+
+#if defined(TARGET_X11)
+/* on old-style, classic and potentially slow graphics systems, redraw single
+ tiles instead of the whole playfield unless a certain threshold is reached;
+ when using the X11 target, this method should still be fast on all systems */
#define REDRAWTILES_THRESHOLD (SCR_FIELDX * SCR_FIELDY / 2)
+#else
+/* on modern graphics systems and when using the SDL target, this tile redraw
+ optimization can slow things down a lot due to many small blits compared to
+ one single playfield-sized blit (especially observed on Mac OS X with SDL) */
+#define REDRAWTILES_THRESHOLD 0
+#endif
#define IN_GFX_SCREEN(x, y) (x >= gfx.sx && x < gfx.sx + gfx.sxsize && \
y >= gfx.sy && y < gfx.sy + gfx.sysize)
#define GAME_FRAME_DELAY 20 /* frame delay in milliseconds */
#define FFWD_FRAME_DELAY 10 /* 200% speed for fast forward */
#define FRAMES_PER_SECOND (ONE_SECOND_DELAY / GAME_FRAME_DELAY)
+#define FRAMES_PER_SECOND_SP 35
/* maximum playfield size supported by libgame functions */
#define MAX_PLAYFIELD_WIDTH 128
/* maximum allowed length of player name */
#define MAX_PLAYER_NAME_LEN 10
+/* maximum number of levels in a level set */
+#define MAX_LEVELS 1000
+
/* default name for empty highscore entry */
#define EMPTY_PLAYER_NAME "no name"
#define TREE_TYPE_SOUNDS_DIR ARTWORK_TYPE_SOUNDS
#define TREE_TYPE_MUSIC_DIR ARTWORK_TYPE_MUSIC
#define TREE_TYPE_LEVEL_DIR 3
+#define TREE_TYPE_LEVEL_NR 4
-#define NUM_TREE_TYPES 4
+#define NUM_TREE_TYPES 5
#define INFOTEXT_UNDEFINED ""
#define INFOTEXT_GRAPHICS_DIR "Custom Graphics"
#define INFOTEXT_SOUNDS_DIR "Custom Sounds"
#define INFOTEXT_MUSIC_DIR "Custom Music"
#define INFOTEXT_LEVEL_DIR "Level Sets"
+#define INFOTEXT_LEVEL_NR "Levels"
-#define TREE_INFOTEXT(t) ((t) == TREE_TYPE_LEVEL_DIR ? \
+#define TREE_INFOTEXT(t) ((t) == TREE_TYPE_LEVEL_NR ? \
+ INFOTEXT_LEVEL_NR : \
+ (t) == TREE_TYPE_LEVEL_DIR ? \
INFOTEXT_LEVEL_DIR : \
(t) == TREE_TYPE_GRAPHICS_DIR ? \
INFOTEXT_GRAPHICS_DIR : \
/* type definitions */
+#if defined(TARGET_SDL2)
+typedef int (*EventFilter)(void *, Event *);
+#else
typedef int (*EventFilter)(const Event *);
+#endif
/* structure definitions */
struct ProgramInfo
{
- char *command_basepath; /* directory that contains the program */
+ char *command_basepath; /* path to the program binary */
char *command_basename; /* base filename of the program binary */
+ char *maindata_path; /* main game data (installation) directory */
+
char *userdata_subdir; /* personal user game data directory */
char *userdata_subdir_unix; /* personal user game data directory (Unix) */
char *userdata_path; /* resulting full path to game data directory */
int version_minor;
int version_patch;
+ void (*exit_message_function)(char *, va_list);
void (*exit_function)(int);
};
boolean fullscreen_enabled;
struct ScreenModeInfo *fullscreen_modes;
char *fullscreen_mode_current;
+
+ boolean window_scaling_available;
+ int window_scaling_percent;
};
struct AudioSystemInfo
Bitmap *background_bitmap;
int background_bitmap_mask;
+ boolean clipping_enabled;
+ int clip_x, clip_y;
+ int clip_width, clip_height;
+
boolean override_level_graphics;
boolean override_level_sounds;
boolean override_level_music;
Key focus_player_all;
Key tape_eject;
+ Key tape_extra;
Key tape_stop;
Key tape_pause;
Key tape_record;
Key sound_simple;
Key sound_loops;
Key sound_music;
+
+ Key snap_left;
+ Key snap_right;
+ Key snap_up;
+ Key snap_down;
};
struct SetupSystemInfo
boolean time_limit;
boolean fullscreen;
char *fullscreen_mode;
+ int window_scaling_percent;
boolean ask_on_escape;
boolean ask_on_escape_editor;
boolean quick_switch;
boolean prefer_aga_graphics;
int game_frame_delay;
boolean sp_show_border_elements;
+ boolean small_game_graphics;
char *graphics_set;
char *sounds_set;
int override_level_sounds; /* not boolean -- can also be "AUTO" */
int override_level_music; /* not boolean -- can also be "AUTO" */
+ int volume_simple;
+ int volume_loops;
+ int volume_music;
+
struct SetupEditorInfo editor;
struct SetupEditorCascadeInfo editor_cascade;
struct SetupShortcutInfo shortcut;
int width, height;
};
+struct RectWithBorder
+{
+ int x, y;
+ int width, height;
+ int border_size;
+};
+
struct MenuPosInfo
{
int x, y;
int id;
};
+struct LevelStats
+{
+ int played;
+ int solved;
+};
+
/* ========================================================================= */
/* exported variables */
extern LevelDirTree *leveldir_current;
extern int level_nr;
+extern struct LevelStats level_stats[];
+
extern Display *display;
extern Visual *visual;
extern int screen;
extern int button_status;
extern boolean motion_status;
+#if defined(TARGET_SDL2)
+extern boolean keyrepeat_status;
+#endif
extern int redraw_mask;
extern int redraw_tiles;
void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
char *, char *, char *, char *, char *, int);
+void InitExitMessageFunction(void (*exit_message_function)(char *, va_list));
void InitExitFunction(void (*exit_function)(int));
void InitPlatformDependentStuff(void);
void ClosePlatformDependentStuff(void);
void InitGfxDoor2Info(int, int, int, int);
void InitGfxWindowInfo(int, int);
void InitGfxScrollbufferInfo(int, int);
+void InitGfxClipRegion(boolean, int, int, int, int);
void InitGfxDrawBusyAnimFunction(void (*draw_busy_anim_function)(void));
void InitGfxCustomArtworkInfo();
void SetDrawDeactivationMask(int);
void ReCreateBitmap(Bitmap **, int, int, int);
void FreeBitmap(Bitmap *);
void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
+void BlitBitmapTiled(Bitmap *, Bitmap *, int, int, int, int, int, int, int,int);
void FadeRectangle(Bitmap *bitmap, int, int, int, int, int, int, int,
void (*draw_border_function)(void));
void FillRectangle(Bitmap *, int, int, int, int, Pixel);