added separate playfield and buffer sizes for EM engine caves
[rocksndiamonds.git] / src / files.c
index cfba947d0c50ac26aa6870d5d87cbb1f48f45d3d..0c0f2f9b08ef1349c77fdc04feff1ae4fc3efff6 100644 (file)
@@ -3519,8 +3519,8 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
   struct PLAYER **ply = level_em->ply;
   int i, j, x, y;
 
-  lev->width  = MIN(level->fieldx, EM_MAX_CAVE_WIDTH);
-  lev->height = MIN(level->fieldy, EM_MAX_CAVE_HEIGHT);
+  lev->width  = MIN(level->fieldx, EM_MAX_CAVE_BUFFER_WIDTH);
+  lev->height = MIN(level->fieldy, EM_MAX_CAVE_BUFFER_HEIGHT);
 
   lev->time_seconds     = level->time;
   lev->required_initial = level->gems_needed;
@@ -3574,9 +3574,9 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
   map_android_clone_elements_RND_to_EM(level);
 
   // first fill the complete playfield with the default border element
-  for (y = 0; y < EM_MAX_CAVE_HEIGHT; y++)
-    for (x = 0; x < EM_MAX_CAVE_WIDTH; x++)
-      level_em->cave[x][y] = ZBORDER;
+  for (y = 0; y < EM_MAX_CAVE_BUFFER_HEIGHT; y++)
+    for (x = 0; x < EM_MAX_CAVE_BUFFER_WIDTH; x++)
+      level_em->cave[x][y] = Zborder;
 
   if (BorderElement == EL_STEELWALL)
   {
@@ -8951,6 +8951,10 @@ static struct TokenInfo internal_setup_tokens[] =
     TYPE_BOOLEAN,
     &setup.internal.show_scaling_in_title,     "show_scaling_in_title"
   },
