added support for extra diamond score in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Sat, 9 Mar 2024 00:38:46 +0000 (01:38 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 9 Mar 2024 00:38:46 +0000 (01:38 +0100)
src/editor.c
src/files.c
src/main.h

index eae4514e8b4e22e2dac2f06f251607366550a198..5a2c42a7b90c450b03e1332715745738feab85c6 100644 (file)
@@ -10486,6 +10486,7 @@ static void DrawPropertiesInfo(void)
 }
 
 #define TEXT_COLLECTING                "Score for collecting"
+#define TEXT_COLLECTING_EXTRA  "Extra score for collecting"
 #define TEXT_SMASHING          "Score for smashing"
 #define TEXT_SLURPING          "Score for slurping robot"
 #define TEXT_CRACKING          "Score for cracking"
@@ -10514,6 +10515,7 @@ static struct
 {
   { EL_EMERALD,                &level.score[SC_EMERALD],       TEXT_COLLECTING },
   { EL_BD_DIAMOND,     &level.score[SC_EMERALD],       TEXT_COLLECTING },
+  { EL_BD_DIAMOND,     &level.score[SC_DIAMOND_EXTRA], TEXT_COLLECTING_EXTRA },
   { EL_EMERALD_YELLOW, &level.score[SC_EMERALD],       TEXT_COLLECTING },
   { EL_EMERALD_RED,    &level.score[SC_EMERALD],       TEXT_COLLECTING },
   { EL_EMERALD_PURPLE, &level.score[SC_EMERALD],       TEXT_COLLECTING },
@@ -10887,7 +10889,12 @@ static void DrawPropertiesConfig(void)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS);
 
   if (IS_GEM(properties_element))
+  {
+    checkbutton_info[ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS].y =
+      ED_ELEMENT_SETTINGS_XPOS(properties_element == EL_BD_DIAMOND ? 2 : 1);
+
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS);
+  }
 
   if (properties_element == EL_EM_DYNAMITE)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EM_EXPLODES_BY_FIRE);
index 8e04c423a08aff5483a69d0921e9480c0d011a6b..e0225dc2deded68ce3c9297a7ff41dbc61314deb 100644 (file)
@@ -576,6 +576,12 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     &li.bd_diagonal_movements,         FALSE
   },
 
+  {
+    EL_BD_DIAMOND,                     -1,
+    TYPE_INTEGER,                      CONF_VALUE_16_BIT(1),
+    &li.score[SC_DIAMOND_EXTRA],       20
+  },
+
   // (the following values are related to various game elements)
 
   {
@@ -958,14 +964,6 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     &li.score[SC_ELEM_BONUS],          10
   },
 
-  // ---------- unused values -------------------------------------------------
-
-  {
-    EL_UNKNOWN,                                SAVE_CONF_NEVER,
-    TYPE_INTEGER,                      CONF_VALUE_16_BIT(1),
-    &li.score[SC_UNKNOWN_15],          10
-  },
-
   {
     -1,                                        -1,
     -1,                                        -1,
@@ -3720,8 +3718,8 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
     cave->level_timevalue[i]           = level->score[SC_TIME_BONUS];
   }
 
-  cave->diamond_value                  = level->score[SC_DIAMOND];
-  cave->extra_diamond_value            = level->score[SC_DIAMOND];
+  cave->diamond_value                  = level->score[SC_EMERALD];
+  cave->extra_diamond_value            = level->score[SC_DIAMOND_EXTRA];
 
   cave->level_speed[0]                 = 160;  // set cave speed
 
@@ -3746,15 +3744,16 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   level->fieldx = MIN(cave->w, MAX_LEV_FIELDX);
   level->fieldy = MIN(cave->h, MAX_LEV_FIELDY);
 
-  level->time                  = cave->level_time[bd_level_nr];
-  level->gems_needed           = cave->level_diamonds[bd_level_nr];
-  level->time_magic_wall       = cave->level_magic_wall_time[bd_level_nr];
+  level->time                          = cave->level_time[bd_level_nr];
+  level->gems_needed                   = cave->level_diamonds[bd_level_nr];
+  level->time_magic_wall               = cave->level_magic_wall_time[bd_level_nr];
 
-  level->score[SC_TIME_BONUS]  = cave->level_timevalue[bd_level_nr];
-  level->score[SC_DIAMOND]     = cave->diamond_value;
+  level->score[SC_TIME_BONUS]          = cave->level_timevalue[bd_level_nr];
+  level->score[SC_EMERALD]             = cave->diamond_value;
+  level->score[SC_DIAMOND_EXTRA]       = cave->extra_diamond_value;
 
-  level->bd_intermission       = cave->intermission;
-  level->bd_diagonal_movements = cave->diagonal_movements;
+  level->bd_intermission               = cave->intermission;
+  level->bd_diagonal_movements         = cave->diagonal_movements;
 
   strncpy(level->name, cave->name, MAX_LEVEL_NAME_LEN);
   level->name[MAX_LEVEL_NAME_LEN] = '\0';
index fc07b5eaffa9b57ab845bf9109d119ad1c183853..c98b7d2f4d32259af56c0fe6a5e5df8aa2e94894 100644 (file)
 #define SC_PEARL                               12
 #define SC_SHIELD                              13
 #define SC_ELEM_BONUS                          14
-#define SC_UNKNOWN_15                          15
+#define SC_DIAMOND_EXTRA                       15
 
 #define LEVEL_SCORE_ELEMENTS                   16      // level elements with score