added using setup option for displaying overlay touch buttons
[rocksndiamonds.git] / src / files.c
index 6866a4b64ebed84ea96ecebf5e5526fabbd4bd79..8889f810ecaf59d121a62cbf506fb558757c4f9b 100644 (file)
@@ -7798,6 +7798,28 @@ void DumpLevel(struct LevelInfo *level)
   Print("use step counter: %s\n", (level->use_step_counter ? "yes" : "no"));
   Print("rate time over score: %s\n", (level->rate_time_over_score ? "yes" : "no"));
 
+  if (options.debug)
+  {
+    int i, j;
+
+    for (i = 0; i < NUM_ENVELOPES; i++)
+    {
+      char *text = level->envelope[i].text;
+      int text_len = strlen(text);
+      boolean has_text = FALSE;
+
+      for (j = 0; j < text_len; j++)
+       if (text[j] != ' ' && text[j] != '\n')
+         has_text = TRUE;
+
+      if (has_text)
+      {
+       Print("\n");
+       Print("Envelope %d:\n'%s'\n", i + 1, text);
+      }
+    }
+  }
+
   PrintLine("-", 79);
 }
 
@@ -8340,6 +8362,13 @@ void LoadScoreTape(char *score_tape_basename, int nr)
   LoadTapeFromFilename(filename);
 }
 
+void LoadScoreCacheTape(char *score_tape_basename, int nr)
+{
+  char *filename = getScoreCacheTapeFilename(score_tape_basename, nr);
+
+  LoadTapeFromFilename(filename);
+}
+
 static boolean checkSaveTape_SCRN(struct TapeInfo *tape)
 {
   // chunk required for team mode tapes with non-default screen size
@@ -8686,7 +8715,9 @@ static void setScoreInfoToDefaultsExt(struct ScoreInfo *scores)
   // The following values are intentionally not reset here:
   // - last_level_nr
   // - last_entry_nr
-  // - was_just_playing
+  // - next_level_nr
+  // - continue_playing
+  // - continue_on_return
 }
 
 static void setScoreInfoToDefaults(void)
@@ -9319,6 +9350,7 @@ void SaveServerScoreFromFile(int nr, boolean tape_saved,
 void LoadLocalAndServerScore(int nr, boolean download_score)
 {
   int last_added_local = scores.last_added_local;
+  boolean force_last_added = scores.force_last_added;
 
   // needed if only showing server scores
   setScoreInfoToDefaults();
@@ -9338,6 +9370,9 @@ void LoadLocalAndServerScore(int nr, boolean download_score)
     // merge local scores with scores from server
     MergeServerScore();
   }
+
+  if (force_last_added)
+    scores.force_last_added = force_last_added;
 }
 
 
@@ -9626,6 +9661,10 @@ static struct TokenInfo global_setup_tokens[] =
     TYPE_INTEGER,
     &setup.touch.grid_ysize[1],                        "touch.virtual_buttons.1.ysize"
   },
+  {
+    TYPE_SWITCH,
+    &setup.touch.overlay_buttons,              "touch.overlay_buttons"
+  },
 };
 
 static struct TokenInfo auto_setup_tokens[] =
@@ -10366,6 +10405,8 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
 
   si->touch.grid_initialized           = video.initialized;
 
+  si->touch.overlay_buttons            = FALSE;
+
   si->editor.el_boulderdash            = TRUE;
   si->editor.el_emerald_mine           = TRUE;
   si->editor.el_emerald_mine_club      = TRUE;
@@ -10508,6 +10549,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
 
 #if defined(PLATFORM_ANDROID)
   si->fullscreen = TRUE;
+  si->touch.overlay_buttons = TRUE;
 #endif
 
   setHideSetupEntry(&setup.debug.xsn_mode);
@@ -10831,6 +10873,12 @@ void LoadSetup_Default(void)
   // try to load setup values from default setup file
   filename = getDefaultSetupFilename();
 
+  if (fileExists(filename))
+    LoadSetupFromFilename(filename);
+
+  // try to load setup values from platform setup file
+  filename = getPlatformSetupFilename();
+
   if (fileExists(filename))
     LoadSetupFromFilename(filename);