mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-26 00:04:43 +01:00
Create weak enum for PaletteIndex
This commit is contained in:
committed by
GitHub
parent
6693278b7f
commit
cfb4b008b2
@@ -201,7 +201,7 @@ void ChatDraw(DrawPixelInfo& dpi, ColourWithFlags chatBackgroundColor)
|
||||
int32_t caretX = screenCoords.x + GfxGetStringWidth(lineBuffer, FontStyle::Medium);
|
||||
int32_t caretY = screenCoords.y + 14;
|
||||
|
||||
GfxFillRect(dpi, { { caretX, caretY }, { caretX + 6, caretY + 1 } }, PALETTE_INDEX_56);
|
||||
GfxFillRect(dpi, { { caretX, caretY }, { caretX + 6, caretY + 1 } }, PaletteIndex::pi56);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,18 +50,18 @@ void ColoursInitMaps()
|
||||
const G1Element* g1 = GfxGetG1Element(paletteIndex + i);
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
ColourMapA[i].colour_0 = g1->offset[INDEX_COLOUR_0];
|
||||
ColourMapA[i].colour_1 = g1->offset[INDEX_COLOUR_1];
|
||||
ColourMapA[i].darkest = g1->offset[INDEX_DARKEST];
|
||||
ColourMapA[i].darker = g1->offset[INDEX_DARKER];
|
||||
ColourMapA[i].dark = g1->offset[INDEX_DARK];
|
||||
ColourMapA[i].mid_dark = g1->offset[INDEX_MID_DARK];
|
||||
ColourMapA[i].mid_light = g1->offset[INDEX_MID_LIGHT];
|
||||
ColourMapA[i].light = g1->offset[INDEX_LIGHT];
|
||||
ColourMapA[i].lighter = g1->offset[INDEX_LIGHTER];
|
||||
ColourMapA[i].lightest = g1->offset[INDEX_LIGHTEST];
|
||||
ColourMapA[i].colour_10 = g1->offset[INDEX_COLOUR_10];
|
||||
ColourMapA[i].colour_11 = g1->offset[INDEX_COLOUR_11];
|
||||
ColourMapA[i].colour_0 = static_cast<PaletteIndex>(g1->offset[INDEX_COLOUR_0]);
|
||||
ColourMapA[i].colour_1 = static_cast<PaletteIndex>(g1->offset[INDEX_COLOUR_1]);
|
||||
ColourMapA[i].darkest = static_cast<PaletteIndex>(g1->offset[INDEX_DARKEST]);
|
||||
ColourMapA[i].darker = static_cast<PaletteIndex>(g1->offset[INDEX_DARKER]);
|
||||
ColourMapA[i].dark = static_cast<PaletteIndex>(g1->offset[INDEX_DARK]);
|
||||
ColourMapA[i].mid_dark = static_cast<PaletteIndex>(g1->offset[INDEX_MID_DARK]);
|
||||
ColourMapA[i].mid_light = static_cast<PaletteIndex>(g1->offset[INDEX_MID_LIGHT]);
|
||||
ColourMapA[i].light = static_cast<PaletteIndex>(g1->offset[INDEX_LIGHT]);
|
||||
ColourMapA[i].lighter = static_cast<PaletteIndex>(g1->offset[INDEX_LIGHTER]);
|
||||
ColourMapA[i].lightest = static_cast<PaletteIndex>(g1->offset[INDEX_LIGHTEST]);
|
||||
ColourMapA[i].colour_10 = static_cast<PaletteIndex>(g1->offset[INDEX_COLOUR_10]);
|
||||
ColourMapA[i].colour_11 = static_cast<PaletteIndex>(g1->offset[INDEX_COLOUR_11]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ static uint8_t FindClosestPaletteIndex(uint8_t red, uint8_t green, uint8_t blue)
|
||||
int16_t closest = -1;
|
||||
int32_t closestDistance = INT32_MAX;
|
||||
|
||||
for (int i = PALETTE_INDEX_0; i < PALETTE_INDEX_230; i++)
|
||||
for (int i = PaletteIndex::pi0; i < PaletteIndex::pi230; i++)
|
||||
{
|
||||
const int32_t distance = std::pow(gPalette[i].Red - red, 2) + std::pow(gPalette[i].Green - green, 2)
|
||||
+ std::pow(gPalette[i].Blue - blue, 2);
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <string_view>
|
||||
|
||||
using colour_t = uint8_t;
|
||||
using PaletteIndex = uint8_t;
|
||||
|
||||
/**
|
||||
* Colour IDs as used by the colour dropdown, NOT palette indices.
|
||||
@@ -97,115 +96,115 @@ enum
|
||||
COLOUR_DEEP_WATER = 50
|
||||
};
|
||||
|
||||
enum : PaletteIndex
|
||||
enum PaletteIndex : uint8_t
|
||||
{
|
||||
PALETTE_INDEX_0 = 0, // Transparent
|
||||
PALETTE_INDEX_10 = 10, // Black (0-dark), Dark grey (0)
|
||||
PALETTE_INDEX_11 = 11, // Black (middark)
|
||||
PALETTE_INDEX_12 = 12, // Black (midlight), Dark grey (1-darkest)
|
||||
PALETTE_INDEX_14 = 14, // Black (lighter), Dark grey (dark)
|
||||
PALETTE_INDEX_13 = 13, //
|
||||
PALETTE_INDEX_16 = 16, //
|
||||
PALETTE_INDEX_17 = 17, // Black (11), Dark grey (light), White (dark)
|
||||
PALETTE_INDEX_20 = 20, // Dark grey (10), White (light)
|
||||
PALETTE_INDEX_21 = 21, // Dark grey (11), White (lighter-11)
|
||||
PALETTE_INDEX_40 = 40, //
|
||||
PALETTE_INDEX_42 = 42, // Light Brown (lighter), Saturated brown (11)
|
||||
PALETTE_INDEX_44 = 44, // Construction marker
|
||||
PALETTE_INDEX_46 = 46, // Tertiary remap 0 / Yellow (darkest)
|
||||
PALETTE_INDEX_47 = 47, // Tertiary remap 1 / Yellow
|
||||
PALETTE_INDEX_48 = 48, // Tertiary remap 2 / Yellow
|
||||
PALETTE_INDEX_49 = 49, // Tertiary remap 3 / Yellow
|
||||
PALETTE_INDEX_50 = 50, // Tertiary remap 4 / Yellow
|
||||
PALETTE_INDEX_51 = 51, // Tertiary remap 5 / Yellow
|
||||
PALETTE_INDEX_52 = 52, // Tertiary remap 6 / Yellow
|
||||
PALETTE_INDEX_53 = 53, // Tertiary remap 7 / Yellow
|
||||
PALETTE_INDEX_54 = 54, // Tertiary remap 8 / Yellow
|
||||
PALETTE_INDEX_55 = 55, // Tertiary remap 9 / Yellow
|
||||
PALETTE_INDEX_56 = 56, // Tertiary remap 10 / Yellow
|
||||
PALETTE_INDEX_57 = 57, // Tertiary remap 11 / Yellow (lightest)
|
||||
PALETTE_INDEX_61 = 61, // Bordeaux Red (darker)
|
||||
PALETTE_INDEX_62 = 62, //
|
||||
PALETTE_INDEX_68 = 68, //
|
||||
PALETTE_INDEX_73 = 73, //
|
||||
PALETTE_INDEX_99 = 99, //
|
||||
PALETTE_INDEX_102 = 102, // Bright green (lighter)
|
||||
PALETTE_INDEX_108 = 108, //
|
||||
PALETTE_INDEX_111 = 111, //
|
||||
PALETTE_INDEX_129 = 129, // Light Purple (11)
|
||||
PALETTE_INDEX_135 = 135, //
|
||||
PALETTE_INDEX_136 = 136, // Dark Blue (10-11), Light Blue (midlight), Icy Blue (darker)
|
||||
PALETTE_INDEX_138 = 138, // Light Blue (lighter), Icy Blue (middark)
|
||||
PALETTE_INDEX_141 = 141, //
|
||||
PALETTE_INDEX_144 = 144, // Dark Green (1-darkest,
|
||||
PALETTE_INDEX_161 = 161, // Bright Purple (light)
|
||||
PALETTE_INDEX_162 = 162, //
|
||||
PALETTE_INDEX_171 = 171, // Saturated Red (lightest) Bright Red (middark)
|
||||
PALETTE_INDEX_172 = 172, // Saturated Red (10-11), Bright Red (midlight)
|
||||
PALETTE_INDEX_173 = 173, // Used to draw intense lines in the Ride Graphs window
|
||||
PALETTE_INDEX_183 = 183, // Used to draw rides in the Map window
|
||||
PALETTE_INDEX_186 = 186, //
|
||||
PALETTE_INDEX_194 = 194, //
|
||||
PALETTE_INDEX_195 = 195, //
|
||||
PALETTE_INDEX_202 = 202, // Secondary remap 0 / Pink (darkest)
|
||||
PALETTE_INDEX_203 = 203, // Secondary remap 1 / Pink
|
||||
PALETTE_INDEX_204 = 204, // Secondary remap 2 / Pink
|
||||
PALETTE_INDEX_205 = 205, // Secondary remap 3 / Pink
|
||||
PALETTE_INDEX_206 = 206, // Secondary remap 4 / Pink
|
||||
PALETTE_INDEX_207 = 207, // Secondary remap 5 / Pink
|
||||
PALETTE_INDEX_208 = 208, // Secondary remap 6 / Pink
|
||||
PALETTE_INDEX_209 = 209, // Secondary remap 7 / Pink
|
||||
PALETTE_INDEX_210 = 210, // Secondary remap 8 / Pink
|
||||
PALETTE_INDEX_211 = 211, // Secondary remap 9 / Pink
|
||||
PALETTE_INDEX_212 = 212, // Secondary remap 10 / Pink
|
||||
PALETTE_INDEX_213 = 213, // Secondary remap 11 / Pink (lightest)
|
||||
PALETTE_INDEX_222 = 222, //
|
||||
PALETTE_INDEX_230 = 230, // Water (waves)
|
||||
PALETTE_INDEX_231 = 231, // Water (waves)
|
||||
PALETTE_INDEX_232 = 232, // Water (waves)
|
||||
PALETTE_INDEX_233 = 233, // Water (waves)
|
||||
PALETTE_INDEX_234 = 234, // Water (waves)
|
||||
PALETTE_INDEX_235 = 235, // Water (sparkles)
|
||||
PALETTE_INDEX_236 = 236, // Water (sparkles)
|
||||
PALETTE_INDEX_237 = 237, // Water (sparkles)
|
||||
PALETTE_INDEX_238 = 238, // Water (sparkles)
|
||||
PALETTE_INDEX_239 = 239, // Water (sparkles)
|
||||
PALETTE_INDEX_240 = 240, // Track rails
|
||||
PALETTE_INDEX_241 = 241, // Track rails
|
||||
PALETTE_INDEX_242 = 242, // Track rails
|
||||
PALETTE_INDEX_243 = 243, // Primary remap 0
|
||||
PALETTE_INDEX_244 = 244, // Primary remap 1
|
||||
PALETTE_INDEX_245 = 245, // Primary remap 2
|
||||
PALETTE_INDEX_246 = 246, // Primary remap 3
|
||||
PALETTE_INDEX_247 = 247, // Primary remap 4
|
||||
PALETTE_INDEX_248 = 248, // Primary remap 5
|
||||
PALETTE_INDEX_249 = 249, // Primary remap 6
|
||||
PALETTE_INDEX_250 = 250, // Primary remap 7
|
||||
PALETTE_INDEX_251 = 251, // Primary remap 8
|
||||
PALETTE_INDEX_252 = 252, // Primary remap 9
|
||||
PALETTE_INDEX_253 = 253, // Primary remap 10
|
||||
PALETTE_INDEX_254 = 254, // Primary remap 11
|
||||
pi0 = 0, // Transparent
|
||||
pi10 = 10, // Black (0-dark), Dark grey (0)
|
||||
pi11 = 11, // Black (middark)
|
||||
pi12 = 12, // Black (midlight), Dark grey (1-darkest)
|
||||
pi14 = 14, // Black (lighter), Dark grey (dark)
|
||||
pi13 = 13, //
|
||||
pi16 = 16, //
|
||||
pi17 = 17, // Black (11), Dark grey (light), White (dark)
|
||||
pi20 = 20, // Dark grey (10), White (light)
|
||||
pi21 = 21, // Dark grey (11), White (lighter-11)
|
||||
pi40 = 40, //
|
||||
pi42 = 42, // Light Brown (lighter), Saturated brown (11)
|
||||
pi44 = 44, // Construction marker
|
||||
pi46 = 46, // Tertiary remap 0 / Yellow (darkest)
|
||||
pi47 = 47, // Tertiary remap 1 / Yellow
|
||||
pi48 = 48, // Tertiary remap 2 / Yellow
|
||||
pi49 = 49, // Tertiary remap 3 / Yellow
|
||||
pi50 = 50, // Tertiary remap 4 / Yellow
|
||||
pi51 = 51, // Tertiary remap 5 / Yellow
|
||||
pi52 = 52, // Tertiary remap 6 / Yellow
|
||||
pi53 = 53, // Tertiary remap 7 / Yellow
|
||||
pi54 = 54, // Tertiary remap 8 / Yellow
|
||||
pi55 = 55, // Tertiary remap 9 / Yellow
|
||||
pi56 = 56, // Tertiary remap 10 / Yellow
|
||||
pi57 = 57, // Tertiary remap 11 / Yellow (lightest)
|
||||
pi61 = 61, // Bordeaux Red (darker)
|
||||
pi62 = 62, //
|
||||
pi68 = 68, //
|
||||
pi73 = 73, //
|
||||
pi99 = 99, //
|
||||
pi102 = 102, // Bright green (lighter)
|
||||
pi108 = 108, //
|
||||
pi111 = 111, //
|
||||
pi129 = 129, // Light Purple (11)
|
||||
pi135 = 135, //
|
||||
pi136 = 136, // Dark Blue (10-11), Light Blue (midlight), Icy Blue (darker)
|
||||
pi138 = 138, // Light Blue (lighter), Icy Blue (middark)
|
||||
pi141 = 141, //
|
||||
pi144 = 144, // Dark Green (1-darkest,
|
||||
pi161 = 161, // Bright Purple (light)
|
||||
pi162 = 162, //
|
||||
pi171 = 171, // Saturated Red (lightest) Bright Red (middark)
|
||||
pi172 = 172, // Saturated Red (10-11), Bright Red (midlight)
|
||||
pi173 = 173, // Used to draw intense lines in the Ride Graphs window
|
||||
pi183 = 183, // Used to draw rides in the Map window
|
||||
pi186 = 186, //
|
||||
pi194 = 194, //
|
||||
pi195 = 195, //
|
||||
pi202 = 202, // Secondary remap 0 / Pink (darkest)
|
||||
pi203 = 203, // Secondary remap 1 / Pink
|
||||
pi204 = 204, // Secondary remap 2 / Pink
|
||||
pi205 = 205, // Secondary remap 3 / Pink
|
||||
pi206 = 206, // Secondary remap 4 / Pink
|
||||
pi207 = 207, // Secondary remap 5 / Pink
|
||||
pi208 = 208, // Secondary remap 6 / Pink
|
||||
pi209 = 209, // Secondary remap 7 / Pink
|
||||
pi210 = 210, // Secondary remap 8 / Pink
|
||||
pi211 = 211, // Secondary remap 9 / Pink
|
||||
pi212 = 212, // Secondary remap 10 / Pink
|
||||
pi213 = 213, // Secondary remap 11 / Pink (lightest)
|
||||
pi222 = 222, //
|
||||
pi230 = 230, // Water (waves)
|
||||
pi231 = 231, // Water (waves)
|
||||
pi232 = 232, // Water (waves)
|
||||
pi233 = 233, // Water (waves)
|
||||
pi234 = 234, // Water (waves)
|
||||
pi235 = 235, // Water (sparkles)
|
||||
pi236 = 236, // Water (sparkles)
|
||||
pi237 = 237, // Water (sparkles)
|
||||
pi238 = 238, // Water (sparkles)
|
||||
pi239 = 239, // Water (sparkles)
|
||||
pi240 = 240, // Track rails
|
||||
pi241 = 241, // Track rails
|
||||
pi242 = 242, // Track rails
|
||||
pi243 = 243, // Primary remap 0
|
||||
pi244 = 244, // Primary remap 1
|
||||
pi245 = 245, // Primary remap 2
|
||||
pi246 = 246, // Primary remap 3
|
||||
pi247 = 247, // Primary remap 4
|
||||
pi248 = 248, // Primary remap 5
|
||||
pi249 = 249, // Primary remap 6
|
||||
pi250 = 250, // Primary remap 7
|
||||
pi251 = 251, // Primary remap 8
|
||||
pi252 = 252, // Primary remap 9
|
||||
pi253 = 253, // Primary remap 10
|
||||
pi254 = 254, // Primary remap 11
|
||||
};
|
||||
|
||||
constexpr size_t kPaletteCount = 256;
|
||||
|
||||
constexpr uint8_t kPaletteOffsetDynamic = PALETTE_INDEX_10;
|
||||
constexpr auto kPaletteOffsetDynamic = PaletteIndex::pi10;
|
||||
constexpr uint8_t kPaletteLengthDynamic = 236;
|
||||
|
||||
constexpr uint8_t kPaletteOffsetWaterWaves = PALETTE_INDEX_230;
|
||||
constexpr uint8_t kPaletteOffsetWaterSparkles = PALETTE_INDEX_235;
|
||||
constexpr auto kPaletteOffsetWaterWaves = PaletteIndex::pi230;
|
||||
constexpr auto kPaletteOffsetWaterSparkles = PaletteIndex::pi235;
|
||||
constexpr uint8_t kPaletteLengthWaterWaves = 5;
|
||||
constexpr uint8_t kPaletteLengthWaterSparkles = 5;
|
||||
|
||||
constexpr uint8_t kPaletteOffsetTrackRails = PALETTE_INDEX_240;
|
||||
constexpr auto kPaletteOffsetTrackRails = PaletteIndex::pi240;
|
||||
constexpr uint8_t kPaletteLengthTrackRails = 3;
|
||||
|
||||
constexpr uint8_t kPaletteOffsetRemapPrimary = PALETTE_INDEX_243;
|
||||
constexpr uint8_t kPaletteOffsetRemapSecondary = PALETTE_INDEX_202;
|
||||
constexpr uint8_t kPaletteOffsetRemapTertiary = PALETTE_INDEX_46;
|
||||
constexpr auto kPaletteOffsetRemapPrimary = PaletteIndex::pi243;
|
||||
constexpr auto kPaletteOffsetRemapSecondary = PaletteIndex::pi202;
|
||||
constexpr auto kPaletteOffsetRemapTertiary = PaletteIndex::pi46;
|
||||
constexpr uint8_t kPaletteLengthRemap = 12;
|
||||
|
||||
constexpr uint8_t kPaletteOffsetAnimated = PALETTE_INDEX_230;
|
||||
constexpr auto kPaletteOffsetAnimated = PaletteIndex::pi230;
|
||||
constexpr uint8_t kPaletteLengthAnimated = 16;
|
||||
|
||||
constexpr uint8_t kColourNumOriginal = 32;
|
||||
|
||||
@@ -240,7 +240,7 @@ static DrawPixelInfo CreateDPI(const Viewport& viewport)
|
||||
|
||||
if (viewport.flags & VIEWPORT_FLAG_TRANSPARENT_BACKGROUND)
|
||||
{
|
||||
std::memset(dpi.bits, PALETTE_INDEX_0, static_cast<size_t>(dpi.width) * dpi.height);
|
||||
std::memset(dpi.bits, PaletteIndex::pi0, static_cast<size_t>(dpi.width) * dpi.height);
|
||||
}
|
||||
|
||||
return dpi;
|
||||
|
||||
Reference in New Issue
Block a user