fixed bug with cheat codes not working anymore after changing player name
[rocksndiamonds.git] / src / libgame / system.c
index b5de8c9e6959ee11848072c3ec9599f0e52a9850..4f27d60a614cd0fb0649814fe7538391d6168d3f 100644 (file)
@@ -300,7 +300,18 @@ void InitGfxOtherSettings()
 
 void InitOverlayInfo()
 {
+  overlay.enabled = FALSE;
   overlay.active = FALSE;
+
+#if defined(PLATFORM_ANDROID)
+  if (strEqual(setup.touch.control_type, TOUCH_CONTROL_VIRTUAL_BUTTONS))
+    overlay.enabled = TRUE;
+#endif
+}
+
+void SetOverlayEnabled(boolean enabled)
+{
+  overlay.enabled = enabled;
 }
 
 void SetOverlayActive(boolean active)
@@ -318,6 +329,11 @@ void SetDrawDeactivationMask(int draw_deactivation_mask)
   gfx.draw_deactivation_mask = draw_deactivation_mask;
 }
 
+int GetDrawDeactivationMask()
+{
+  return gfx.draw_deactivation_mask;
+}
+
 void SetDrawBackgroundMask(int draw_background_mask)
 {
   gfx.draw_background_mask = draw_background_mask;
@@ -1567,9 +1583,9 @@ KeyMod GetKeyModStateFromEvents()
 void StartTextInput(int x, int y, int width, int height)
 {
 #if defined(TARGET_SDL2)
+#if defined(HAS_SCREEN_KEYBOARD)
   SDL_StartTextInput();
 
-#if defined(HAS_SCREEN_KEYBOARD)
   if (y + height > SCREEN_KEYBOARD_POS(video.height))
   {
     video.shifted_up_pos = y + height - SCREEN_KEYBOARD_POS(video.height);
@@ -1583,9 +1599,9 @@ void StartTextInput(int x, int y, int width, int height)
 void StopTextInput()
 {
 #if defined(TARGET_SDL2)
+#if defined(HAS_SCREEN_KEYBOARD)
   SDL_StopTextInput();
 
-#if defined(HAS_SCREEN_KEYBOARD)
   if (video.shifted_up)
   {
     video.shifted_up_pos = 0;
@@ -1620,7 +1636,7 @@ void InitJoysticks()
   /* always start with reliable default values */
   joystick.status = JOYSTICK_NOT_AVAILABLE;
   for (i = 0; i < MAX_PLAYERS; i++)
-    joystick.fd[i] = -1;               /* joystick device closed */
+    joystick.nr[i] = -1;               /* no joystick configured */
 
   SDLInitJoysticks();
 }
@@ -1629,3 +1645,13 @@ boolean ReadJoystick(int nr, int *x, int *y, boolean *b1, boolean *b2)
 {
   return SDLReadJoystick(nr, x, y, b1, b2);
 }
+
+boolean CheckJoystickOpened(int nr)
+{
+  return SDLCheckJoystickOpened(nr);
+}
+
+void ClearJoystickState()
+{
+  SDLClearJoystickState();
+}