added support for pushing settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Mon, 11 Mar 2024 19:39:41 +0000 (20:39 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 11 Mar 2024 19:39:41 +0000 (20:39 +0100)
src/editor.c
src/files.c
src/main.h

index a9ef7e5e57aee657b2de8d3acb5c485b89e8cde3..daa50a04e8d1b851a6ce088c9c490323d46c6943 100644 (file)
@@ -441,6 +441,12 @@ 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_PUSHING_PROB_DOWN,
+  GADGET_ID_BD_PUSHING_PROB_TEXT,
+  GADGET_ID_BD_PUSHING_PROB_UP,
+  GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_DOWN,
+  GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_TEXT,
+  GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_UP,
   GADGET_ID_ELEMENT_VALUE1_DOWN,
   GADGET_ID_ELEMENT_VALUE1_TEXT,
   GADGET_ID_ELEMENT_VALUE1_UP,
@@ -701,6 +707,7 @@ enum
   GADGET_ID_DONT_COLLIDE_WITH,
   GADGET_ID_BD_DIAGONAL_MOVEMENTS,
   GADGET_ID_BD_TOPMOST_PLAYER_ACTIVE,
+  GADGET_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET,
   GADGET_ID_ENVELOPE_AUTOWRAP,
   GADGET_ID_ENVELOPE_CENTERED,
   GADGET_ID_MM_LASER_RED,
@@ -773,6 +780,8 @@ 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_PUSHING_PROB,
+  ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET,
   ED_COUNTER_ID_ELEMENT_VALUE1,
   ED_COUNTER_ID_ELEMENT_VALUE2,
   ED_COUNTER_ID_ELEMENT_VALUE3,
@@ -1033,6 +1042,7 @@ enum
   ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH,
   ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS,
   ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_ACTIVE,
+  ED_CHECKBUTTON_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET,
   ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
   ED_CHECKBUTTON_ID_ENVELOPE_CENTERED,
   ED_CHECKBUTTON_ID_MM_LASER_RED,
@@ -1554,6 +1564,24 @@ static struct
 
   // ---------- element settings: configure (various elements) ----------------
 
+  {
+    ED_COUNTER_ID_BD_PUSHING_PROB,
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(2),
+    0,                                 100,
+    GADGET_ID_BD_PUSHING_PROB_DOWN,    GADGET_ID_BD_PUSHING_PROB_UP,
+    GADGET_ID_BD_PUSHING_PROB_TEXT,    GADGET_ID_NONE,
+    &level.bd_pushing_prob,
+    NULL,                              NULL, "probability to push rocks"
+  },
+  {
+    ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET,
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(3),
+    0,                                 100,
+    GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_DOWN, GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_UP,
+    GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_TEXT, GADGET_ID_NONE,
+    &level.bd_pushing_prob_with_sweet,
+    NULL,                              NULL, "as above, after eating sweet"
+  },
   {
     ED_COUNTER_ID_ELEMENT_VALUE1,
     ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
@@ -3652,6 +3680,14 @@ static struct
     NULL, NULL,
     "topmost player is active",                "use first player found on playfield"
   },
+  {
+    ED_CHECKBUTTON_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET,
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(4),
+    GADGET_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET, GADGET_ID_NONE,
+    &level.bd_push_mega_rock_with_sweet,
+    NULL, NULL,
+    "mega rocks pushable with sweet",  "push mega rocks after eating sweet"
+  },
   {
     ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
     ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
@@ -11044,8 +11080,14 @@ static void DrawPropertiesConfig(void)
 
   if (IS_BD_PLAYER_ELEMENT(properties_element))
   {
+    // draw checkbutton gadgets
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS);
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_ACTIVE);
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET);
+
+    // draw counter gadgets
+    MapCounterButtons(ED_COUNTER_ID_BD_PUSHING_PROB);
+    MapCounterButtons(ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET);
   }
 
   // special case: slippery walls option for gems only available in R'n'D game engine
index b6162a68b69514127153f02dbaf92424d3308013..def5405a0cd7cff30ab04c9b601081d454044ef4 100644 (file)
@@ -617,6 +617,21 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(2),
     &li.bd_topmost_player_active,      TRUE
   },
+  {
+    EL_BD_PLAYER,                      -1,
+    TYPE_INTEGER,                      CONF_VALUE_8_BIT(3),
+    &li.bd_pushing_prob,               25
+  },
+  {
+    EL_BD_PLAYER,                      -1,
+    TYPE_INTEGER,                      CONF_VALUE_8_BIT(4),
+    &li.bd_pushing_prob_with_sweet,    100
+  },
+  {
+    EL_BD_PLAYER,                      -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(5),
+    &li.bd_push_mega_rock_with_sweet,  FALSE
+  },
 
   {
     EL_BD_DIAMOND,                     -1,
@@ -3790,6 +3805,9 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   // player properties
   cave->diagonal_movements             = level->bd_diagonal_movements;
   cave->active_is_first_found          = level->bd_topmost_player_active;
+  cave->pushing_stone_prob             = level->bd_pushing_prob            * 10000;
+  cave->pushing_stone_prob_sweet       = level->bd_pushing_prob_with_sweet * 10000;
+  cave->mega_stones_pushable_with_sweet        = level->bd_push_mega_rock_with_sweet;
 
   // level name
   strncpy(cave->name, level->name, sizeof(GdString));
@@ -3844,6 +3862,9 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   // player properties
   level->bd_diagonal_movements         = cave->diagonal_movements;
   level->bd_topmost_player_active      = cave->active_is_first_found;
+  level->bd_pushing_prob               = cave->pushing_stone_prob       / 10000;
+  level->bd_pushing_prob_with_sweet    = cave->pushing_stone_prob_sweet / 10000;
+  level->bd_push_mega_rock_with_sweet  = cave->mega_stones_pushable_with_sweet;
 
   // level name
   char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1);
index 77f15e42659c88391de4acbbe80ed79ba2734310..08ba56d5053b1a810ed6756491aaec89f93fbf89 100644 (file)
@@ -3494,6 +3494,9 @@ struct LevelInfo
   boolean bd_intermission;             // BD level is intermission
   boolean bd_diagonal_movements;       // BD style diagonal movements
   boolean bd_topmost_player_active;    // BD engine uses first player found on playfield
+  int bd_pushing_prob;                 // BD player probability to push rocks
+  int bd_pushing_prob_with_sweet;      // BD player probability to push rocks after eating sweet
+  boolean bd_push_mega_rock_with_sweet;        // BD player can push mega rocks after eating sweet
   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