fixed tile selection cursor position for levels smaller than the playfield
[rocksndiamonds.git] / src / libgame / system.h
index b6cea7b51ea2d38ed0d5fddae8174d9fa114521a..f3da4ad15bf6d0b5a771638b78b0785a88578c86 100644 (file)
 #endif
 
 /* values for touch control */
+#define TOUCH_CONTROL_OFF              "off"
 #define TOUCH_CONTROL_VIRTUAL_BUTTONS  "virtual_buttons"
 #define TOUCH_CONTROL_WIPE_GESTURES    "wipe_gestures"
 #define TOUCH_CONTROL_FOLLOW_FINGER    "follow_finger"
 
+#if defined(PLATFORM_ANDROID)
 #define TOUCH_CONTROL_DEFAULT          TOUCH_CONTROL_VIRTUAL_BUTTONS
+#else
+#define TOUCH_CONTROL_DEFAULT          TOUCH_CONTROL_OFF
+#endif
 
 #define TOUCH_MOVE_DISTANCE_DEFAULT    2
 #define TOUCH_DROP_DISTANCE_DEFAULT    5
 #define STYLE_NONE             0
 #define STYLE_ACCURATE_BORDERS (1 << 0)
 #define STYLE_INNER_CORNERS    (1 << 1)
+#define STYLE_REVERSE          (1 << 2)
 
 #define STYLE_DEFAULT          STYLE_NONE
 
+/* values for special global animation events */
+#define ANIM_EVENT_NONE                0
+#define ANIM_EVENT_SELF                (1 << 16)
+#define ANIM_EVENT_ANY         (1 << 17)
+
+#define ANIM_EVENT_ANIM_BIT    0
+#define ANIM_EVENT_PART_BIT    8
+
+#define ANIM_EVENT_ANIM_MASK   (0xff << ANIM_EVENT_ANIM_BIT)
+#define ANIM_EVENT_PART_MASK   (0xff << ANIM_EVENT_PART_BIT)
+
+#define ANIM_EVENT_DEFAULT     ANIM_EVENT_NONE
+
 /* values for fade mode */
 #define FADE_TYPE_NONE         0
 #define FADE_TYPE_FADE_IN      (1 << 0)
 #define POS_LOWER              5
 #define POS_BOTTOM             6
 #define POS_ANY                        7
+#define POS_LAST               8
 
 /* values for text alignment */
 #define ALIGN_LEFT             (1 << 0)
 /* maximum number of levels in a level set */
 #define MAX_LEVELS             1000
 
+/* maximum number of global animation and parts */
+#define MAX_GLOBAL_ANIMS               32
+#define MAX_GLOBAL_ANIM_PARTS          32
+
 /* default name for empty highscore entry */
 #define EMPTY_PLAYER_NAME      "no name"
 
 #define SCORES_DIRECTORY       "scores"
 #define DOCS_DIRECTORY         "docs"
 #define CACHE_DIRECTORY                "cache"
+#define CONF_DIRECTORY         "conf"
 
 #define GFX_CLASSIC_SUBDIR     "gfx_classic"
 #define SND_CLASSIC_SUBDIR     "snd_classic"
 /* file names and filename extensions */
 #define LEVELSETUP_DIRECTORY   "levelsetup"
 #define SETUP_FILENAME         "setup.conf"
+#define AUTOSETUP_FILENAME     "autosetup.conf"
 #define LEVELSETUP_FILENAME    "levelsetup.conf"
 #define EDITORSETUP_FILENAME   "editorsetup.conf"
 #define EDITORCASCADE_FILENAME "editorcascade.conf"
 #define SOUNDSINFO_FILENAME    "soundsinfo.conf"
 #define MUSICINFO_FILENAME     "musicinfo.conf"
 #define ARTWORKINFO_CACHE_FILE "artworkinfo.cache"
+#define LEVELTEMPLATE_FILENAME "template.level"
 #define LEVELFILE_EXTENSION    "level"
 #define TAPEFILE_EXTENSION     "tape"
 #define SCOREFILE_EXTENSION    "score"
 
+#define GAMECONTROLLER_BASENAME        "gamecontrollerdb.txt"
+
 #define LOG_OUT_BASENAME       "stdout.txt"
 #define LOG_ERR_BASENAME       "stderr.txt"
 
@@ -757,9 +786,16 @@ struct ProgramInfo
   int version_build;
   int version_ident;
 
+  char *version_string;
+
   char *(*window_title_function)(void);
   void (*exit_message_function)(char *, va_list);
   void (*exit_function)(int);
