X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.h;h=e3454997cc1d83afa841c2a9ca48045845a720d3;hb=3ae70b9d27b4b2c038f35b0aa5985c368542a486;hp=aeab9c23cd3b737240c53fd2a4bc88f8a65961e5;hpb=d442dd6ca65b694c37fbd3c93505644fe8478263;p=rocksndiamonds.git diff --git a/src/libgame/system.h b/src/libgame/system.h index aeab9c23..e3454997 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -73,10 +73,18 @@ #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 @@ -127,6 +135,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 @@ -150,6 +160,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) @@ -204,6 +216,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) @@ -266,7 +285,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) @@ -285,6 +315,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 @@ -296,6 +327,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" @@ -484,16 +518,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 : \ @@ -606,16 +644,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 */ @@ -639,6 +683,7 @@ struct ProgramInfo int version_minor; int version_patch; + void (*exit_message_function)(char *, va_list); void (*exit_function)(int); }; @@ -744,6 +789,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; @@ -841,10 +890,20 @@ struct SetupShortcutInfo 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 @@ -883,6 +942,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; @@ -891,6 +951,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; @@ -1094,6 +1158,13 @@ struct Rect int width, height; }; +struct RectWithBorder +{ + int x, y; + int width, height; + int border_size; +}; + struct MenuPosInfo { int x, y; @@ -1113,6 +1184,12 @@ struct TextPosInfo int id; }; +struct LevelStats +{ + int played; + int solved; +}; + /* ========================================================================= */ /* exported variables */ @@ -1133,6 +1210,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; @@ -1144,6 +1223,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; @@ -1156,6 +1238,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); @@ -1165,6 +1248,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); @@ -1178,8 +1262,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);