added support for water settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Fri, 22 Mar 2024 10:14:32 +0000 (11:14 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 22 Mar 2024 10:14:32 +0000 (11:14 +0100)
src/editor.c
src/files.c
src/main.h

index 25853f868eea5dc67786bead6ee00b4cc0c90b72..fd5d546370bbbd76fd2fd30b70ff2bcc8fc7683f 100644 (file)
@@ -733,6 +733,7 @@ enum
   GADGET_ID_BD_REPLICATORS_ACTIVE,
   GADGET_ID_BD_CONVEYOR_BELTS_ACTIVE,
   GADGET_ID_BD_CONVEYOR_BELTS_CHANGED,
+  GADGET_ID_BD_WATER_CANNOT_FLOW_DOWN,
   GADGET_ID_ENVELOPE_AUTOWRAP,
   GADGET_ID_ENVELOPE_CENTERED,
   GADGET_ID_MM_LASER_RED,
@@ -1082,6 +1083,7 @@ enum
   ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE,
   ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_ACTIVE,
   ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_CHANGED,
+  ED_CHECKBUTTON_ID_BD_WATER_CANNOT_FLOW_DOWN,
   ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
   ED_CHECKBUTTON_ID_ENVELOPE_CENTERED,
   ED_CHECKBUTTON_ID_MM_LASER_RED,
@@ -3850,6 +3852,14 @@ static struct
     NULL, NULL,
     "Change direction",                        "Switch conveyor belt direction"
   },
+  {
+    ED_CHECKBUTTON_ID_BD_WATER_CANNOT_FLOW_DOWN,
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
+    GADGET_ID_BD_WATER_CANNOT_FLOW_DOWN, GADGET_ID_NONE,
+    &level.bd_water_cannot_flow_down,
+    NULL, NULL,
+    "Does not flow downwards",         "Water can only flow up, left and right"
+  },
   {
     ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
     ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
@@ -11137,7 +11147,8 @@ static boolean checkPropertiesConfig(int element)
       element == EL_BD_ROCK ||
       element == EL_BD_MEGA_ROCK ||
       element == EL_BD_SWEET ||
-      element == EL_BD_VOODOO_DOLL)
+      element == EL_BD_VOODOO_DOLL ||
+      element == EL_BD_WATER)
   {
     return TRUE;
   }
@@ -11504,6 +11515,11 @@ static void DrawPropertiesConfig(void)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_CHANGED);
   }
 
+  if (properties_element == EL_BD_WATER)
+  {
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_WATER_CANNOT_FLOW_DOWN);
+  }
+
   // 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 a164fdfd4e3452d41d5cdc8fa92fed903fab3df5..3e6d25f3d13c190ba502b1443cdf32992b957095 100644 (file)
@@ -770,6 +770,12 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     &li.bd_conveyor_belts_changed,     FALSE
   },
 
+  {
+    EL_BD_WATER,                       -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(1),
+    &li.bd_water_cannot_flow_down,     FALSE
+  },
+
   // (the following values are related to various game elements)
 
   {
@@ -4073,6 +4079,8 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   cave->conveyor_belts_active          = level->bd_conveyor_belts_active;
   cave->conveyor_belts_direction_changed= level->bd_conveyor_belts_changed;
 
+  cave->water_does_not_flow_down       = level->bd_water_cannot_flow_down;
+
   // level name
   strncpy(cave->name, level->name, sizeof(GdString));
   cave->name[sizeof(GdString) - 1] = '\0';
@@ -4180,6 +4188,8 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   level->bd_conveyor_belts_active      = cave->conveyor_belts_active;
   level->bd_conveyor_belts_changed     = cave->conveyor_belts_direction_changed;
 
+  level->bd_water_cannot_flow_down     = cave->water_does_not_flow_down;
+
   // level name
   char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1);
 
index f18bfb1dd7a50627358b18695be7b9212d9a3779..5a85ae2882c03fc983db4ffda1939db69fc7fcef 100644 (file)
@@ -3562,6 +3562,7 @@ struct LevelInfo
   int bd_replicator_create_delay;      // BD replicator delay between replications (in BD frames)
   boolean bd_conveyor_belts_active;    // BD conveyor belts start in active state if enabled
   boolean bd_conveyor_belts_changed;   // BD conveyor belts direction is changed if enabled
+  boolean bd_water_cannot_flow_down;   // BD water does not flow downwards if enabled
 
   boolean em_slippery_gems;            // EM style "gems slip from wall" behaviour
   boolean em_explodes_by_fire;         // EM style chain explosion behaviour