1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 00:34:46 +01:00

Create weak enum for PaletteIndex

This commit is contained in:
Michael Steenbeek
2025-04-09 16:47:22 +02:00
committed by GitHub
parent 6693278b7f
commit cfb4b008b2
16 changed files with 200 additions and 200 deletions

View File

@@ -179,7 +179,7 @@ public:
ConfigureBits(width, height, width);
_drawingContext->Clear(_bitsDPI, PALETTE_INDEX_10);
_drawingContext->Clear(_bitsDPI, PaletteIndex::pi10);
}
void SetPalette(const GamePalette& palette) override

View File

@@ -247,7 +247,7 @@ public:
ConfigureBits(width, height, width);
ConfigureCanvas();
_drawingContext->Resize(width, height);
_drawingContext->Clear(_bitsDPI, PALETTE_INDEX_10);
_drawingContext->Clear(_bitsDPI, PaletteIndex::pi10);
}
void SetPalette(const GamePalette& palette) override

View File

@@ -39,7 +39,7 @@ namespace OpenRCT2::Graph
// Draw Y label tick mark
GfxFillRect(
dpi, { { internalBounds.GetLeft() - 5, curScreenPos + 5 }, { internalBounds.GetLeft(), curScreenPos + 5 } },
PALETTE_INDEX_10);
PaletteIndex::pi10);
// Draw horizontal gridline
GfxFillRectInset(
dpi, { { internalBounds.GetLeft(), curScreenPos + 5 }, { internalBounds.GetRight(), curScreenPos + 5 } },
@@ -69,7 +69,7 @@ namespace OpenRCT2::Graph
{ FontStyle::Small, TextAlignment::CENTRE });
// Draw month tick mark
GfxFillRect(
dpi, { screenCoords - ScreenCoordsXY{ 0, 4 }, screenCoords - ScreenCoordsXY{ 0, 1 } }, PALETTE_INDEX_10);
dpi, { screenCoords - ScreenCoordsXY{ 0, 4 }, screenCoords - ScreenCoordsXY{ 0, 1 } }, PaletteIndex::pi10);
}
yearOver32 = (yearOver32 + 1) % 32;
@@ -94,13 +94,13 @@ namespace OpenRCT2::Graph
{ coords.x, bounds.GetTop() },
{ coords.x, bounds.GetBottom() },
},
kDashLength, PALETTE_INDEX_10);
GfxDrawDashedLine(dpi, { { bounds.GetLeft(), coords.y }, coords }, kDashLength, PALETTE_INDEX_10);
kDashLength, PaletteIndex::pi10);
GfxDrawDashedLine(dpi, { { bounds.GetLeft(), coords.y }, coords }, kDashLength, PaletteIndex::pi10);
DrawText(dpi, coords - ScreenCoordsXY{ 0, 16 }, { textCol, TextAlignment::CENTRE }, text);
GfxFillRect(dpi, { { coords - ScreenCoordsXY{ 2, 2 } }, coords + ScreenCoordsXY{ 2, 2 } }, PALETTE_INDEX_10);
GfxFillRect(dpi, { { coords - ScreenCoordsXY{ 1, 1 } }, { coords + ScreenCoordsXY{ 1, 1 } } }, PALETTE_INDEX_21);
GfxFillRect(dpi, { { coords - ScreenCoordsXY{ 2, 2 } }, coords + ScreenCoordsXY{ 2, 2 } }, PaletteIndex::pi10);
GfxFillRect(dpi, { { coords - ScreenCoordsXY{ 1, 1 } }, { coords + ScreenCoordsXY{ 1, 1 } } }, PaletteIndex::pi21);
}
template<typename T, T TkNoValue, bool TbackgroundLine>
@@ -129,12 +129,12 @@ namespace OpenRCT2::Graph
auto rightBottom1 = coords + ScreenCoordsXY{ 1, 1 };
auto leftTop2 = lastCoords + ScreenCoordsXY{ 0, 1 };
auto rightBottom2 = coords + ScreenCoordsXY{ 0, 1 };
GfxDrawLine(dpi, { leftTop1, rightBottom1 }, PALETTE_INDEX_10);
GfxDrawLine(dpi, { leftTop2, rightBottom2 }, PALETTE_INDEX_10);
GfxDrawLine(dpi, { leftTop1, rightBottom1 }, PaletteIndex::pi10);
GfxDrawLine(dpi, { leftTop2, rightBottom2 }, PaletteIndex::pi10);
}
if (i == 0)
{
GfxFillRect(dpi, { coords, coords + ScreenCoordsXY{ 2, 2 } }, PALETTE_INDEX_10);
GfxFillRect(dpi, { coords, coords + ScreenCoordsXY{ 2, 2 } }, PaletteIndex::pi10);
}
}
else
@@ -143,12 +143,12 @@ namespace OpenRCT2::Graph
{
auto leftTop = lastCoords;
auto rightBottom = coords;
GfxDrawLine(dpi, { leftTop, rightBottom }, PALETTE_INDEX_21);
GfxDrawLine(dpi, { leftTop, rightBottom }, PaletteIndex::pi21);
}
if (i == 0)
{
GfxFillRect(
dpi, { coords - ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 1, 1 } }, PALETTE_INDEX_21);
dpi, { coords - ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 1, 1 } }, PaletteIndex::pi21);
}
}

