added support for voodoo doll settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Sat, 16 Mar 2024 23:43:18 +0000 (00:43 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 16 Mar 2024 23:43:22 +0000 (00:43 +0100)
src/editor.c
src/files.c
src/main.h

index 9f917b4325b1c77332eb30fef73d7b02c4498b4e..6ca4145f54b06507482f5799778641afefa8bc28 100644 (file)
@@ -719,6 +719,10 @@ enum
   GADGET_ID_BD_AMOEBA_WAIT_FOR_HATCHING,
   GADGET_ID_BD_AMOEBA_START_IMMEDIATELY,
   GADGET_ID_BD_AMOEBA_2_EXPLODE_BY_AMOEBA,
+  GADGET_ID_BD_VOODOO_COLLECTS_DIAMONDS,
+  GADGET_ID_BD_VOODOO_HURT_KILLS_PLAYER,
+  GADGET_ID_BD_VOODOO_DIES_BY_ROCK,
+  GADGET_ID_BD_VOODOO_VANISH_BY_EXPLOSION,
   GADGET_ID_ENVELOPE_AUTOWRAP,
   GADGET_ID_ENVELOPE_CENTERED,
   GADGET_ID_MM_LASER_RED,
@@ -1059,6 +1063,10 @@ enum
   ED_CHECKBUTTON_ID_BD_AMOEBA_WAIT_FOR_HATCHING,
   ED_CHECKBUTTON_ID_BD_AMOEBA_START_IMMEDIATELY,
   ED_CHECKBUTTON_ID_BD_AMOEBA_2_EXPLODE_BY_AMOEBA,
+  ED_CHECKBUTTON_ID_BD_VOODOO_COLLECTS_DIAMONDS,
+  ED_CHECKBUTTON_ID_BD_VOODOO_HURT_KILLS_PLAYER,
+  ED_CHECKBUTTON_ID_BD_VOODOO_DIES_BY_ROCK,
+  ED_CHECKBUTTON_ID_BD_VOODOO_VANISH_BY_EXPLOSION,
   ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
   ED_CHECKBUTTON_ID_ENVELOPE_CENTERED,
   ED_CHECKBUTTON_ID_MM_LASER_RED,
@@ -3750,6 +3758,38 @@ static struct
     NULL, NULL,
     "explodes if touched by amoeba",   "amoeba 2 explodes if touched by amoeba"
   },
+  {
+    ED_CHECKBUTTON_ID_BD_VOODOO_COLLECTS_DIAMONDS,
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
+    GADGET_ID_BD_VOODOO_COLLECTS_DIAMONDS, GADGET_ID_NONE,
+    &level.bd_voodoo_collects_diamonds,
+    NULL, NULL,
+    "can collect diamonds",            "can collect diamonds for the player"
+  },
+  {
+    ED_CHECKBUTTON_ID_BD_VOODOO_HURT_KILLS_PLAYER,
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
+    GADGET_ID_BD_VOODOO_HURT_KILLS_PLAYER, GADGET_ID_NONE,
+    &level.bd_voodoo_hurt_kills_player,
+    NULL, NULL,
+    "player is killed if hurt",                "if hurt in any way, player is killed"
+  },
+  {
+    ED_CHECKBUTTON_ID_BD_VOODOO_DIES_BY_ROCK,
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(2),
+    GADGET_ID_BD_VOODOO_DIES_BY_ROCK,  GADGET_ID_NONE,
+    &level.bd_voodoo_dies_by_rock,
+    NULL, NULL,
+    "killed by falling rock",          "can be killed by a falling rock"
+  },
+  {
+    ED_CHECKBUTTON_ID_BD_VOODOO_VANISH_BY_EXPLOSION,
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(3),
+    GADGET_ID_BD_VOODOO_VANISH_BY_EXPLOSION, GADGET_ID_NONE,
+    &level.bd_voodoo_vanish_by_explosion,
+    NULL, NULL,
+    "disappears in explosions",                "can be destroyed by explosions"
+  },
   {
     ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
     ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
@@ -10787,6 +10827,7 @@ static void DrawPropertiesInfo(void)
 #define TEXT_GAME_OF_LIFE_3    "Min neighbours to create"
 #define TEXT_GAME_OF_LIFE_4    "Max neighbours to create"
 #define TEXT_TIME_BONUS                "Extra time to solve level"
+#define TEXT_TIME_PENALTY      "Time penalty if destroyed"
 
 static struct
 {
@@ -10901,6 +10942,8 @@ static struct
   { EL_SHIELD_DEADLY,          &level.shield_deadly_time,              TEXT_DURATION           },
   { EL_BD_CLOCK,               &level.bd_clock_extra_time,             TEXT_TIME_BONUS,
                                -100, 100                                                       },
+  { EL_BD_VOODOO_DOLL,         &level.bd_voodoo_penalty_time,          TEXT_TIME_PENALTY,
+                               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 },
@@ -10960,7 +11003,8 @@ static boolean checkPropertiesConfig(int element)
       MAYBE_DONT_COLLIDE_WITH(element) ||
       element == EL_BD_ROCK ||
       element == EL_BD_MEGA_ROCK ||
-      element == EL_BD_SWEET)
+      element == EL_BD_SWEET ||
+      element == EL_BD_VOODOO_DOLL)
   {
     return TRUE;
   }
