# HG changeset patch # User Peter Nelson # Date 2023-12-28 16:06:35 # Node ID 5e58b8dec74decd588c8ea40c5f3d0d41adb74b5 # Parent 02b90af3b0ccb80bbcdd369fe201c30b05e9e3f1 Codechange: Off-by-one in colour gradient initialisation. Remap sprites start with a count byte followed by 256 entries, but SetupColoursAndInitialWindow did not take account of this extra byte and therefore started at palette index 0xC5 instead of 0xC6. This caused the first colour of each gradient to be incorrect and all shades were actually 1 step lower in the gradient than indicated. diff --git a/src/main_gui.cpp b/src/main_gui.cpp --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -541,7 +541,7 @@ void ShowSelectGameWindow(); void SetupColoursAndInitialWindow() { for (Colours i = COLOUR_BEGIN; i != COLOUR_END; i++) { - const byte *b = GetNonSprite(GENERAL_SPRITE_COLOUR(i), SpriteType::Recolour); + const byte *b = GetNonSprite(GENERAL_SPRITE_COLOUR(i), SpriteType::Recolour) + 1; assert(b != nullptr); for (ColourShade j = SHADE_BEGIN; j < SHADE_END; j++) { SetColourGradient(i, j, b[0xC6 + j]); diff --git a/src/palette_func.h b/src/palette_func.h --- a/src/palette_func.h +++ b/src/palette_func.h @@ -42,13 +42,14 @@ TextColour GetContrastColour(uint8_t bac enum ColourShade : uint8_t { SHADE_BEGIN = 0, - SHADE_DARKEST, + SHADE_DARKEST = SHADE_BEGIN, SHADE_DARKER, SHADE_DARK, SHADE_NORMAL, SHADE_LIGHT, SHADE_LIGHTER, SHADE_LIGHTEST, + SHADE_LIGHTEREST, SHADE_END, }; DECLARE_POSTFIX_INCREMENT(ColourShade)