View File

@@ -471,7 +471,7 @@ namespace OpenRCT2::Ui::Windows
GfxFillRect(
dpi,
{ screenCoords + ScreenCoordsXY{ 10, -2 }, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, -2 } },
PALETTE_INDEX_10);
PaletteIndex::pi10);
screenCoords.x += EXPENDITURE_COLUMN_WIDTH;
}

View File

@@ -52,7 +52,7 @@ namespace OpenRCT2::Ui::Windows
}
static constexpr uint16_t MapColourUnowned(uint16_t colour)
{
return MapColour2((colour & 0xFF00) >> 8, PALETTE_INDEX_10);
return MapColour2((colour & 0xFF00) >> 8, PaletteIndex::pi10);
}
static int32_t getPracticalMapSize()
{
@@ -163,23 +163,23 @@ namespace OpenRCT2::Ui::Windows
};
static constexpr uint16_t RideKeyColours[] = {
MapColour(PALETTE_INDEX_61), // COLOUR_KEY_RIDE
MapColour(PALETTE_INDEX_42), // COLOUR_KEY_FOOD
MapColour(PALETTE_INDEX_20), // COLOUR_KEY_DRINK
MapColour(PALETTE_INDEX_209), // COLOUR_KEY_SOUVENIR
MapColour(PALETTE_INDEX_136), // COLOUR_KEY_KIOSK
MapColour(PALETTE_INDEX_102), // COLOUR_KEY_FIRST_AID
MapColour(PALETTE_INDEX_55), // COLOUR_KEY_CASH_MACHINE
MapColour(PALETTE_INDEX_161), // COLOUR_KEY_TOILETS
MapColour(PaletteIndex::pi61), // COLOUR_KEY_RIDE
MapColour(PaletteIndex::pi42), // COLOUR_KEY_FOOD
MapColour(PaletteIndex::pi20), // COLOUR_KEY_DRINK
MapColour(PaletteIndex::pi209), // COLOUR_KEY_SOUVENIR
MapColour(PaletteIndex::pi136), // COLOUR_KEY_KIOSK
MapColour(PaletteIndex::pi102), // COLOUR_KEY_FIRST_AID
MapColour(PaletteIndex::pi55), // COLOUR_KEY_CASH_MACHINE
MapColour(PaletteIndex::pi161), // COLOUR_KEY_TOILETS
};
static constexpr uint8_t DefaultPeepMapColour = PALETTE_INDEX_20;
static constexpr uint8_t GuestMapColour = PALETTE_INDEX_172;
static constexpr uint8_t GuestMapColourAlternate = PALETTE_INDEX_21;
static constexpr uint8_t StaffMapColour = PALETTE_INDEX_138;
static constexpr uint8_t StaffMapColourAlternate = PALETTE_INDEX_10;
static constexpr uint8_t DefaultPeepMapColour = PaletteIndex::pi20;
static constexpr uint8_t GuestMapColour = PaletteIndex::pi172;
static constexpr uint8_t GuestMapColourAlternate = PaletteIndex::pi21;
static constexpr uint8_t StaffMapColour = PaletteIndex::pi138;
static constexpr uint8_t StaffMapColourAlternate = PaletteIndex::pi10;
static constexpr uint16_t WaterColour = MapColour(PALETTE_INDEX_195);
static constexpr uint16_t WaterColour = MapColour(PaletteIndex::pi195);
static constexpr uint16_t ElementTypeMaskColour[] = {
0xFFFF, // TILE_ELEMENT_TYPE_SURFACE
@@ -193,14 +193,14 @@ namespace OpenRCT2::Ui::Windows
};
static constexpr uint16_t ElementTypeAddColour[] = {
MapColour(PALETTE_INDEX_0), // TILE_ELEMENT_TYPE_SURFACE
MapColour(PALETTE_INDEX_17), // TILE_ELEMENT_TYPE_PATH
MapColour2(PALETTE_INDEX_183, PALETTE_INDEX_0), // TILE_ELEMENT_TYPE_TRACK
MapColour2(PALETTE_INDEX_0, PALETTE_INDEX_99), // TILE_ELEMENT_TYPE_SMALL_SCENERY
MapColour(PALETTE_INDEX_186), // TILE_ELEMENT_TYPE_ENTRANCE
MapColour(PALETTE_INDEX_0), // TILE_ELEMENT_TYPE_WALL
MapColour(PALETTE_INDEX_99), // TILE_ELEMENT_TYPE_LARGE_SCENERY
MapColour(PALETTE_INDEX_0), // TILE_ELEMENT_TYPE_BANNER
MapColour(PaletteIndex::pi0), // TILE_ELEMENT_TYPE_SURFACE
MapColour(PaletteIndex::pi17), // TILE_ELEMENT_TYPE_PATH
MapColour2(PaletteIndex::pi183, PaletteIndex::pi0), // TILE_ELEMENT_TYPE_TRACK
MapColour2(PaletteIndex::pi0, PaletteIndex::pi99), // TILE_ELEMENT_TYPE_SMALL_SCENERY
MapColour(PaletteIndex::pi186), // TILE_ELEMENT_TYPE_ENTRANCE
MapColour(PaletteIndex::pi0), // TILE_ELEMENT_TYPE_WALL
MapColour(PaletteIndex::pi99), // TILE_ELEMENT_TYPE_LARGE_SCENERY
MapColour(PaletteIndex::pi0), // TILE_ELEMENT_TYPE_BANNER
};
namespace MapFlashingFlags
@@ -569,7 +569,7 @@ namespace OpenRCT2::Ui::Windows
void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override
{
GfxClear(dpi, PALETTE_INDEX_10);
GfxClear(dpi, PaletteIndex::pi10);
// Ensure small maps are centred
auto screenOffset = ScreenCoordsXY(0, 0);
@@ -714,7 +714,7 @@ namespace OpenRCT2::Ui::Windows
void InitMap()
{
_mapImageData.resize(getMiniMapWidth() * getMiniMapWidth());
std::fill(_mapImageData.begin(), _mapImageData.end(), PALETTE_INDEX_10);
std::fill(_mapImageData.begin(), _mapImageData.end(), PaletteIndex::pi10);
_currentLine = 0;
}
@@ -856,7 +856,7 @@ namespace OpenRCT2::Ui::Windows
if (surfaceElement == nullptr)
return 0;
uint16_t colour = MapColour(PALETTE_INDEX_0);
uint16_t colour = MapColour(PaletteIndex::pi0);
const auto* surfaceObject = surfaceElement->GetSurfaceObject();
if (surfaceObject != nullptr)
colour = MapColour2(surfaceObject->MapColours[0], surfaceObject->MapColours[1]);
@@ -873,7 +873,7 @@ namespace OpenRCT2::Ui::Windows
{
if (tileElement->IsGhost())
{
colour = MapColour(PALETTE_INDEX_21);
colour = MapColour(PaletteIndex::pi21);
break;
}
@@ -891,8 +891,8 @@ namespace OpenRCT2::Ui::Windows
uint16_t GetPixelColourRide(const CoordsXY& c)
{
uint16_t colourA = 0; // highlight colour
uint16_t colourB = MapColour(PALETTE_INDEX_13); // surface colour (dark grey)
uint16_t colourA = 0; // highlight colour
uint16_t colourB = MapColour(PaletteIndex::pi13); // surface colour (dark grey)
// as an improvement we could use first_element to show underground stuff?
TileElement* tileElement = reinterpret_cast<TileElement*>(MapGetSurfaceElementAt(c));
@@ -903,7 +903,7 @@ namespace OpenRCT2::Ui::Windows
if (tileElement->IsGhost())
{
colourA = MapColour(PALETTE_INDEX_21);
colourA = MapColour(PaletteIndex::pi21);
break;
}
@@ -912,12 +912,12 @@ namespace OpenRCT2::Ui::Windows
case TileElementType::Surface:
if (tileElement->AsSurface()->GetWaterHeight() > 0)
// Why is this a different water colour as above (195)?
colourB = MapColour(PALETTE_INDEX_194);
colourB = MapColour(PaletteIndex::pi194);
if (!(tileElement->AsSurface()->GetOwnership() & OWNERSHIP_OWNED))
colourB = MapColourUnowned(colourB);
break;
case TileElementType::Path:
colourA = MapColour(PALETTE_INDEX_14); // lighter grey
colourA = MapColour(PaletteIndex::pi14); // lighter grey
break;
case TileElementType::Entrance:
{
@@ -1025,7 +1025,7 @@ namespace OpenRCT2::Ui::Windows
auto mapCoord = TransformToMapCoords({ vehicle->x, vehicle->y });
auto pixelCoord = ScreenCoordsXY{ mapCoord.x, mapCoord.y } + offset;
GfxFillRect(dpi, { pixelCoord, pixelCoord }, PALETTE_INDEX_171);
GfxFillRect(dpi, { pixelCoord, pixelCoord }, PaletteIndex::pi171);
}
}
}
@@ -1056,20 +1056,20 @@ namespace OpenRCT2::Ui::Windows
auto leftBottom = ScreenCoordsXY{ leftTop.x, rightBottom.y };
// top horizontal lines
GfxFillRect(dpi, { leftTop, leftTop + ScreenCoordsXY{ 3, 0 } }, PALETTE_INDEX_56);
GfxFillRect(dpi, { rightTop - ScreenCoordsXY{ 3, 0 }, rightTop }, PALETTE_INDEX_56);
GfxFillRect(dpi, { leftTop, leftTop + ScreenCoordsXY{ 3, 0 } }, PaletteIndex::pi56);
GfxFillRect(dpi, { rightTop - ScreenCoordsXY{ 3, 0 }, rightTop }, PaletteIndex::pi56);
// left vertical lines
GfxFillRect(dpi, { leftTop, leftTop + ScreenCoordsXY{ 0, 3 } }, PALETTE_INDEX_56);
GfxFillRect(dpi, { leftBottom - ScreenCoordsXY{ 0, 3 }, leftBottom }, PALETTE_INDEX_56);
GfxFillRect(dpi, { leftTop, leftTop + ScreenCoordsXY{ 0, 3 } }, PaletteIndex::pi56);
GfxFillRect(dpi, { leftBottom - ScreenCoordsXY{ 0, 3 }, leftBottom }, PaletteIndex::pi56);
// bottom horizontal lines
GfxFillRect(dpi, { leftBottom, leftBottom + ScreenCoordsXY{ 3, 0 } }, PALETTE_INDEX_56);
GfxFillRect(dpi, { rightBottom - ScreenCoordsXY{ 3, 0 }, rightBottom }, PALETTE_INDEX_56);
GfxFillRect(dpi, { leftBottom, leftBottom + ScreenCoordsXY{ 3, 0 } }, PaletteIndex::pi56);
GfxFillRect(dpi, { rightBottom - ScreenCoordsXY{ 3, 0 }, rightBottom }, PaletteIndex::pi56);
// right vertical lines
GfxFillRect(dpi, { rightTop, rightTop + ScreenCoordsXY{ 0, 3 } }, PALETTE_INDEX_56);
GfxFillRect(dpi, { rightBottom - ScreenCoordsXY{ 0, 3 }, rightBottom }, PALETTE_INDEX_56);
GfxFillRect(dpi, { rightTop, rightTop + ScreenCoordsXY{ 0, 3 } }, PaletteIndex::pi56);
GfxFillRect(dpi, { rightBottom - ScreenCoordsXY{ 0, 3 }, rightBottom }, PaletteIndex::pi56);
}
void DrawTabImages(DrawPixelInfo& dpi)

