X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.h;h=b74b6fae17165e376d7da80d6a22a8752e0fc7c2;hb=f6513d7bc5806904a55708a2ddb6673842e933bd;hp=06ad220d111a04c3eaf86c23a03487751fe41403;hpb=cd77f8c1eb3e792f1cd0c108ce49a03d762ebb96;p=rocksndiamonds.git diff --git a/src/libgame/system.h b/src/libgame/system.h index 06ad220d..b74b6fae 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,26 @@ #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 + +/* values for window scaling quality */ +#define SCALING_QUALITY_NEAREST "nearest" +#define SCALING_QUALITY_LINEAR "linear" +#define SCALING_QUALITY_BEST "best" + +#define SCALING_QUALITY_DEFAULT SCALING_QUALITY_LINEAR + /* default input keys */ #define DEFAULT_KEY_LEFT KSYM_Left #define DEFAULT_KEY_RIGHT KSYM_Right @@ -285,14 +304,31 @@ 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 && \ +#define IN_GFX_FIELD_PLAY(x, y) (x >= gfx.sx && x < gfx.sx + gfx.sxsize && \ y >= gfx.sy && y < gfx.sy + gfx.sysize) -#define IN_GFX_DOOR(x, y) (x >= gfx.dx && x < gfx.dx + gfx.dxsize && \ +#define IN_GFX_FIELD_FULL(x, y) (x >= gfx.real_sx && \ + x < gfx.real_sx + gfx.full_sxsize && \ + y >= gfx.real_sy && \ + y < gfx.real_sy + gfx.full_sysize) +#define IN_GFX_DOOR_1(x, y) (x >= gfx.dx && x < gfx.dx + gfx.dxsize && \ y >= gfx.dy && y < gfx.dy + gfx.dysize) -#define IN_GFX_VIDEO(x, y) (x >= gfx.vx && x < gfx.vx + gfx.vxsize && \ +#define IN_GFX_DOOR_2(x, y) (x >= gfx.vx && x < gfx.vx + gfx.vxsize && \ y >= gfx.vy && y < gfx.vy + gfx.vysize) +#define IN_GFX_DOOR_3(x, y) (x >= gfx.ex && x < gfx.ex + gfx.exsize && \ + y >= gfx.ey && y < gfx.ey + gfx.eysize) /* values for mouse cursor */ #define CURSOR_DEFAULT 0 @@ -316,6 +352,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" @@ -504,16 +543,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 : \ @@ -626,16 +669,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 */ @@ -659,6 +708,7 @@ struct ProgramInfo int version_minor; int version_patch; + void (*exit_message_function)(char *, va_list); void (*exit_function)(int); }; @@ -696,11 +746,17 @@ 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; + char *window_scaling_quality; }; struct AudioSystemInfo @@ -754,6 +810,9 @@ struct GfxInfo int vx, vy; int vxsize, vysize; + int ex, ey; + int exsize, eysize; + int win_xsize, win_ysize; int draw_deactivation_mask; @@ -910,6 +969,8 @@ struct SetupInfo boolean time_limit; boolean fullscreen; char *fullscreen_mode; + int window_scaling_percent; + char *window_scaling_quality; boolean ask_on_escape; boolean ask_on_escape_editor; boolean quick_switch; @@ -917,6 +978,7 @@ struct SetupInfo boolean prefer_aga_graphics; int game_frame_delay; boolean sp_show_border_elements; + boolean small_game_graphics; char *graphics_set; char *sounds_set; @@ -925,6 +987,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; @@ -1142,6 +1208,19 @@ struct MenuPosInfo int align, valign; }; +struct DoorPartPosInfo +{ + int x, y; + int step_xoffset; + int step_yoffset; + int step_delay; + int start_step; + int start_step_opening; + int start_step_closing; + boolean draw_masked; + int sort_priority; +}; + struct TextPosInfo { int x, y; @@ -1150,10 +1229,17 @@ struct TextPosInfo int size; int font, font_alt; boolean draw_masked; + boolean draw_player; /* special case for network player buttons */ int sort_priority; int id; }; +struct LevelStats +{ + int played; + int solved; +}; + /* ========================================================================= */ /* exported variables */ @@ -1174,6 +1260,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; @@ -1185,6 +1273,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; @@ -1197,6 +1288,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); @@ -1204,6 +1296,7 @@ void ClosePlatformDependentStuff(void); void InitGfxFieldInfo(int, int, int, int, int, int, int, int, Bitmap *); void InitGfxDoor1Info(int, int, int, int); void InitGfxDoor2Info(int, int, int, int); +void InitGfxDoor3Info(int, int, int, int); void InitGfxWindowInfo(int, int); void InitGfxScrollbufferInfo(int, int); void InitGfxClipRegion(boolean, int, int, int, int); @@ -1215,6 +1308,8 @@ void SetWindowBackgroundBitmap(Bitmap *); void SetMainBackgroundBitmap(Bitmap *); void SetDoorBackgroundBitmap(Bitmap *); +void LimitScreenUpdates(boolean); + void InitVideoDisplay(void); void CloseVideoDisplay(void); void InitVideoBuffer(int, int, int, boolean);