replaced BD color index numbers with meaningful constants
authorHolger Schemel <holger.schemel@virtion.de>
Fri, 13 Dec 2024 20:00:22 +0000 (21:00 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Fri, 13 Dec 2024 16:05:06 +0000 (17:05 +0100)
src/files.c
src/game_bd/bd_cave.c

index 82fd7c74d46d9fcafb732caa80911979fed899c6..50e1f63f0e6a2373c4a66b43d8e5a0d5044c7657 100644 (file)
@@ -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
   },
 
   {
index d23dbeca74a5aab8a7d23eff40f369b56757e7e6..ee5bab381ec80f758a170a31a361021b0a38dfc6 100644 (file)
@@ -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))