added support for hatching delay in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Sun, 10 Mar 2024 15:14:26 +0000 (16:14 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 10 Mar 2024 15:14:26 +0000 (16:14 +0100)
src/editor.c
src/files.c
src/main.h

index c5b1b4a7438e0d111df54a712e70d926ae331436..6d8bd174f876727a3ec06aff7a28b62f9aca3916 100644 (file)
@@ -435,6 +435,12 @@ enum
   GADGET_ID_BD_CYCLE_DELAY_C64_DOWN,
   GADGET_ID_BD_CYCLE_DELAY_C64_TEXT,
   GADGET_ID_BD_CYCLE_DELAY_C64_UP,
+  GADGET_ID_BD_HATCHING_DELAY_CYCLES_DOWN,
+  GADGET_ID_BD_HATCHING_DELAY_CYCLES_TEXT,
+  GADGET_ID_BD_HATCHING_DELAY_CYCLES_UP,
+  GADGET_ID_BD_HATCHING_DELAY_SECONDS_DOWN,
+  GADGET_ID_BD_HATCHING_DELAY_SECONDS_TEXT,
+  GADGET_ID_BD_HATCHING_DELAY_SECONDS_UP,
   GADGET_ID_ELEMENT_VALUE1_DOWN,
   GADGET_ID_ELEMENT_VALUE1_TEXT,
   GADGET_ID_ELEMENT_VALUE1_UP,
@@ -760,6 +766,8 @@ enum
   ED_COUNTER_ID_LEVEL_RANDOM,
   ED_COUNTER_ID_BD_CYCLE_DELAY_MS,
   ED_COUNTER_ID_BD_CYCLE_DELAY_C64,
+  ED_COUNTER_ID_BD_HATCHING_DELAY_CYCLES,
+  ED_COUNTER_ID_BD_HATCHING_DELAY_SECONDS,
   ED_COUNTER_ID_ELEMENT_VALUE1,
   ED_COUNTER_ID_ELEMENT_VALUE2,
   ED_COUNTER_ID_ELEMENT_VALUE3,
@@ -1515,6 +1523,24 @@ static struct
     &level.bd_cycle_delay_c64,
     NULL,                              NULL, "game cycle delay (C64-style)"
   },
+  {
+    ED_COUNTER_ID_BD_HATCHING_DELAY_CYCLES,
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(4),
+    1,                                 40,
+    GADGET_ID_BD_HATCHING_DELAY_CYCLES_DOWN,   GADGET_ID_BD_HATCHING_DELAY_CYCLES_UP,
+    GADGET_ID_BD_HATCHING_DELAY_CYCLES_TEXT,   GADGET_ID_NONE,
+    &level.bd_hatching_delay_cycles,
+    NULL,                              NULL, "hatching delay (cycles)"
+  },
+  {
+    ED_COUNTER_ID_BD_HATCHING_DELAY_SECONDS,
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(4),
+    1,                                 40,
+    GADGET_ID_BD_HATCHING_DELAY_SECONDS_DOWN,  GADGET_ID_BD_HATCHING_DELAY_SECONDS_UP,
+    GADGET_ID_BD_HATCHING_DELAY_SECONDS_TEXT,  GADGET_ID_NONE,
+    &level.bd_hatching_delay_seconds,
+    NULL,                              NULL, "hatching delay (seconds)"
+  },
 
   // ---------- element settings: configure (various elements) ----------------
 
@@ -10072,9 +10098,15 @@ static void DrawLevelConfigEngine(void)
 
   // draw counter gadgets
   if (level.bd_scheduling_type == GD_SCHEDULING_MILLISECONDS)
+  {
     MapCounterButtons(ED_COUNTER_ID_BD_CYCLE_DELAY_MS);
+    MapCounterButtons(ED_COUNTER_ID_BD_HATCHING_DELAY_CYCLES);
+  }
   else
+  {
     MapCounterButtons(ED_COUNTER_ID_BD_CYCLE_DELAY_C64);
+    MapCounterButtons(ED_COUNTER_ID_BD_HATCHING_DELAY_SECONDS);
+  }
 
   // draw checkbutton gadgets
   for (i = ED_CHECKBUTTON_ID_ENGINE_FIRST; i <= ED_CHECKBUTTON_ID_ENGINE_LAST; i++)
index 898b33bbb867cf68bdbdcb967455c0813b4acc46..8044d338699f6320db107d04e9f62daf8306a625 100644 (file)
@@ -303,6 +303,18 @@ static struct LevelFileConfigInfo chunk_config_INFO[] =
     &li.bd_cycle_delay_c64,            0
   },
 
+  {
+    -1,                                        -1,
+    TYPE_INTEGER,                      CONF_VALUE_8_BIT(18),
+    &li.bd_hatching_delay_cycles,      21
+  },
+
+  {
+    -1,                                        -1,
+    TYPE_INTEGER,                      CONF_VALUE_8_BIT(19),
+    &li.bd_hatching_delay_seconds,     2
+  },
+
   {
     -1,                                        -1,
     -1,                                        -1,
@@ -3742,6 +3754,8 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
 
     cave->level_speed[i]               = level->bd_cycle_delay_ms;
     cave->level_ckdelay[i]             = level->bd_cycle_delay_c64;
+    cave->level_hatching_delay_frame[i]        = level->bd_hatching_delay_cycles;
+    cave->level_hatching_delay_time[i] = level->bd_hatching_delay_seconds;
 
     cave->level_timevalue[i]           = level->score[SC_TIME_BONUS];
   }
@@ -3778,6 +3792,8 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
 
   level->bd_cycle_delay_ms             = cave->level_speed[bd_level_nr];
   level->bd_cycle_delay_c64            = cave->level_ckdelay[bd_level_nr];
+  level->bd_hatching_delay_cycles      = cave->level_hatching_delay_frame[bd_level_nr];
+  level->bd_hatching_delay_seconds     = cave->level_hatching_delay_time[bd_level_nr];
 
   level->score[SC_TIME_BONUS]          = cave->level_timevalue[bd_level_nr];
   level->score[SC_EMERALD]             = cave->diamond_value;
index fc1a1cecb7629a8c97a6800e85aa762d4731647d..be4eb9c31936ba9a8773c25a7ff0f5f48c154210 100644 (file)
@@ -3484,6 +3484,8 @@ struct LevelInfo
   boolean bd_pal_timing;               // BD engine special timing
   boolean bd_cycle_delay_ms;           // BD game cycle delay (in milliseconds)
   boolean bd_cycle_delay_c64;          // BD game cycle delay (in C64 game units)
+  boolean bd_hatching_delay_cycles;    // BD hatching delay (in game cycles)
+  boolean bd_hatching_delay_seconds;   // BD hatching delay (in seconds)
   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