rnd-20131113-1-src
[rocksndiamonds.git] / src / libgame / system.h
index 176085d473370702aac7b58ae5670c590a66e42e..b6c2ad3b465f74274944449c2886183a3b737731 100644 (file)
                                 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 :                \
@@ -632,9 +651,11 @@ typedef int (*EventFilter)(const Event *);
 
 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 */
@@ -916,6 +937,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;
@@ -924,6 +946,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;
@@ -1153,6 +1179,12 @@ struct TextPosInfo
   int id;
 };
 
+struct LevelStats
+{
+  int played;
+  int solved;
+};
+
 
 /* ========================================================================= */
 /* exported variables                                                        */
@@ -1173,6 +1205,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;
@@ -1222,6 +1256,7 @@ 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);