added support for creature movement settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Mon, 25 Mar 2024 00:11:55 +0000 (01:11 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 25 Mar 2024 00:11:59 +0000 (01:11 +0100)
src/editor.c
src/files.c
src/main.h

index 7d055ca3a3724ce87a35cff326ed3f3fde7d86be..a22375828387d0060b6919d47d47bff1a7d838cf 100644 (file)
@@ -441,6 +441,9 @@ enum
   GADGET_ID_BD_HATCHING_DELAY_SECONDS_DOWN,
   GADGET_ID_BD_HATCHING_DELAY_SECONDS_TEXT,
   GADGET_ID_BD_HATCHING_DELAY_SECONDS_UP,
+  GADGET_ID_BD_CREATURES_AUTO_TURN_DELAY_DOWN,
+  GADGET_ID_BD_CREATURES_AUTO_TURN_DELAY_TEXT,
+  GADGET_ID_BD_CREATURES_AUTO_TURN_DELAY_UP,
   GADGET_ID_BD_PUSHING_PROB_DOWN,
   GADGET_ID_BD_PUSHING_PROB_TEXT,
   GADGET_ID_BD_PUSHING_PROB_UP,
@@ -701,6 +704,8 @@ enum
   GADGET_ID_BD_SCAN_FIRST_AND_LAST_ROW,
   GADGET_ID_BD_SHORT_EXPLOSIONS,
   GADGET_ID_BD_GRAVITY_AFFECTS_ALL,
+  GADGET_ID_BD_CREATURES_START_BACKWARDS,
+  GADGET_ID_BD_CREATURES_TURN_ON_HATCHING,
   GADGET_ID_STICK_ELEMENT,
   GADGET_ID_EM_SLIPPERY_GEMS,
   GADGET_ID_EM_EXPLODES_BY_FIRE,
@@ -823,6 +828,7 @@ enum
   ED_COUNTER_ID_BD_CYCLE_DELAY_C64,
   ED_COUNTER_ID_BD_HATCHING_DELAY_CYCLES,
   ED_COUNTER_ID_BD_HATCHING_DELAY_SECONDS,
+  ED_COUNTER_ID_BD_CREATURES_AUTO_TURN_DELAY,
   ED_COUNTER_ID_BD_PUSHING_PROB,
   ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET,
   ED_COUNTER_ID_ELEMENT_VALUE1,
@@ -1052,6 +1058,8 @@ enum
   ED_CHECKBUTTON_ID_BD_SCAN_FIRST_AND_LAST_ROW,
   ED_CHECKBUTTON_ID_BD_SHORT_EXPLOSIONS,
   ED_CHECKBUTTON_ID_BD_GRAVITY_AFFECTS_ALL,
+  ED_CHECKBUTTON_ID_BD_CREATURES_START_BACKWARDS,
+  ED_CHECKBUTTON_ID_BD_CREATURES_TURN_ON_HATCHING,
   ED_CHECKBUTTON_ID_STICK_ELEMENT,
   ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS,
   ED_CHECKBUTTON_ID_EM_EXPLODES_BY_FIRE,
@@ -1151,7 +1159,7 @@ enum
 #define ED_CHECKBUTTON_ID_EDITOR_LAST  ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2
 
 #define ED_CHECKBUTTON_ID_ENGINE_FIRST ED_CHECKBUTTON_ID_BD_INTERMISSION
-#define ED_CHECKBUTTON_ID_ENGINE_LAST  ED_CHECKBUTTON_ID_BD_GRAVITY_AFFECTS_ALL
+#define ED_CHECKBUTTON_ID_ENGINE_LAST  ED_CHECKBUTTON_ID_BD_CREATURES_TURN_ON_HATCHING
 
 #define ED_CHECKBUTTON_ID_CUSTOM1_FIRST        ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC
 #define ED_CHECKBUTTON_ID_CUSTOM1_LAST ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE
@@ -1647,6 +1655,15 @@ static struct
     &level.bd_hatching_delay_seconds,
     NULL,                              NULL, "Hatching delay (seconds)"
   },
+  {
+    ED_COUNTER_ID_BD_CREATURES_AUTO_TURN_DELAY,
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(12),
+    0,                                 999,
+    GADGET_ID_BD_CREATURES_AUTO_TURN_DELAY_DOWN,       GADGET_ID_BD_CREATURES_AUTO_TURN_DELAY_UP,
+    GADGET_ID_BD_CREATURES_AUTO_TURN_DELAY_TEXT,       GADGET_ID_NONE,
+    &level.bd_creatures_auto_turn_delay,
+    NULL,                              NULL, "Creatures auto turn delay"
+  },
 
   // ---------- element settings: configure (various elements) ----------------
 
@@ -3499,6 +3516,22 @@ static struct
     NULL, NULL,
     "Gravity change affects everything",       "Gravity affects all falling objects"
   },
