added enabling/disabling virtual button overlay depending on input events
[rocksndiamonds.git] / src / libgame / system.h
index 009cbf81bc9dda05036e1ffaae98499be7ed3809..1b1dc2a453b5f64d73ba4b922ee4cb6d73ddecfb 100644 (file)
@@ -85,6 +85,7 @@
 /* values for touch control */
 #define TOUCH_CONTROL_VIRTUAL_BUTTONS  "virtual_buttons"
 #define TOUCH_CONTROL_WIPE_GESTURES    "wipe_gestures"
+#define TOUCH_CONTROL_FOLLOW_FINGER    "follow_finger"
 
 #define TOUCH_CONTROL_DEFAULT          TOUCH_CONTROL_VIRTUAL_BUTTONS
 
 #define TOUCH_DROP_DISTANCE_DEFAULT    5
 
 
-/* values for screen keyboard on mobile devices */
+/* values for special settings for mobile devices */
 #if defined(PLATFORM_ANDROID)
+#define USE_TOUCH_INPUT_OVERLAY
+#define USE_COMPLETE_DISPLAY
 #define HAS_SCREEN_KEYBOARD
+#define SCREEN_KEYBOARD_POS(h)         ((h) / 2)
 #endif
 
 
 
 #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 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"
 
 }
 
 
-/* type definitions */
-#if defined(TARGET_SDL2)
-typedef int (*EventFilter)(void *, Event *);
-#else
-typedef int (*EventFilter)(const Event *);
-#endif
-
-
 /* structure definitions */
 
 struct ProgramInfo
@@ -764,6 +781,11 @@ struct ProgramInfo
   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
@@ -783,6 +805,7 @@ struct OptionInfo
 
   char *special_flags;
 
+  boolean mytapes;
   boolean serveronly;
   boolean network;
   boolean verbose;
@@ -794,6 +817,9 @@ struct VideoSystemInfo
   int default_depth;
   int width, height, depth;
   int window_width, window_height;
+  int display_width, display_height;
+  int screen_width, screen_height;
+  int screen_xoffset, screen_yoffset;
 
   boolean fullscreen_available;
   boolean fullscreen_enabled;
@@ -808,6 +834,10 @@ struct VideoSystemInfo
   unsigned int frame_delay_value;
 
   boolean shifted_up;
+  int shifted_up_pos;
+  int shifted_up_pos_last;
+  unsigned int shifted_up_delay;
+  unsigned int shifted_up_delay_value;
 
   boolean initialized;
 };
@@ -909,10 +939,16 @@ struct GfxInfo
   int cursor_mode;
 };
 
+struct OverlayInfo
+{
+  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
@@ -956,6 +992,8 @@ struct SetupEditorInfo
   boolean el_dx_boulderdash;
   boolean el_chars;
   boolean el_steel_chars;
+
+  boolean el_classic;
   boolean el_custom;
   boolean el_user_defined;
   boolean el_dynamic;
@@ -966,6 +1004,8 @@ struct SetupEditorInfo
   boolean el_by_type;
 
   boolean show_element_token;
+
+  boolean use_template_for_new_levels;
 };
 
 struct SetupEditorCascadeInfo
@@ -1075,6 +1115,7 @@ struct SetupInfo
   boolean team_mode;
   boolean handicap;
   boolean skip_levels;
+  boolean increment_levels;
   boolean time_limit;
   boolean fullscreen;
   int window_scaling_percent;
@@ -1372,6 +1413,7 @@ extern struct OptionInfo  options;
 extern struct VideoSystemInfo  video;
 extern struct AudioSystemInfo  audio;
 extern struct GfxInfo          gfx;
+extern struct OverlayInfo      overlay;
 extern struct AnimInfo         anim;
 extern struct ArtworkInfo      artwork;
 extern struct JoystickInfo     joystick;
@@ -1405,6 +1447,7 @@ extern int                        FrameCounter;
 void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
                     int);
 
+void InitScoresInfo();
 void SetWindowTitle();
 
 void InitWindowTitleFunction(char *(*window_title_function)(void));
@@ -1426,6 +1469,10 @@ void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(int, int));
 void InitGfxDrawGlobalBorderFunction(void (*draw_global_border_function)(int));
 void InitGfxCustomArtworkInfo();
 void InitGfxOtherSettings();
+void InitOverlayInfo();
+void SetOverlayEnabled(boolean);
+void SetOverlayActive(boolean);
+boolean GetOverlayActive();
 void SetDrawDeactivationMask(int);
 void SetDrawBackgroundMask(int);
 void SetWindowBackgroundBitmap(Bitmap *);
@@ -1488,7 +1535,6 @@ void OpenAudio(void);
 void CloseAudio(void);
 void SetAudioMode(boolean);
 
-void InitEventFilter(EventFilter);
 boolean PendingEvent(void);
 void NextEvent(Event *event);
 void PeekEvent(Event *event);
@@ -1496,11 +1542,12 @@ Key GetEventKey(KeyEvent *, boolean);
 KeyMod HandleKeyModState(Key, int);
 KeyMod GetKeyModState();
 KeyMod GetKeyModStateFromEvents();
-void StartTextInput(int, int);
+void StartTextInput(int, int, int, int);
 void StopTextInput();
 boolean CheckCloseWindowEvent(ClientMessageEvent *);
 
 void InitJoysticks();
 boolean ReadJoystick(int, int *, int *, boolean *, boolean *);
+boolean CheckJoystickOpened(int);
 
 #endif /* SYSTEM_H */