From ce22005c9362ab5475aee8701c7d056db3a32050 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 13 Dec 2024 21:00:22 +0100 Subject: [PATCH] replaced BD color index numbers with meaningful constants --- src/files.c | 18 +++++++++--------- src/game_bd/bd_cave.c | 29 +++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/files.c b/src/files.c index 82fd7c74..50e1f63f 100644 --- a/src/files.c +++ b/src/files.c @@ -320,47 +320,47 @@ static struct LevelFileConfigInfo chunk_config_INFO[] = { -1, -1, TYPE_INTEGER, CONF_VALUE_32_BIT(3), - &li.bd_color_b, GD_C64_COLOR(0) + &li.bd_color_b, GD_C64_COLOR_BLACK }, { -1, -1, TYPE_INTEGER, CONF_VALUE_32_BIT(4), - &li.bd_color_0, GD_C64_COLOR(0) + &li.bd_color_0, GD_C64_COLOR_BLACK }, { -1, -1, TYPE_INTEGER, CONF_VALUE_32_BIT(5), - &li.bd_color_1, GD_C64_COLOR(8) + &li.bd_color_1, GD_C64_COLOR_ORANGE }, { -1, -1, TYPE_INTEGER, CONF_VALUE_32_BIT(6), - &li.bd_color_2, GD_C64_COLOR(11) + &li.bd_color_2, GD_C64_COLOR_GRAY1 }, { -1, -1, TYPE_INTEGER, CONF_VALUE_32_BIT(7), - &li.bd_color_3, GD_C64_COLOR(1) + &li.bd_color_3, GD_C64_COLOR_WHITE }, { -1, -1, TYPE_INTEGER, CONF_VALUE_32_BIT(8), - &li.bd_color_4, GD_C64_COLOR(5) + &li.bd_color_4, GD_C64_COLOR_GREEN }, { -1, -1, TYPE_INTEGER, CONF_VALUE_32_BIT(9), - &li.bd_color_5, GD_C64_COLOR(6) + &li.bd_color_5, GD_C64_COLOR_BLUE }, { -1, -1, TYPE_INTEGER, CONF_VALUE_32_BIT(10), - &li.bd_color_6, GD_C64_COLOR(12) + &li.bd_color_6, GD_C64_COLOR_GRAY2 }, { -1, -1, TYPE_INTEGER, CONF_VALUE_32_BIT(11), - &li.bd_color_7, GD_C64_COLOR(1) + &li.bd_color_7, GD_C64_COLOR_WHITE }, { diff --git a/src/game_bd/bd_cave.c b/src/game_bd/bd_cave.c index d23dbeca..ee5bab38 100644 --- a/src/game_bd/bd_cave.c +++ b/src/game_bd/bd_cave.c @@ -789,13 +789,30 @@ static inline void swap(int *i1, int *i2) void gd_cave_set_random_c64_colors(GdCave *cave) { - const int bright_colors[] = { 1, 3, 7 }; - const int dark_colors[] = { 2, 6, 8, 9, 11 }; - const int gray_colors[] = { 11, 12, 15 }; + const int bright_colors[] = + { + GD_COLOR_INDEX_WHITE, + GD_COLOR_INDEX_CYAN, + GD_COLOR_INDEX_YELLOW, + }; + const int dark_colors[] = + { + GD_COLOR_INDEX_RED, + GD_COLOR_INDEX_BLUE, + GD_COLOR_INDEX_ORANGE, + GD_COLOR_INDEX_BROWN, + GD_COLOR_INDEX_GRAY1, + }; + const int gray_colors[] = + { + GD_COLOR_INDEX_GRAY1, + GD_COLOR_INDEX_GRAY2, + GD_COLOR_INDEX_GRAY3, + }; // always black - cave->colorb = gd_c64_color(0); - cave->color0 = gd_c64_color(0); + cave->colorb = gd_c64_color(GD_COLOR_INDEX_BLACK); + cave->color0 = gd_c64_color(GD_COLOR_INDEX_BLACK); // choose some bright color for brick cave->color3 = gd_c64_color(bright_colors[gd_random_int_range(0, ARRAY_SIZE(bright_colors))]); @@ -821,7 +838,7 @@ void gd_cave_set_random_c64_colors(GdCave *cave) // extra colors cave->color6 = gd_c64_color(gray_colors[gd_random_int_range(0, ARRAY_SIZE(gray_colors))]); - cave->color7 = gd_c64_color(1); + cave->color7 = gd_c64_color(GD_COLOR_INDEX_WHITE); } static void cave_set_random_indexed_colors(GdCave *cave, GdColor (*color_indexer_func) (int, int)) -- 2.34.1