@@ -11080,6 +11124,7 @@ static void DrawPropertiesConfig(void)
                               (CAN_GROW(properties_element)                ? 1 : 0) +
                               (COULD_MOVE_INTO_ACID(properties_element)    ? 1 : 0) +
                               (MAYBE_DONT_COLLIDE_WITH(properties_element) ? 1 : 0) +
+                              (properties_element == EL_BD_VOODOO_DOLL     ? 4 : 0) +
                               (properties_element == EL_EMC_MAGIC_BALL     ? 2 : 0) +
                               num_element_counters);
 
@@ -11271,6 +11316,14 @@ static void DrawPropertiesConfig(void)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET);
   }
 
+  if (properties_element == EL_BD_VOODOO_DOLL)
+  {
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_VOODOO_COLLECTS_DIAMONDS);
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_VOODOO_HURT_KILLS_PLAYER);
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_VOODOO_DIES_BY_ROCK);
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_VOODOO_VANISH_BY_EXPLOSION);
+  }
+
   if (properties_element == EL_BD_MAGIC_WALL)
   {
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_WAIT_HATCHING);
index 78c47b9fe8a81cbbd8f0ae8d1d7804819d361576..b4c2d7e4023af33ec725c199872b27ac137866e5 100644 (file)
@@ -652,6 +652,33 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     &li.bd_clock_extra_time,           30
   },
 
+  {
+    EL_BD_VOODOO_DOLL,                 -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(1),
+    &li.bd_voodoo_collects_diamonds,   FALSE
+  },
+  {
+    EL_BD_VOODOO_DOLL,                 -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(2),
+    &li.bd_voodoo_hurt_kills_player,   FALSE
+  },
+  {
+    EL_BD_VOODOO_DOLL,                 -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(3),
+    &li.bd_voodoo_dies_by_rock,                FALSE
+  },
+  {
+    EL_BD_VOODOO_DOLL,                 -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(4),
+    &li.bd_voodoo_vanish_by_explosion, TRUE
+  },
+  {
+    EL_BD_VOODOO_DOLL,                 -1,
+    TYPE_INTEGER,                      CONF_VALUE_8_BIT(5),
+    &li.bd_voodoo_penalty_time,                30
+  },
+
+
   // (the following values are related to various game elements)
 
   {
@@ -3903,6 +3930,11 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
 
   // element properties
   cave->level_bonus_time[0]            = level->bd_clock_extra_time;
+  cave->voodoo_collects_diamonds       = level->bd_voodoo_collects_diamonds;
+  cave->voodoo_any_hurt_kills_player   = level->bd_voodoo_hurt_kills_player;
+  cave->voodoo_dies_by_stone           = level->bd_voodoo_dies_by_rock;
+  cave->voodoo_disappear_in_explosion  = level->bd_voodoo_vanish_by_explosion;
+  cave->level_penalty_time[0]          = level->bd_voodoo_penalty_time;
   cave->level_magic_wall_time[0]       = level->time_magic_wall;
   cave->magic_timer_wait_for_hatching  = level->bd_magic_wall_wait_hatching;
   cave->magic_wall_stops_amoeba                = level->bd_magic_wall_stops_amoeba;
@@ -3980,6 +4012,11 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
 
   // element properties
   level->bd_clock_extra_time           = cave->level_bonus_time[0];
+  level->bd_voodoo_collects_diamonds   = cave->voodoo_collects_diamonds;
+  level->bd_voodoo_hurt_kills_player   = cave->voodoo_any_hurt_kills_player;
+  level->bd_voodoo_dies_by_rock                = cave->voodoo_dies_by_stone;
+  level->bd_voodoo_vanish_by_explosion = cave->voodoo_disappear_in_explosion;
+  level->bd_voodoo_penalty_time                = cave->level_penalty_time[0];
   level->time_magic_wall               = cave->level_magic_wall_time[bd_level_nr];
   level->bd_magic_wall_wait_hatching   = cave->magic_timer_wait_for_hatching;
   level->bd_magic_wall_stops_amoeba    = cave->magic_wall_stops_amoeba;
index 45b045f19f7c5a4d02df8388a5734f307053e513..9abb886a5634f03c718f42610aaaf733ffc378ca 100644 (file)
@@ -3516,6 +3516,11 @@ struct LevelInfo
   int bd_amoeba_2_content_exploding;   // BD amoeba 2 changes to this element if exploding
   int bd_amoeba_2_content_looks_like;  // BD amoeba 2 looks like this other game element
   int bd_clock_extra_time;             // BD engine extra time when collecting clock
+  boolean bd_voodoo_collects_diamonds; // BD voodoo doll can collect diamonds for the player
+  boolean bd_voodoo_hurt_kills_player; // BD voodoo doll hurt in any way, player is killed
+  boolean bd_voodoo_dies_by_rock;      // BD voodoo doll can be killed by a falling rock
+  boolean bd_voodoo_vanish_by_explosion;// BD voodoo doll can be destroyed by explosions
+  int bd_voodoo_penalty_time;          // BD engine penalty time when voodoo doll destroyed
   boolean em_slippery_gems;            // EM style "gems slip from wall" behaviour
   boolean em_explodes_by_fire;         // EM style chain explosion behaviour
   boolean use_spring_bug;              // for compatibility with old levels