+  {
+    TYPE_BOOLEAN,
+    &setup.internal.create_user_levelset,      "create_user_levelset"
+  },
   {
     TYPE_BOOLEAN,
     &setup.internal.menu_game,                 "menu_game"
@@ -9324,6 +9328,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->internal.default_level_series = getStringCopy(UNDEFINED_LEVELSET);
   si->internal.choose_from_top_leveldir = FALSE;
   si->internal.show_scaling_in_title = TRUE;
+  si->internal.create_user_levelset = TRUE;
 
   si->internal.default_window_width  = WIN_XSIZE_DEFAULT;
   si->internal.default_window_height = WIN_YSIZE_DEFAULT;
@@ -10290,7 +10295,10 @@ int get_parameter_value(char *value_raw, char *suffix, int type)
   {
     result = get_anim_parameter_values(value);
   }
-  else if (strEqual(suffix, ".init_event_action") ||
+  else if (strEqual(suffix, ".init_delay_action") ||
+          strEqual(suffix, ".anim_delay_action") ||
+          strEqual(suffix, ".post_delay_action") ||
+          strEqual(suffix, ".init_event_action") ||
           strEqual(suffix, ".anim_event_action"))
   {
     result = get_anim_action_parameter_value(value_raw);
@@ -10328,6 +10336,12 @@ int get_parameter_value(char *value_raw, char *suffix, int type)
              string_has_parameter(value, "curtain")    ? FADE_MODE_CURTAIN :
              FADE_MODE_DEFAULT);
   }
+  else if (strEqual(suffix, ".auto_delay_unit"))
+  {
+    result = (string_has_parameter(value, "ms")     ? AUTO_DELAY_UNIT_MS :
+             string_has_parameter(value, "frames") ? AUTO_DELAY_UNIT_FRAMES :
+             AUTO_DELAY_UNIT_DEFAULT);
+  }
   else if (strPrefix(suffix, ".font"))         // (may also be ".font_xyz")
   {
     result = gfx.get_font_from_token_function(value);
@@ -10394,10 +10408,14 @@ static void InitMenuDesignSettings_SpecialPreProcessing(void)
     title_initial_first_default.post_delay;
   titlescreen_initial_first_default.auto_delay =
     title_initial_first_default.auto_delay;
+  titlescreen_initial_first_default.auto_delay_unit =
+    title_initial_first_default.auto_delay_unit;
   titlescreen_first_default.fade_mode  = title_first_default.fade_mode;
   titlescreen_first_default.fade_delay = title_first_default.fade_delay;
   titlescreen_first_default.post_delay = title_first_default.post_delay;
   titlescreen_first_default.auto_delay = title_first_default.auto_delay;
+  titlescreen_first_default.auto_delay_unit =
+    title_first_default.auto_delay_unit;
   titlemessage_initial_first_default.fade_mode  =
     title_initial_first_default.fade_mode;
   titlemessage_initial_first_default.fade_delay =
@@ -10406,27 +10424,36 @@ static void InitMenuDesignSettings_SpecialPreProcessing(void)
     title_initial_first_default.post_delay;
   titlemessage_initial_first_default.auto_delay =
     title_initial_first_default.auto_delay;
+  titlemessage_initial_first_default.auto_delay_unit =
+    title_initial_first_default.auto_delay_unit;
   titlemessage_first_default.fade_mode  = title_first_default.fade_mode;
   titlemessage_first_default.fade_delay = title_first_default.fade_delay;
   titlemessage_first_default.post_delay = title_first_default.post_delay;
   titlemessage_first_default.auto_delay = title_first_default.auto_delay;
+  titlemessage_first_default.auto_delay_unit =
+    title_first_default.auto_delay_unit;
 
   titlescreen_initial_default.fade_mode  = title_initial_default.fade_mode;
   titlescreen_initial_default.fade_delay = title_initial_default.fade_delay;
   titlescreen_initial_default.post_delay = title_initial_default.post_delay;
   titlescreen_initial_default.auto_delay = title_initial_default.auto_delay;
+  titlescreen_initial_default.auto_delay_unit =
+    title_initial_default.auto_delay_unit;
   titlescreen_default.fade_mode  = title_default.fade_mode;
   titlescreen_default.fade_delay = title_default.fade_delay;
   titlescreen_default.post_delay = title_default.post_delay;
   titlescreen_default.auto_delay = title_default.auto_delay;
+  titlescreen_default.auto_delay_unit = title_default.auto_delay_unit;
   titlemessage_initial_default.fade_mode  = title_initial_default.fade_mode;
   titlemessage_initial_default.fade_delay = title_initial_default.fade_delay;
   titlemessage_initial_default.post_delay = title_initial_default.post_delay;
-  titlemessage_initial_default.auto_delay = title_initial_default.auto_delay;
+  titlemessage_initial_default.auto_delay_unit =
+    title_initial_default.auto_delay_unit;
   titlemessage_default.fade_mode  = title_default.fade_mode;
   titlemessage_default.fade_delay = title_default.fade_delay;
   titlemessage_default.post_delay = title_default.post_delay;
   titlemessage_default.auto_delay = title_default.auto_delay;
+  titlemessage_default.auto_delay_unit = title_default.auto_delay_unit;
 
   // special case: initialize "ARG_DEFAULT" values in static default config
   // (e.g., init "titlemessage_1.fade_mode" from "[titlemessage].fade_mode")
@@ -10815,6 +10842,7 @@ static void LoadMenuDesignSettingsFromFilename(char *filename)
     { TYPE_INTEGER,    &tfi.fade_delay,        ".fade_delay"           },
     { TYPE_INTEGER,    &tfi.post_delay,        ".post_delay"           },
     { TYPE_INTEGER,    &tfi.auto_delay,        ".auto_delay"           },
+    { TYPE_INTEGER,    &tfi.auto_delay_unit,   ".auto_delay_unit"      },
 
     { -1,              NULL,                   NULL                    }
   };
@@ -10837,6 +10865,7 @@ static void LoadMenuDesignSettingsFromFilename(char *filename)
     { TYPE_INTEGER,    &tmi.fade_delay,        ".fade_delay"           },
     { TYPE_INTEGER,    &tmi.post_delay,        ".post_delay"           },
     { TYPE_INTEGER,    &tmi.auto_delay,        ".auto_delay"           },
+    { TYPE_INTEGER,    &tmi.auto_delay_unit,   ".auto_delay_unit"      },
 
     { -1,              NULL,                   NULL                    }
   };