X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.h;h=dfa7a4f73cd1af11b0cffa925416f02e14ba9b19;hb=68d1418be737276c8214780106399c0dae588d1c;hp=73b5472f7d8201fdb99d8ded8bb06a6cf3fb4bdb;hpb=b6847742a0713d8ed21bb6104476db54f8c1a4b9;p=rocksndiamonds.git diff --git a/src/libgame/system.h b/src/libgame/system.h index 73b5472f..dfa7a4f7 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -24,6 +24,8 @@ #include "windows.h" #elif defined(PLATFORM_MSDOS) #include "msdos.h" +#elif defined(PLATFORM_ANDROID) +#include "android.h" #endif #if defined(TARGET_SDL) @@ -45,9 +47,19 @@ #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 50 +#define STD_WINDOW_SCALING_PERCENT 100 +#define MAX_WINDOW_SCALING_PERCENT 300 +#define STEP_WINDOW_SCALING_PERCENT 10 + /* default input keys */ #define DEFAULT_KEY_LEFT KSYM_Left #define DEFAULT_KEY_RIGHT KSYM_Right @@ -72,6 +84,19 @@ #define DEFAULT_KEY_FOCUS_PLAYER_3 KSYM_F7 #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_TAPE_PLAY 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 @@ -122,6 +147,8 @@ #define BUTTON_1 4 #define BUTTON_2 5 +#define NUM_PLAYER_ACTIONS 6 + /* values for special "focus player" bitmasks */ #define BIT_SET_FOCUS 6 @@ -145,6 +172,8 @@ #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) @@ -199,6 +228,13 @@ #define ANIM_DEFAULT ANIM_LOOP +/* values for special drawing styles (currently only for crumbled graphics) */ +#define STYLE_NONE 0 +#define STYLE_ACCURATE_BORDERS (1 << 0) +#define STYLE_INNER_CORNERS (1 << 1) + +#define STYLE_DEFAULT STYLE_NONE + /* values for fade mode */ #define FADE_TYPE_NONE 0 #define FADE_TYPE_FADE_IN (1 << 0) @@ -261,7 +297,18 @@ 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) @@ -280,6 +327,7 @@ #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 @@ -291,6 +339,9 @@ /* 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" @@ -479,16 +530,20 @@ #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 : \ @@ -601,16 +656,22 @@ /* 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 */ @@ -634,6 +695,7 @@ struct ProgramInfo int version_minor; int version_patch; + void (*exit_message_function)(char *, va_list); void (*exit_function)(int); }; @@ -650,15 +712,16 @@ struct OptionInfo char *sounds_directory; char *music_directory; char *docs_directory; + char *execute_command; + char *special_flags; + boolean serveronly; boolean network; boolean verbose; boolean debug; boolean debug_x11_sync; - - unsigned long cmd_switches; }; struct ScreenModeInfo @@ -670,11 +733,16 @@ struct VideoSystemInfo { int default_depth; int width, height, depth; + int window_width, window_height; boolean fullscreen_available; boolean fullscreen_enabled; + boolean fullscreen_initial; struct ScreenModeInfo *fullscreen_modes; char *fullscreen_mode_current; + + boolean window_scaling_available; + int window_scaling_percent; }; struct AudioSystemInfo @@ -738,6 +806,10 @@ struct GfxInfo 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; @@ -833,6 +905,22 @@ struct SetupShortcutInfo Key focus_player[MAX_PLAYERS]; Key focus_player_all; + + Key tape_eject; + Key tape_extra; + Key tape_stop; + Key tape_pause; + Key tape_record; + Key tape_play; + + Key sound_simple; + Key sound_loops; + Key sound_music; + + Key snap_left; + Key snap_right; + Key snap_up; + Key snap_down; }; struct SetupSystemInfo @@ -864,12 +952,15 @@ struct SetupInfo 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 input_on_focus; boolean prefer_aga_graphics; int game_frame_delay; + boolean sp_show_border_elements; + boolean small_game_graphics; char *graphics_set; char *sounds_set; @@ -878,6 +969,10 @@ struct SetupInfo 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; @@ -924,6 +1019,8 @@ struct TreeInfo char *level_filename; /* filename of level file (for packed level file) */ char *level_filetype; /* type of levels in level directory or level file */ + char *special_flags; /* flags for special actions performed on level file */ + int levels; /* number of levels in level series */ int first_level; /* first level number (to allow start with 0 or 1) */ int last_level; /* last level number (automatically calculated) */ @@ -1079,6 +1176,13 @@ struct Rect int width, height; }; +struct RectWithBorder +{ + int x, y; + int width, height; + int border_size; +}; + struct MenuPosInfo { int x, y; @@ -1098,6 +1202,12 @@ struct TextPosInfo int id; }; +struct LevelStats +{ + int played; + int solved; +}; + /* ========================================================================= */ /* exported variables */ @@ -1118,6 +1228,8 @@ extern LevelDirTree *leveldir_first; extern LevelDirTree *leveldir_current; extern int level_nr; +extern struct LevelStats level_stats[]; + extern Display *display; extern Visual *visual; extern int screen; @@ -1129,6 +1241,9 @@ extern DrawBuffer *drawto; 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; @@ -1141,6 +1256,7 @@ extern int FrameCounter; 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); @@ -1150,6 +1266,7 @@ void InitGfxDoor1Info(int, int, int, int); 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); @@ -1163,8 +1280,10 @@ void CloseVideoDisplay(void); void InitVideoBuffer(int, int, int, boolean); Bitmap *CreateBitmapStruct(void); Bitmap *CreateBitmap(int, int, 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);