From ed8c1829a0a5eac5e46efe0e8202b570f75fd0c6 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 9 Mar 2024 01:38:46 +0100 Subject: [PATCH] added support for extra diamond score in BD engine to level editor --- src/editor.c | 7 +++++++ src/files.c | 33 ++++++++++++++++----------------- src/main.h | 2 +- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/editor.c b/src/editor.c index eae4514e..5a2c42a7 100644 --- a/src/editor.c +++ b/src/editor.c @@ -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); diff --git a/src/files.c b/src/files.c index 8e04c423..e0225dc2 100644 --- a/src/files.c +++ b/src/files.c @@ -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'; diff --git a/src/main.h b/src/main.h index fc07b5ea..c98b7d2f 100644 --- a/src/main.h +++ b/src/main.h @@ -1071,7 +1071,7 @@ #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 -- 2.34.1