From aea9683d94e9fc9030a2e4cc86ef13ac782a7eac Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 3 Jan 2025 14:59:27 +0100 Subject: [PATCH] fixed initializing level specific colors when loading non-BD levels --- src/files.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/files.c b/src/files.c index ac46c7ad..af7f9c7a 100644 --- a/src/files.c +++ b/src/files.c @@ -7900,6 +7900,27 @@ static void LoadLevel_InitSettings_SB(struct LevelInfo *level) } } +static void LoadLevel_InitColorSettings(struct LevelInfo *level) +{ + GdCave *cave = level->native_bd_level->cave; + + // copy level colors to native BD level + // (this workaround is needed as long as color template handling is still BD specific) + cave->colorb = level->bd_color_b; + cave->color0 = level->bd_color_0; + cave->color1 = level->bd_color_1; + cave->color2 = level->bd_color_2; + cave->color3 = level->bd_color_3; + cave->color4 = level->bd_color_4; + cave->color5 = level->bd_color_5; + cave->color6 = level->bd_color_6; + cave->color7 = level->bd_color_7; + + // set default color type and colors for BD style level colors + SetDefaultLevelColorType_BD(); + SetDefaultLevelColors_BD(); +} + static void LoadLevel_InitSettings(struct LevelInfo *level) { // adjust level settings for (non-native) Sokoban-style levels @@ -7912,9 +7933,8 @@ static void LoadLevel_InitSettings(struct LevelInfo *level) snprintf(level->name, MAX_LEVEL_NAME_LEN + 1, leveldir_current->empty_level_name, level_nr); - // set default color type and colors for BD style level colors - SetDefaultLevelColorType_BD(); - SetDefaultLevelColors_BD(); + // initialize level specific colors + LoadLevel_InitColorSettings(level); } static void LoadLevel_InitStandardElements(struct LevelInfo *level) -- 2.34.1