X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_bd%2Fbd_colors.c;h=7a9a35aa460ff588b4e2a07c8b13de67ad4e7900;hb=b197ad86c0801f6139e4f147bf22bd375c9dfb63;hp=9641fa07e6e28d65cc1f608fb337e90ca95ca416;hpb=88f7ecb806128d27957a42ed0d3c073463710b42;p=rocksndiamonds.git diff --git a/src/game_bd/bd_colors.c b/src/game_bd/bd_colors.c index 9641fa07..7a9a35aa 100644 --- a/src/game_bd/bd_colors.c +++ b/src/game_bd/bd_colors.c @@ -17,10 +17,6 @@ #include "main_bd.h" -static int gd_c64_palette = 0; -static int gd_c64dtv_palette = 0; -static int gd_atari_palette = 0; - static char *c64_color_names[] = { "Black", "White", "Red", "Cyan", "Purple", "Green", "Blue", "Yellow", @@ -86,8 +82,8 @@ static unsigned int c64_colors_rtadash[]={ 0xe66c00, 0x935f00, 0xff7c64, 0x6c6c6c, 0xa1a1a1, 0xafff4d, 0x9778ff, 0xd8d8d8, }; -/* make sure that pointeres and names match! */ -static unsigned int *c64_palette_pointers[] = +// pointer array positions must match palette numbers in header file +static unsigned int *c64_palettes_pointers[] = { c64_colors_vice_new, c64_colors_vice_old, @@ -440,6 +436,7 @@ static byte XFormer[] = 190,133,230,198,145,234,202,153,234,214,157,238,218,161 }; +// pointer array positions must match palette numbers in header file static const byte *atari_palettes_pointers[] = { BuiltIn, @@ -535,6 +532,7 @@ static byte Murray[] = 39,185,212,57,208,232,80,225,249,89,238,255,107,255,255,126 }; +// pointer array positions must match palette numbers in header file static const byte *c64dtv_palettes_pointers[] = { Spiff, @@ -592,25 +590,28 @@ GdColor gd_color_get_rgb(GdColor color) return color; case GD_COLOR_TYPE_C64: - if (gd_c64_palette < 0 || gd_c64_palette >= ARRAY_SIZE(c64_palette_pointers) - 1) - gd_c64_palette = 0; // silently switch to default, if invalid value - c64_pal = c64_palette_pointers[gd_c64_palette]; + if (setup.bd_palette_c64 < 0 || + setup.bd_palette_c64 >= ARRAY_SIZE(c64_palettes_pointers) - 1) + setup.bd_palette_c64 = 0; // silently switch to default, if invalid value + c64_pal = c64_palettes_pointers[setup.bd_palette_c64]; index = color & 0x0f; return c64_pal[index]; case GD_COLOR_TYPE_C64DTV: - if (gd_c64dtv_palette < 0 || gd_c64dtv_palette >= ARRAY_SIZE(c64dtv_palettes_pointers) - 1) - gd_c64dtv_palette = 0; - c64dtv_pal = c64dtv_palettes_pointers[gd_c64dtv_palette]; + if (setup.bd_palette_c64dtv < 0 || + setup.bd_palette_c64dtv >= ARRAY_SIZE(c64dtv_palettes_pointers) - 1) + setup.bd_palette_c64dtv = 0; // silently switch to default, if invalid value + c64dtv_pal = c64dtv_palettes_pointers[setup.bd_palette_c64dtv]; index = color & 0xff; return gd_color_get_from_rgb(c64dtv_pal[index * 3], c64dtv_pal[index * 3 + 1], c64dtv_pal[index * 3 + 2]); case GD_COLOR_TYPE_ATARI: - if (gd_atari_palette < 0 || gd_atari_palette >= ARRAY_SIZE(atari_palettes_pointers) - 1) - gd_atari_palette = 0; - atari_pal = atari_palettes_pointers[gd_atari_palette]; + if (setup.bd_palette_atari < 0 || + setup.bd_palette_atari >= ARRAY_SIZE(atari_palettes_pointers) - 1) + setup.bd_palette_atari = 0; // silently switch to default, if invalid value + atari_pal = atari_palettes_pointers[setup.bd_palette_atari]; index = color & 0xff; return gd_color_get_from_rgb(atari_pal[index * 3], atari_pal[index * 3 + 1],