View File

@@ -2967,7 +2967,7 @@ namespace OpenRCT2::Ui::Windows
const auto* rideEntry = ride->getRideEntry();
// Background
GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } }, PALETTE_INDEX_12);
GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } }, PaletteIndex::pi12);
Widget* widget = &widgets[WIDX_VEHICLE_TRAINS_PREVIEW];
int32_t startX = std::max(2, (widget->width() - ((ride->numTrains - 1) * 36)) / 2 - 25);
@@ -4840,7 +4840,7 @@ namespace OpenRCT2::Ui::Windows
dpi,
{ { windowPos + ScreenCoordsXY{ trackPreviewWidget.left + 1, trackPreviewWidget.top + 1 } },
{ windowPos + ScreenCoordsXY{ trackPreviewWidget.right - 1, trackPreviewWidget.bottom - 1 } } },
PALETTE_INDEX_12);
PaletteIndex::pi12);
auto trackColour = ride->trackColours[_rideColour];
@@ -4913,7 +4913,7 @@ namespace OpenRCT2::Ui::Windows
windowPos + ScreenCoordsXY{ entrancePreviewWidget.left + 1, entrancePreviewWidget.top + 1 },
entrancePreviewWidget.width(), entrancePreviewWidget.height()))
{
GfxClear(clippedDpi, PALETTE_INDEX_12);
GfxClear(clippedDpi, PaletteIndex::pi12);
auto stationObj = ride->getStationObject();
if (stationObj != nullptr && stationObj->BaseImageId != kImageIndexUndefined)
@@ -4953,7 +4953,7 @@ namespace OpenRCT2::Ui::Windows
auto vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex);
// Background colour
GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, PALETTE_INDEX_12);
GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width - 1, dpi.y + dpi.height - 1 } }, PaletteIndex::pi12);
// ?
auto screenCoords = ScreenCoordsXY{ vehiclePreviewWidget->width() / 2, vehiclePreviewWidget->height() - 15 };
@@ -6214,12 +6214,13 @@ namespace OpenRCT2::Ui::Windows
// Draw the current line in grey.
GfxFillRect(
dpi, { { x, firstPoint }, { x, secondPoint } }, previousMeasurement ? PALETTE_INDEX_17 : PALETTE_INDEX_21);
dpi, { { x, firstPoint }, { x, secondPoint } },
previousMeasurement ? PaletteIndex::pi17 : PaletteIndex::pi21);
// Draw red over extreme values (if supported by graph type).
if (listType == GRAPH_VERTICAL || listType == GRAPH_LATERAL)
{
const auto redLineColour = previousMeasurement ? PALETTE_INDEX_171 : PALETTE_INDEX_173;
const auto redLineColour = previousMeasurement ? PaletteIndex::pi171 : PaletteIndex::pi173;
// Line exceeds negative threshold (at bottom of graph).
if (secondPoint >= intensityThresholdNegative)

View File

@@ -48,10 +48,10 @@ namespace OpenRCT2::Ui::Windows
constexpr int16_t TRACK_MINI_PREVIEW_HEIGHT = 78;
constexpr uint16_t TRACK_MINI_PREVIEW_SIZE = TRACK_MINI_PREVIEW_WIDTH * TRACK_MINI_PREVIEW_HEIGHT;
static constexpr uint8_t kPaletteIndexColourEntrance = PALETTE_INDEX_20; // White
static constexpr uint8_t kPaletteIndexColourExit = PALETTE_INDEX_10; // Black
static constexpr uint8_t kPaletteIndexColourTrack = PALETTE_INDEX_248; // Grey (dark)
static constexpr uint8_t kPaletteIndexColourStation = PALETTE_INDEX_252; // Grey (light)
static constexpr uint8_t kPaletteIndexColourEntrance = PaletteIndex::pi20; // White
static constexpr uint8_t kPaletteIndexColourExit = PaletteIndex::pi10; // Black
static constexpr uint8_t kPaletteIndexColourTrack = PaletteIndex::pi248; // Grey (dark)
static constexpr uint8_t kPaletteIndexColourStation = PaletteIndex::pi252; // Grey (light)
enum
{
@@ -430,7 +430,7 @@ namespace OpenRCT2::Ui::Windows
void ClearMiniPreview()
{
// Fill with transparent colour.
std::fill(_miniPreview.begin(), _miniPreview.end(), PALETTE_INDEX_0);
std::fill(_miniPreview.begin(), _miniPreview.end(), PaletteIndex::pi0);
}
private:

View File

@@ -1081,7 +1081,7 @@ void UpdatePaletteEffects()
int32_t n = 3;
for (int32_t i = 0; i < n; i++)
{
auto& vd = gGamePalette[PALETTE_INDEX_243 + i];
auto& vd = gGamePalette[PaletteIndex::pi243 + i];
vd.Blue = vs[0];
vd.Green = vs[1];
vd.Red = vs[2];
@@ -1124,14 +1124,14 @@ void DebugDPI(DrawPixelInfo& dpi)
ScreenCoordsXY topRight = { dpi.x + dpi.width - 1, dpi.y };
ScreenCoordsXY bottomLeft = { dpi.x, dpi.y + dpi.height - 1 };
GfxDrawLine(dpi, { topLeft, bottomRight }, PALETTE_INDEX_136);
GfxDrawLine(dpi, { bottomLeft, topRight }, PALETTE_INDEX_136);
GfxDrawLine(dpi, { topLeft, topRight }, PALETTE_INDEX_129);
GfxDrawLine(dpi, { topRight, bottomRight }, PALETTE_INDEX_129);
GfxDrawLine(dpi, { bottomLeft, bottomRight }, PALETTE_INDEX_129);
GfxDrawLine(dpi, { topLeft, bottomLeft }, PALETTE_INDEX_129);
GfxDrawLine(dpi, { topLeft, bottomRight }, PaletteIndex::pi136);
GfxDrawLine(dpi, { bottomLeft, topRight }, PaletteIndex::pi136);
GfxDrawLine(dpi, { topLeft, topRight }, PaletteIndex::pi129);
GfxDrawLine(dpi, { topRight, bottomRight }, PaletteIndex::pi129);
GfxDrawLine(dpi, { bottomLeft, bottomRight }, PaletteIndex::pi129);
GfxDrawLine(dpi, { topLeft, bottomLeft }, PaletteIndex::pi129);
GfxDrawLine(dpi, { topLeft, topLeft + ScreenCoordsXY{ 4, 0 } }, PALETTE_INDEX_136);
GfxDrawLine(dpi, { topLeft, topLeft + ScreenCoordsXY{ 4, 0 } }, PaletteIndex::pi136);
const auto str = std::to_string(dpi.x);
DrawText(dpi, ScreenCoordsXY{ dpi.x, dpi.y }, { COLOUR_WHITE, FontStyle::Tiny }, str.c_str());

View File

@@ -139,7 +139,7 @@ void X8DrawingEngine::Resize(uint32_t width, uint32_t height)
{
uint32_t pitch = width;
ConfigureBits(width, height, pitch);
_drawingContext->Clear(_bitsDPI, PALETTE_INDEX_10);
_drawingContext->Clear(_bitsDPI, PaletteIndex::pi10);
}
void X8DrawingEngine::SetPalette([[maybe_unused]] const GamePalette& palette)

View File

@@ -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);
}
}
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -100,7 +100,7 @@ void TerrainSurfaceObject::ReadJson(IReadObjectContext* context, json_t& root)
if (mapColoursAreValid)
MapColours[i] = mapColours[i];
else
MapColours[i] = PALETTE_INDEX_0;
MapColours[i] = PaletteIndex::pi0;
}
for (auto& el : properties["special"])

