added support for intermission levels in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Fri, 8 Mar 2024 17:48:36 +0000 (18:48 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 8 Mar 2024 17:48:36 +0000 (18:48 +0100)
src/editor.c
src/files.c
src/main.h

index eeb4c2f9891dbdb26b2d651b0e8fea0468ab7c24..eae4514e8b4e22e2dac2f06f251607366550a198 100644 (file)
@@ -649,6 +649,7 @@ enum
   GADGET_ID_RANDOM_PERCENTAGE,
   GADGET_ID_RANDOM_QUANTITY,
   GADGET_ID_RANDOM_RESTRICTED,
+  GADGET_ID_BD_INTERMISSION,
   GADGET_ID_STICK_ELEMENT,
   GADGET_ID_EM_SLIPPERY_GEMS,
   GADGET_ID_EM_EXPLODES_BY_FIRE,
@@ -966,6 +967,7 @@ enum
   ED_CHECKBUTTON_ID_RANDOM_RESTRICTED,
   ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_3,
   ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2,
+  ED_CHECKBUTTON_ID_BD_INTERMISSION,
   ED_CHECKBUTTON_ID_STICK_ELEMENT,
   ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS,
   ED_CHECKBUTTON_ID_EM_EXPLODES_BY_FIRE,
@@ -1046,6 +1048,9 @@ enum
 #define ED_CHECKBUTTON_ID_EDITOR_FIRST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
 #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_INTERMISSION
+
 #define ED_CHECKBUTTON_ID_CUSTOM1_FIRST        ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC
 #define ED_CHECKBUTTON_ID_CUSTOM1_LAST ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE
 #define ED_CHECKBUTTON_ID_CUSTOM2_FIRST        ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE
@@ -3241,6 +3246,14 @@ static struct
     NULL, NULL,
     "use template for custom elements",        "use template for custom properties"
   },
+  {
+    ED_CHECKBUTTON_ID_BD_INTERMISSION,
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(0),
+    GADGET_ID_BD_INTERMISSION,         GADGET_ID_NONE,
+    &level.bd_intermission,
+    "Boulder Dash game engine settings:", NULL,
+    "intermission",                    "level is an intermission level"
+  },
 
   // ---------- element settings: configure (various elements) ----------------
 
@@ -9992,6 +10005,11 @@ static void DrawLevelConfigEditor(void)
 
 static void DrawLevelConfigEngine(void)
 {
+  int i;
+
+  // draw checkbutton gadgets
+  for (i = ED_CHECKBUTTON_ID_ENGINE_FIRST; i <= ED_CHECKBUTTON_ID_ENGINE_LAST; i++)
+    MapCheckbuttonGadget(i);
 }
 
 static void DrawLevelConfigWindow(void)
index b48fcf4a1482b38942301fbadb8396be182513f0..8e04c423a08aff5483a69d0921e9480c0d011a6b 100644 (file)
@@ -273,6 +273,12 @@ static struct LevelFileConfigInfo chunk_config_INFO[] =
     &li.rate_time_over_score,          FALSE
   },
 
+  {
+    -1,                                        -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(14),
+    &li.bd_intermission,               FALSE
+  },
+
   {
     -1,                                        -1,
     -1,                                        -1,
@@ -3719,6 +3725,7 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
 
   cave->level_speed[0]                 = 160;  // set cave speed
 
+  cave->intermission                   = level->bd_intermission;
   cave->diagonal_movements             = level->bd_diagonal_movements;
 
   strncpy(cave->name, level->name, sizeof(GdString));
@@ -3746,6 +3753,7 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   level->score[SC_TIME_BONUS]  = cave->level_timevalue[bd_level_nr];
   level->score[SC_DIAMOND]     = cave->diamond_value;
 
+  level->bd_intermission       = cave->intermission;
   level->bd_diagonal_movements = cave->diagonal_movements;
 
   strncpy(level->name, cave->name, MAX_LEVEL_NAME_LEN);
index 9a54263f204e3aace9ce1e5ab7a81cb6af8966e1..fc07b5eaffa9b57ab845bf9109d119ad1c183853 100644 (file)
@@ -3480,6 +3480,7 @@ struct LevelInfo
   int initial_inventory_size[MAX_PLAYERS];
   int initial_inventory_content[MAX_PLAYERS][MAX_INITIAL_INVENTORY_SIZE];
 
+  boolean bd_intermission;             // BD level is intermission
   boolean bd_diagonal_movements;       // BD style diagonal movements
   boolean em_slippery_gems;            // EM style "gems slip from wall" behaviour
   boolean em_explodes_by_fire;         // EM style chain explosion behaviour