added support for gravity effects in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Mon, 11 Mar 2024 08:45:05 +0000 (09:45 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 11 Mar 2024 08:45:05 +0000 (09:45 +0100)
src/editor.c
src/files.c
src/main.h

index 6ea027d683b2702045223266fd33e2d936e6fd7d..0db1f716337dca926a423dcf27605e397d45bd28 100644 (file)
@@ -667,6 +667,7 @@ enum
   GADGET_ID_BD_LINE_SHIFTING_BORDERS,
   GADGET_ID_BD_SCAN_FIRST_AND_LAST_ROW,
   GADGET_ID_BD_SHORT_EXPLOSIONS,
+  GADGET_ID_BD_GRAVITY_AFFECTS_ALL,
   GADGET_ID_STICK_ELEMENT,
   GADGET_ID_EM_SLIPPERY_GEMS,
   GADGET_ID_EM_EXPLODES_BY_FIRE,
@@ -997,6 +998,7 @@ enum
   ED_CHECKBUTTON_ID_BD_LINE_SHIFTING_BORDERS,
   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_STICK_ELEMENT,
   ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS,
   ED_CHECKBUTTON_ID_EM_EXPLODES_BY_FIRE,
@@ -1078,7 +1080,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_SHORT_EXPLOSIONS
+#define ED_CHECKBUTTON_ID_ENGINE_LAST  ED_CHECKBUTTON_ID_BD_GRAVITY_AFFECTS_ALL
 
 #define ED_CHECKBUTTON_ID_CUSTOM1_FIRST        ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC
 #define ED_CHECKBUTTON_ID_CUSTOM1_LAST ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE
@@ -3373,6 +3375,14 @@ static struct
     NULL, NULL,
     "short explosions",                        "use four game cycles for explosions"
   },
+  {
+    ED_CHECKBUTTON_ID_BD_GRAVITY_AFFECTS_ALL,
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(9),
+    GADGET_ID_BD_GRAVITY_AFFECTS_ALL,  GADGET_ID_NONE,
+    &level.bd_gravity_affects_all,
+    NULL, NULL,
+    "gravity change affects everything", "gravity affects all falling objects"
+  },
 
   // ---------- element settings: configure (various elements) ----------------
 
index 2842d1d4fa1eea88deee454ed6b5ba40b5ca2859..0c75667c9c50aa102bd7ce3f360c16a1232187e2 100644 (file)
@@ -339,6 +339,12 @@ static struct LevelFileConfigInfo chunk_config_INFO[] =
     &li.bd_short_explosions,           TRUE
   },
 
+  {
+    -1,                                        -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(24),
+    &li.bd_gravity_affects_all,                TRUE
+  },
+
   {
     -1,                                        -1,
     -1,                                        -1,
@@ -3796,6 +3802,7 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   cave->wraparound_objects             = level->bd_wraparound_objects;
   cave->border_scan_first_and_last     = level->bd_scan_first_and_last_row;
   cave->short_explosions               = level->bd_short_explosions;
+  cave->gravity_affects_all            = level->bd_gravity_affects_all;
 
   strncpy(cave->name, level->name, sizeof(GdString));
   cave->name[sizeof(GdString) - 1] = '\0';
@@ -3837,6 +3844,7 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   level->bd_wraparound_objects         = cave->wraparound_objects;
   level->bd_scan_first_and_last_row    = cave->border_scan_first_and_last;
   level->bd_short_explosions           = cave->short_explosions;
+  level->bd_gravity_affects_all                = cave->gravity_affects_all;
 
   char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1);
 
index 07eabfb9321728cefff04f136be3729b02b70cfb..85b69174b1e7fc1efc629550a7d43b5fcff753fc 100644 (file)
@@ -3490,6 +3490,7 @@ struct LevelInfo
   boolean bd_wraparound_objects;       // BD cave object rendering uses wrap-around
   boolean bd_scan_first_and_last_row;  // BD engine scans top and bottom border rows
   boolean bd_short_explosions;         // BD engine uses four game cycles for explosions
+  boolean bd_gravity_affects_all;      // BD engine gravity affects all falling objects
   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