+  {
+    ED_CHECKBUTTON_ID_BD_CREATURES_START_BACKWARDS,
+    ED_ELEMENT_SETTINGS_XPOS(0),               ED_LEVEL_SETTINGS_YPOS(10),
+    GADGET_ID_BD_CREATURES_START_BACKWARDS,    GADGET_ID_NONE,
+    &level.bd_creatures_start_backwards,
+    NULL, NULL,
+    "Creatures start moving backwards",                "Creatures start in opposite direction"
+  },
+  {
+    ED_CHECKBUTTON_ID_BD_CREATURES_TURN_ON_HATCHING,
+    ED_ELEMENT_SETTINGS_XPOS(0),               ED_LEVEL_SETTINGS_YPOS(11),
+    GADGET_ID_BD_CREATURES_TURN_ON_HATCHING,   GADGET_ID_NONE,
+    &level.bd_creatures_turn_on_hatching,
+    NULL, NULL,
+    "Creatures turn on hatching",              "Creatures change direction on hatching"
+  },
 
   // ---------- element settings: configure (various elements) ----------------
 
@@ -10804,6 +10837,8 @@ static void DrawLevelConfigEngine(void)
     MapCounterButtons(ED_COUNTER_ID_BD_HATCHING_DELAY_SECONDS);
   }
 
+  MapCounterButtons(ED_COUNTER_ID_BD_CREATURES_AUTO_TURN_DELAY);
+
   // draw checkbutton gadgets
   for (i = ED_CHECKBUTTON_ID_ENGINE_FIRST; i <= ED_CHECKBUTTON_ID_ENGINE_LAST; i++)
     MapCheckbuttonGadget(i);
index e50a37635c0839d8665039ab645b19678733d847..bc58d722728b7325b62d5f7ff2c025ec2f89e520 100644 (file)
@@ -315,6 +315,21 @@ static struct LevelFileConfigInfo chunk_config_INFO[] =
     TYPE_INTEGER,                      CONF_VALUE_8_BIT(24),
     &li.bd_cave_random_seed_c64,       0
   },
+  {
+    -1,                                        -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(25),
+    &li.bd_creatures_start_backwards,  FALSE
+  },
+  {
+    -1,                                        -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(26),
+    &li.bd_creatures_turn_on_hatching, FALSE
+  },
+  {
+    -1,                                        -1,
+    TYPE_INTEGER,                      CONF_VALUE_16_BIT(7),
+    &li.bd_creatures_auto_turn_delay,  0
+  },
 
   {
     -1,                                        -1,
@@ -4220,6 +4235,10 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   cave->expanding_wall_looks_like      = LEVEL_TO_CAVE(level->bd_expanding_wall_looks_like);
   cave->dirt_looks_like                        = LEVEL_TO_CAVE(level->bd_sand_looks_like);
 
+  cave->creatures_backwards                     = level->bd_creatures_start_backwards;
+  cave->creatures_direction_auto_change_on_start = level->bd_creatures_turn_on_hatching;
+  cave->creatures_direction_auto_change_time    = level->bd_creatures_auto_turn_delay;
+
   // level name
   strncpy(cave->name, level->name, sizeof(GdString));
   cave->name[sizeof(GdString) - 1] = '\0';
@@ -4356,6 +4375,10 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   level->bd_expanding_wall_looks_like  = CAVE_TO_LEVEL(cave->expanding_wall_looks_like);
   level->bd_sand_looks_like            = CAVE_TO_LEVEL(cave->dirt_looks_like);
 
+  level->bd_creatures_start_backwards  = cave->creatures_backwards;
+  level->bd_creatures_turn_on_hatching = cave->creatures_direction_auto_change_on_start;
+  level->bd_creatures_auto_turn_delay  = cave->creatures_direction_auto_change_time;
+
   // level name
   char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1);
 
index 2481f3da9eaf5eb1b0cfd579437d63eecdc00fd0..ae06a99d9c162d435725b5ae9f5e974b0a981418 100644 (file)
@@ -3684,6 +3684,9 @@ struct LevelInfo
   int bd_skeleton_worth_num_diamonds;  // BD skeleton collected is worth this number of diamonds
   int bd_expanding_wall_looks_like;    // BD expanding wall looks like this other game element
   int bd_sand_looks_like;              // BD sand looks like this other game element
+  boolean bd_creatures_start_backwards;        // BD creatures start moving in opposite direction
+  boolean bd_creatures_turn_on_hatching;// BD creatures change direction after hatching
+  int bd_creatures_auto_turn_delay;    // BD creatures change direction after delay (in seconds)
 
   boolean em_slippery_gems;            // EM style "gems slip from wall" behaviour
   boolean em_explodes_by_fire;         // EM style chain explosion behaviour