View File

@@ -55,7 +55,7 @@ namespace OpenRCT2
static PaletteIndex getPreviewColourByTilePos(const TileCoordsXY& pos)
{
PaletteIndex paletteIndex = PALETTE_INDEX_0;
PaletteIndex paletteIndex = PaletteIndex::pi0;
auto tileElement = MapGetFirstElementAt(pos);
if (tileElement == nullptr)
@@ -72,13 +72,13 @@ namespace OpenRCT2
auto* surfaceElement = tileElement->AsSurface();
if (surfaceElement == nullptr)
{
surfaceColour = paletteIndex = PALETTE_INDEX_0;
surfaceColour = paletteIndex = PaletteIndex::pi0;
break;
}
if (surfaceElement->GetWaterHeight() > 0)
{
surfaceColour = paletteIndex = PALETTE_INDEX_195;
surfaceColour = paletteIndex = PaletteIndex::pi195;
}
else
{
@@ -94,20 +94,20 @@ namespace OpenRCT2
}
case TileElementType::Path:
paletteIndex = PALETTE_INDEX_17;
paletteIndex = PaletteIndex::pi17;
break;
case TileElementType::Track:
paletteIndex = PALETTE_INDEX_183;
paletteIndex = PaletteIndex::pi183;
break;
case TileElementType::SmallScenery:
case TileElementType::LargeScenery:
paletteIndex = PALETTE_INDEX_99; // 64
paletteIndex = PaletteIndex::pi99;
break;
case TileElementType::Entrance:
paletteIndex = PALETTE_INDEX_186;
paletteIndex = PaletteIndex::pi186;
break;
default:
@@ -116,10 +116,10 @@ namespace OpenRCT2
} while (!(tileElement++)->IsLastForTile());
// Darken every other tile that's outside of the park, unless it's a path
if (isOutsidePark && _tileColourIndex == 1 && paletteIndex != PALETTE_INDEX_17)
paletteIndex = PALETTE_INDEX_10;
if (isOutsidePark && _tileColourIndex == 1 && paletteIndex != PaletteIndex::pi17)
paletteIndex = PaletteIndex::pi10;
// For rides, every other tile should use the surface colour
else if (_tileColourIndex == 1 && paletteIndex == PALETTE_INDEX_183)
else if (_tileColourIndex == 1 && paletteIndex == PaletteIndex::pi183)
paletteIndex = surfaceColour;
_tileColourIndex = (_tileColourIndex + 1) % 2;

View File

@@ -22,9 +22,9 @@ using OpenRCT2::Audio::SoundId;
namespace OpenRCT2
{
static constexpr PaletteIndex kBackgroundColourDark = PALETTE_INDEX_10;
static constexpr PaletteIndex kBackgroundColourLogo = PALETTE_INDEX_245;
static constexpr PaletteIndex kBorderColourPublisher = PALETTE_INDEX_129;
static constexpr PaletteIndex kBackgroundColourDark = PaletteIndex::pi10;
static constexpr PaletteIndex kBackgroundColourLogo = PaletteIndex::pi245;
static constexpr PaletteIndex kBorderColourPublisher = PaletteIndex::pi129;
constexpr int32_t PALETTE_G1_IDX_DEVELOPER = 23217;
constexpr int32_t PALETTE_G1_IDX_LOGO = 23224;