+
+  boolean global_scores;
+  boolean many_scores_per_name;
+
+  boolean headless;
 };
 
 struct OptionInfo
@@ -774,11 +810,13 @@ struct OptionInfo
   char *sounds_directory;
   char *music_directory;
   char *docs_directory;
+  char *conf_directory;
 
   char *execute_command;
 
   char *special_flags;
 
+  boolean mytapes;
   boolean serveronly;
   boolean network;
   boolean verbose;
@@ -838,8 +876,11 @@ struct FontBitmapInfo
 {
   Bitmap *bitmap;
 
-  int src_x, src_y;            /* start position of animation frames */
-  int width, height;           /* width/height of each animation frame */
+  int src_x, src_y;            /* start position of font characters */
+  int width, height;           /* width / height of font characters */
+
+  int offset_x;                        /* offset to next font character */
+  int offset_y;                        /* offset to next font character */
 
   int draw_xoffset;            /* offset for drawing font characters */
   int draw_yoffset;            /* offset for drawing font characters */
@@ -908,19 +949,34 @@ struct GfxInfo
   void (*draw_busy_anim_function)(void);
   void (*draw_global_anim_function)(int, int);
   void (*draw_global_border_function)(int);
+  void (*draw_tile_cursor_function)(int);
 
   int cursor_mode;
 };
 
+struct TileCursorInfo
+{
+  boolean enabled;             /* tile cursor generally enabled or disabled */
+  boolean active;              /* tile cursor activated (depending on game) */
+  boolean moving;              /* tile cursor moving to target position */
+
+  int xpos, ypos;              /* tile cursor level playfield position */
+  int x, y;                    /* tile cursor current screen position */
+  int target_x, target_y;      /* tile cursor target screen position */
+
+  int sx, sy;                  /* tile cursor screen start position */
+};
+
 struct OverlayInfo
 {
-  boolean active;
+  boolean enabled;             /* overlay generally enabled or disabled */
+  boolean active;              /* overlay activated (depending on game mode) */
 };
 
 struct JoystickInfo
 {
   int status;
-  int fd[MAX_PLAYERS];         /* file descriptor of player's joystick */
+  int nr[MAX_PLAYERS];         /* joystick number for each player */
 };
 
 struct SetupJoystickInfo
@@ -962,8 +1018,14 @@ struct SetupEditorInfo
   boolean el_supaplex;
   boolean el_diamond_caves;
   boolean el_dx_boulderdash;
+
+  boolean el_mirror_magic;
+  boolean el_deflektor;
+
   boolean el_chars;
   boolean el_steel_chars;
+
+  boolean el_classic;
   boolean el_custom;
   boolean el_user_defined;
   boolean el_dynamic;
@@ -974,6 +1036,13 @@ struct SetupEditorInfo
   boolean el_by_type;
 
   boolean show_element_token;
+
+  boolean use_template_for_new_levels;
+};
+
+struct SetupAutoSetupInfo
+{
+  int editor_zoom_tilesize;
 };
 
 struct SetupEditorCascadeInfo
@@ -986,6 +1055,8 @@ struct SetupEditorCascadeInfo
   boolean el_sp;
   boolean el_dc;
   boolean el_dx;
+  boolean el_mm;
+  boolean el_df;
   boolean el_chars;
   boolean el_steel_chars;
   boolean el_ce;
@@ -1031,6 +1102,7 @@ struct SetupSystemInfo
 struct SetupInternalInfo
 {
   char *program_title;
+  char *program_version;
   char *program_author;
   char *program_email;
   char *program_website;
@@ -1053,6 +1125,7 @@ struct SetupInternalInfo
   int default_window_height;
 
   boolean choose_from_top_leveldir;
+  boolean show_scaling_in_title;
 };
 
 struct SetupDebugInfo
@@ -1061,6 +1134,7 @@ struct SetupDebugInfo
   Key frame_delay_key[10];
   boolean frame_delay_use_mod_key;
   boolean frame_delay_game_only;
+  boolean show_frames_per_second;
 };
 
 struct SetupInfo
@@ -1083,6 +1157,7 @@ struct SetupInfo
   boolean team_mode;
   boolean handicap;
   boolean skip_levels;
+  boolean increment_levels;
   boolean time_limit;
   boolean fullscreen;
   int window_scaling_percent;
@@ -1109,6 +1184,7 @@ struct SetupInfo
   int volume_loops;
   int volume_music;
 
+  struct SetupAutoSetupInfo auto_setup;
   struct SetupEditorInfo editor;
   struct SetupEditorCascadeInfo editor_cascade;
   struct SetupShortcutInfo shortcut;
