fixed clipping BD engine intermission levels in editor
authorHolger Schemel <holger.schemel@virtion.de>
Sat, 10 Aug 2024 10:58:45 +0000 (12:58 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Sat, 10 Aug 2024 10:58:45 +0000 (12:58 +0200)
src/editor.c
src/files.c
src/main.h

index d2d020faa9a711bf41c8701534ddba6d7774d53c..c7748d574b1569fe3691fc41acf66dfaba6ddbbc 100644 (file)
@@ -790,6 +790,7 @@ enum
   GADGET_ID_RANDOM_QUANTITY,
   GADGET_ID_RANDOM_RESTRICTED,
   GADGET_ID_BD_INTERMISSION,
+  GADGET_ID_BD_INTERMISSION_CLIPPED,
   GADGET_ID_BD_PAL_TIMING,
   GADGET_ID_BD_LINE_SHIFTING_BORDERS,
   GADGET_ID_BD_SCAN_FIRST_AND_LAST_ROW,
@@ -1175,6 +1176,7 @@ enum
   ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_3,
   ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2,
   ED_CHECKBUTTON_ID_BD_INTERMISSION,
+  ED_CHECKBUTTON_ID_BD_INTERMISSION_CLIPPED,
   ED_CHECKBUTTON_ID_BD_PAL_TIMING,
   ED_CHECKBUTTON_ID_BD_LINE_SHIFTING_BORDERS,
   ED_CHECKBUTTON_ID_BD_SCAN_FIRST_AND_LAST_ROW,
@@ -3851,6 +3853,14 @@ static struct
     "Boulder Dash game engine settings:", NULL,
     "Intermission",                            "Level is an intermission level"
   },
+  {
+    ED_CHECKBUTTON_ID_BD_INTERMISSION_CLIPPED,
+    -1,                                                ED_ENGINE_SETTINGS_YPOS(0),
+    GADGET_ID_BD_INTERMISSION_CLIPPED,         GADGET_ID_BD_INTERMISSION,
+    &level.bd_intermission_clipped,
+    NULL, " ",
+    "Clipped",                                 "Clip to standard intermission size"
+  },
   {
     ED_CHECKBUTTON_ID_BD_PAL_TIMING,
     ED_ENGINE_SETTINGS_XPOS(0),                        ED_ENGINE_SETTINGS_YPOS(2),
index 589c34dc7e1f5bde3ad6fe49c78f480eda8be202..a0e7df1f4e2a27ec90494266ce68656c09814122 100644 (file)
@@ -311,6 +311,11 @@ static struct LevelFileConfigInfo chunk_config_INFO[] =
     TYPE_INTEGER,                      CONF_VALUE_8_BIT(23),
     &li.bd_cave_random_seed_c64,       0
   },
+  {
+    -1,                                        -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(24),
+    &li.bd_intermission_clipped,       FALSE
+  },
   {
     -1,                                        -1,
     TYPE_INTEGER,                      CONF_VALUE_32_BIT(3),
@@ -4297,6 +4302,15 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   // level type
   cave->intermission                   = level->bd_intermission;
 
+  // level clipping
+  if (level->bd_intermission && level->bd_intermission_clipped)
+  {
+    cave->x1 = 0;
+    cave->y1 = 0;
+    cave->x2 = MIN(19, cave->w - 1);
+    cave->y2 = MIN(11, cave->h - 1);
+  }
+
   // level settings
   cave->level_time[0]                  = level->time;
   cave->level_diamonds[0]              = level->gems_needed;
@@ -4470,6 +4484,16 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   // level type
   level->bd_intermission               = cave->intermission;
 
+  // level clipping
+  if (cave->intermission &&
+      cave->w  == 40 &&
+      cave->h  == 22 &&
+      cave->x1 == 0  &&
+      cave->y1 == 0  &&
+      cave->x2 == 19 &&
+      cave->y2 == 11)
+    level->bd_intermission_clipped = TRUE;
+
   // level settings
   level->time                          = cave->level_time[bd_level_nr];
   level->gems_needed                   = cave->level_diamonds[bd_level_nr];
index 0deb4de8e5fac2ef3f84c8f3084eeb8cf9c888be..a49be9ae28b3f543163e0c2f33701cb4eab8f4ac 100644 (file)
@@ -3695,6 +3695,7 @@ struct LevelInfo
   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_intermission;             // BD level is intermission
+  boolean bd_intermission_clipped;     // BD intermission should be clipped to standard size
   boolean bd_diagonal_movements;       // BD style diagonal movements
   boolean bd_topmost_player_active;    // BD engine uses first player found on playfield
   int bd_snap_element;                 // BD element that is created when player is snapping