added support for replicator settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Wed, 20 Mar 2024 23:59:55 +0000 (00:59 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 20 Mar 2024 23:59:55 +0000 (00:59 +0100)
src/editor.c
src/files.c
src/main.h

index 391aae986ad2e72c54fe0658f92050c002db2756..a3fc486f04d8e10a367493c20eac118646480796 100644 (file)
@@ -730,6 +730,7 @@ enum
   GADGET_ID_BD_VOODOO_VANISH_BY_EXPLOSION,
   GADGET_ID_BD_SLIME_IS_PREDICTABLE,
   GADGET_ID_BD_CHANGE_EXPANDING_WALL,
+  GADGET_ID_BD_REPLICATORS_ACTIVE,
   GADGET_ID_ENVELOPE_AUTOWRAP,
   GADGET_ID_ENVELOPE_CENTERED,
   GADGET_ID_MM_LASER_RED,
@@ -1076,6 +1077,7 @@ enum
   ED_CHECKBUTTON_ID_BD_VOODOO_VANISH_BY_EXPLOSION,
   ED_CHECKBUTTON_ID_BD_SLIME_IS_PREDICTABLE,
   ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL,
+  ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE,
   ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
   ED_CHECKBUTTON_ID_ENVELOPE_CENTERED,
   ED_CHECKBUTTON_ID_MM_LASER_RED,
@@ -3820,6 +3822,14 @@ static struct
     NULL, NULL,
     "Change direction",                        "Switch horizontal/vertical direction"
   },
+  {
+    ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE,
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
+    GADGET_ID_BD_REPLICATORS_ACTIVE,   GADGET_ID_NONE,
+    &level.bd_replicators_active,
+    NULL, NULL,
+    "Active at start",                 "Replicators start in active state"
+  },
   {
     ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
     ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
@@ -10907,6 +10917,7 @@ static void DrawPropertiesInfo(void)
 #define TEXT_RANDOM_SEED       "slime random number seed"
 #define TEXT_ACID_SPREAD_RATE  "Spread rate (percent)"
 #define TEXT_BITER_MOVE_DELAY  "Move delay (BD frames)"
+#define TEXT_REPLICATION_DELAY "Create delay (BD frames)"
 
 static struct
 {
@@ -11041,6 +11052,8 @@ static struct
                                0, 3                                                            },
   { EL_BD_BITER_DOWN,          &level.bd_biter_move_delay,             TEXT_BITER_MOVE_DELAY,
                                0, 3                                                            },
+  { EL_BD_REPLICATOR,          &level.bd_replicator_create_delay,      TEXT_REPLICATION_DELAY,
+                               0, 100                                                          },
   { EL_EXTRA_TIME,             &level.extra_time,                      TEXT_TIME_BONUS         },
   { EL_TIME_ORB_FULL,          &level.time_orb_time,                   TEXT_TIME_BONUS         },
   { EL_GAME_OF_LIFE,           &level.game_of_life[0],                 TEXT_GAME_OF_LIFE_1,0,8 },
@@ -11225,6 +11238,7 @@ static void DrawPropertiesConfig(void)
                               (properties_element == EL_BD_VOODOO_DOLL     ? 4 : 0) +
                               (properties_element == EL_BD_SLIME           ? 1 : 0) +
                               (properties_element == EL_BD_ACID            ? 1 : 0) +
+                              (properties_element == EL_BD_REPLICATOR      ? 1 : 0) +
                               (properties_element == EL_EMC_MAGIC_BALL     ? 2 : 0) +
                               num_element_counters);
 
@@ -11456,6 +11470,11 @@ static void DrawPropertiesConfig(void)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL);
   }
 
+  if (properties_element == EL_BD_REPLICATOR)
+  {
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE);
+  }
+
   // special case: slippery walls option for gems only available in R'n'D game engine
   if (IS_GEM(properties_element) && level.game_engine_type == GAME_ENGINE_TYPE_RND)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS);
index 489565f976255aaf1c22679ebd70fb23fbaa533d..1260870372cf83bd6c03c9c061d7e33e772caf34 100644 (file)
@@ -748,6 +748,17 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     &li.bd_change_expanding_wall,      FALSE
   },
 
+  {
+    EL_BD_REPLICATOR,                  -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(1),
+    &li.bd_replicators_active,         TRUE
+  },
+  {
+    EL_BD_REPLICATOR,                  -1,
+    TYPE_INTEGER,                      CONF_VALUE_8_BIT(2),
+    &li.bd_replicator_create_delay,    4
+  },
+
   // (the following values are related to various game elements)
 
   {
@@ -4045,6 +4056,9 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
 
   cave->expanding_wall_changed         = level->bd_change_expanding_wall;
 
+  cave->replicators_active             = level->bd_replicators_active;
+  cave->replicator_delay_frame         = level->bd_replicator_create_delay;
+
   // level name
   strncpy(cave->name, level->name, sizeof(GdString));
   cave->name[sizeof(GdString) - 1] = '\0';
@@ -4146,6 +4160,9 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
 
   level->bd_change_expanding_wall      = cave->expanding_wall_changed;
 
+  level->bd_replicators_active         = cave->replicators_active;
+  level->bd_replicator_create_delay    = cave->replicator_delay_frame;
+
   // level name
   char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1);
 
index 13217f5034e3e2a32647393451741ecbd0bb9c44..7d9bc3f1591bcbdc832d111d07a304d7e3e09b99 100644 (file)
@@ -3548,6 +3548,8 @@ struct LevelInfo
   int bd_biter_eats_element;           // BD biter eats this game element when moving
   int bd_bladder_converts_by_element;  // BD bladder converts to clock by touching this element
   boolean bd_change_expanding_wall;    // BD expanding wall direction is changed if enabled
+  boolean bd_replicators_active;       // BD replicators start in active state if enabled
+  int bd_replicator_create_delay;      // BD replicator delay between replications (in BD frames)
 
   boolean em_slippery_gems;            // EM style "gems slip from wall" behaviour
   boolean em_explodes_by_fire;         // EM style chain explosion behaviour