@@ -1143,6 +1219,11 @@ struct TreeInfo
   char *name_sorting;  /* optional sorting name for correct name sorting */
   char *author;                /* level or artwork author name */
   char *year;          /* optional year of creation for levels or artwork */
+
+  char *program_title;    /* optional alternative text for program title */
+  char *program_copyright; /* optional alternative text for program copyright */
+  char *program_company;   /* optional alternative text for program company */
+
   char *imported_from; /* optional comment for imported levels or artwork */
   char *imported_by;   /* optional comment for imported levels or artwork */
   char *tested_by;     /* optional comment to name people who tested a set */
@@ -1362,6 +1443,17 @@ struct TextPosInfo
   boolean draw_player;         /* special case for network player buttons */
   int sort_priority;           /* also used for suffix ".draw_order" */
   int id;
+
+  int direction;               /* needed for panel time/health graphics */
+  int class;                   /* needed for panel time/health graphics */
+  int style;                   /* needed for panel time/health graphics */
+};
+
+struct MouseActionInfo
+{
+  int lx, ly;
+  int button;
+  int button_hint;
 };
 
 struct LevelStats
@@ -1380,6 +1472,7 @@ extern struct OptionInfo  options;
 extern struct VideoSystemInfo  video;
 extern struct AudioSystemInfo  audio;
 extern struct GfxInfo          gfx;
+extern struct TileCursorInfo   tile_cursor;
 extern struct OverlayInfo      overlay;
 extern struct AnimInfo         anim;
 extern struct ArtworkInfo      artwork;
@@ -1412,8 +1505,9 @@ extern int                        FrameCounter;
 /* function definitions */
 
 void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
-                    int);
+                    char *, int);
 
+void InitScoresInfo();
 void SetWindowTitle();
 
 void InitWindowTitleFunction(char *(*window_title_function)(void));
@@ -1433,12 +1527,21 @@ void InitGfxClipRegion(boolean, int, int, int, int);
 void InitGfxDrawBusyAnimFunction(void (*draw_busy_anim_function)(void));
 void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(int, int));
 void InitGfxDrawGlobalBorderFunction(void (*draw_global_border_function)(int));
+void InitGfxDrawTileCursorFunction(void (*draw_tile_cursor_function)(int));
 void InitGfxCustomArtworkInfo();
 void InitGfxOtherSettings();
+void InitTileCursorInfo();
 void InitOverlayInfo();
+void SetTileCursorEnabled(boolean);
+void SetTileCursorActive(boolean);
+void SetTileCursorTargetXY(int, int);
+void SetTileCursorXY(int, int);
+void SetTileCursorSXSY(int, int);
+void SetOverlayEnabled(boolean);
 void SetOverlayActive(boolean);
 boolean GetOverlayActive();
 void SetDrawDeactivationMask(int);
+int GetDrawDeactivationMask(void);
 void SetDrawBackgroundMask(int);
 void SetWindowBackgroundBitmap(Bitmap *);
 void SetMainBackgroundBitmap(Bitmap *);
@@ -1447,6 +1550,7 @@ void SetRedrawMaskFromArea(int, int, int, int);
 
 void LimitScreenUpdates(boolean);
 
+void InitVideoDefaults(void);
 void InitVideoDisplay(void);
 void CloseVideoDisplay(void);
 void InitVideoBuffer(int, int, int, boolean);
@@ -1462,6 +1566,7 @@ void FillRectangle(Bitmap *, int, int, int, int, Pixel);
 void ClearRectangle(Bitmap *, int, int, int, int);
 void ClearRectangleOnBackground(Bitmap *, int, int, int, int);
 void BlitBitmapMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
+boolean DrawingDeactivatedField(void);
 boolean DrawingDeactivated(int, int, int, int);
 boolean DrawingOnBackground(int, int);
 boolean DrawingAreaChanged();
@@ -1501,8 +1606,9 @@ void CloseAudio(void);
 void SetAudioMode(boolean);
 
 boolean PendingEvent(void);
-void NextEvent(Event *event);
+void WaitEvent(Event *event);
 void PeekEvent(Event *event);
+void CheckQuitEvent(void);
 Key GetEventKey(KeyEvent *, boolean);
 KeyMod HandleKeyModState(Key, int);
 KeyMod GetKeyModState();
@@ -1513,5 +1619,7 @@ boolean CheckCloseWindowEvent(ClientMessageEvent *);
 
 void InitJoysticks();
 boolean ReadJoystick(int, int *, int *, boolean *, boolean *);
+boolean CheckJoystickOpened(int);
+void ClearJoystickState();
 
 #endif /* SYSTEM_H */