From 599c259603c87f2c8c000f1c1b7ce2c9a70ff16b Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Thu, 5 Nov 2015 19:42:23 +0000 Subject: [PATCH] Fix #1749. Rainbow road graphical glitch. Issue was caused by the image using an invalid colour entry. This initilises the memory that is expected to return white. Platform update palette also had to be modified to allow this fix to work. --- src/platform/shared.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/platform/shared.c b/src/platform/shared.c index 98064406f2..9c34a7eb6b 100644 --- a/src/platform/shared.c +++ b/src/platform/shared.c @@ -356,8 +356,9 @@ void platform_update_palette(const uint8* colours, int start_index, int num_colo { SDL_Surface *surface; int i; + colours += start_index * 4; - for (i = 0; i < 256; i++) { + for (i = start_index; i < num_colours + start_index; i++) { gPalette[i].r = colours[2]; gPalette[i].g = colours[1]; gPalette[i].b = colours[0]; @@ -651,6 +652,14 @@ void platform_init() platform_create_window(); gKeysPressed = malloc(sizeof(unsigned char) * 256); memset(gKeysPressed, 0, sizeof(unsigned char) * 256); + + // Set the highest palette entry to white. + // This fixes a bug with the TT:rainbow road due to the + // image not using the correct white palette entry. + gPalette[255].a = 0; + gPalette[255].r = 255; + gPalette[255].g = 255; + gPalette[255].b = 255; } static void platform_create_window()