Change colour to a strong enum (#25873)

This commit is contained in:
Michael Steenbeek authored and GitHub committed 2026-01-28 10:06:45 +01:00
1 parent bc0f2e8539
commit 343c7a70d7
266 files changed
+1843 -1799

No files matched your search

+1
View File
@@ -14,6 +14,7 @@
- Fix: [#25850] Guests do not have their happiness penalised by low energy, low hunger, low thirst, high toilet. Ride nausea generation different compared to vanilla.
- Fix: [#25854] When a guest is at 0 happiness or energy, the game draws too big of a bar in the guest stats window.
- Fix: [#25862] Diagonal and inclined brakes are not counted when calculating upkeep cost.
- Fix: [#25873] Repainting a banner in OpenRCT2-specific colours results in an error message.
0.4.30 (2026-01-04)
------------------------------------------------------------------------
@@ -16,7 +16,6 @@
#include <openrct2/core/EnumUtils.hpp>
#include <openrct2/drawing/BlendColourMap.h>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/world/Location.hpp>
#include <stdexcept>
#include <vector>
+2 -2
View File
@@ -60,10 +60,10 @@ namespace OpenRCT2::Ui::Windows
int32_t DropdownIndexFromPoint(const ScreenCoordsXY& loc, WindowBase* w);
void WindowDropdownShowColour(
WindowBase* w, Widget* widget, ColourWithFlags dropdownColour, colour_t selectedColour,
WindowBase* w, Widget* widget, ColourWithFlags dropdownColour, Drawing::Colour selectedColour,
bool alwaysHideSpecialColours = false);
colour_t ColourDropDownIndexToColour(uint8_t ddidx);
Drawing::Colour ColourDropDownIndexToColour(uint8_t ddidx);
uint32_t DropdownGetAppropriateImageDropdownItemsPerRow(uint32_t numItems);
} // namespace OpenRCT2::Ui::Windows
+5 -6
View File
@@ -22,7 +22,6 @@
#include <openrct2/drawing/ColourMap.h>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/drawing/Rectangle.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/interface/ColourWithFlags.h>
#include <openrct2/interface/Viewport.h>
#include <openrct2/interface/Window.h>
@@ -341,10 +340,10 @@ void InGameConsole::Draw(RenderTarget& rt) const
{
// This is something of a hack to ensure the text is actually black
// as opposed to a desaturated grey
if (textColour.colour == COLOUR_BLACK)
if (textColour.colour == OpenRCT2::Drawing::Colour::black)
{
DrawText(rt, screenCoords, { textColour, style }, "{BLACK}");
DrawText(rt, screenCoords, { COLOUR_NULL, style }, _consoleLines[index].first.c_str(), true);
DrawText(rt, screenCoords, { OpenRCT2::Drawing::kColourNull, style }, _consoleLines[index].first.c_str(), true);
}
else
{
@@ -355,7 +354,7 @@ void InGameConsole::Draw(RenderTarget& rt) const
{
std::string lineColour = FormatTokenToStringWithBraces(_consoleLines[index].second);
DrawText(rt, screenCoords, { textColour, style }, lineColour.c_str());
DrawText(rt, screenCoords, { COLOUR_NULL, style }, _consoleLines[index].first.c_str(), true);
DrawText(rt, screenCoords, { OpenRCT2::Drawing::kColourNull, style }, _consoleLines[index].first.c_str(), true);
}
screenCoords.y += lineHeight;
@@ -364,10 +363,10 @@ void InGameConsole::Draw(RenderTarget& rt) const
screenCoords.y = _consoleBottomRight.y - lineHeight - kConsoleEdgePadding - 1;
// Draw current line
if (textColour.colour == COLOUR_BLACK)
if (textColour.colour == OpenRCT2::Drawing::Colour::black)
{
DrawText(rt, screenCoords, { textColour, style }, "{BLACK}");
DrawText(rt, screenCoords, { COLOUR_NULL, style }, _consoleCurrentLine.c_str(), true);
DrawText(rt, screenCoords, { OpenRCT2::Drawing::kColourNull, style }, _consoleCurrentLine.c_str(), true);
}
else
{
+1 -1
View File
@@ -64,7 +64,7 @@ void LandTool::ShowSurfaceStyleDropdown(WindowBase* w, Widget* widget, ObjectEnt
if (surfaceObj != nullptr && !surfaceObj->UsesFallbackImages())
{
auto imageId = ImageId(surfaceObj->IconImageId);
if (surfaceObj->Colour != TerrainSurfaceObject::kNoValue)
if (surfaceObj->Colour != Drawing::kColourNull)
imageId = imageId.WithPrimary(surfaceObj->Colour);
gDropdown.items[itemIndex] = Dropdown::ImageItem(imageId, surfaceObj->NameStringId);
+94 -95
View File
@@ -26,7 +26,6 @@
#include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/interface/ColourWithFlags.h>
#include <openrct2/localisation/Language.h>
#include <openrct2/localisation/StringIds.h>
@@ -146,11 +145,11 @@ namespace OpenRCT2::Ui
// clang-format off
static constexpr ColourWithFlags opaque(colour_t colour)
static constexpr ColourWithFlags opaque(Drawing::Colour colour)
{
return ColourWithFlags{ colour };
}
static constexpr ColourWithFlags translucent(colour_t colour)
static constexpr ColourWithFlags translucent(Drawing::Colour colour)
{
return ColourWithFlags{ colour, { ColourFlag::translucent } };
}
@@ -158,73 +157,73 @@ namespace OpenRCT2::Ui
static constexpr WindowThemeDesc kWindowThemeDescriptors[] =
{
// WindowClass WindowClassSZ WindowName windowColours
{ WindowClass::topToolbar, "WC_TOP_TOOLBAR", STR_THEMES_WINDOW_TOP_TOOLBAR, { opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_DARK_GREEN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_GREY) } },
{ WindowClass::bottomToolbar, "WC_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR, { translucent(COLOUR_DARK_GREEN), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BRIGHT_GREEN) } },
{ WindowClass::ride, "WC_RIDE", STR_THEMES_WINDOW_RIDE, { opaque(COLOUR_GREY), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_SATURATED_GREEN) } },
{ WindowClass::rideConstruction, "WC_RIDE_CONSTRUCTION", STR_THEMES_WINDOW_RIDE_CONSTRUCTION, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN) } },
{ WindowClass::rideList, "WC_RIDE_LIST", STR_THEMES_WINDOW_RIDE_LIST, { opaque(COLOUR_GREY), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED) } },
{ WindowClass::savePrompt, "WC_SAVE_PROMPT", STR_THEMES_WINDOW_SAVE_PROMPT, { translucent(COLOUR_BORDEAUX_RED) } },
{ WindowClass::constructRide, "WC_CONSTRUCT_RIDE", STR_THEMES_WINDOW_CONSTRUCT_RIDE, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED) } },
{ WindowClass::demolishRidePrompt, "WC_DEMOLISH_RIDE_PROMPT", STR_THEMES_WINDOW_DEMOLISH_RIDE_PROMPT, { translucent(COLOUR_BORDEAUX_RED) } },
{ WindowClass::error, "WC_ERROR", STR_THEMES_WINDOW_ERROR, { translucent(COLOUR_BORDEAUX_RED) } },
{ WindowClass::scenery, "WC_SCENERY", STR_THEMES_WINDOW_SCENERY, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_GREEN), opaque(COLOUR_DARK_GREEN) } },
{ WindowClass::sceneryScatter, "WC_SCENERY_SCATTER", STR_THEMES_WINDOW_SCENERY_SCATTER, { opaque(COLOUR_DARK_GREEN), opaque(COLOUR_DARK_GREEN) } },
{ WindowClass::options, "WC_OPTIONS", STR_THEMES_WINDOW_OPTIONS, { opaque(COLOUR_GREY), opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE) } },
{ WindowClass::assetPacks, "WC_ASSET_PACKS", STR_ASSET_PACKS, { opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE) } },
{ WindowClass::footpath, "WC_FOOTPATH", STR_THEMES_WINDOW_FOOTPATH, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN) } },
{ WindowClass::land, "WC_LAND", STR_THEMES_WINDOW_LAND, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN) } },
{ WindowClass::water, "WC_WATER", STR_THEMES_WINDOW_WATER, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN) } },
{ WindowClass::peep, "WC_PEEP", STR_THEMES_WINDOW_PEEP, { opaque(COLOUR_GREY), opaque(COLOUR_OLIVE_GREEN), opaque(COLOUR_OLIVE_GREEN) } },
{ WindowClass::guestList, "WC_GUEST_LIST", STR_THEMES_WINDOW_GUEST_LIST, { opaque(COLOUR_GREY), opaque(COLOUR_OLIVE_GREEN), opaque(COLOUR_OLIVE_GREEN) } },
{ WindowClass::staffList, "WC_STAFF_LIST", STR_THEMES_WINDOW_STAFF_LIST, { opaque(COLOUR_GREY), opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_LIGHT_PURPLE) } },
{ WindowClass::firePrompt, "WC_FIRE_PROMPT", STR_THEMES_WINDOW_FIRE_PROMPT, { translucent(COLOUR_BORDEAUX_RED) } },
{ WindowClass::parkInformation, "WC_PARK_INFORMATION", STR_THEMES_WINDOW_PARK_INFORMATION, { opaque(COLOUR_GREY), opaque(COLOUR_DARK_YELLOW), opaque(COLOUR_DARK_YELLOW) } },
{ WindowClass::finances, "WC_FINANCES", STR_THEMES_WINDOW_FINANCES, { opaque(COLOUR_GREY), opaque(COLOUR_DARK_YELLOW), opaque(COLOUR_DARK_YELLOW) } },
{ WindowClass::titleMenu, "WC_TITLE_MENU", STR_THEMES_WINDOW_TITLE_MENU_BUTTONS, { translucent(COLOUR_DARK_GREEN), translucent(COLOUR_DARK_GREEN), translucent(COLOUR_DARK_GREEN) } },
{ WindowClass::titleExit, "WC_TITLE_EXIT", STR_THEMES_WINDOW_TITLE_MENU_EXIT, { translucent(COLOUR_DARK_GREEN), translucent(COLOUR_DARK_GREEN), translucent(COLOUR_DARK_GREEN) } },
{ WindowClass::recentNews, "WC_RECENT_NEWS", STR_THEMES_WINDOW_RECENT_NEWS, { opaque(COLOUR_DARK_GREEN), opaque(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::scenarioSelect, "WC_SCENARIO_SELECT", STR_THEMES_WINDOW_TITLE_MENU_SCENARIO_SELECTION, { opaque(COLOUR_GREY), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED) } },
{ WindowClass::trackDesignList, "WC_TRACK_DESIGN_LIST", STR_THEMES_WINDOW_TRACK_DESIGN_LIST, { opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED) } },
{ WindowClass::trackDesignPlace, "WC_TRACK_DESIGN_PLACE", STR_THEMES_WINDOW_TRACK_DESIGN_PLACE, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN) } },
{ WindowClass::newCampaign, "WC_NEW_CAMPAIGN", STR_THEMES_WINDOW_NEW_CAMPAIGN, { opaque(COLOUR_DARK_YELLOW), opaque(COLOUR_DARK_YELLOW), opaque(COLOUR_DARK_YELLOW) } },
{ WindowClass::keyboardShortcutList, "WC_KEYBOARD_SHORTCUT_LIST", STR_THEMES_WINDOW_KEYBOARD_SHORTCUT_LIST, { opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE) } },
{ WindowClass::changeKeyboardShortcut, "WC_CHANGE_KEYBOARD_SHORTCUT", STR_THEMES_WINDOW_CHANGE_KEYBOARD_SHORTCUT, { opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE) } },
{ WindowClass::resetShortcutKeysPrompt, "WC_RESET_SHORTCUT_KEYS_PROMPT", STR_SHORTCUT_ACTION_RESET, { translucent(COLOUR_BORDEAUX_RED) } },
{ WindowClass::map, "WC_MAP", STR_THEMES_WINDOW_MAP, { opaque(COLOUR_DARK_GREEN), opaque(COLOUR_DARK_BROWN) } },
{ WindowClass::banner, "WC_BANNER", STR_THEMES_WINDOW_BANNER, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN) } },
{ WindowClass::editorObjectSelection, "WC_EDITOR_OBJECT_SELECTION", STR_THEMES_WINDOW_EDITOR_OBJECT_SELECTION, { opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_GREY), opaque(COLOUR_GREY) } },
{ WindowClass::editorInventionList, "WC_EDITOR_INVENTION_LIST", STR_THEMES_WINDOW_EDITOR_INVENTION_LIST, { opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_GREY), opaque(COLOUR_GREY) } },
{ WindowClass::editorScenarioOptions, "WC_EDITOR_SCENARIO_OPTIONS", STR_THEMES_WINDOW_EDITOR_SCENARIO_OPTIONS, { opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_GREY), opaque(COLOUR_GREY) } },
{ WindowClass::manageTrackDesign, "WC_MANAGE_TRACK_DESIGN", STR_THEMES_WINDOW_MANAGE_TRACK_DESIGN, { opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_GREY) } },
{ WindowClass::trackDeletePrompt, "WC_TRACK_DELETE_PROMPT", STR_THEMES_WINDOW_TRACK_DELETE_PROMPT, { opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED) } },
{ WindowClass::installTrack, "WC_INSTALL_TRACK", STR_THEMES_WINDOW_INSTALL_TRACK, { opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED) } },
{ WindowClass::clearScenery, "WC_CLEAR_SCENERY", STR_THEMES_WINDOW_CLEAR_SCENERY, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN) } },
{ WindowClass::cheats, "WC_CHEATS", STR_CHEAT_TITLE, { opaque(COLOUR_GREY), opaque(COLOUR_DARK_YELLOW) } },
{ WindowClass::research, "WC_RESEARCH", STR_THEMES_WINDOW_RESEARCH, { opaque(COLOUR_GREY), opaque(COLOUR_DARK_YELLOW), opaque(COLOUR_DARK_YELLOW) } },
{ WindowClass::viewport, "WC_VIEWPORT", STR_THEMES_WINDOW_VIEWPORT, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN) } },
{ WindowClass::mapgen, "WC_MAPGEN", STR_THEMES_WINDOW_MAPGEN, { opaque(COLOUR_DARK_GREEN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN) } },
{ WindowClass::loadsave, "WC_LOADSAVE", STR_THEMES_WINDOW_LOADSAVE, { opaque(COLOUR_DARK_GREEN), opaque(COLOUR_DARK_GREEN), opaque(COLOUR_DARK_GREEN) } },
{ WindowClass::loadsaveOverwritePrompt, "WC_LOADSAVE_OVERWRITE_PROMPT", STR_THEMES_WINDOW_LOADSAVE_OVERWRITE_PROMPT, { translucent(COLOUR_BORDEAUX_RED) } },
{ WindowClass::titleOptions, "WC_TITLE_OPTIONS", STR_THEMES_WINDOW_TITLE_MENU_OPTIONS, { translucent(COLOUR_DARK_GREEN), translucent(COLOUR_DARK_GREEN), translucent(COLOUR_DARK_GREEN) } },
{ WindowClass::landRights, "WC_LAND_RIGHTS", STR_THEMES_WINDOW_LAND_RIGHTS, { opaque(COLOUR_DARK_YELLOW), opaque(COLOUR_DARK_YELLOW), opaque(COLOUR_DARK_YELLOW) } },
{ WindowClass::themes, "WC_THEMES", STR_THEMES_WINDOW_THEMES, { opaque(COLOUR_GREY), opaque(COLOUR_DARK_GREEN), opaque(COLOUR_DARK_GREEN) } },
{ WindowClass::staff, "WC_STAFF", STR_THEMES_WINDOW_STAFF, { opaque(COLOUR_GREY), opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_LIGHT_PURPLE) } },
{ WindowClass::editorTrackBottomToolbar, "WC_EDITOR_TRACK_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR_TRACK_EDITOR, { translucent(COLOUR_LIGHT_BLUE), translucent(COLOUR_LIGHT_BLUE), translucent(COLOUR_LIGHT_BLUE) } },
{ WindowClass::editorScenarioBottomToolbar, "WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR_SCENARIO_EDITOR, { translucent(COLOUR_LIGHT_BROWN), translucent(COLOUR_LIGHT_BROWN), translucent(COLOUR_MOSS_GREEN) } },
{ WindowClass::tileInspector, "WC_TILE_INSPECTOR", STR_TILE_INSPECTOR_TITLE, { opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE) } },
{ WindowClass::viewClipping, "WC_VIEW_CLIPPING", STR_VIEW_CLIPPING_TITLE, { opaque(COLOUR_DARK_GREEN) } },
{ WindowClass::patrolArea, "WC_PATROL_AREA", STR_SET_PATROL_AREA, { opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_LIGHT_PURPLE) } },
{ WindowClass::transparency, "WC_TRANSPARENCY", STR_TRANSPARENCY_OPTIONS_TITLE, { opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE) } },
{ WindowClass::about, "WC_ABOUT", STR_ABOUT, { opaque(COLOUR_GREY), opaque(COLOUR_LIGHT_BLUE) } },
{ WindowClass::changelog, "WC_CHANGELOG", STR_CHANGELOG_TITLE, { opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE) } },
{ WindowClass::multiplayer, "WC_MULTIPLAYER", STR_MULTIPLAYER, { opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE) } },
{ WindowClass::player, "WC_PLAYER", STR_THEMES_WINDOW_PLAYER, { opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE) } },
{ WindowClass::networkStatus, "WC_NETWORK_STATUS", STR_THEMES_WINDOW_NETWORK_STATUS, { opaque(COLOUR_BLACK) } },
{ WindowClass::serverList, "WC_SERVER_LIST", STR_SERVER_LIST, { opaque(COLOUR_LIGHT_BLUE), opaque(COLOUR_LIGHT_BLUE) } },
{ WindowClass::chat, "WC_CHAT", STR_CHAT, { translucent(COLOUR_GREY) } },
{ WindowClass::console, "WC_CONSOLE", STR_CONSOLE, { translucent(COLOUR_LIGHT_BLUE), opaque(COLOUR_WHITE) } },
{ WindowClass::progressWindow, "WC_PROGRESS_WINDOW", STR_THEME_LOADING_WINDOW, { opaque(COLOUR_BLACK) } },
{ WindowClass::editorParkEntrance, "WC_EDITOR_PARK_ENTRANCE", STR_OBJECT_SELECTION_PARK_ENTRANCE, { opaque(COLOUR_DARK_GREEN), opaque(COLOUR_DARK_BROWN) } },
{ WindowClass::topToolbar, "WC_TOP_TOOLBAR", STR_THEMES_WINDOW_TOP_TOOLBAR, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::grey) } },
{ WindowClass::bottomToolbar, "WC_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR, { translucent(Drawing::Colour::darkGreen), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::brightGreen) } },
{ WindowClass::ride, "WC_RIDE", STR_THEMES_WINDOW_RIDE, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::saturatedGreen) } },
{ WindowClass::rideConstruction, "WC_RIDE_CONSTRUCTION", STR_THEMES_WINDOW_RIDE_CONSTRUCTION, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown) } },
{ WindowClass::rideList, "WC_RIDE_LIST", STR_THEMES_WINDOW_RIDE_LIST, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::bordeauxRed) } },
{ WindowClass::savePrompt, "WC_SAVE_PROMPT", STR_THEMES_WINDOW_SAVE_PROMPT, { translucent(Drawing::Colour::bordeauxRed) } },
{ WindowClass::constructRide, "WC_CONSTRUCT_RIDE", STR_THEMES_WINDOW_CONSTRUCT_RIDE, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::bordeauxRed) } },
{ WindowClass::demolishRidePrompt, "WC_DEMOLISH_RIDE_PROMPT", STR_THEMES_WINDOW_DEMOLISH_RIDE_PROMPT, { translucent(Drawing::Colour::bordeauxRed) } },
{ WindowClass::error, "WC_ERROR", STR_THEMES_WINDOW_ERROR, { translucent(Drawing::Colour::bordeauxRed) } },
{ WindowClass::scenery, "WC_SCENERY", STR_THEMES_WINDOW_SCENERY, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::darkGreen) } },
{ WindowClass::sceneryScatter, "WC_SCENERY_SCATTER", STR_THEMES_WINDOW_SCENERY_SCATTER, { opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::darkGreen) } },
{ WindowClass::options, "WC_OPTIONS", STR_THEMES_WINDOW_OPTIONS, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::assetPacks, "WC_ASSET_PACKS", STR_ASSET_PACKS, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::footpath, "WC_FOOTPATH", STR_THEMES_WINDOW_FOOTPATH, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown) } },
{ WindowClass::land, "WC_LAND", STR_THEMES_WINDOW_LAND, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown) } },
{ WindowClass::water, "WC_WATER", STR_THEMES_WINDOW_WATER, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown) } },
{ WindowClass::peep, "WC_PEEP", STR_THEMES_WINDOW_PEEP, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::oliveGreen), opaque(Drawing::Colour::oliveGreen) } },
{ WindowClass::guestList, "WC_GUEST_LIST", STR_THEMES_WINDOW_GUEST_LIST, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::oliveGreen), opaque(Drawing::Colour::oliveGreen) } },
{ WindowClass::staffList, "WC_STAFF_LIST", STR_THEMES_WINDOW_STAFF_LIST, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::lightPurple) } },
{ WindowClass::firePrompt, "WC_FIRE_PROMPT", STR_THEMES_WINDOW_FIRE_PROMPT, { translucent(Drawing::Colour::bordeauxRed) } },
{ WindowClass::parkInformation, "WC_PARK_INFORMATION", STR_THEMES_WINDOW_PARK_INFORMATION, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::darkYellow), opaque(Drawing::Colour::darkYellow) } },
{ WindowClass::finances, "WC_FINANCES", STR_THEMES_WINDOW_FINANCES, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::darkYellow), opaque(Drawing::Colour::darkYellow) } },
{ WindowClass::titleMenu, "WC_TITLE_MENU", STR_THEMES_WINDOW_TITLE_MENU_BUTTONS, { translucent(Drawing::Colour::darkGreen), translucent(Drawing::Colour::darkGreen), translucent(Drawing::Colour::darkGreen) } },
{ WindowClass::titleExit, "WC_TITLE_EXIT", STR_THEMES_WINDOW_TITLE_MENU_EXIT, { translucent(Drawing::Colour::darkGreen), translucent(Drawing::Colour::darkGreen), translucent(Drawing::Colour::darkGreen) } },
{ WindowClass::recentNews, "WC_RECENT_NEWS", STR_THEMES_WINDOW_RECENT_NEWS, { opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::scenarioSelect, "WC_SCENARIO_SELECT", STR_THEMES_WINDOW_TITLE_MENU_SCENARIO_SELECTION, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::bordeauxRed) } },
{ WindowClass::trackDesignList, "WC_TRACK_DESIGN_LIST", STR_THEMES_WINDOW_TRACK_DESIGN_LIST, { opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::bordeauxRed) } },
{ WindowClass::trackDesignPlace, "WC_TRACK_DESIGN_PLACE", STR_THEMES_WINDOW_TRACK_DESIGN_PLACE, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown) } },
{ WindowClass::newCampaign, "WC_NEW_CAMPAIGN", STR_THEMES_WINDOW_NEW_CAMPAIGN, { opaque(Drawing::Colour::darkYellow), opaque(Drawing::Colour::darkYellow), opaque(Drawing::Colour::darkYellow) } },
{ WindowClass::keyboardShortcutList, "WC_KEYBOARD_SHORTCUT_LIST", STR_THEMES_WINDOW_KEYBOARD_SHORTCUT_LIST, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::changeKeyboardShortcut, "WC_CHANGE_KEYBOARD_SHORTCUT", STR_THEMES_WINDOW_CHANGE_KEYBOARD_SHORTCUT, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::resetShortcutKeysPrompt, "WC_RESET_SHORTCUT_KEYS_PROMPT", STR_SHORTCUT_ACTION_RESET, { translucent(Drawing::Colour::bordeauxRed) } },
{ WindowClass::map, "WC_MAP", STR_THEMES_WINDOW_MAP, { opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::darkBrown) } },
{ WindowClass::banner, "WC_BANNER", STR_THEMES_WINDOW_BANNER, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown) } },
{ WindowClass::editorObjectSelection, "WC_EDITOR_OBJECT_SELECTION", STR_THEMES_WINDOW_EDITOR_OBJECT_SELECTION, { opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey) } },
{ WindowClass::editorInventionList, "WC_EDITOR_INVENTION_LIST", STR_THEMES_WINDOW_EDITOR_INVENTION_LIST, { opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey) } },
{ WindowClass::editorScenarioOptions, "WC_EDITOR_SCENARIO_OPTIONS", STR_THEMES_WINDOW_EDITOR_SCENARIO_OPTIONS, { opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey) } },
{ WindowClass::manageTrackDesign, "WC_MANAGE_TRACK_DESIGN", STR_THEMES_WINDOW_MANAGE_TRACK_DESIGN, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey) } },
{ WindowClass::trackDeletePrompt, "WC_TRACK_DELETE_PROMPT", STR_THEMES_WINDOW_TRACK_DELETE_PROMPT, { opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::bordeauxRed) } },
{ WindowClass::installTrack, "WC_INSTALL_TRACK", STR_THEMES_WINDOW_INSTALL_TRACK, { opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::bordeauxRed) } },
{ WindowClass::clearScenery, "WC_CLEAR_SCENERY", STR_THEMES_WINDOW_CLEAR_SCENERY, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown) } },
{ WindowClass::cheats, "WC_CHEATS", STR_CHEAT_TITLE, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::darkYellow) } },
{ WindowClass::research, "WC_RESEARCH", STR_THEMES_WINDOW_RESEARCH, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::darkYellow), opaque(Drawing::Colour::darkYellow) } },
{ WindowClass::viewport, "WC_VIEWPORT", STR_THEMES_WINDOW_VIEWPORT, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown) } },
{ WindowClass::mapgen, "WC_MAPGEN", STR_THEMES_WINDOW_MAPGEN, { opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown) } },
{ WindowClass::loadsave, "WC_LOADSAVE", STR_THEMES_WINDOW_LOADSAVE, { opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::darkGreen) } },
{ WindowClass::loadsaveOverwritePrompt, "WC_LOADSAVE_OVERWRITE_PROMPT", STR_THEMES_WINDOW_LOADSAVE_OVERWRITE_PROMPT, { translucent(Drawing::Colour::bordeauxRed) } },
{ WindowClass::titleOptions, "WC_TITLE_OPTIONS", STR_THEMES_WINDOW_TITLE_MENU_OPTIONS, { translucent(Drawing::Colour::darkGreen), translucent(Drawing::Colour::darkGreen), translucent(Drawing::Colour::darkGreen) } },
{ WindowClass::landRights, "WC_LAND_RIGHTS", STR_THEMES_WINDOW_LAND_RIGHTS, { opaque(Drawing::Colour::darkYellow), opaque(Drawing::Colour::darkYellow), opaque(Drawing::Colour::darkYellow) } },
{ WindowClass::themes, "WC_THEMES", STR_THEMES_WINDOW_THEMES, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::darkGreen) } },
{ WindowClass::staff, "WC_STAFF", STR_THEMES_WINDOW_STAFF, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::lightPurple) } },
{ WindowClass::editorTrackBottomToolbar, "WC_EDITOR_TRACK_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR_TRACK_EDITOR, { translucent(Drawing::Colour::lightBlue), translucent(Drawing::Colour::lightBlue), translucent(Drawing::Colour::lightBlue) } },
{ WindowClass::editorScenarioBottomToolbar, "WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR_SCENARIO_EDITOR, { translucent(Drawing::Colour::lightBrown), translucent(Drawing::Colour::lightBrown), translucent(Drawing::Colour::mossGreen) } },
{ WindowClass::tileInspector, "WC_TILE_INSPECTOR", STR_TILE_INSPECTOR_TITLE, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::viewClipping, "WC_VIEW_CLIPPING", STR_VIEW_CLIPPING_TITLE, { opaque(Drawing::Colour::darkGreen) } },
{ WindowClass::patrolArea, "WC_PATROL_AREA", STR_SET_PATROL_AREA, { opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::lightPurple) } },
{ WindowClass::transparency, "WC_TRANSPARENCY", STR_TRANSPARENCY_OPTIONS_TITLE, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::about, "WC_ABOUT", STR_ABOUT, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::changelog, "WC_CHANGELOG", STR_CHANGELOG_TITLE, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::multiplayer, "WC_MULTIPLAYER", STR_MULTIPLAYER, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::player, "WC_PLAYER", STR_THEMES_WINDOW_PLAYER, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::networkStatus, "WC_NETWORK_STATUS", STR_THEMES_WINDOW_NETWORK_STATUS, { opaque(Drawing::Colour::black) } },
{ WindowClass::serverList, "WC_SERVER_LIST", STR_SERVER_LIST, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::chat, "WC_CHAT", STR_CHAT, { translucent(Drawing::Colour::grey) } },
{ WindowClass::console, "WC_CONSOLE", STR_CONSOLE, { translucent(Drawing::Colour::lightBlue), opaque(Drawing::Colour::white) } },
{ WindowClass::progressWindow, "WC_PROGRESS_WINDOW", STR_THEME_LOADING_WINDOW, { opaque(Drawing::Colour::black) } },
{ WindowClass::editorParkEntrance, "WC_EDITOR_PARK_ENTRANCE", STR_OBJECT_SELECTION_PARK_ENTRANCE, { opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::darkBrown) } },
};
#pragma endregion
@@ -232,29 +231,29 @@ namespace OpenRCT2::Ui
#pragma region Pre-defined Themes
static constexpr std::array kPredefinedThemeRCT1Entries = std::to_array<UIThemeWindowEntry>({
{ WindowClass::topToolbar, { opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::bottomToolbar, { translucent(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_VOID), opaque(COLOUR_YELLOW), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::ride, { opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_GREY), opaque(COLOUR_SATURATED_GREEN), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::rideList, { opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::constructRide, { opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::peep, { opaque(COLOUR_LIGHT_BROWN), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::guestList, { opaque(COLOUR_LIGHT_BROWN), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::staffList, { opaque(COLOUR_DARK_GREEN), opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::finances, { opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::titleMenu, { translucent(COLOUR_GREY), translucent(COLOUR_GREY), translucent(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::titleExit, { translucent(COLOUR_GREY), translucent(COLOUR_GREY), translucent(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::newCampaign, { opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::titleOptions, { translucent(COLOUR_GREY), translucent(COLOUR_GREY), translucent(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::staff, { opaque(COLOUR_DARK_GREEN), opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_LIGHT_PURPLE), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::options, { opaque(COLOUR_GREY), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::assetPacks, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::keyboardShortcutList, { opaque(COLOUR_GREY), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::changeKeyboardShortcut, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::recentNews, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_VOID), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::trackDesignList, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::map, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::about, { opaque(COLOUR_GREY), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_WHITE), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::changelog, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_WHITE), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } },
{ WindowClass::topToolbar, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::bottomToolbar, { translucent(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::voidBackground), opaque(Drawing::Colour::yellow), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::ride, { opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::saturatedGreen), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::rideList, { opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::constructRide, { opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::peep, { opaque(Drawing::Colour::lightBrown), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::guestList, { opaque(Drawing::Colour::lightBrown), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::staffList, { opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::finances, { opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::titleMenu, { translucent(Drawing::Colour::grey), translucent(Drawing::Colour::grey), translucent(Drawing::Colour::grey), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::titleExit, { translucent(Drawing::Colour::grey), translucent(Drawing::Colour::grey), translucent(Drawing::Colour::grey), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::newCampaign, { opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::titleOptions, { translucent(Drawing::Colour::grey), translucent(Drawing::Colour::grey), translucent(Drawing::Colour::grey), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::staff, { opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::options, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::assetPacks, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::keyboardShortcutList, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::changeKeyboardShortcut, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::recentNews, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::voidBackground), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::trackDesignList, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::map, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::about, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::white), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::changelog, { opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::white), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
});
// clang-format on
@@ -322,7 +321,7 @@ namespace OpenRCT2::Ui
json_t jsonColours = json_t::array();
for (uint8_t i = 0; i < wtDesc->windowColours.numColours; i++)
{
json_t jsonEntry = { { "colour", Colour::ToString(Theme.Colours[i].colour) },
json_t jsonEntry = { { "colour", colourToString(Theme.Colours[i].colour) },
{ "translucent", Theme.Colours[i].flags.has(ColourFlag::translucent) } };
jsonColours.emplace_back(jsonEntry);
@@ -363,7 +362,7 @@ namespace OpenRCT2::Ui
else
{
auto colourObject = Json::AsObject(jsonColours[i]);
auto colour = Colour::FromString(Json::GetString(colourObject["colour"]), COLOUR_BLACK);
auto colour = colourFromString(Json::GetString(colourObject["colour"]), Drawing::Colour::black);
auto isTranslucent = Json::GetBoolean(colourObject["translucent"], false);
ColourFlags flags{};
flags.set(ColourFlag::translucent, isTranslucent);
-1
View File
@@ -9,7 +9,6 @@
#pragma once
#include <openrct2/interface/Colour.h>
#include <openrct2/interface/Window.h>
namespace OpenRCT2
+7 -6
View File
@@ -513,7 +513,7 @@ namespace OpenRCT2::Ui
const auto r = w.windowPos.x + widget.right;
const auto b = w.windowPos.y + widget.bottom;
uint8_t colour = w.colours[widget.colour].colour;
auto colour = w.colours[widget.colour].colour;
// Border left of text
Rectangle::fill(rt, { { l, t }, { l + 4, t } }, getColourMap(colour).midDark);
@@ -560,7 +560,7 @@ namespace OpenRCT2::Ui
Rectangle::FillMode::dontLightenWhenInset);
// Black caption bars look slightly green, this fixes that
if (colour.colour == COLOUR_BLACK)
if (colour.colour == Drawing::Colour::black)
Rectangle::fill(
rt, { { topLeft + ScreenCoordsXY{ 1, 1 } }, { bottomRight - ScreenCoordsXY{ 1, 1 } } },
getColourMap(colour.colour).dark);
@@ -592,7 +592,7 @@ namespace OpenRCT2::Ui
DrawTextEllipsised(
rt, topLeft, width, widget->text, Formatter::Common(),
{ ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true), TextAlignment::centre });
{ ColourWithFlags{ Drawing::Colour::white }.withFlag(ColourFlag::withOutline, true), TextAlignment::centre });
}
/**
@@ -1243,9 +1243,10 @@ namespace OpenRCT2::Ui
const int32_t fillSize = (barWidth * percentage) / 100;
if (fillSize > 0)
{
// Progress bar widgets have an actual colour saved in them, rather than an index to the window colours.
Rectangle::fillInset(
rt, { topLeft + ScreenCoordsXY{ 1, 1 }, topLeft + ScreenCoordsXY{ fillSize + 1, widget.height() - 2 } },
{ widget.colour });
{ static_cast<Colour>(widget.colour) });
}
}
@@ -1257,9 +1258,9 @@ namespace OpenRCT2::Ui
Rectangle::fillInset(rt, { topLeft, bottomRight }, w.colours[1], Rectangle::BorderStyle::inset);
}
ImageId getColourButtonImage(colour_t colour)
ImageId getColourButtonImage(Drawing::Colour colour)
{
if (colour == COLOUR_INVISIBLE)
if (colour == Drawing::Colour::invisible)
{
return ImageId(SPR_G2_ICON_PALETTE_INVISIBLE, colour).WithBlended(false);
}
+3 -3
View File
@@ -17,7 +17,7 @@
namespace OpenRCT2::Ui
{
ImageId getColourButtonImage(colour_t colour);
ImageId getColourButtonImage(Drawing::Colour colour);
Widget* getWidgetByIndex(WindowBase& w, WidgetIndex widgetIndex);
constexpr uint32_t kWidgetContentEmpty = 0xFFFFFFFF;
@@ -92,7 +92,7 @@ namespace OpenRCT2::Ui
}
constexpr Widget makeProgressBar(
const ScreenCoordsXY& origin, const ScreenSize& size, colour_t colour, uint8_t lowerBlinkBound = 0,
const ScreenCoordsXY& origin, const ScreenSize& size, Drawing::Colour colour, uint8_t lowerBlinkBound = 0,
uint8_t upperBlinkBound = 0)
{
Widget out = {};
@@ -101,7 +101,7 @@ namespace OpenRCT2::Ui
out.top = origin.y;
out.bottom = origin.y + size.height - 1;
out.type = WidgetType::progressBar;
out.colour = colour;
out.colour = EnumValue(colour);
out.content = 0 | (lowerBlinkBound << 8) | (upperBlinkBound << 16);
out.tooltip = kStringIdNone;
+1 -1
View File
@@ -1052,7 +1052,7 @@ namespace OpenRCT2::Ui::Windows
if (w.flashTimer > 0)
{
Rectangle::fillInset(
rt, { w.windowPos, w.windowPos + ScreenCoordsXY{ w.width - 1, w.height - 1 } }, { COLOUR_WHITE },
rt, { w.windowPos, w.windowPos + ScreenCoordsXY{ w.width - 1, w.height - 1 } }, { Drawing::Colour::white },
Rectangle::BorderStyle::outset, Rectangle::FillBrightness::light, Rectangle::FillMode::none);
}
}
+20 -17
View File
@@ -63,7 +63,7 @@ namespace OpenRCT2::Ui::Windows
ImageId Image;
std::string Text;
TextAlignment TextAlign{};
colour_t Colour{};
Drawing::Colour Colour{};
std::string Tooltip;
std::vector<std::string> Items;
std::vector<ListViewItem> ListViewItems;
@@ -126,9 +126,9 @@ namespace OpenRCT2::Ui::Windows
else if (result.Type == "colourpicker")
{
auto colour = AsOrDefault(desc["colour"], 0);
if (colour < COLOUR_COUNT)
if (colour < kColourNumTotal)
{
result.Colour = colour;
result.Colour = static_cast<Drawing::Colour>(colour);
}
result.OnChange = desc["onChange"];
}
@@ -220,15 +220,18 @@ namespace OpenRCT2::Ui::Windows
if (dukImage["primaryColour"].type() == DukValue::Type::NUMBER)
{
result.imageFrameBase = result.imageFrameBase.WithPrimary(dukImage["primaryColour"].as_uint());
result.imageFrameBase = result.imageFrameBase.WithPrimary(
static_cast<Colour>(dukImage["primaryColour"].as_uint()));
if (dukImage["secondaryColour"].type() == DukValue::Type::NUMBER)
{
result.imageFrameBase = result.imageFrameBase.WithSecondary(dukImage["secondaryColour"].as_uint());
result.imageFrameBase = result.imageFrameBase.WithSecondary(
static_cast<Colour>(dukImage["secondaryColour"].as_uint()));
if (dukImage["tertiaryColour"].type() == DukValue::Type::NUMBER)
{
result.imageFrameBase = result.imageFrameBase.WithTertiary(dukImage["tertiaryColour"].as_uint());
result.imageFrameBase = result.imageFrameBase.WithTertiary(
static_cast<Colour>(dukImage["tertiaryColour"].as_uint()));
}
}
}
@@ -315,12 +318,12 @@ namespace OpenRCT2::Ui::Windows
{
auto dukColours = desc["colours"].as_array();
std::transform(dukColours.begin(), dukColours.end(), std::back_inserter(result.Colours), [](const DukValue& w) {
ColourWithFlags c = { COLOUR_BLACK };
ColourWithFlags c = { Colour::black };
if (w.type() == DukValue::Type::NUMBER)
{
colour_t colour = w.as_uint() & ~kLegacyColourFlagTranslucent;
uint8_t colour = (w.as_uint() & ~kLegacyColourFlagTranslucent) % kColourNumTotal;
bool isTranslucent = (w.as_uint() & kLegacyColourFlagTranslucent);
c.colour = std::clamp<colour_t>(colour, COLOUR_BLACK, COLOUR_COUNT - 1);
c.colour = static_cast<Colour>(colour);
c.flags.set(ColourFlag::translucent, isTranslucent);
}
return c;
@@ -413,9 +416,9 @@ namespace OpenRCT2::Ui::Windows
page = _info.Desc.TabIndex.value_or(0);
// Set window colours
colours[0] = COLOUR_GREY;
colours[1] = COLOUR_GREY;
colours[2] = COLOUR_GREY;
colours[0] = Colour::grey;
colours[1] = Colour::grey;
colours[2] = Colour::grey;
auto numColours = std::min(std::size(colours), std::size(_info.Desc.Colours));
for (size_t i = 0; i < numColours; i++)
{
@@ -1228,7 +1231,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void UpdateWidgetColour(WindowBase* w, WidgetIndex widgetIndex, colour_t colour)
void UpdateWidgetColour(WindowBase* w, WidgetIndex widgetIndex, Colour colour)
{
if (w->classification == WindowClass::custom)
{
@@ -1239,7 +1242,7 @@ namespace OpenRCT2::Ui::Windows
auto& widget = w->widgets[widgetIndex];
auto lastColour = customWidgetInfo->Colour;
if (lastColour != colour && colour < COLOUR_COUNT)
if (lastColour != colour && colourIsValid(colour))
{
customWidgetInfo->Colour = colour;
widget.image = getColourButtonImage(colour);
@@ -1249,7 +1252,7 @@ namespace OpenRCT2::Ui::Windows
std::vector<DukValue> args;
auto ctx = customWidgetInfo->OnChange.context();
duk_push_int(ctx, colour);
duk_push_int(ctx, EnumValue(colour));
args.push_back(DukValue::take_from_stack(ctx));
InvokeEventHandler(customInfo.Owner, customWidgetInfo->OnChange, args);
}
@@ -1319,7 +1322,7 @@ namespace OpenRCT2::Ui::Windows
return {};
}
colour_t GetWidgetColour(WindowBase* w, WidgetIndex widgetIndex)
Colour GetWidgetColour(WindowBase* w, WidgetIndex widgetIndex)
{
if (w->classification == WindowClass::custom)
{
@@ -1330,7 +1333,7 @@ namespace OpenRCT2::Ui::Windows
return customWidgetInfo->Colour;
}
}
return COLOUR_BLACK;
return Colour::black;
}
int32_t GetWidgetSelectedIndex(WindowBase* w, WidgetIndex widgetIndex)
+2 -2
View File
@@ -26,10 +26,10 @@ namespace OpenRCT2::Ui::Windows
void UpdateWindowTab(WindowBase* w, int32_t tabIndex);
void UpdateWidgetText(WindowBase* w, WidgetIndex widget, std::string_view string_view);
void UpdateWidgetItems(WindowBase* w, WidgetIndex widgetIndex, const std::vector<std::string>& items);
void UpdateWidgetColour(WindowBase* w, WidgetIndex widgetIndex, colour_t colour);
void UpdateWidgetColour(WindowBase* w, WidgetIndex widgetIndex, Drawing::Colour colour);
void UpdateWidgetSelectedIndex(WindowBase* w, WidgetIndex widgetIndex, int32_t selectedIndex);
std::vector<std::string> GetWidgetItems(WindowBase* w, WidgetIndex widgetIndex);
colour_t GetWidgetColour(WindowBase* w, WidgetIndex widgetIndex);
Drawing::Colour GetWidgetColour(WindowBase* w, WidgetIndex widgetIndex);
int32_t GetWidgetSelectedIndex(WindowBase* w, WidgetIndex widgetIndex);
WindowBase* FindCustomWindowByClassification(std::string_view classification);
std::optional<WidgetIndex> FindWidgetIndexByName(WindowBase* w, std::string_view name);
+13 -13
View File
@@ -28,9 +28,9 @@ namespace OpenRCT2::Scripting
duk_context* _ctx{};
RenderTarget _rt{};
std::optional<colour_t> _colour{};
std::optional<colour_t> _secondaryColour{};
std::optional<colour_t> _tertiaryColour{};
std::optional<uint8_t> _colour{};
std::optional<uint8_t> _secondaryColour{};
std::optional<uint8_t> _tertiaryColour{};
std::optional<uint8_t> _paletteId{};
PaletteIndex _stroke{};
PaletteIndex _fill{};
@@ -79,7 +79,7 @@ namespace OpenRCT2::Scripting
void colour_set(DukValue value)
{
if (value.type() == DukValue::NUMBER)
_colour = static_cast<colour_t>(value.as_uint());
_colour = static_cast<uint8_t>(value.as_uint());
else
_colour = {};
}
@@ -92,7 +92,7 @@ namespace OpenRCT2::Scripting
void secondaryColour_set(DukValue value)
{
if (value.type() == DukValue::NUMBER)
_secondaryColour = static_cast<colour_t>(value.as_uint());
_secondaryColour = static_cast<uint8_t>(value.as_uint());
else
_secondaryColour = {};
}
@@ -105,7 +105,7 @@ namespace OpenRCT2::Scripting
void tertiaryColour_set(DukValue value)
{
if (value.type() == DukValue::NUMBER)
_tertiaryColour = static_cast<colour_t>(value.as_uint());
_tertiaryColour = static_cast<uint8_t>(value.as_uint());
else
_tertiaryColour = {};
}
@@ -167,14 +167,14 @@ namespace OpenRCT2::Scripting
void box(int32_t x, int32_t y, int32_t width, int32_t height)
{
Rectangle::fillInset(_rt, { x, y, x + width - 1, y + height - 1 }, { _colour.value_or(0) });
Rectangle::fillInset(_rt, { x, y, x + width - 1, y + height - 1 }, { static_cast<Colour>(_colour.value_or(0)) });
}
void well(int32_t x, int32_t y, int32_t width, int32_t height)
{
Rectangle::fillInset(
_rt, { x, y, x + width - 1, y + height - 1 }, { _colour.value_or(0) }, Rectangle::BorderStyle::inset,
Rectangle::FillBrightness::light, Rectangle::FillMode::dontLightenWhenInset);
_rt, { x, y, x + width - 1, y + height - 1 }, { static_cast<Colour>(_colour.value_or(0)) },
Rectangle::BorderStyle::inset, Rectangle::FillBrightness::light, Rectangle::FillMode::dontLightenWhenInset);
}
void clear()
@@ -201,15 +201,15 @@ namespace OpenRCT2::Scripting
{
if (_colour)
{
img = img.WithPrimary(*_colour);
img = img.WithPrimary(static_cast<Colour>(*_colour));
}
if (_secondaryColour)
{
img = img.WithSecondary(*_secondaryColour);
img = img.WithSecondary(static_cast<Colour>(*_secondaryColour));
}
}
GfxDrawSprite(_rt, img.WithTertiary(_tertiaryColour.value_or(0)), { x, y });
GfxDrawSprite(_rt, img.WithTertiary(static_cast<Colour>(_tertiaryColour.value_or(0))), { x, y });
}
void line(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
@@ -239,7 +239,7 @@ namespace OpenRCT2::Scripting
void text(const std::string& text, int32_t x, int32_t y)
{
DrawText(_rt, { x, y }, { _colour.value_or(0) }, text.c_str());
DrawText(_rt, { x, y }, { static_cast<Colour>(_colour.value_or(0)) }, text.c_str());
}
};
} // namespace OpenRCT2::Scripting
+5 -5
View File
@@ -585,21 +585,21 @@ namespace OpenRCT2::Scripting
}
private:
colour_t colour_get() const
uint8_t colour_get() const
{
auto w = GetWindow();
if (w != nullptr)
{
return GetWidgetColour(w, _widgetIndex);
return EnumValue(GetWidgetColour(w, _widgetIndex));
}
return COLOUR_BLACK;
return EnumValue(Drawing::Colour::black);
}
void colour_set(colour_t value)
void colour_set(uint8_t value)
{
auto w = GetWindow();
if (w != nullptr)
{
UpdateWidgetColour(w, _widgetIndex, value);
UpdateWidgetColour(w, _widgetIndex, static_cast<Drawing::Colour>(value));
Invalidate();
}
}
+4 -4
View File
@@ -238,7 +238,7 @@ namespace OpenRCT2::Scripting
result.reserve(std::size(w->colours));
for (auto c : w->colours)
{
auto colour = c.colour;
auto colour = EnumValue(c.colour);
if (c.flags.has(ColourFlag::translucent))
colour |= kLegacyColourFlagTranslucent;
result.push_back(colour);
@@ -253,12 +253,12 @@ namespace OpenRCT2::Scripting
{
for (size_t i = 0; i < std::size(w->colours); i++)
{
auto c = ColourWithFlags{ COLOUR_BLACK };
auto c = ColourWithFlags{ Drawing::Colour::black };
if (i < colours.size())
{
colour_t colour = colours[i] & ~kLegacyColourFlagTranslucent;
auto colour = (colours[i] & ~kLegacyColourFlagTranslucent) % Drawing::kColourNumTotal;
bool isTranslucent = (colours[i] & kLegacyColourFlagTranslucent);
c.colour = std::clamp<colour_t>(colour, COLOUR_BLACK, COLOUR_COUNT - 1);
c.colour = static_cast<Drawing::Colour>(colour);
c.flags.set(ColourFlag::translucent, isTranslucent);
}
w->colours[i] = c;
+3 -2
View File
@@ -165,14 +165,15 @@ namespace OpenRCT2::Ui::Windows
ft.Add<StringId>(STR_TITLE_SEQUENCE_OPENRCT2);
DrawTextWrapped(
rt, aboutOpenRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft,
{ COLOUR_LIGHT_WATER, TextAlignment::centre });
{ Drawing::Colour::lightWater, TextAlignment::centre });
}
{
// TODO: this string shouldn't be reused for this tab
auto ft = Formatter();
ft.Add<StringId>(STR_TITLE_SEQUENCE_RCT2);
DrawTextWrapped(
rt, aboutRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, { COLOUR_LIGHT_WATER, TextAlignment::centre });
rt, aboutRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft,
{ Drawing::Colour::lightWater, TextAlignment::centre });
}
int32_t newHeight = 0;
+1 -1
View File
@@ -238,7 +238,7 @@ namespace OpenRCT2::Ui::Windows
auto bannerSetStyle = GameActions::BannerSetStyleAction(
GameActions::BannerSetStyleType::PrimaryColour, GetBannerIndex(),
ColourDropDownIndexToColour(dropdownIndex));
EnumValue(ColourDropDownIndexToColour(dropdownIndex)));
GameActions::Execute(&bannerSetStyle, gameState);
break;
}
+3 -4
View File
@@ -15,7 +15,6 @@
#include <openrct2/core/EnumUtils.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/drawing/Text.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/localisation/Currency.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/ui/WindowManager.h>
@@ -56,9 +55,9 @@ namespace OpenRCT2::Ui::Windows
setWidgets(window_custom_currency_widgets);
holdDownWidgets = (1uLL << WIDX_RATE_UP) | (1uLL << WIDX_RATE_DOWN);
WindowInitScrollWidgets(*this);
colours[0] = COLOUR_LIGHT_BROWN;
colours[1] = COLOUR_LIGHT_BROWN;
colours[2] = COLOUR_LIGHT_BROWN;
colours[0] = Drawing::Colour::lightBrown;
colours[1] = Drawing::Colour::lightBrown;
colours[2] = Drawing::Colour::lightBrown;
}
void onMouseDown(WidgetIndex widgetIndex) override
+2 -2
View File
@@ -62,8 +62,8 @@ namespace OpenRCT2::Ui::Windows
initScrollWidgets();
WindowPushOthersBelow(*this);
colours[0] = ColourWithFlags{ COLOUR_BLACK }.withFlag(ColourFlag::translucent, true);
colours[1] = COLOUR_GREY;
colours[0] = ColourWithFlags{ Drawing::Colour::black }.withFlag(ColourFlag::translucent, true);
colours[1] = Drawing::Colour::grey;
ResizeLanguage = LANGUAGE_UNDEFINED;
}
+31 -68
View File
@@ -90,11 +90,11 @@ namespace OpenRCT2::Ui::Windows
static void drawTextItem(
RenderTarget& rt, ScreenCoordsXY screenCoords, int32_t width, const Dropdown::Item& item, bool highlighted,
StringId format, colour_t background)
StringId format, Colour background)
{
ColourWithFlags colour = { background };
if (highlighted)
colour.colour = COLOUR_WHITE;
colour.colour = Colour::white;
if (item.isDisabled())
colour = { background, { ColourFlag::inset } };
@@ -129,7 +129,7 @@ namespace OpenRCT2::Ui::Windows
if (colours[0].flags.has(ColourFlag::translucent))
{
TranslucentWindowPalette palette = kTranslucentWindowPalettes[colours[0].colour];
TranslucentWindowPalette palette = kTranslucentWindowPalettes[EnumValue(colours[0].colour)];
Rectangle::filter(rt, { leftTop, rightBottom }, palette.highlight);
Rectangle::filter(rt, { leftTop + shadowOffset, rightBottom + shadowOffset }, palette.shadow);
}
@@ -471,70 +471,33 @@ namespace OpenRCT2::Ui::Windows
return -1;
}
// colour_t ordered for use in colour dropdown
static constexpr colour_t kColoursDropdownOrder[] = {
COLOUR_BLACK,
COLOUR_SATURATED_RED,
COLOUR_DARK_ORANGE,
COLOUR_DARK_YELLOW,
COLOUR_GRASS_GREEN_DARK,
COLOUR_SATURATED_GREEN,
COLOUR_DEEP_WATER,
COLOUR_DARK_BLUE,
COLOUR_SATURATED_PURPLE_DARK,
// Colour ordered for use in colour dropdown
static constexpr Colour kColoursDropdownOrder[] = {
Colour::black, Colour::saturatedRed, Colour::darkOrange, Colour::darkYellow,
Colour::forestGreen, Colour::saturatedGreen, Colour::deepWater, Colour::darkBlue,
Colour::violet,
COLOUR_GREY,
COLOUR_BRIGHT_RED,
COLOUR_LIGHT_ORANGE,
COLOUR_YELLOW,
COLOUR_MOSS_GREEN,
COLOUR_BRIGHT_GREEN,
COLOUR_DARK_WATER,
COLOUR_LIGHT_BLUE,
COLOUR_BRIGHT_PURPLE,
Colour::grey, Colour::brightRed, Colour::lightOrange, Colour::yellow,
Colour::mossGreen, Colour::brightGreen, Colour::darkWater, Colour::lightBlue,
Colour::brightPurple,
COLOUR_WHITE,
COLOUR_LIGHT_PINK,
COLOUR_ORANGE_LIGHT,
COLOUR_BRIGHT_YELLOW,
COLOUR_GRASS_GREEN_LIGHT,
COLOUR_SATURATED_GREEN_LIGHT,
COLOUR_LIGHT_WATER,
COLOUR_ICY_BLUE,
COLOUR_SATURATED_PURPLE_LIGHT,
Colour::white, Colour::lightPink, Colour::pastelOrange, Colour::brightYellow,
Colour::chartreuse, Colour::limeGreen, Colour::lightWater, Colour::icyBlue,
Colour::lavender,
COLOUR_DULL_BROWN_DARK,
COLOUR_BORDEAUX_RED_DARK,
COLOUR_TAN_DARK,
COLOUR_SATURATED_BROWN,
COLOUR_DARK_OLIVE_DARK,
COLOUR_OLIVE_DARK,
COLOUR_DULL_GREEN_DARK,
COLOUR_DARK_PURPLE,
COLOUR_DARK_PINK,
Colour::umber, Colour::maroon, Colour::sepia, Colour::saturatedBrown,
Colour::armyGreen, Colour::hunterGreen, Colour::viridian, Colour::darkPurple,
Colour::darkPink,
COLOUR_DARK_BROWN,
COLOUR_BORDEAUX_RED,
COLOUR_SALMON_PINK,
COLOUR_LIGHT_BROWN,
COLOUR_DARK_OLIVE_GREEN,
COLOUR_OLIVE_GREEN,
COLOUR_DARK_GREEN,
COLOUR_LIGHT_PURPLE,
COLOUR_BRIGHT_PINK,
Colour::darkBrown, Colour::bordeauxRed, Colour::salmonPink, Colour::lightBrown,
Colour::darkOliveGreen, Colour::oliveGreen, Colour::darkGreen, Colour::lightPurple,
Colour::brightPink,
COLOUR_DULL_BROWN_LIGHT,
COLOUR_BORDEAUX_RED_LIGHT,
COLOUR_TAN_LIGHT,
COLOUR_SATURATED_BROWN_LIGHT,
COLOUR_DARK_OLIVE_LIGHT,
COLOUR_OLIVE_LIGHT,
COLOUR_DULL_GREEN_LIGHT,
COLOUR_DULL_PURPLE_LIGHT,
COLOUR_MAGENTA_LIGHT,
Colour::beige, Colour::coralPink, Colour::peach, Colour::tan,
Colour::honeyDew, Colour::celadon, Colour::seafoamGreen, Colour::periwinkle,
Colour::pastelPink,
COLOUR_INVISIBLE,
COLOUR_VOID,
Colour::invisible, Colour::voidBackground,
};
constexpr std::array kColourTooltips = {
@@ -602,7 +565,7 @@ namespace OpenRCT2::Ui::Windows
STR_COLOUR_VOID_TIP,
};
colour_t ColourDropDownIndexToColour(uint8_t ddidx)
Colour ColourDropDownIndexToColour(uint8_t ddidx)
{
return kColoursDropdownOrder[ddidx];
}
@@ -611,12 +574,12 @@ namespace OpenRCT2::Ui::Windows
* rct2: 0x006ED43D
*/
void WindowDropdownShowColour(
WindowBase* w, Widget* widget, ColourWithFlags dropdownColour, colour_t selectedColour, bool alwaysHideSpecialColours)
WindowBase* w, Widget* widget, ColourWithFlags dropdownColour, Colour selectedColour, bool alwaysHideSpecialColours)
{
int32_t defaultIndex = -1;
const bool specialColoursEnabled = !alwaysHideSpecialColours && getGameState().cheats.allowSpecialColourSchemes;
auto numColours = specialColoursEnabled ? static_cast<uint8_t>(COLOUR_COUNT) : kColourNumNormal;
auto numColours = specialColoursEnabled ? static_cast<uint8_t>(Drawing::kColourNumTotal) : kColourNumNormal;
// Set items
for (uint64_t i = 0; i < numColours; i++)
{
@@ -627,13 +590,13 @@ namespace OpenRCT2::Ui::Windows
ImageId imageId;
if (Config::Get().interface.enlargedUi)
{
imageId = (orderedColour == COLOUR_INVISIBLE) ? ImageId(SPR_G2_ICON_PALETTE_INVISIBLE_LARGE, COLOUR_WHITE)
: ImageId(SPR_G2_ICON_PALETTE_LARGE, orderedColour);
imageId = (orderedColour == Colour::invisible) ? ImageId(SPR_G2_ICON_PALETTE_INVISIBLE_LARGE, Colour::white)
: ImageId(SPR_G2_ICON_PALETTE_LARGE, orderedColour);
}
else
{
imageId = (orderedColour == COLOUR_INVISIBLE) ? ImageId(SPR_G2_ICON_PALETTE_INVISIBLE, COLOUR_WHITE)
: ImageId(SPR_PALETTE_BTN, orderedColour);
imageId = (orderedColour == Colour::invisible) ? ImageId(SPR_G2_ICON_PALETTE_INVISIBLE, Colour::white)
: ImageId(SPR_PALETTE_BTN, orderedColour);
}
gDropdown.items[i] = { .type = Dropdown::ItemType::colour, .image = imageId, .tooltip = kColourTooltips[i] };
@@ -357,11 +357,11 @@ namespace OpenRCT2::Ui::Windows
rt, ImageId(SPR_PREVIOUS),
windowPos + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].left + 6, widgets[WIDX_PREVIOUS_IMAGE].top + 6 });
colour_t textColour = colours[1].colour;
Drawing::Colour textColour = colours[1].colour;
if (gHoverWidget.windowClassification == WindowClass::bottomToolbar
&& gHoverWidget.widgetIndex == WIDX_PREVIOUS_STEP_BUTTON)
{
textColour = COLOUR_WHITE;
textColour = Drawing::Colour::white;
}
int16_t textX = (widgets[WIDX_PREVIOUS_IMAGE].left + 30 + widgets[WIDX_PREVIOUS_IMAGE].right) / 2 + windowPos.x;
@@ -397,12 +397,12 @@ namespace OpenRCT2::Ui::Windows
rt, ImageId(SPR_NEXT),
windowPos + ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].right - 29, widgets[WIDX_NEXT_IMAGE].top + 6 });
colour_t textColour = colours[1].colour;
Drawing::Colour textColour = colours[1].colour;
if (gHoverWidget.windowClassification == WindowClass::bottomToolbar
&& gHoverWidget.widgetIndex == WIDX_NEXT_STEP_BUTTON)
{
textColour = COLOUR_WHITE;
textColour = Drawing::Colour::white;
}
int16_t textX = (widgets[WIDX_NEXT_IMAGE].left + widgets[WIDX_NEXT_IMAGE].right - 30) / 2 + windowPos.x;
@@ -314,7 +314,7 @@ namespace OpenRCT2::Ui::Windows
// TODO: this parameter by itself produces very light text.
// It needs a {BLACK} token in the string to work properly.
ColourWithFlags colour = { COLOUR_BLACK };
ColourWithFlags colour = { Drawing::Colour::black };
FontStyle fontStyle = FontStyle::medium;
auto darkness = TextDarkness::regular;
@@ -607,7 +607,7 @@ namespace OpenRCT2::Ui::Windows
void onOpen() override
{
setWidgets(_inventionListDragWidgets);
colours[1] = COLOUR_WHITE;
colours[1] = Drawing::Colour::white;
}
CursorID onCursor(const WidgetIndex widx, const ScreenCoordsXY& screenCoords, const CursorID defaultCursor) override
@@ -663,7 +663,7 @@ namespace OpenRCT2::Ui::Windows
DrawResearchItem(
rt, _draggedItem, width, screenCoords, STR_WINDOW_COLOUR_2_STRINGID,
{ ColourWithFlags{ COLOUR_BLACK }.withFlag(ColourFlag::withOutline, true) });
{ ColourWithFlags{ Drawing::Colour::black }.withFlag(ColourFlag::withOutline, true) });
}
void init(ResearchItem& researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth)
@@ -777,7 +777,7 @@ namespace OpenRCT2::Ui::Windows
auto bufferWithColour = strcpy(itemBuffer, highlighted ? "{WINDOW_COLOUR_2}" : "{BLACK}");
auto buffer = strchr(bufferWithColour, '\0');
colour_t colour = COLOUR_BLACK;
Drawing::Colour colour = Drawing::Colour::black;
auto darkness = TextDarkness::regular;
if (*listItem.flags & ObjectSelectionFlags::Flag6)
{
@@ -1276,7 +1276,7 @@ namespace OpenRCT2::Ui::Windows
{
screenPos.y += DrawTextWrapped(
rt, screenPos, descriptionWidth, STR_OBJECT_SELECTION_COMPAT_OBJECT_DESCRIPTION, {},
{ COLOUR_BRIGHT_RED })
{ Drawing::Colour::brightRed })
+ kListRowHeight;
}
@@ -1366,7 +1366,8 @@ namespace OpenRCT2::Ui::Windows
// Draw fallback image warning
if (_loadedObject && _loadedObject->UsesFallbackImages())
{
DrawTextBasic(rt, screenPos, STR_OBJECT_USES_FALLBACK_IMAGES, {}, { COLOUR_WHITE, TextAlignment::right });
DrawTextBasic(
rt, screenPos, STR_OBJECT_USES_FALLBACK_IMAGES, {}, { Drawing::Colour::white, TextAlignment::right });
}
screenPos.y += kListRowHeight;
@@ -1374,7 +1375,7 @@ namespace OpenRCT2::Ui::Windows
if (GetSelectedObjectType() == ObjectType::ride)
{
auto stringId = GetRideTypeStringId(listItem->repositoryItem);
DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::right });
DrawTextBasic(rt, screenPos, stringId, {}, { Drawing::Colour::white, TextAlignment::right });
}
// Draw peep animation object type
@@ -1382,14 +1383,14 @@ namespace OpenRCT2::Ui::Windows
{
auto* animObj = reinterpret_cast<PeepAnimationsObject*>(_loadedObject.get());
auto stringId = GetAnimationPeepTypeStringId(animObj->GetPeepType());
DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::right });
DrawTextBasic(rt, screenPos, stringId, {}, { Drawing::Colour::white, TextAlignment::right });
}
screenPos.y += kListRowHeight;
// Draw object source
auto stringId = ObjectManagerGetSourceGameString(listItem->repositoryItem->GetFirstSourceGame());
DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::right });
DrawTextBasic(rt, screenPos, stringId, {}, { Drawing::Colour::white, TextAlignment::right });
screenPos.y += kListRowHeight;
// Draw object filename
@@ -1400,7 +1401,7 @@ namespace OpenRCT2::Ui::Windows
ft.Add<const utf8*>(path.c_str());
DrawTextBasic(
rt, { windowPos.x + this->width - 5, screenPos.y }, STR_WINDOW_COLOUR_2_STRINGID, ft,
{ COLOUR_BLACK, TextAlignment::right });
{ Drawing::Colour::black, TextAlignment::right });
screenPos.y += kListRowHeight;
}
@@ -28,7 +28,6 @@
#include <openrct2/drawing/Rectangle.h>
#include <openrct2/drawing/Text.h>
#include <openrct2/entity/Peep.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/localisation/Language.h>
#include <openrct2/localisation/Localisation.Date.h>
+1 -1
View File
@@ -599,7 +599,7 @@ namespace OpenRCT2::Ui::Windows
// Expenditure / Income heading
DrawTextBasic(
rt, screenCoords, STR_FINANCES_SUMMARY_EXPENDITURE_INCOME, {},
{ COLOUR_BLACK, TextUnderline::on, TextAlignment::left });
{ Drawing::Colour::black, TextUnderline::on, TextAlignment::left });
screenCoords.y += 14;
// Expenditure / Income row labels
@@ -82,11 +82,11 @@ namespace OpenRCT2::Ui::Windows
class GameBottomToolbar final : public Window
{
private:
colour_t GetHoverWidgetColour(WidgetIndex index)
Drawing::Colour GetHoverWidgetColour(WidgetIndex index)
{
return (
gHoverWidget.windowClassification == WindowClass::bottomToolbar && gHoverWidget.widgetIndex == index
? static_cast<colour_t>(COLOUR_WHITE)
? static_cast<Drawing::Colour>(Drawing::Colour::white)
: colours[0].colour);
}
@@ -151,23 +151,24 @@ namespace OpenRCT2::Ui::Windows
const auto& widget = widgets[WIDX_PARK_RATING];
auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 11, widget.midY() - 5 };
DrawParkRating(rt, colours[3].colour, screenCoords, std::max(10, ((gameState.park.rating / 4) * 263) / 256));
DrawParkRating(
rt, colours[3].colour, false, screenCoords, std::max(10, ((gameState.park.rating / 4) * 263) / 256));
}
}
void DrawParkRating(RenderTarget& rt, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor)
void DrawParkRating(RenderTarget& rt, Colour colour, bool blink, const ScreenCoordsXY& coords, uint8_t factor)
{
int16_t bar_width = (factor * 114) / 255;
Rectangle::fillInset(
rt, { coords + ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 114, 9 } }, colours[0],
Rectangle::BorderStyle::inset, Rectangle::FillBrightness::light, Rectangle::FillMode::none);
if (!(colour & kBarBlink) || GameIsPaused() || (gCurrentRealTimeTicks & 8))
if (!blink || GameIsPaused() || (gCurrentRealTimeTicks & 8))
{
if (bar_width > 2)
{
Rectangle::fillInset(
rt, { coords + ScreenCoordsXY{ 2, 2 }, coords + ScreenCoordsXY{ bar_width - 1, 8 } },
ColourWithFlags{ static_cast<uint8_t>(colour) });
ColourWithFlags{ colour });
}
}
@@ -255,7 +256,7 @@ namespace OpenRCT2::Ui::Windows
auto screenCoords = windowPos + ScreenCoordsXY{ middleOutsetWidget.midX(), middleOutsetWidget.top + 11 };
int32_t itemWidth = middleOutsetWidget.width() - 63;
DrawNewsTicker(
rt, screenCoords, itemWidth, COLOUR_BRIGHT_GREEN, STR_BOTTOM_TOOLBAR_NEWS_TEXT, newsItem->text,
rt, screenCoords, itemWidth, Drawing::Colour::brightGreen, STR_BOTTOM_TOOLBAR_NEWS_TEXT, newsItem->text,
newsItem->ticks);
const auto& newsSubjectWidget = widgets[WIDX_NEWS_SUBJECT];
+6 -6
View File
@@ -143,17 +143,17 @@ namespace OpenRCT2::Ui::Windows
static constexpr auto _guestWindowWidgetsStats = makeWidgets(
kMainGuestWidgets,
makeWidget ({ 3, (kListRowHeight * 0) + 4 + 43 }, { 62, 10 }, WidgetType::label, WindowColour::secondary, STR_GUEST_STAT_HAPPINESS_LABEL),
makeProgressBar({ 65, (kListRowHeight * 0) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_GREEN, 0, 19),
makeProgressBar({ 65, (kListRowHeight * 0) + 4 + 43 }, { 119, 10 }, Drawing::Colour::brightGreen, 0, 19),
makeWidget ({ 3, (kListRowHeight * 1) + 4 + 43 }, { 62, 10 }, WidgetType::label, WindowColour::secondary, STR_GUEST_STAT_ENERGY_LABEL),
makeProgressBar({ 65, (kListRowHeight * 1) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_GREEN, 0, 19),
makeProgressBar({ 65, (kListRowHeight * 1) + 4 + 43 }, { 119, 10 }, Drawing::Colour::brightGreen, 0, 19),
makeWidget ({ 3, (kListRowHeight * 2) + 4 + 43 }, { 62, 10 }, WidgetType::label, WindowColour::secondary, STR_GUEST_STAT_HUNGER_LABEL),
makeProgressBar({ 65, (kListRowHeight * 2) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 67, 100),
makeProgressBar({ 65, (kListRowHeight * 2) + 4 + 43 }, { 119, 10 }, Drawing::Colour::brightRed, 67, 100),
makeWidget ({ 3, (kListRowHeight * 3) + 4 + 43 }, { 62, 10 }, WidgetType::label, WindowColour::secondary, STR_GUEST_STAT_THIRST_LABEL),
makeProgressBar({ 65, (kListRowHeight * 3) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 67, 100),
makeProgressBar({ 65, (kListRowHeight * 3) + 4 + 43 }, { 119, 10 }, Drawing::Colour::brightRed, 67, 100),
makeWidget ({ 3, (kListRowHeight * 4) + 4 + 43 }, { 62, 10 }, WidgetType::label, WindowColour::secondary, STR_GUEST_STAT_NAUSEA_LABEL),
makeProgressBar({ 65, (kListRowHeight * 4) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 47, 100),
makeProgressBar({ 65, (kListRowHeight * 4) + 4 + 43 }, { 119, 10 }, Drawing::Colour::brightRed, 47, 100),
makeWidget ({ 3, (kListRowHeight * 5) + 4 + 43 }, { 62, 10 }, WidgetType::label, WindowColour::secondary, STR_GUEST_STAT_TOILET_LABEL),
makeProgressBar({ 65, (kListRowHeight * 5) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 62, 100),
makeProgressBar({ 65, (kListRowHeight * 5) + 4 + 43 }, { 119, 10 }, Drawing::Colour::brightRed, 62, 100),
makeWidget ({ 3, (kListRowHeight * 7) + 9 + 43 }, { 180, 2 }, WidgetType::horizontalSeparator, WindowColour::secondary)
);
+1 -1
View File
@@ -635,7 +635,7 @@ namespace OpenRCT2::Ui::Windows
auto* animObj = findPeepAnimationsObjectForType(AnimationPeepType::guest);
i += animObj->GetPeepAnimation(PeepAnimationGroup::normal).baseImage + 1;
GfxDrawSprite(
rt, ImageId(i, COLOUR_GREY, COLOUR_DARK_OLIVE_GREEN),
rt, ImageId(i, Drawing::Colour::grey, Drawing::Colour::darkOliveGreen),
windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].midX(), widgets[WIDX_TAB_1].bottom - 6 });
// Tab 2 image
+1 -1
View File
@@ -858,7 +858,7 @@ namespace OpenRCT2::Ui::Windows
if (surfaceObj != nullptr)
{
surfaceImage = ImageId(surfaceObj->IconImageId);
if (surfaceObj->Colour != TerrainSurfaceObject::kNoValue)
if (surfaceObj->Colour != Drawing::kColourNull)
surfaceImage = surfaceImage.WithPrimary(surfaceObj->Colour);
}
+5 -3
View File
@@ -478,7 +478,8 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(
rt, textPos, previewText, {},
{ ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true), TextAlignment::centre });
{ ColourWithFlags{ Drawing::Colour::white }.withFlag(ColourFlag::withOutline, true),
TextAlignment::centre });
return;
}
@@ -774,7 +775,7 @@ namespace OpenRCT2::Ui::Windows
auto cRT = const_cast<const RenderTarget&>(rt);
DrawTextEllipsised(
cRT, windowPos + ScreenCoordsXY{ widget.left + 5, widget.top + 1 }, widget.width() - 1, strId, ft,
{ COLOUR_GREY });
{ Drawing::Colour::grey });
};
auto& config = Config::Get().general;
@@ -794,7 +795,8 @@ namespace OpenRCT2::Ui::Windows
if (action == LoadSaveAction::save)
{
auto& widget = widgets[WIDX_FILENAME_TEXTBOX];
DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 5, widget.top + 2 }, STR_FILENAME_LABEL, {}, { COLOUR_GREY });
DrawTextBasic(
rt, windowPos + ScreenCoordsXY{ 5, widget.top + 2 }, STR_FILENAME_LABEL, {}, { Drawing::Colour::grey });
}
}
+1 -1
View File
@@ -1191,7 +1191,7 @@ namespace OpenRCT2::Ui::Windows
if (surfaceObj != nullptr)
{
surfaceImage = ImageId(surfaceObj->IconImageId);
if (surfaceObj->Colour != TerrainSurfaceObject::kNoValue)
if (surfaceObj->Colour != kColourNull)
{
surfaceImage = surfaceImage.WithPrimary(surfaceObj->Colour);
}
+1 -1
View File
@@ -269,7 +269,7 @@ namespace OpenRCT2::Ui::Windows
_buffer.clear();
// Draw player name
auto colour = ColourWithFlags{ COLOUR_BLACK };
auto colour = ColourWithFlags{ Drawing::Colour::black };
if (listPosition == selectedListItem)
{
Rectangle::filter(
+1 -1
View File
@@ -97,7 +97,7 @@ namespace OpenRCT2::Ui::Windows
ScreenCoordsXY screenCoords(windowPos.x + (width / 2), windowPos.y + (height / 2));
screenCoords.x -= GfxGetStringWidth(_buffer, FontStyle::medium) / 2;
DrawText(rt, screenCoords, { COLOUR_BLACK }, _buffer.c_str());
DrawText(rt, screenCoords, { Drawing::Colour::black }, _buffer.c_str());
}
void setCloseCallBack(CloseCallback callback)
+4 -4
View File
@@ -169,7 +169,7 @@ namespace OpenRCT2::Ui::Windows
Widget groupWidget = {
.type = WidgetType::groupbox,
.colour = colours[1].colour,
.colour = EnumValue(colours[1].colour),
.left = static_cast<int16_t>(baseCheckBox.left - 5),
.right = static_cast<int16_t>(baseCheckBox.right + 5),
.top = y,
@@ -185,7 +185,7 @@ namespace OpenRCT2::Ui::Windows
// Create checkbox widgets
Widget checkboxWidget = {
.type = WidgetType::checkbox,
.colour = colours[1].colour,
.colour = EnumValue(colours[1].colour),
.left = baseCheckBox.left,
.right = baseCheckBox.right,
.top = y,
@@ -491,7 +491,7 @@ namespace OpenRCT2::Ui::Windows
auto ft = Formatter();
ft.Add<StringId>(DateDayNames[newsItem.day - 1]);
ft.Add<StringId>(DateGameMonthNames[DateGetMonth(newsItem.monthYear)]);
DrawTextBasic(rt, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { COLOUR_WHITE, FontStyle::small });
DrawTextBasic(rt, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { Drawing::Colour::white, FontStyle::small });
}
// Item text
{
@@ -499,7 +499,7 @@ namespace OpenRCT2::Ui::Windows
ft.Add<const char*>(newsItem.text.c_str());
DrawTextWrapped(
rt, { 2, y + lineHeight }, 325, STR_BOTTOM_TOOLBAR_NEWS_TEXT, ft,
{ COLOUR_BRIGHT_GREEN, FontStyle::small });
{ Drawing::Colour::brightGreen, FontStyle::small });
}
// Subject button
if (newsItem.typeHasSubject() && !newsItem.hasButton())
+7 -6
View File
@@ -403,9 +403,9 @@ namespace OpenRCT2::Ui::Windows
setWidgets(window_object_load_error_widgets);
WindowInitScrollWidgets(*this);
colours[0] = COLOUR_LIGHT_BLUE;
colours[1] = COLOUR_LIGHT_BLUE;
colours[2] = COLOUR_LIGHT_BLUE;
colours[0] = Drawing::Colour::lightBlue;
colours[1] = Drawing::Colour::lightBlue;
colours[2] = Drawing::Colour::lightBlue;
}
void onClose() override
@@ -547,18 +547,19 @@ namespace OpenRCT2::Ui::Windows
auto name = entry.GetName();
char buffer[256];
String::set(buffer, sizeof(buffer), name.data(), name.size());
DrawText(rt, screenCoords, { COLOUR_DARK_GREEN }, buffer);
DrawText(rt, screenCoords, { Drawing::Colour::darkGreen }, buffer);
if (entry.Generation == ObjectGeneration::DAT)
{
// ... source game ...
const auto sourceStringId = ObjectManagerGetSourceGameString(entry.Entry.GetSourceGame());
DrawTextBasic(rt, { kSourceColLeft - 3, screenCoords.y }, sourceStringId, {}, { COLOUR_DARK_GREEN });
DrawTextBasic(
rt, { kSourceColLeft - 3, screenCoords.y }, sourceStringId, {}, { Drawing::Colour::darkGreen });
}
// ... and type
const auto type = GetStringFromObjectType(entry.GetType());
DrawTextBasic(rt, { kTypeColLeft - 3, screenCoords.y }, type, {}, { COLOUR_DARK_GREEN });
DrawTextBasic(rt, { kTypeColLeft - 3, screenCoords.y }, type, {}, { Drawing::Colour::darkGreen });
}
}
+2 -1
View File
@@ -1244,7 +1244,8 @@ namespace OpenRCT2::Ui::Windows
auto* animObj = findPeepAnimationsObjectForType(AnimationPeepType::guest);
ImageId peepImage(
animObj->GetPeepAnimation(PeepAnimationGroup::normal).baseImage + 1, COLOUR_BRIGHT_RED, COLOUR_DARK_WATER);
animObj->GetPeepAnimation(PeepAnimationGroup::normal).baseImage + 1, Drawing::Colour::brightRed,
Drawing::Colour::darkWater);
if (page == WINDOW_PARK_PAGE_GUESTS)
peepImage = peepImage.WithIndexOffset(_peepAnimationFrame & 0xFFFFFFFC);
+11 -11
View File
@@ -46,23 +46,23 @@ namespace OpenRCT2::Ui::Windows
static std::array<LoaderVehicleStyle, 4> kVehicleStyles = { {
{
ImageId{SPR_G2_LOADER_HYBRID_SUPPORTS, COLOUR_LIGHT_ORANGE, COLOUR_DARK_BROWN },
ImageId{SPR_G2_LOADER_HYBRID_TRACK, COLOUR_LIGHT_ORANGE, COLOUR_LIGHT_ORANGE },
ImageId{SPR_G2_LOADER_HYBRID_VEHICLE, COLOUR_OLIVE_GREEN, COLOUR_OLIVE_GREEN, COLOUR_BRIGHT_RED }
ImageId{SPR_G2_LOADER_HYBRID_SUPPORTS, Drawing::Colour::lightOrange, Drawing::Colour::darkBrown },
ImageId{SPR_G2_LOADER_HYBRID_TRACK, Drawing::Colour::lightOrange, Drawing::Colour::lightOrange },
ImageId{SPR_G2_LOADER_HYBRID_VEHICLE, Drawing::Colour::oliveGreen, Drawing::Colour::oliveGreen, Drawing::Colour::brightRed }
},
{
ImageId{SPR_G2_LOADER_STEEL_SUPPORTS, COLOUR_LIGHT_BROWN, COLOUR_BLACK },
ImageId{SPR_G2_LOADER_STEEL_TRACK, COLOUR_LIGHT_BROWN, COLOUR_LIGHT_BROWN },
ImageId{SPR_G2_LOADER_STEEL_VEHICLE, COLOUR_LIGHT_BLUE, COLOUR_WHITE, COLOUR_LIGHT_BLUE }
ImageId{SPR_G2_LOADER_STEEL_SUPPORTS, Drawing::Colour::lightBrown, Drawing::Colour::black },
ImageId{SPR_G2_LOADER_STEEL_TRACK, Drawing::Colour::lightBrown, Drawing::Colour::lightBrown },
ImageId{SPR_G2_LOADER_STEEL_VEHICLE, Drawing::Colour::lightBlue, Drawing::Colour::white, Drawing::Colour::lightBlue }
},
{
ImageId{SPR_G2_LOADER_WOODEN_SUPPORTS, COLOUR_BLACK, COLOUR_WHITE },
ImageId{SPR_G2_LOADER_WOODEN_TRACK, COLOUR_BORDEAUX_RED, COLOUR_BLACK },
ImageId{SPR_G2_LOADER_WOODEN_VEHICLE, COLOUR_BRIGHT_RED, COLOUR_BRIGHT_RED, COLOUR_SATURATED_BROWN}
ImageId{SPR_G2_LOADER_WOODEN_SUPPORTS, Drawing::Colour::black, Drawing::Colour::white },
ImageId{SPR_G2_LOADER_WOODEN_TRACK, Drawing::Colour::bordeauxRed, Drawing::Colour::black },
ImageId{SPR_G2_LOADER_WOODEN_VEHICLE, Drawing::Colour::brightRed, Drawing::Colour::brightRed, Drawing::Colour::saturatedBrown}
},
{
ImageId{SPR_G2_LOADER_GO_KARTS_SUPPORTS, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN },
ImageId{SPR_G2_LOADER_GO_KARTS_TRACK, COLOUR_BLACK, COLOUR_BLACK },
ImageId{SPR_G2_LOADER_GO_KARTS_SUPPORTS, Drawing::Colour::darkBrown, Drawing::Colour::darkBrown },
ImageId{SPR_G2_LOADER_GO_KARTS_TRACK, Drawing::Colour::black, Drawing::Colour::black },
ImageId{SPR_G2_LOADER_GO_KARTS_VEHICLES }
},
} };
+25 -25
View File
@@ -321,8 +321,8 @@ namespace OpenRCT2::Ui::Windows
makeWidget ({289, 108}, { 24, 24}, WidgetType::flatBtn, WindowColour::secondary, 0xFFFFFFFF, STR_LOCATE_NEAREST_AVAILABLE_MECHANIC_TIP ),
makeWidget ({265, 108}, { 24, 24}, WidgetType::flatBtn, WindowColour::secondary, ImageId(SPR_CONSTRUCTION), STR_REFURBISH_RIDE_TIP ),
makeWidget ({241, 108}, { 24, 24}, WidgetType::flatBtn, WindowColour::secondary, ImageId(SPR_NO_ENTRY), STR_DEBUG_FORCE_BREAKDOWN_TIP ),
makeProgressBar({107, 47}, { 147, 10}, COLOUR_BRIGHT_GREEN ),
makeProgressBar({107, 58}, { 147, 10}, COLOUR_BRIGHT_RED )
makeProgressBar({107, 47}, { 147, 10}, Drawing::Colour::brightGreen ),
makeProgressBar({107, 58}, { 147, 10}, Drawing::Colour::brightRed )
);
// 0x009AE2A4
@@ -1333,7 +1333,7 @@ namespace OpenRCT2::Ui::Windows
spriteIndex += animObj->GetPeepAnimation(PeepAnimationGroup::normal).baseImage + 1;
GfxDrawSprite(
rt, ImageId(spriteIndex, COLOUR_BRIGHT_RED, COLOUR_DARK_WATER),
rt, ImageId(spriteIndex, Drawing::Colour::brightRed, Drawing::Colour::darkWater),
windowPos + ScreenCoordsXY{ widget.midX(), widget.bottom - 6 });
}
}
@@ -3693,7 +3693,7 @@ namespace OpenRCT2::Ui::Windows
auto underWidget = ride->mode == RideMode::poweredLaunchBlockSectioned ? WIDX_MODE_TWEAK : WIDX_MODE;
DrawTextBasic(
rt, windowPos + ScreenCoordsXY{ 21, widgets[underWidget].bottom + 3 }, STR_BLOCK_SECTIONS, ft,
{ COLOUR_BLACK });
{ Drawing::Colour::black });
}
}
@@ -4026,7 +4026,7 @@ namespace OpenRCT2::Ui::Windows
// Locate mechanic button image
Widget* widget = &widgets[WIDX_LOCATE_MECHANIC];
auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top };
auto image = ImageId(SPR_MECHANIC, COLOUR_BLACK, getGameState().park.staffMechanicColour);
auto image = ImageId(SPR_MECHANIC, Drawing::Colour::black, getGameState().park.staffMechanicColour);
GfxDrawSprite(rt, image, screenCoords);
// Inspection label
@@ -4252,25 +4252,25 @@ namespace OpenRCT2::Ui::Windows
{
if (allowChangingBodyColour)
{
colour_t colour = UtilRand() % kColourNumNormal;
auto colour = static_cast<Colour>(UtilRand() % kColourNumNormal);
auto vehicleSetBodyColourAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourBody, colour, i);
rideId, GameActions::RideSetAppearanceType::VehicleColourBody, EnumValue(colour), i);
GameActions::Execute(&vehicleSetBodyColourAction, gameState);
}
if (allowChangingTrimColour)
{
colour_t colour = UtilRand() % kColourNumNormal;
auto colour = static_cast<Colour>(UtilRand() % kColourNumNormal);
auto vehicleSetTrimColourAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourTrim, colour, i);
rideId, GameActions::RideSetAppearanceType::VehicleColourTrim, EnumValue(colour), i);
GameActions::Execute(&vehicleSetTrimColourAction, gameState);
}
if (allowChangingTertiaryColour)
{
colour_t colour = UtilRand() % kColourNumNormal;
auto colour = static_cast<Colour>(UtilRand() % kColourNumNormal);
auto vehicleSetTertiaryColourAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourTertiary, colour, i);
rideId, GameActions::RideSetAppearanceType::VehicleColourTertiary, EnumValue(colour), i);
GameActions::Execute(&vehicleSetTertiaryColourAction, gameState);
}
}
@@ -4341,7 +4341,7 @@ namespace OpenRCT2::Ui::Windows
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, 4, widgets[widgetIndex].right - dropdownWidget->left);
gDropdown.items[ride->trackColours[colourSchemeIndex].supports].setChecked(true);
gDropdown.items[EnumValue(ride->trackColours[colourSchemeIndex].supports)].setChecked(true);
break;
}
case WIDX_ENTRANCE_STYLE_DROPDOWN:
@@ -4441,8 +4441,8 @@ namespace OpenRCT2::Ui::Windows
case WIDX_TRACK_MAIN_COLOUR:
{
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::TrackColourMain, ColourDropDownIndexToColour(dropdownIndex),
_rideColour);
rideId, GameActions::RideSetAppearanceType::TrackColourMain,
EnumValue(ColourDropDownIndexToColour(dropdownIndex)), _rideColour);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
@@ -4450,7 +4450,7 @@ namespace OpenRCT2::Ui::Windows
{
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::TrackColourAdditional,
ColourDropDownIndexToColour(dropdownIndex), _rideColour);
EnumValue(ColourDropDownIndexToColour(dropdownIndex)), _rideColour);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
@@ -4458,7 +4458,7 @@ namespace OpenRCT2::Ui::Windows
{
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::TrackColourSupports,
ColourDropDownIndexToColour(dropdownIndex), _rideColour);
EnumValue(ColourDropDownIndexToColour(dropdownIndex)), _rideColour);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
@@ -4509,7 +4509,7 @@ namespace OpenRCT2::Ui::Windows
{
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourBody,
ColourDropDownIndexToColour(dropdownIndex), _vehicleIndex);
EnumValue(ColourDropDownIndexToColour(dropdownIndex)), _vehicleIndex);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
@@ -4517,7 +4517,7 @@ namespace OpenRCT2::Ui::Windows
{
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourTrim,
ColourDropDownIndexToColour(dropdownIndex), _vehicleIndex);
EnumValue(ColourDropDownIndexToColour(dropdownIndex)), _vehicleIndex);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
@@ -4525,7 +4525,7 @@ namespace OpenRCT2::Ui::Windows
{
auto rideSetAppearanceAction = GameActions::RideSetAppearanceAction(
rideId, GameActions::RideSetAppearanceType::VehicleColourTertiary,
ColourDropDownIndexToColour(dropdownIndex), _vehicleIndex);
EnumValue(ColourDropDownIndexToColour(dropdownIndex)), _vehicleIndex);
GameActions::Execute(&rideSetAppearanceAction, gameState);
}
break;
@@ -4582,7 +4582,7 @@ namespace OpenRCT2::Ui::Windows
{
widgets[WIDX_MAZE_STYLE].type = WidgetType::dropdownMenu;
widgets[WIDX_MAZE_STYLE_DROPDOWN].type = WidgetType::button;
widgets[WIDX_MAZE_STYLE].text = MazeOptions[trackColour.supports].text;
widgets[WIDX_MAZE_STYLE].text = MazeOptions[EnumValue(trackColour.supports)].text;
}
else
{
@@ -4829,7 +4829,7 @@ namespace OpenRCT2::Ui::Windows
const auto& rtd = ride->getRideTypeDescriptor();
if (rtd.specialType == RtdSpecialType::maze)
{
GfxDrawSprite(rt, ImageId(MazeOptions[trackColour.supports].sprite), screenCoords);
GfxDrawSprite(rt, ImageId(MazeOptions[EnumValue(trackColour.supports)].sprite), screenCoords);
}
else
{
@@ -4858,7 +4858,7 @@ namespace OpenRCT2::Ui::Windows
: rideEntry->shop_item[1];
if (ride->hasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS))
{
colour_t spriteColour = (getGameState().currentTicks / 32) % COLOUR_COUNT;
auto spriteColour = static_cast<Colour>((getGameState().currentTicks / 32) % kColourNumTotal);
GfxDrawSprite(rt, ImageId(GetShopItemDescriptor(shopItem).Image, spriteColour), screenCoords);
}
@@ -6043,7 +6043,7 @@ namespace OpenRCT2::Ui::Windows
void GraphsOnScrollDraw(RenderTarget& rt, int32_t scrollIndex)
{
GfxClear(rt, getColourMap(COLOUR_SATURATED_GREEN).darker);
GfxClear(rt, getColourMap(Drawing::Colour::saturatedGreen).darker);
auto widget = &widgets[WIDX_GRAPH];
auto ride = GetRide(rideId);
@@ -6064,8 +6064,8 @@ namespace OpenRCT2::Ui::Windows
}
// Vertical grid lines
const auto lightColour = getColourMap(COLOUR_SATURATED_GREEN).midLight;
const auto darkColour = getColourMap(COLOUR_SATURATED_GREEN).midDark;
const auto lightColour = getColourMap(Drawing::Colour::saturatedGreen).midLight;
const auto darkColour = getColourMap(Drawing::Colour::saturatedGreen).midDark;
int32_t time = 0;
for (int32_t x = 0; x < rt.x + rt.width; x += 80)
-1
View File
@@ -22,7 +22,6 @@
#include <openrct2/drawing/ColourMap.h>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/drawing/Rectangle.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/network/Network.h>
#include <openrct2/ride/RideData.h>
+3 -2
View File
@@ -327,7 +327,8 @@ namespace OpenRCT2::Ui::Windows
ft.Add<StringId>(kScenarioOriginStringIds[i]);
auto stringCoords = windowPos + ScreenCoordsXY{ widget.midX(), widget.midY() - 3 };
DrawTextWrapped(rt, stringCoords, 87, format, ft, { COLOUR_LIGHT_WATER, fontStyle, TextAlignment::centre });
DrawTextWrapped(
rt, stringCoords, 87, format, ft, { Drawing::Colour::lightWater, fontStyle, TextAlignment::centre });
}
auto previewPaneWidth = GetPreviewPaneWidth();
@@ -600,7 +601,7 @@ namespace OpenRCT2::Ui::Windows
ft.Add<StringId>(STR_STRING);
ft.Add<const char*>(scenario->Name.c_str());
auto colour = isDisabled ? colours[1].withFlag(ColourFlag::inset, true)
: ColourWithFlags{ COLOUR_BLACK };
: ColourWithFlags{ Drawing::Colour::black };
auto darkness = isDisabled ? TextDarkness::dark : TextDarkness::regular;
const auto scrollCentre = widgets[WIDX_SCENARIOLIST].width() / 2;
+15 -16
View File
@@ -137,9 +137,9 @@ namespace OpenRCT2::Ui::Windows
static std::vector<ScenerySelection> _tabSelections;
static bool _sceneryPaintEnabled;
static colour_t _sceneryPrimaryColour;
static colour_t _scenerySecondaryColour;
static colour_t _sceneryTertiaryColour;
static Colour _sceneryPrimaryColour;
static Colour _scenerySecondaryColour;
static Colour _sceneryTertiaryColour;
uint8_t gWindowSceneryRotation;
bool gWindowSceneryEyedropperEnabled;
@@ -938,8 +938,8 @@ namespace OpenRCT2::Ui::Windows
}
void setSelectedItem(
const ScenerySelection& scenery, const std::optional<colour_t> primary, const std::optional<colour_t> secondary,
const std::optional<colour_t> tertiary, const std::optional<colour_t> rotation)
const ScenerySelection& scenery, const std::optional<Colour> primary, const std::optional<Colour> secondary,
const std::optional<Colour> tertiary, const std::optional<uint8_t> rotation)
{
auto tabIndex = FindTabWithScenery(scenery);
if (!tabIndex.has_value())
@@ -2080,8 +2080,8 @@ namespace OpenRCT2::Ui::Windows
* on success places ghost scenery and returns cost to place proper
*/
money64 TryPlaceGhostSmallScenery(
CoordsXYZD loc, uint8_t quadrant, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour,
colour_t tertiaryColour)
CoordsXYZD loc, uint8_t quadrant, ObjectEntryIndex entryIndex, Colour primaryColour, Colour secondaryColour,
Colour tertiaryColour)
{
SceneryRemoveGhostToolPlacement();
@@ -2139,8 +2139,8 @@ namespace OpenRCT2::Ui::Windows
}
money64 TryPlaceGhostWall(
CoordsXYZ loc, uint8_t edge, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour,
colour_t tertiaryColour)
CoordsXYZ loc, uint8_t edge, ObjectEntryIndex entryIndex, Colour primaryColour, Colour secondaryColour,
Colour tertiaryColour)
{
SceneryRemoveGhostToolPlacement();
@@ -2167,8 +2167,7 @@ namespace OpenRCT2::Ui::Windows
}
money64 TryPlaceGhostLargeScenery(
CoordsXYZD loc, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour,
colour_t tertiaryColour)
CoordsXYZD loc, ObjectEntryIndex entryIndex, Colour primaryColour, Colour secondaryColour, Colour tertiaryColour)
{
SceneryRemoveGhostToolPlacement();
@@ -3424,8 +3423,8 @@ namespace OpenRCT2::Ui::Windows
}
void WindowScenerySetSelectedItem(
const ScenerySelection& scenery, const std::optional<colour_t> primary, const std::optional<colour_t> secondary,
const std::optional<colour_t> tertiary, const std::optional<colour_t> rotation)
const ScenerySelection& scenery, const std::optional<Colour> primary, const std::optional<Colour> secondary,
const std::optional<Colour> tertiary, const std::optional<uint8_t> rotation)
{
auto* windowMgr = GetWindowManager();
auto* w = static_cast<SceneryWindow*>(windowMgr->BringToFrontByClass(WindowClass::scenery));
@@ -3456,9 +3455,9 @@ namespace OpenRCT2::Ui::Windows
void WindowScenerySetDefaultPlacementConfiguration()
{
gWindowSceneryRotation = 3;
_sceneryPrimaryColour = COLOUR_BORDEAUX_RED;
_scenerySecondaryColour = COLOUR_YELLOW;
_sceneryTertiaryColour = COLOUR_DARK_BROWN;
_sceneryPrimaryColour = Colour::bordeauxRed;
_scenerySecondaryColour = Colour::yellow;
_sceneryTertiaryColour = Colour::darkBrown;
WindowSceneryResetSelectedSceneryItems();
}
+6 -7
View File
@@ -22,7 +22,6 @@
#include <openrct2/drawing/ColourMap.h>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/drawing/Rectangle.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/network/Network.h>
#include <openrct2/network/ServerList.h>
@@ -233,7 +232,7 @@ namespace OpenRCT2::Ui::Windows
windowPos.x + listWidget.left + screenCoords.x + 2 - scrolls[0].contentOffsetX,
windowPos.y + listWidget.top + screenCoords.y + 2 - scrolls[0].contentOffsetY
};
WindowDropdownShowText(dropdownPos, 0, { COLOUR_GREY }, 0, dropdownItems);
WindowDropdownShowText(dropdownPos, 0, { Drawing::Colour::grey }, 0, dropdownItems);
}
}
@@ -312,7 +311,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(
rt, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PLAYER_NAME_INPUT].top }, STR_PLAYER_NAME, {},
{ COLOUR_WHITE });
{ Drawing::Colour::white });
// Draw version number
std::string version = Network::GetVersion();
@@ -320,11 +319,11 @@ namespace OpenRCT2::Ui::Windows
ft.Add<const char*>(version.c_str());
DrawTextBasic(
rt, windowPos + ScreenCoordsXY{ 324, widgets[WIDX_START_SERVER].top + 1 }, STR_NETWORK_VERSION, ft,
{ COLOUR_WHITE });
{ Drawing::Colour::white });
ft = Formatter();
ft.Add<uint32_t>(_numPlayersOnline);
DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 8, height - 15 }, _statusText, ft, { COLOUR_WHITE });
DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 8, height - 15 }, _statusText, ft, { Drawing::Colour::white });
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
@@ -357,11 +356,11 @@ namespace OpenRCT2::Ui::Windows
auto colour = colours[1];
if (serverDetails.Favourite)
{
colour = COLOUR_YELLOW;
colour = Drawing::Colour::yellow;
}
else if (serverDetails.Local)
{
colour = COLOUR_MOSS_GREEN;
colour = Drawing::Colour::mossGreen;
}
screenCoords.x = 3;
+2 -2
View File
@@ -64,8 +64,8 @@ namespace OpenRCT2::Ui::Windows
private:
bool _isSmall = false;
ObjectEntryIndex _sceneryEntry = kObjectEntryIndexNull;
colour_t _mainColour = {};
colour_t _textColour = {};
Drawing::Colour _mainColour = {};
Drawing::Colour _textColour = {};
BannerIndex GetBannerIndex() const
{
@@ -15,7 +15,6 @@
#include <openrct2/drawing/Drawing.h>
#include <openrct2/entity/EntityRegistry.h>
#include <openrct2/entity/Staff.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/ui/WindowManager.h>
+1 -1
View File
@@ -605,7 +605,7 @@ namespace OpenRCT2::Ui::Windows
DrawTabImage(rt, WINDOW_STAFF_LIST_TAB_ENTERTAINERS, AnimationPeepType::entertainer);
}
void DrawTabImage(RenderTarget& rt, int32_t tabIndex, AnimationPeepType type, colour_t colour) const
void DrawTabImage(RenderTarget& rt, int32_t tabIndex, AnimationPeepType type, Drawing::Colour colour) const
{
PeepAnimationsObject* animObj = findPeepAnimationsObjectForType(type);
if (animObj == nullptr)
+3 -3
View File
@@ -79,9 +79,9 @@ namespace OpenRCT2::Ui::Windows
_parentWidget.window.number = 0;
_parentWidget.widgetIndex = 0;
colours[0] = COLOUR_GREY;
colours[1] = COLOUR_GREY;
colours[2] = COLOUR_GREY;
colours[0] = Drawing::Colour::grey;
colours[1] = Drawing::Colour::grey;
colours[2] = Drawing::Colour::grey;
}
else
{
+1 -1
View File
@@ -762,7 +762,7 @@ namespace OpenRCT2::Ui::Windows
if (colour.flags.has(ColourFlag::translucent))
{
TranslucentWindowPalette windowPalette = kTranslucentWindowPalettes[colour.colour];
TranslucentWindowPalette windowPalette = kTranslucentWindowPalettes[EnumValue(colour.colour)];
Rectangle::filter(rt, { leftTop, rightBottom }, windowPalette.highlight);
Rectangle::filter(rt, { leftTop + yPixelOffset, rightBottom + yPixelOffset }, windowPalette.shadow);
+6 -5
View File
@@ -1167,7 +1167,8 @@ static uint64_t PageDisabledWidgets[] = {
{
auto ft = Formatter();
ft.Add<StringId>(surfaceObj->NameStringId);
DrawTextBasic(rt, screenCoords, STR_TILE_INSPECTOR_FOOTPATH_SURFACE_NAME, ft, { COLOUR_WHITE });
DrawTextBasic(
rt, screenCoords, STR_TILE_INSPECTOR_FOOTPATH_SURFACE_NAME, ft, { Drawing::Colour::white });
}
// Railings name
@@ -1178,7 +1179,7 @@ static uint64_t PageDisabledWidgets[] = {
ft.Add<StringId>(railingsObj->NameStringId);
DrawTextBasic(
rt, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_FOOTPATH_RAILINGS_NAME, ft,
{ COLOUR_WHITE });
{ Drawing::Colour::white });
}
}
else
@@ -1187,7 +1188,7 @@ static uint64_t PageDisabledWidgets[] = {
auto footpathEntry = reinterpret_cast<const FootpathEntry*>(footpathObj->GetLegacyData());
auto ft = Formatter();
ft.Add<StringId>(footpathEntry->string_idx);
DrawTextBasic(rt, screenCoords, STR_TILE_INSPECTOR_PATH_NAME, ft, { COLOUR_WHITE });
DrawTextBasic(rt, screenCoords, STR_TILE_INSPECTOR_PATH_NAME, ft, { Drawing::Colour::white });
}
// Path addition
@@ -1201,13 +1202,13 @@ static uint64_t PageDisabledWidgets[] = {
ft.Add<StringId>(additionNameId);
DrawTextBasic(
rt, screenCoords + ScreenCoordsXY{ 0, 2 * 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS, ft,
{ COLOUR_WHITE });
{ Drawing::Colour::white });
}
else
{
DrawTextBasic(
rt, screenCoords + ScreenCoordsXY{ 0, 2 * 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS_NONE, {},
{ COLOUR_WHITE });
{ Drawing::Colour::white });
}
// Properties
+3 -4
View File
@@ -11,7 +11,6 @@
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/SpriteIds.h>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/interface/ColourWithFlags.h>
#include <openrct2/ui/WindowManager.h>
@@ -38,9 +37,9 @@ namespace OpenRCT2::Ui::Windows
{
setWidgets(_titleLogoWidgets);
WindowInitScrollWidgets(*this);
colours[0] = ColourWithFlags{ COLOUR_GREY }.withFlag(ColourFlag::translucent, true);
colours[1] = ColourWithFlags{ COLOUR_GREY }.withFlag(ColourFlag::translucent, true);
colours[2] = ColourWithFlags{ COLOUR_GREY }.withFlag(ColourFlag::translucent, true);
colours[0] = ColourWithFlags{ Drawing::Colour::grey }.withFlag(ColourFlag::translucent, true);
colours[1] = ColourWithFlags{ Drawing::Colour::grey }.withFlag(ColourFlag::translucent, true);
colours[2] = ColourWithFlags{ Drawing::Colour::grey }.withFlag(ColourFlag::translucent, true);
}
void onMouseUp(WidgetIndex widgetIndex) override
+1 -1
View File
@@ -116,7 +116,7 @@ namespace OpenRCT2::Ui::Windows
width = x;
widgets[WIDX_NEW_VERSION].right = width;
windowPos.x = (ContextGetWidth() - width) / 2;
colours[1] = ColourWithFlags{ COLOUR_LIGHT_ORANGE }.withFlag(ColourFlag::translucent, true);
colours[1] = ColourWithFlags{ Drawing::Colour::lightOrange }.withFlag(ColourFlag::translucent, true);
initScrollWidgets();
}
+1 -2
View File
@@ -12,7 +12,6 @@
#include <openrct2/Context.h>
#include <openrct2/Version.h>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/interface/ColourWithFlags.h>
#include <openrct2/ui/WindowManager.h>
@@ -27,7 +26,7 @@ namespace OpenRCT2::Ui::Windows
void onDraw(Drawing::RenderTarget& rt) override
{
// Write name and version information
const auto whiteOutline = ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true);
const auto whiteOutline = ColourWithFlags{ Drawing::Colour::white }.withFlag(ColourFlag::withOutline, true);
DrawText(rt, windowPos, { whiteOutline }, gVersionInfoFull);
width = GfxGetStringWidth(gVersionInfoFull, FontStyle::medium);
+2 -2
View File
@@ -1421,7 +1421,7 @@ namespace OpenRCT2::Ui::Windows
// Draw an overlay if clearance checks are disabled
if (getGameState().cheats.disableClearanceChecks)
{
auto colour = ColourWithFlags{ COLOUR_DARK_ORANGE }.withFlag(ColourFlag::withOutline, true);
auto colour = ColourWithFlags{ Drawing::Colour::darkOrange }.withFlag(ColourFlag::withOutline, true);
DrawTextBasic(
rt, screenPos + ScreenCoordsXY{ 26, 2 }, STR_OVERLAY_CLEARANCE_CHECKS_DISABLED, {},
{ colour, TextAlignment::right });
@@ -1487,7 +1487,7 @@ namespace OpenRCT2::Ui::Windows
// Draw number of players.
auto ft = Formatter();
ft.Add<int32_t>(Network::GetNumVisiblePlayers());
auto colour = ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true);
auto colour = ColourWithFlags{ Drawing::Colour::white }.withFlag(ColourFlag::withOutline, true);
DrawTextBasic(rt, screenPos + ScreenCoordsXY{ 23, 1 }, STR_COMMA16, ft, { colour, TextAlignment::right });
}
+1 -1
View File
@@ -148,7 +148,7 @@ namespace OpenRCT2::Ui::Windows
// Locate mechanic button image
const auto& widget = widgets[WIDX_HIDE_STAFF];
auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top };
auto image = ImageId(SPR_MECHANIC, COLOUR_BLACK, getGameState().park.staffMechanicColour);
auto image = ImageId(SPR_MECHANIC, Drawing::Colour::black, getGameState().park.staffMechanicColour);
GfxDrawSprite(rt, image, screenCoords);
}
+2 -2
View File
@@ -270,8 +270,8 @@ namespace OpenRCT2::Ui::Windows
// Scenery
WindowBase* SceneryOpen();
void WindowScenerySetSelectedItem(
const ScenerySelection& sceneryconst, std::optional<colour_t> primary, std::optional<colour_t> secondary,
std::optional<colour_t> tertiary, std::optional<colour_t> rotation);
const ScenerySelection& sceneryconst, std::optional<Drawing::Colour> primary, std::optional<Drawing::Colour> secondary,
std::optional<Drawing::Colour> tertiary, std::optional<uint8_t> rotation);
void WindowScenerySetSelectedTab(ObjectEntryIndex sceneryGroupIndex);
void WindowScenerySetDefaultPlacementConfiguration();
void WindowSceneryInit();
-1
View File
@@ -37,7 +37,6 @@
#include "entity/PatrolArea.h"
#include "entity/Peep.h"
#include "entity/Staff.h"
#include "interface/Colour.h"
#include "interface/Screenshot.h"
#include "interface/Viewport.h"
#include "interface/Window.h"
+1 -1
View File
@@ -26,7 +26,7 @@
namespace OpenRCT2::GameActions
{
BannerPlaceAction::BannerPlaceAction(const CoordsXYZD& loc, ObjectEntryIndex bannerType, colour_t primaryColour)
BannerPlaceAction::BannerPlaceAction(const CoordsXYZD& loc, ObjectEntryIndex bannerType, Drawing::Colour primaryColour)
: _loc(loc)
, _bannerType(bannerType)
, _primaryColour(primaryColour)
+7 -2
View File
@@ -11,6 +11,11 @@
#include "GameAction.h"
namespace OpenRCT2::Drawing
{
enum class Colour : uint8_t;
}
namespace OpenRCT2::GameActions
{
struct BannerPlaceActionResult
@@ -23,11 +28,11 @@ namespace OpenRCT2::GameActions
private:
CoordsXYZD _loc;
ObjectEntryIndex _bannerType{ kBannerNull };
uint8_t _primaryColour{};
Drawing::Colour _primaryColour{};
public:
BannerPlaceAction() = default;
BannerPlaceAction(const CoordsXYZD& loc, ObjectEntryIndex bannerType, colour_t primaryColour);
BannerPlaceAction(const CoordsXYZD& loc, ObjectEntryIndex bannerType, Drawing::Colour primaryColour);
void AcceptParameters(GameActionParameterVisitor&) final;
@@ -20,7 +20,7 @@
namespace OpenRCT2::GameActions
{
BannerSetColourAction::BannerSetColourAction(const CoordsXYZD& loc, uint8_t primaryColour)
BannerSetColourAction::BannerSetColourAction(const CoordsXYZD& loc, Drawing::Colour primaryColour)
: _loc(loc)
, _primaryColour(primaryColour)
{
@@ -69,7 +69,7 @@ namespace OpenRCT2::GameActions
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_OFF_EDGE_OF_MAP);
}
if (_primaryColour > 31)
if (!Drawing::colourIsValid(_primaryColour))
{
LOG_ERROR("Invalid primary colour %u", _primaryColour);
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
+7 -2
View File
@@ -11,17 +11,22 @@
#include "GameAction.h"
namespace OpenRCT2::Drawing
{
enum class Colour : uint8_t;
}
namespace OpenRCT2::GameActions
{
class BannerSetColourAction final : public GameActionBase<GameCommand::SetBannerColour>
{
private:
CoordsXYZD _loc;
uint8_t _primaryColour{};
Drawing::Colour _primaryColour{};
public:
BannerSetColourAction() = default;
BannerSetColourAction(const CoordsXYZD& loc, uint8_t primaryColour);
BannerSetColourAction(const CoordsXYZD& loc, Drawing::Colour primaryColour);
void AcceptParameters(GameActionParameterVisitor&) final;
@@ -93,7 +93,7 @@ namespace OpenRCT2::GameActions
switch (_type)
{
case BannerSetStyleType::PrimaryColour:
if (_parameter > COLOUR_COUNT)
if (_parameter > Drawing::kColourNumTotal)
{
LOG_ERROR("Invalid primary colour %u", _parameter);
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
@@ -147,7 +147,7 @@ namespace OpenRCT2::GameActions
switch (_type)
{
case BannerSetStyleType::PrimaryColour:
banner->colour = _parameter;
banner->colour = static_cast<Drawing::Colour>(_parameter);
break;
case BannerSetStyleType::TextColour:
banner->textColour = static_cast<Drawing::TextColour>(_parameter);
+3 -2
View File
@@ -16,6 +16,7 @@
#include "../core/EnumUtils.hpp"
#include "../core/Guard.hpp"
#include "../core/String.hpp"
#include "../drawing/Colour.h"
#include "../drawing/Drawing.h"
#include "../entity/Duck.h"
#include "../entity/EntityList.h"
@@ -696,12 +697,12 @@ namespace OpenRCT2::GameActions
break;
case OBJECT_BALLOON:
peep->GiveItem(ShopItem::balloon);
peep->BalloonColour = ScenarioRandMax(kColourNumNormal);
peep->BalloonColour = static_cast<Drawing::Colour>(ScenarioRandMax(Drawing::kColourNumNormal));
peep->UpdateAnimationGroup();
break;
case OBJECT_UMBRELLA:
peep->GiveItem(ShopItem::umbrella);
peep->UmbrellaColour = ScenarioRandMax(kColourNumNormal);
peep->UmbrellaColour = static_cast<Drawing::Colour>(ScenarioRandMax(Drawing::kColourNumNormal));
peep->UpdateAnimationGroup();
break;
}
@@ -33,8 +33,8 @@
namespace OpenRCT2::GameActions
{
LargeSceneryPlaceAction::LargeSceneryPlaceAction(
const CoordsXYZD& loc, ObjectEntryIndex sceneryType, uint8_t primaryColour, uint8_t secondaryColour,
uint8_t tertiaryColour)
const CoordsXYZD& loc, ObjectEntryIndex sceneryType, Drawing::Colour primaryColour, Drawing::Colour secondaryColour,
Drawing::Colour tertiaryColour)
: _loc(loc)
, _sceneryType(sceneryType)
, _primaryColour(primaryColour)
@@ -79,22 +79,22 @@ namespace OpenRCT2::GameActions
money64 supportsCost = 0;
if (_primaryColour >= COLOUR_COUNT)
if (!Drawing::colourIsValid(_primaryColour))
{
LOG_ERROR("Invalid primary colour %u", _primaryColour);
return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR);
}
else if (_secondaryColour >= COLOUR_COUNT)
if (!Drawing::colourIsValid(_secondaryColour))
{
LOG_ERROR("Invalid secondary colour %u", _secondaryColour);
return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR);
}
else if (_tertiaryColour >= COLOUR_COUNT)
if (!Drawing::colourIsValid(_tertiaryColour))
{
LOG_ERROR("Invalid tertiary colour %u", _tertiaryColour);
return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_INVALID_COLOUR);
}
else if (_sceneryType >= kMaxLargeSceneryObjects)
if (_sceneryType >= kMaxLargeSceneryObjects)
{
LOG_ERROR("Invalid sceneryType %u", _sceneryType);
return Result(Status::invalidParameters, STR_CANT_POSITION_THIS_HERE, STR_ERR_VALUE_OUT_OF_RANGE);
@@ -242,7 +242,7 @@ namespace OpenRCT2::GameActions
}
banner->text = {};
banner->colour = 2;
banner->colour = Drawing::Colour::white;
banner->textColour = Drawing::TextColour::white;
banner->flags = { BannerFlag::isLargeScenery };
banner->type = 0;
@@ -31,16 +31,16 @@ namespace OpenRCT2::GameActions
private:
CoordsXYZD _loc;
ObjectEntryIndex _sceneryType{ kObjectEntryIndexNull };
uint8_t _primaryColour{};
uint8_t _secondaryColour{};
uint8_t _tertiaryColour{};
Drawing::Colour _primaryColour{};
Drawing::Colour _secondaryColour{};
Drawing::Colour _tertiaryColour{};
public:
LargeSceneryPlaceAction() = default;
LargeSceneryPlaceAction(
const CoordsXYZD& loc, ObjectEntryIndex sceneryType, uint8_t primaryColour, uint8_t secondaryColour,
uint8_t tertiaryColour);
const CoordsXYZD& loc, ObjectEntryIndex sceneryType, Drawing::Colour primaryColour, Drawing::Colour secondaryColour,
Drawing::Colour tertiaryColour);
void AcceptParameters(GameActionParameterVisitor&) final;
@@ -21,7 +21,8 @@
namespace OpenRCT2::GameActions
{
LargeScenerySetColourAction::LargeScenerySetColourAction(
const CoordsXYZD& loc, uint8_t tileIndex, uint8_t primaryColour, uint8_t secondaryColour, uint8_t tertiaryColour)
const CoordsXYZD& loc, uint8_t tileIndex, Drawing::Colour primaryColour, Drawing::Colour secondaryColour,
Drawing::Colour tertiaryColour)
: _loc(loc)
, _tileIndex(tileIndex)
, _primaryColour(primaryColour)
@@ -78,17 +79,17 @@ namespace OpenRCT2::GameActions
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_VALUE_OUT_OF_RANGE);
}
if (_primaryColour >= COLOUR_COUNT)
if (!Drawing::colourIsValid(_primaryColour))
{
LOG_ERROR("Invalid primary colour %u", _primaryColour);
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
}
else if (_secondaryColour >= COLOUR_COUNT)
if (!Drawing::colourIsValid(_secondaryColour))
{
LOG_ERROR("Invalid secondary colour %u", _secondaryColour);
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
}
else if (_tertiaryColour >= COLOUR_COUNT)
if (!Drawing::colourIsValid(_tertiaryColour))
{
LOG_ERROR("Invalid tertiary colour %u", _tertiaryColour);
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
@@ -18,14 +18,15 @@ namespace OpenRCT2::GameActions
private:
CoordsXYZD _loc;
uint8_t _tileIndex{};
uint8_t _primaryColour{};
uint8_t _secondaryColour{};
uint8_t _tertiaryColour{};
Drawing::Colour _primaryColour{};
Drawing::Colour _secondaryColour{};
Drawing::Colour _tertiaryColour{};
public:
LargeScenerySetColourAction() = default;
LargeScenerySetColourAction(
const CoordsXYZD& loc, uint8_t tileIndex, uint8_t primaryColour, uint8_t secondaryColour, uint8_t tertiaryColour);
const CoordsXYZD& loc, uint8_t tileIndex, Drawing::Colour primaryColour, Drawing::Colour secondaryColour,
Drawing::Colour tertiaryColour);
void AcceptParameters(GameActionParameterVisitor&) final;
+2 -2
View File
@@ -19,8 +19,8 @@ namespace OpenRCT2::GameActions
ride_type_t _rideType{ kRideTypeNull };
ObjectEntryIndex _subType{ kObjectEntryIndexNull };
ObjectEntryIndex _entranceObjectIndex{ kObjectEntryIndexNull };
uint8_t _trackColourPreset{ COLOUR_NULL };
uint8_t _vehicleColourPreset{ COLOUR_NULL };
uint8_t _trackColourPreset{ std::numeric_limits<uint8_t>::max() };
uint8_t _vehicleColourPreset{ std::numeric_limits<uint8_t>::max() };
RideInspection _inspectionInterval{ RideInspection::every30Minutes };
public:
@@ -103,27 +103,27 @@ namespace OpenRCT2::GameActions
switch (_type)
{
case RideSetAppearanceType::TrackColourMain:
ride->trackColours[_index].main = _value;
ride->trackColours[_index].main = static_cast<Drawing::Colour>(_value);
GfxInvalidateScreen();
break;
case RideSetAppearanceType::TrackColourAdditional:
ride->trackColours[_index].additional = _value;
ride->trackColours[_index].additional = static_cast<Drawing::Colour>(_value);
GfxInvalidateScreen();
break;
case RideSetAppearanceType::TrackColourSupports:
ride->trackColours[_index].supports = _value;
ride->trackColours[_index].supports = static_cast<Drawing::Colour>(_value);
GfxInvalidateScreen();
break;
case RideSetAppearanceType::VehicleColourBody:
ride->vehicleColours[_index].Body = _value;
ride->vehicleColours[_index].Body = static_cast<Drawing::Colour>(_value);
RideUpdateVehicleColours(*ride);
break;
case RideSetAppearanceType::VehicleColourTrim:
ride->vehicleColours[_index].Trim = _value;
ride->vehicleColours[_index].Trim = static_cast<Drawing::Colour>(_value);
RideUpdateVehicleColours(*ride);
break;
case RideSetAppearanceType::VehicleColourTertiary:
ride->vehicleColours[_index].Tertiary = _value;
ride->vehicleColours[_index].Tertiary = static_cast<Drawing::Colour>(_value);
RideUpdateVehicleColours(*ride);
break;
case RideSetAppearanceType::VehicleColourScheme:
+2 -1
View File
@@ -23,7 +23,8 @@
namespace OpenRCT2::GameActions
{
SignSetStyleAction::SignSetStyleAction(BannerIndex bannerIndex, uint8_t mainColour, uint8_t textColour, bool isLarge)
SignSetStyleAction::SignSetStyleAction(
BannerIndex bannerIndex, Drawing::Colour mainColour, Drawing::Colour textColour, bool isLarge)
: _bannerIndex(bannerIndex)
, _mainColour(mainColour)
, _textColour(textColour)
+3 -3
View File
@@ -17,13 +17,13 @@ namespace OpenRCT2::GameActions
{
private:
BannerIndex _bannerIndex{ BannerIndex::GetNull() };
uint8_t _mainColour{};
uint8_t _textColour{};
Drawing::Colour _mainColour{};
Drawing::Colour _textColour{};
bool _isLarge{};
public:
SignSetStyleAction() = default;
SignSetStyleAction(BannerIndex bannerIndex, uint8_t mainColour, uint8_t textColour, bool isLarge);
SignSetStyleAction(BannerIndex bannerIndex, Drawing::Colour mainColour, Drawing::Colour textColour, bool isLarge);
void AcceptParameters(GameActionParameterVisitor&) final;
@@ -39,8 +39,8 @@ namespace OpenRCT2::GameActions
using namespace OpenRCT2::Numerics;
SmallSceneryPlaceAction::SmallSceneryPlaceAction(
const CoordsXYZD& loc, uint8_t quadrant, ObjectEntryIndex sceneryType, uint8_t primaryColour, uint8_t secondaryColour,
uint8_t tertiaryColour)
const CoordsXYZD& loc, uint8_t quadrant, ObjectEntryIndex sceneryType, Drawing::Colour primaryColour,
Drawing::Colour secondaryColour, Drawing::Colour tertiaryColour)
: _loc(loc)
, _quadrant(quadrant)
, _sceneryType(sceneryType)
@@ -26,15 +26,15 @@ namespace OpenRCT2::GameActions
CoordsXYZD _loc;
uint8_t _quadrant{};
ObjectEntryIndex _sceneryType{};
uint8_t _primaryColour{};
uint8_t _secondaryColour{};
uint8_t _tertiaryColour{};
Drawing::Colour _primaryColour{};
Drawing::Colour _secondaryColour{};
Drawing::Colour _tertiaryColour{};
public:
SmallSceneryPlaceAction() = default;
SmallSceneryPlaceAction(
const CoordsXYZD& loc, uint8_t quadrant, ObjectEntryIndex sceneryType, uint8_t primaryColour,
uint8_t secondaryColour, uint8_t tertiaryColour);
const CoordsXYZD& loc, uint8_t quadrant, ObjectEntryIndex sceneryType, Drawing::Colour primaryColour,
Drawing::Colour secondaryColour, Drawing::Colour tertiaryColour);
void AcceptParameters(GameActionParameterVisitor&) final;
@@ -25,8 +25,8 @@
namespace OpenRCT2::GameActions
{
SmallScenerySetColourAction::SmallScenerySetColourAction(
const CoordsXYZ& loc, uint8_t quadrant, ObjectEntryIndex sceneryType, uint8_t primaryColour, uint8_t secondaryColour,
uint8_t tertiaryColour)
const CoordsXYZ& loc, uint8_t quadrant, ObjectEntryIndex sceneryType, Drawing::Colour primaryColour,
Drawing::Colour secondaryColour, Drawing::Colour tertiaryColour)
: _loc(loc)
, _quadrant(quadrant)
, _sceneryType(sceneryType)
@@ -19,15 +19,15 @@ namespace OpenRCT2::GameActions
CoordsXYZ _loc;
uint8_t _quadrant{};
ObjectEntryIndex _sceneryType{};
uint8_t _primaryColour{};
uint8_t _secondaryColour{};
uint8_t _tertiaryColour{};
Drawing::Colour _primaryColour{};
Drawing::Colour _secondaryColour{};
Drawing::Colour _tertiaryColour{};
public:
SmallScenerySetColourAction() = default;
SmallScenerySetColourAction(
const CoordsXYZ& loc, uint8_t quadrant, ObjectEntryIndex sceneryType, uint8_t primaryColour,
uint8_t secondaryColour, uint8_t tertiaryColour);
const CoordsXYZ& loc, uint8_t quadrant, ObjectEntryIndex sceneryType, Drawing::Colour primaryColour,
Drawing::Colour secondaryColour, Drawing::Colour tertiaryColour);
void AcceptParameters(GameActionParameterVisitor&) final;
+1 -1
View File
@@ -189,7 +189,7 @@ namespace OpenRCT2::GameActions
newPeep->PathfindGoal.z = 0xFF;
newPeep->PathfindGoal.direction = kInvalidDirection;
uint8_t colour = StaffGetColour(static_cast<StaffType>(_staffType));
auto colour = StaffGetColour(static_cast<StaffType>(_staffType));
newPeep->TshirtColour = colour;
newPeep->TrousersColour = colour;
@@ -21,7 +21,7 @@
namespace OpenRCT2::GameActions
{
StaffSetColourAction::StaffSetColourAction(StaffType staffType, uint8_t colour)
StaffSetColourAction::StaffSetColourAction(StaffType staffType, Drawing::Colour colour)
: _staffType(static_cast<uint8_t>(staffType))
, _colour(colour)
{
+2 -2
View File
@@ -18,11 +18,11 @@ namespace OpenRCT2::GameActions
{
private:
uint8_t _staffType{};
uint8_t _colour{};
Drawing::Colour _colour{};
public:
StaffSetColourAction() = default;
StaffSetColourAction(StaffType staffType, uint8_t colour);
StaffSetColourAction(StaffType staffType, Drawing::Colour colour);
void AcceptParameters(GameActionParameterVisitor&) final;
+3 -3
View File
@@ -37,8 +37,8 @@ namespace OpenRCT2::GameActions
using namespace OpenRCT2::TrackMetaData;
WallPlaceAction::WallPlaceAction(
ObjectEntryIndex wallType, const CoordsXYZ& loc, uint8_t edge, int32_t primaryColour, int32_t secondaryColour,
int32_t tertiaryColour)
ObjectEntryIndex wallType, const CoordsXYZ& loc, uint8_t edge, Drawing::Colour primaryColour,
Drawing::Colour secondaryColour, Drawing::Colour tertiaryColour)
: _wallType(wallType)
, _loc(loc)
, _edge(edge)
@@ -346,7 +346,7 @@ namespace OpenRCT2::GameActions
}
banner->text = {};
banner->colour = COLOUR_WHITE;
banner->colour = Drawing::Colour::white;
banner->textColour = Drawing::TextColour::white;
banner->flags = { BannerFlag::isWall };
banner->type = 0; // Banner must be deleted after this point in an early return
+5 -5
View File
@@ -34,15 +34,15 @@ namespace OpenRCT2::GameActions
ObjectEntryIndex _wallType{ kObjectEntryIndexNull };
CoordsXYZ _loc;
Direction _edge{ kInvalidDirection };
int32_t _primaryColour{ COLOUR_BLACK };
int32_t _secondaryColour{ COLOUR_BLACK };
int32_t _tertiaryColour{ COLOUR_BLACK };
Drawing::Colour _primaryColour{ Drawing::Colour::black };
Drawing::Colour _secondaryColour{ Drawing::Colour::black };
Drawing::Colour _tertiaryColour{ Drawing::Colour::black };
public:
WallPlaceAction() = default;
WallPlaceAction(
ObjectEntryIndex wallType, const CoordsXYZ& loc, uint8_t edge, int32_t primaryColour, int32_t secondaryColour,
int32_t tertiaryColour);
ObjectEntryIndex wallType, const CoordsXYZ& loc, uint8_t edge, Drawing::Colour primaryColour,
Drawing::Colour secondaryColour, Drawing::Colour tertiaryColour);
void AcceptParameters(GameActionParameterVisitor&) final;
+5 -5
View File
@@ -24,7 +24,7 @@
namespace OpenRCT2::GameActions
{
WallSetColourAction::WallSetColourAction(
const CoordsXYZD& loc, int32_t primaryColour, int32_t secondaryColour, int32_t tertiaryColour)
const CoordsXYZD& loc, Drawing::Colour primaryColour, Drawing::Colour secondaryColour, Drawing::Colour tertiaryColour)
: _loc(loc)
, _primaryColour(primaryColour)
, _secondaryColour(secondaryColour)
@@ -95,19 +95,19 @@ namespace OpenRCT2::GameActions
return Result(Status::unknown, STR_CANT_REPAINT_THIS, kStringIdNone);
}
if (_primaryColour >= COLOUR_COUNT)
if (!Drawing::colourIsValid(_primaryColour))
{
LOG_ERROR("Primary colour invalid: colour = %d", _primaryColour);
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
}
else if (_secondaryColour >= COLOUR_COUNT)
if (!Drawing::colourIsValid(_secondaryColour))
{
LOG_ERROR("Secondary colour invalid: colour = %d", _secondaryColour);
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, STR_ERR_INVALID_COLOUR);
}
else if (wallEntry->flags & WALL_SCENERY_HAS_TERTIARY_COLOUR)
if (wallEntry->flags & WALL_SCENERY_HAS_TERTIARY_COLOUR)
{
if (_tertiaryColour >= COLOUR_COUNT)
if (!Drawing::colourIsValid(_tertiaryColour))
{
LOG_ERROR("Tertiary colour invalid: colour = %d", _tertiaryColour);
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, kStringIdNone);
+6 -4
View File
@@ -17,13 +17,15 @@ namespace OpenRCT2::GameActions
{
private:
CoordsXYZD _loc;
int32_t _primaryColour{};
int32_t _secondaryColour{};
int32_t _tertiaryColour{};
Drawing::Colour _primaryColour{};
Drawing::Colour _secondaryColour{};
Drawing::Colour _tertiaryColour{};
public:
WallSetColourAction() = default;
WallSetColourAction(const CoordsXYZD& loc, int32_t primaryColour, int32_t secondaryColour, int32_t tertiaryColour);
WallSetColourAction(
const CoordsXYZD& loc, Drawing::Colour primaryColour, Drawing::Colour secondaryColour,
Drawing::Colour tertiaryColour);
void AcceptParameters(GameActionParameterVisitor&) final;
+13 -3
View File
@@ -335,6 +335,12 @@ struct DataSerializerTraitsT<uint64_t[_Size]> : public DataSerializerTraitsPODAr
{
};
template<size_t _Size>
struct DataSerializerTraitsT<OpenRCT2::Drawing::Colour[_Size]>
: public DataSerializerTraitsPODArray<OpenRCT2::Drawing::Colour, _Size>
{
};
template<typename T, T TNullValue, typename TTag, size_t _Size>
struct DataSerializerTraitsT<TIdentifier<T, TNullValue, TTag>[_Size]>
: public DataSerializerTraitsPODArray<TIdentifier<T, TNullValue, TTag>, _Size>
@@ -777,7 +783,8 @@ struct DataSerializerTraitsT<TrackDesignSceneryElement>
snprintf(
msg, sizeof(msg),
"TrackDesignSceneryElement(x = %d, y = %d, z = %d, flags = %d, colour1 = %d, colour2 = %d, colour3 = %d)",
val.loc.x, val.loc.y, val.loc.z, val.flags, val.primaryColour, val.secondaryColour, val.tertiaryColour);
val.loc.x, val.loc.y, val.loc.z, val.flags, EnumValue(val.primaryColour), EnumValue(val.secondaryColour),
EnumValue(val.tertiaryColour));
stream->Write(msg, strlen(msg));
auto identifier = val.sceneryObject.GetName();
@@ -804,7 +811,8 @@ struct DataSerializerTraitsT<TrackColour>
{
char msg[128] = {};
snprintf(
msg, sizeof(msg), "TrackColour(main = %d, additional = %d, supports = %d)", val.main, val.additional, val.supports);
msg, sizeof(msg), "TrackColour(main = %d, additional = %d, supports = %d)", EnumValue(val.main),
EnumValue(val.additional), EnumValue(val.supports));
stream->Write(msg, strlen(msg));
}
};
@@ -827,7 +835,9 @@ struct DataSerializerTraitsT<VehicleColour>
static void log(OpenRCT2::IStream* stream, const VehicleColour& val)
{
char msg[128] = {};
snprintf(msg, sizeof(msg), "VehicleColour(Body = %d, Trim = %d, Tertiary = %d)", val.Body, val.Trim, val.Tertiary);
snprintf(
msg, sizeof(msg), "VehicleColour(Body = %d, Trim = %d, Tertiary = %d)", EnumValue(val.Body), EnumValue(val.Trim),
EnumValue(val.Tertiary));
stream->Write(msg, strlen(msg));
}
};
+89
View File
@@ -0,0 +1,89 @@
/*****************************************************************************
* Copyright (c) 2014-2026 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "Colour.h"
#include "../core/EnumMap.hpp"
namespace OpenRCT2::Drawing
{
static const EnumMap<Colour> kLookupTable{
{ "black", Colour::black },
{ "grey", Colour::grey },
{ "white", Colour::white },
{ "dark_purple", Colour::darkPurple },
{ "light_purple", Colour::lightPurple },
{ "bright_purple", Colour::brightPurple },
{ "dark_blue", Colour::darkBlue },
{ "light_blue", Colour::lightBlue },
{ "icy_blue", Colour::icyBlue },
{ "teal", Colour::darkWater },
{ "aquamarine", Colour::lightWater },
{ "saturated_green", Colour::saturatedGreen },
{ "dark_green", Colour::darkGreen },
{ "moss_green", Colour::mossGreen },
{ "bright_green", Colour::brightGreen },
{ "olive_green", Colour::oliveGreen },
{ "dark_olive_green", Colour::darkOliveGreen },
{ "bright_yellow", Colour::brightYellow },
{ "yellow", Colour::yellow },
{ "dark_yellow", Colour::darkYellow },
{ "light_orange", Colour::lightOrange },
{ "dark_orange", Colour::darkOrange },
{ "light_brown", Colour::lightBrown },
{ "saturated_brown", Colour::saturatedBrown },
{ "dark_brown", Colour::darkBrown },
{ "salmon_pink", Colour::salmonPink },
{ "bordeaux_red", Colour::bordeauxRed },
{ "saturated_red", Colour::saturatedRed },
{ "bright_red", Colour::brightRed },
{ "dark_pink", Colour::darkPink },
{ "bright_pink", Colour::brightPink },
{ "light_pink", Colour::lightPink },
{ "dark_olive_dark", Colour::armyGreen },
{ "dark_olive_light", Colour::honeyDew },
{ "saturated_brown_light", Colour::tan },
{ "bordeaux_red_dark", Colour::maroon },
{ "bordeaux_red_light", Colour::coralPink },
{ "grass_green_dark", Colour::forestGreen },
{ "grass_green_light", Colour::chartreuse },
{ "olive_dark", Colour::hunterGreen },
{ "olive_light", Colour::celadon },
{ "saturated_green_light", Colour::limeGreen },
{ "tan_dark", Colour::sepia },
{ "tan_light", Colour::peach },
{ "dull_purple_light", Colour::periwinkle },
{ "dull_green_dark", Colour::viridian },
{ "dull_green_light", Colour::seafoamGreen },
{ "saturated_purple_dark", Colour::violet },
{ "saturated_purple_light", Colour::lavender },
{ "orange_light", Colour::pastelOrange },
{ "aqua_dark", Colour::deepWater },
{ "magenta_light", Colour::pastelPink },
{ "dull_brown_dark", Colour::umber },
{ "dull_brown_light", Colour::beige },
{ "invisible", Colour::invisible },
{ "void", Colour::voidBackground },
};
Colour colourFromString(u8string s, Colour defaultValue)
{
auto result = kLookupTable.find(s);
return (result != kLookupTable.end()) ? result->second : defaultValue;
}
u8string colourToString(Colour colour)
{
auto result = kLookupTable.find(colour);
if (result != kLookupTable.end())
return u8string(result->first);
return "black";
}
} // namespace OpenRCT2::Drawing
+97
View File
@@ -0,0 +1,97 @@
/*****************************************************************************
* Copyright (c) 2014-2026 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include "../core/EnumUtils.hpp"
#include "../core/StringTypes.h"
#include <cstdint>
/**
* Colour IDs as used by the colour dropdown, NOT palette indices.
*/
namespace OpenRCT2::Drawing
{
enum class Colour : uint8_t
{
// Original Colours
black,
grey,
white,
darkPurple,
lightPurple,
brightPurple,
darkBlue,
lightBlue,
icyBlue,
darkWater,
lightWater,
saturatedGreen,
darkGreen,
mossGreen,
brightGreen,
oliveGreen,
darkOliveGreen,
brightYellow,
yellow,
darkYellow,
lightOrange,
darkOrange,
lightBrown,
saturatedBrown,
darkBrown,
salmonPink,
bordeauxRed,
saturatedRed,
brightRed,
darkPink,
brightPink,
lightPink,
// Extended Colour Set
armyGreen,
honeyDew,
tan,
maroon,
coralPink,
forestGreen,
chartreuse,
hunterGreen,
celadon,
limeGreen,
sepia,
peach,
periwinkle,
viridian,
seafoamGreen,
violet,
lavender,
pastelOrange,
deepWater,
pastelPink,
umber,
beige,
invisible,
voidBackground,
};
constexpr uint8_t kColourNumNormal = 54;
constexpr uint8_t kColourNumTotal = 56;
constexpr auto kColourNull = static_cast<Colour>(255);
constexpr bool colourIsValid(Colour colour)
{
return EnumValue(colour) < kColourNumTotal;
}
Colour colourFromString(u8string s, Colour defaultValue = Colour::black);
u8string colourToString(Colour colour);
} // namespace OpenRCT2::Drawing
+5 -5
View File
@@ -30,11 +30,11 @@ namespace OpenRCT2::Drawing
constexpr uint8_t kIndexColour10 = 253;
constexpr uint8_t kIndexColour11 = 254;
static std::array<ColourShadeMap, COLOUR_COUNT> _colourMap = {};
static std::array<ColourShadeMap, kColourNumTotal> _colourMap = {};
void initColourMaps()
{
for (int32_t i = 0; i < COLOUR_COUNT; i++)
for (int32_t i = 0; i < kColourNumTotal; i++)
{
const auto* g1 = GfxGetG1Element(SPR_PALETTE_2_START + i);
if (g1 != nullptr)
@@ -55,9 +55,9 @@ namespace OpenRCT2::Drawing
}
}
ColourShadeMap getColourMap(colour_t colour)
ColourShadeMap getColourMap(Colour colour)
{
Guard::Assert(colour < _colourMap.size());
return _colourMap[colour];
Guard::Assert(EnumValue(colour) < _colourMap.size());
return _colourMap[EnumValue(colour)];
}
} // namespace OpenRCT2::Drawing
+2 -3
View File
@@ -11,10 +11,9 @@
#include <cstdint>
using colour_t = uint8_t;
namespace OpenRCT2::Drawing
{
enum class Colour : uint8_t;
enum class PaletteIndex : uint8_t;
struct ColourShadeMap
@@ -33,7 +32,7 @@ namespace OpenRCT2::Drawing
PaletteIndex colour11;
};
ColourShadeMap getColourMap(colour_t colour);
ColourShadeMap getColourMap(Colour colour);
void initColourMaps();
} // namespace OpenRCT2::Drawing
+7 -7
View File
@@ -294,7 +294,7 @@ static void ColourCharacter(TextColour colour, bool withOutline, TextColours& te
* Changes the palette so that the next character changes colour
* This is specific to changing to a predefined window related colour
*/
static void ColourCharacterWindow(colour_t colour, bool withOutline, TextColours& textPalette)
static void ColourCharacterWindow(OpenRCT2::Drawing::Colour colour, bool withOutline, TextColours& textPalette)
{
TextColours mapping = {
getColourMap(colour).colour11,
@@ -325,13 +325,13 @@ void DrawStringCentredRaw(
RenderTarget& rt, const ScreenCoordsXY& coords, int32_t numLines, const utf8* text, FontStyle fontStyle)
{
ScreenCoordsXY screenCoords(rt.x, rt.y);
DrawText(rt, screenCoords, { COLOUR_BLACK, fontStyle }, "");
DrawText(rt, screenCoords, { OpenRCT2::Drawing::Colour::black, fontStyle }, "");
screenCoords = coords;
for (int32_t i = 0; i <= numLines; i++)
{
int32_t width = GfxGetStringWidth(text, fontStyle);
DrawText(rt, screenCoords - ScreenCoordsXY{ width / 2, 0 }, { COLOUR_NULL, fontStyle }, text);
DrawText(rt, screenCoords - ScreenCoordsXY{ width / 2, 0 }, { OpenRCT2::Drawing::kColourNull, fontStyle }, text);
const utf8* ch = text;
const utf8* nextCh = nullptr;
@@ -417,8 +417,8 @@ int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle)
* ticks : ebp >> 16
*/
void DrawNewsTicker(
RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, colour_t colour, StringId format, u8string_view args,
int32_t ticks)
RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, OpenRCT2::Drawing::Colour colour, StringId format,
u8string_view args, int32_t ticks)
{
int32_t numLines, lineHeight, lineY;
ScreenCoordsXY screenCoords(rt.x, rt.y);
@@ -462,7 +462,7 @@ void DrawNewsTicker(
}
screenCoords = { coords.x - halfWidth, lineY };
DrawText(rt, screenCoords, { COLOUR_NULL, FontStyle::small }, buffer);
DrawText(rt, screenCoords, { OpenRCT2::Drawing::kColourNull, FontStyle::small }, buffer);
if (numCharactersDrawn > numCharactersToDraw)
{
@@ -749,7 +749,7 @@ static void TTFProcessString(RenderTarget& rt, std::string_view text, TextDrawIn
static void TTFProcessInitialColour(ColourWithFlags colour, TextDrawInfo* info)
{
if (colour.colour != COLOUR_NULL)
if (colour.colour != OpenRCT2::Drawing::kColourNull)
{
info->colourFlags = colour.flags;
if (!colour.flags.has(ColourFlag::inset))
-1
View File
@@ -10,7 +10,6 @@
#pragma once
#include "../core/FlagHolder.hpp"
#include "../interface/Colour.h"
#include "../interface/ColourWithFlags.h"
#include "TextColour.h"
+58 -58
View File
@@ -105,7 +105,7 @@ TextColours gTextPalette = {
bool gPaintForceRedraw{ false };
static constexpr FilterPaletteID kGlassPaletteIds[COLOUR_COUNT] = {
static constexpr FilterPaletteID kGlassPaletteIds[kColourNumTotal] = {
FilterPaletteID::paletteGlassBlack,
FilterPaletteID::paletteGlassGrey,
FilterPaletteID::paletteGlassWhite,
@@ -391,61 +391,61 @@ static constexpr TranslucentWindowPalette kWindowPaletteBordeauxRed = { FilterPa
static constexpr TranslucentWindowPalette kWindowPaletteBrightRed = { FilterPaletteID::paletteTranslucentBrightRed, FilterPaletteID::paletteTranslucentBrightRedHighlight, FilterPaletteID::paletteTranslucentBrightRedShadow };
static constexpr TranslucentWindowPalette kWindowPaletteBrightPink = { FilterPaletteID::paletteTranslucentBrightPink, FilterPaletteID::paletteTranslucentBrightPinkHighlight, FilterPaletteID::paletteTranslucentBrightPinkShadow };
const TranslucentWindowPalette kTranslucentWindowPalettes[COLOUR_COUNT] = {
kWindowPaletteGrey, // COLOUR_BLACK
kWindowPaletteGrey, // COLOUR_GREY
const TranslucentWindowPalette kTranslucentWindowPalettes[kColourNumTotal] = {
kWindowPaletteGrey, // Colour::black
kWindowPaletteGrey, // Colour::grey
{ FilterPaletteID::paletteTranslucentWhite, FilterPaletteID::paletteTranslucentWhiteHighlight,FilterPaletteID::paletteTranslucentWhiteShadow },
kWindowPaletteLightPurple, // COLOUR_DARK_PURPLE
kWindowPaletteLightPurple, // COLOUR_LIGHT_PURPLE
kWindowPaletteBrightPurple, // COLOUR_BRIGHT_PURPLE
kWindowPaletteLightBlue, // COLOUR_DARK_BLUE
kWindowPaletteLightBlue, // COLOUR_LIGHT_BLUE
kWindowPaletteLightBlue, // COLOUR_ICY_BLUE
kWindowPaletteTeal, // COLOUR_DARK_WATER
kWindowPaletteTeal, // COLOUR_LIGHT_WATER
kWindowPaletteBrightGreen, // COLOUR_SATURATED_GREEN
kWindowPaletteDarkGreen, // COLOUR_DARK_GREEN
kWindowPaletteMossGreen, // COLOUR_MOSS_GREEN
kWindowPaletteBrightGreen, // COLOUR_BRIGHT_GREEN
kWindowPaletteOliveGreen, // COLOUR_OLIVE_GREEN
kWindowPaletteDarkOliveGreen, // COLOUR_DARK_OLIVE_GREEN
kWindowPaletteYellow, // COLOUR_BRIGHT_YELLOW
kWindowPaletteYellow, // COLOUR_YELLOW
kWindowPaletteYellow, // COLOUR_DARK_YELLOW
kWindowPaletteLightOrange, // COLOUR_LIGHT_ORANGE
kWindowPaletteLightOrange, // COLOUR_DARK_ORANGE
kWindowPaletteLightBrown, // COLOUR_LIGHT_BROWN
kWindowPaletteLightBrown, // COLOUR_SATURATED_BROWN
kWindowPaletteDarkBrown, // COLOUR_DARK_BROWN
kWindowPaletteSalmonPink, // COLOUR_SALMON_PINK
kWindowPaletteBordeauxRed, // COLOUR_BORDEAUX_RED
kWindowPaletteBrightRed, // COLOUR_SATURATED_RED
kWindowPaletteBrightRed, // COLOUR_BRIGHT_RED
kWindowPaletteBrightPink, // COLOUR_DARK_PINK
kWindowPaletteBrightPink, // COLOUR_BRIGHT_PINK
kWindowPaletteLightPurple, // Colour::darkPurple
kWindowPaletteLightPurple, // Colour::lightPurple
kWindowPaletteBrightPurple, // Colour::brightPurple
kWindowPaletteLightBlue, // Colour::darkBlue
kWindowPaletteLightBlue, // Colour::lightBlue
kWindowPaletteLightBlue, // Colour::icyBlue
kWindowPaletteTeal, // Colour::darkWater
kWindowPaletteTeal, // Colour::lightWater
kWindowPaletteBrightGreen, // Colour::saturatedGreen
kWindowPaletteDarkGreen, // Colour::darkGreen
kWindowPaletteMossGreen, // Colour::mossGreen
kWindowPaletteBrightGreen, // Colour::brightGreen
kWindowPaletteOliveGreen, // Colour::oliveGreen
kWindowPaletteDarkOliveGreen, // Colour::darkOliveGreen
kWindowPaletteYellow, // Colour::brightYellow
kWindowPaletteYellow, // Colour::yellow
kWindowPaletteYellow, // Colour::darkYellow
kWindowPaletteLightOrange, // Colour::lightOrange
kWindowPaletteLightOrange, // Colour::darkOrange
kWindowPaletteLightBrown, // Colour::lightBrown
kWindowPaletteLightBrown, // Colour::saturatedBrown
kWindowPaletteDarkBrown, // Colour::darkBrown
kWindowPaletteSalmonPink, // Colour::salmonPink
kWindowPaletteBordeauxRed, // Colour::bordeauxRed
kWindowPaletteBrightRed, // Colour::saturatedRed
kWindowPaletteBrightRed, // Colour::brightRed
kWindowPaletteBrightPink, // Colour::darkPink
kWindowPaletteBrightPink, // Colour::brightPink
{ FilterPaletteID::paletteTranslucentLightPink, FilterPaletteID::paletteTranslucentLightPinkHighlight, FilterPaletteID::paletteTranslucentLightPinkShadow },
kWindowPaletteDarkOliveGreen, // COLOUR_DARK_OLIVE_DARK
kWindowPaletteDarkOliveGreen, // COLOUR_DARK_OLIVE_LIGHT
kWindowPaletteLightBrown, // COLOUR_SATURATED_BROWN_LIGHT
kWindowPaletteBordeauxRed, // COLOUR_BORDEAUX_RED_DARK
kWindowPaletteBordeauxRed, // COLOUR_BORDEAUX_RED_LIGHT
kWindowPaletteMossGreen, // COLOUR_GRASS_GREEN_DARK
kWindowPaletteMossGreen, // COLOUR_GRASS_GREEN_LIGHT
kWindowPaletteOliveGreen, // COLOUR_OLIVE_DARK
kWindowPaletteOliveGreen, // COLOUR_OLIVE_LIGHT
kWindowPaletteBrightGreen, // COLOUR_SATURATED_GREEN_LIGHT
kWindowPaletteSalmonPink, // COLOUR_TAN_DARK
kWindowPaletteSalmonPink, // COLOUR_TAN_LIGHT
kWindowPaletteLightPurple, // COLOUR_DULL_PURPLE_LIGHT
kWindowPaletteDarkGreen, // COLOUR_DULL_GREEN_DARK
kWindowPaletteDarkGreen, // COLOUR_DULL_GREEN_LIGHT
kWindowPaletteBrightPurple, // COLOUR_SATURATED_PURPLE_DARK
kWindowPaletteBrightPurple, // COLOUR_SATURATED_PURPLE_LIGHT
kWindowPaletteLightOrange, // COLOUR_ORANGE_LIGHT
kWindowPaletteTeal, // COLOUR_DEEP_WATER
kWindowPaletteBrightPink, // COLOUR_MAGENTA_LIGHT
kWindowPaletteDarkBrown, // COLOUR_DULL_BROWN_DARK
kWindowPaletteDarkBrown, // COLOUR_DULL_BROWN_LIGHT
kWindowPaletteDarkOliveGreen, // Colour::armyGreen
kWindowPaletteDarkOliveGreen, // Colour::honeyDew
kWindowPaletteLightBrown, // Colour::tan
kWindowPaletteBordeauxRed, // Colour::maroon
kWindowPaletteBordeauxRed, // Colour::coralPink
kWindowPaletteMossGreen, // Colour::forestGreen
kWindowPaletteMossGreen, // Colour::chartreuse
kWindowPaletteOliveGreen, // Colour::hunterGreen
kWindowPaletteOliveGreen, // Colour::celadon
kWindowPaletteBrightGreen, // Colour::limeGreen
kWindowPaletteSalmonPink, // Colour::sepia
kWindowPaletteSalmonPink, // Colour::peach
kWindowPaletteLightPurple, // Colour::periwinkle
kWindowPaletteDarkGreen, // Colour::viridian
kWindowPaletteDarkGreen, // Colour::seafoamGreen
kWindowPaletteBrightPurple, // Colour::violet
kWindowPaletteBrightPurple, // Colour::lavender
kWindowPaletteLightOrange, // Colour::pastelOrange
kWindowPaletteTeal, // Colour::deepWater
kWindowPaletteBrightPink, // Colour::pastelPink
kWindowPaletteDarkBrown, // Colour::umber
kWindowPaletteDarkBrown, // Colour::beige
{ FilterPaletteID::paletteDarken1, FilterPaletteID::paletteDarken1, FilterPaletteID::paletteDarken1 },
{ FilterPaletteID::paletteDarken2, FilterPaletteID::paletteDarken2, FilterPaletteID::paletteDarken2 },
};
@@ -695,9 +695,9 @@ std::optional<PaletteMap> GetPaletteMapForColour(FilterPaletteID paletteId)
return std::nullopt;
}
FilterPaletteID GetGlassPaletteId(colour_t c)
FilterPaletteID GetGlassPaletteId(Colour c)
{
return kGlassPaletteIds[c];
return kGlassPaletteIds[EnumValue(c)];
}
void UpdatePalette(std::span<const BGRAColour> palette, PaletteIndex startIndex, int32_t numColours)
@@ -932,8 +932,8 @@ void DebugRT(RenderTarget& rt)
GfxDrawLine(rt, { topLeft, topLeft + ScreenCoordsXY{ 4, 0 } }, PaletteIndex::pi136);
const auto str = std::to_string(rt.x);
DrawText(rt, ScreenCoordsXY{ rt.x, rt.y }, { COLOUR_WHITE, FontStyle::tiny }, str.c_str());
DrawText(rt, ScreenCoordsXY{ rt.x, rt.y }, { Colour::white, FontStyle::tiny }, str.c_str());
const auto str2 = std::to_string(rt.y);
DrawText(rt, ScreenCoordsXY{ rt.x, rt.y + 6 }, { COLOUR_WHITE, FontStyle::tiny }, str2.c_str());
DrawText(rt, ScreenCoordsXY{ rt.x, rt.y + 6 }, { Colour::white, FontStyle::tiny }, str2.c_str());
}
+3 -4
View File
@@ -11,7 +11,6 @@
#include "../core/CallingConventions.h"
#include "../core/StringTypes.h"
#include "../interface/Colour.h"
#include "../interface/ZoomLevel.h"
#include "../world/Location.hpp"
#include "ColourPalette.h"
@@ -231,7 +230,7 @@ extern OpenRCT2::Drawing::GamePalette gGamePalette;
extern uint32_t gPaletteEffectFrame;
extern OpenRCT2::Drawing::TextColours gTextPalette;
extern const OpenRCT2::Drawing::TranslucentWindowPalette kTranslucentWindowPalettes[COLOUR_COUNT];
extern const OpenRCT2::Drawing::TranslucentWindowPalette kTranslucentWindowPalettes[OpenRCT2::Drawing::kColourNumTotal];
extern ImageId gPickupPeepImage;
extern int32_t gPickupPeepX;
@@ -299,8 +298,8 @@ void GfxDrawStringLeftCentred(
void DrawStringCentredRaw(
OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, int32_t numLines, const utf8* text, FontStyle fontStyle);
void DrawNewsTicker(
OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, colour_t colour, StringId format,
u8string_view args, int32_t ticks);
OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, int32_t width, OpenRCT2::Drawing::Colour colour,
StringId format, u8string_view args, int32_t ticks);
void GfxDrawStringWithYOffsets(
OpenRCT2::Drawing::RenderTarget& rt, const utf8* text, ColourWithFlags colour, const ScreenCoordsXY& coords,
const int8_t* yOffsets, bool forceSpriteFont, FontStyle fontStyle);
+59 -58
View File
@@ -9,7 +9,8 @@
#pragma once
#include "../interface/Colour.h"
#include "../core/EnumUtils.hpp"
#include "Colour.h"
namespace OpenRCT2::Drawing
{
@@ -18,7 +19,7 @@ namespace OpenRCT2::Drawing
paletteNull = 0,
// Additional palettes
paletteWater = COLOUR_COUNT,
paletteWater = kColourNumTotal,
paletteLandMarker0, // North (corner/edge)
paletteLandMarker1, // East (corner/edge)
paletteLandMarker2, // South (corner/edge)
@@ -102,63 +103,63 @@ namespace OpenRCT2::Drawing
// Main glass remap palettes
paletteGlass,
paletteGlassBlack = paletteGlass + COLOUR_BLACK,
paletteGlassGrey = paletteGlass + COLOUR_GREY,
paletteGlassWhite = paletteGlass + COLOUR_WHITE,
paletteGlassDarkPurple = paletteGlass + COLOUR_DARK_PURPLE,
paletteGlassLightPurple = paletteGlass + COLOUR_LIGHT_PURPLE,
paletteGlassBrightPurple = paletteGlass + COLOUR_BRIGHT_PURPLE,
paletteGlassDarkBlue = paletteGlass + COLOUR_DARK_BLUE,
paletteGlassLightBlue = paletteGlass + COLOUR_LIGHT_BLUE,
paletteGlassIcyBlue = paletteGlass + COLOUR_ICY_BLUE,
paletteGlassTeal = paletteGlass + COLOUR_DARK_WATER,
paletteGlassAquamarine = paletteGlass + COLOUR_LIGHT_WATER,
paletteGlassSaturatedGreen = paletteGlass + COLOUR_SATURATED_GREEN,
paletteGlassDarkGreen = paletteGlass + COLOUR_DARK_GREEN,
paletteGlassMossGreen = paletteGlass + COLOUR_MOSS_GREEN,
paletteGlassBrightGreen = paletteGlass + COLOUR_BRIGHT_GREEN,
paletteGlassOliveGreen = paletteGlass + COLOUR_OLIVE_GREEN,
paletteGlassDarkOliveGreen = paletteGlass + COLOUR_DARK_OLIVE_GREEN,
paletteGlassBrightYellow = paletteGlass + COLOUR_BRIGHT_YELLOW,
paletteGlassYellow = paletteGlass + COLOUR_YELLOW,
paletteGlassDarkYellow = paletteGlass + COLOUR_DARK_YELLOW,
paletteGlassLightOrange = paletteGlass + COLOUR_LIGHT_ORANGE,
paletteGlassDarkOrange = paletteGlass + COLOUR_DARK_ORANGE,
paletteGlassLightBrown = paletteGlass + COLOUR_LIGHT_BROWN,
paletteGlassSaturatedBrown = paletteGlass + COLOUR_SATURATED_BROWN,
paletteGlassDarkBrown = paletteGlass + COLOUR_DARK_BROWN,
paletteGlassSalmonPink = paletteGlass + COLOUR_SALMON_PINK,
paletteGlassBordeauxRed = paletteGlass + COLOUR_BORDEAUX_RED,
paletteGlassSaturatedRed = paletteGlass + COLOUR_SATURATED_RED,
paletteGlassBrightRed = paletteGlass + COLOUR_BRIGHT_RED,
paletteGlassDarkPink = paletteGlass + COLOUR_DARK_PINK,
paletteGlassBrightPink = paletteGlass + COLOUR_BRIGHT_PINK,
paletteGlassLightPink = paletteGlass + COLOUR_LIGHT_PINK,
paletteGlassDarkOliveDark = paletteGlass + COLOUR_DARK_OLIVE_DARK,
paletteGlassDarkOliveLight = paletteGlass + COLOUR_DARK_OLIVE_LIGHT,
paletteGlassSaturatedBrownLight = paletteGlass + COLOUR_SATURATED_BROWN_LIGHT,
paletteGlassBordeauxRedDark = paletteGlass + COLOUR_BORDEAUX_RED_DARK,
paletteGlassBordeauxRedLight = paletteGlass + COLOUR_BORDEAUX_RED_LIGHT,
paletteGlassGrassGreenDark = paletteGlass + COLOUR_GRASS_GREEN_DARK,
paletteGlassGrassGreenLight = paletteGlass + COLOUR_GRASS_GREEN_LIGHT,
paletteGlassBlack = paletteGlass + EnumValue(Colour::black),
paletteGlassGrey = paletteGlass + EnumValue(Colour::grey),
paletteGlassWhite = paletteGlass + EnumValue(Colour::white),
paletteGlassDarkPurple = paletteGlass + EnumValue(Colour::darkPurple),
paletteGlassLightPurple = paletteGlass + EnumValue(Colour::lightPurple),
paletteGlassBrightPurple = paletteGlass + EnumValue(Colour::brightPurple),
paletteGlassDarkBlue = paletteGlass + EnumValue(Colour::darkBlue),
paletteGlassLightBlue = paletteGlass + EnumValue(Colour::lightBlue),
paletteGlassIcyBlue = paletteGlass + EnumValue(Colour::icyBlue),
paletteGlassTeal = paletteGlass + EnumValue(Colour::darkWater),
paletteGlassAquamarine = paletteGlass + EnumValue(Colour::lightWater),
paletteGlassSaturatedGreen = paletteGlass + EnumValue(Colour::saturatedGreen),
paletteGlassDarkGreen = paletteGlass + EnumValue(Colour::darkGreen),
paletteGlassMossGreen = paletteGlass + EnumValue(Colour::mossGreen),
paletteGlassBrightGreen = paletteGlass + EnumValue(Colour::brightGreen),
paletteGlassOliveGreen = paletteGlass + EnumValue(Colour::oliveGreen),
paletteGlassDarkOliveGreen = paletteGlass + EnumValue(Colour::darkOliveGreen),
paletteGlassBrightYellow = paletteGlass + EnumValue(Colour::brightYellow),
paletteGlassYellow = paletteGlass + EnumValue(Colour::yellow),
paletteGlassDarkYellow = paletteGlass + EnumValue(Colour::darkYellow),
paletteGlassLightOrange = paletteGlass + EnumValue(Colour::lightOrange),
paletteGlassDarkOrange = paletteGlass + EnumValue(Colour::darkOrange),
paletteGlassLightBrown = paletteGlass + EnumValue(Colour::lightBrown),
paletteGlassSaturatedBrown = paletteGlass + EnumValue(Colour::saturatedBrown),
paletteGlassDarkBrown = paletteGlass + EnumValue(Colour::darkBrown),
paletteGlassSalmonPink = paletteGlass + EnumValue(Colour::salmonPink),
paletteGlassBordeauxRed = paletteGlass + EnumValue(Colour::bordeauxRed),
paletteGlassSaturatedRed = paletteGlass + EnumValue(Colour::saturatedRed),
paletteGlassBrightRed = paletteGlass + EnumValue(Colour::brightRed),
paletteGlassDarkPink = paletteGlass + EnumValue(Colour::darkPink),
paletteGlassBrightPink = paletteGlass + EnumValue(Colour::brightPink),
paletteGlassLightPink = paletteGlass + EnumValue(Colour::lightPink),
paletteGlassDarkOliveDark = paletteGlass + EnumValue(Colour::armyGreen),
paletteGlassDarkOliveLight = paletteGlass + EnumValue(Colour::honeyDew),
paletteGlassSaturatedBrownLight = paletteGlass + EnumValue(Colour::tan),
paletteGlassBordeauxRedDark = paletteGlass + EnumValue(Colour::maroon),
paletteGlassBordeauxRedLight = paletteGlass + EnumValue(Colour::coralPink),
paletteGlassGrassGreenDark = paletteGlass + EnumValue(Colour::forestGreen),
paletteGlassGrassGreenLight = paletteGlass + EnumValue(Colour::chartreuse),
// Extended glass remap palettes
paletteGlassOliveDark = paletteGlass + COLOUR_OLIVE_DARK,
paletteGlassOliveLight = paletteGlass + COLOUR_OLIVE_LIGHT,
paletteGlassSaturatedGreenLight = paletteGlass + COLOUR_SATURATED_GREEN_LIGHT,
paletteGlassTanDark = paletteGlass + COLOUR_TAN_DARK,
paletteGlassTanLight = paletteGlass + COLOUR_TAN_LIGHT,
paletteGlassDullPurpleLight = paletteGlass + COLOUR_DULL_PURPLE_LIGHT,
paletteGlassDullGreenDark = paletteGlass + COLOUR_DULL_GREEN_DARK,
paletteGlassDullGreenLight = paletteGlass + COLOUR_DULL_GREEN_LIGHT,
paletteGlassSaturatedPurpleDark = paletteGlass + COLOUR_SATURATED_PURPLE_DARK,
paletteGlassSaturatedPurpleLight = paletteGlass + COLOUR_SATURATED_PURPLE_LIGHT,
paletteGlassOrangeLight = paletteGlass + COLOUR_ORANGE_LIGHT,
paletteGlassAquaDark = paletteGlass + COLOUR_DEEP_WATER,
paletteGlassMagentaLight = paletteGlass + COLOUR_MAGENTA_LIGHT,
paletteGlassDullBrownDark = paletteGlass + COLOUR_DULL_BROWN_DARK,
paletteGlassDullBrownLight = paletteGlass + COLOUR_DULL_BROWN_LIGHT,
paletteGlassInvisible = paletteGlass + COLOUR_INVISIBLE,
paletteGlassVoid = paletteGlass + COLOUR_VOID,
paletteGlassOliveDark = paletteGlass + EnumValue(Colour::hunterGreen),
paletteGlassOliveLight = paletteGlass + EnumValue(Colour::celadon),
paletteGlassSaturatedGreenLight = paletteGlass + EnumValue(Colour::limeGreen),
paletteGlassTanDark = paletteGlass + EnumValue(Colour::sepia),
paletteGlassTanLight = paletteGlass + EnumValue(Colour::peach),
paletteGlassDullPurpleLight = paletteGlass + EnumValue(Colour::periwinkle),
paletteGlassDullGreenDark = paletteGlass + EnumValue(Colour::viridian),
paletteGlassDullGreenLight = paletteGlass + EnumValue(Colour::seafoamGreen),
paletteGlassSaturatedPurpleDark = paletteGlass + EnumValue(Colour::violet),
paletteGlassSaturatedPurpleLight = paletteGlass + EnumValue(Colour::lavender),
paletteGlassOrangeLight = paletteGlass + EnumValue(Colour::pastelOrange),
paletteGlassAquaDark = paletteGlass + EnumValue(Colour::deepWater),
paletteGlassMagentaLight = paletteGlass + EnumValue(Colour::pastelPink),
paletteGlassDullBrownDark = paletteGlass + EnumValue(Colour::umber),
paletteGlassDullBrownLight = paletteGlass + EnumValue(Colour::beige),
paletteGlassInvisible = paletteGlass + EnumValue(Colour::invisible),
paletteGlassVoid = paletteGlass + EnumValue(Colour::voidBackground),
};
}
+1 -1
View File
@@ -318,7 +318,7 @@ ImageId FontSpriteGetCodepointSprite(FontStyle fontStyle, int32_t codepoint)
auto codePointOffset = FontSpriteGetCodepointOffset(codepoint);
int32_t offset = EnumValue(fontStyle) * SPR_FONTS_GLYPH_COUNT;
return ImageId(SPR_FONTS_BEGIN + offset + codePointOffset, COLOUR_BLACK);
return ImageId(SPR_FONTS_BEGIN + offset + codePointOffset, OpenRCT2::Drawing::Colour::black);
}
int32_t FontGetLineHeight(FontStyle fontStyle)
+22 -20
View File
@@ -9,18 +9,18 @@
#pragma once
#include "../core/EnumUtils.hpp"
#include "ImageIndexType.h"
#include <cassert>
#include <cstdint>
#include <limits>
using colour_t = uint8_t;
namespace OpenRCT2::Drawing
{
enum class Colour : uint8_t;
enum class FilterPaletteID : int32_t;
}
} // namespace OpenRCT2::Drawing
enum class ImageCatalogue
{
@@ -32,7 +32,7 @@ enum class ImageCatalogue
TEMPORARY,
};
OpenRCT2::Drawing::FilterPaletteID GetGlassPaletteId(colour_t);
OpenRCT2::Drawing::FilterPaletteID GetGlassPaletteId(OpenRCT2::Drawing::Colour);
/**
* Represents a specific image from a catalogue such as G1, G2, CSG etc. with remap
@@ -74,17 +74,19 @@ public:
{
}
constexpr ImageId(uint32_t index, colour_t primaryColour)
constexpr ImageId(uint32_t index, OpenRCT2::Drawing::Colour primaryColour)
: ImageId(ImageId(index).WithPrimary(primaryColour))
{
}
constexpr ImageId(uint32_t index, colour_t primaryColour, colour_t secondaryColour)
constexpr ImageId(uint32_t index, OpenRCT2::Drawing::Colour primaryColour, OpenRCT2::Drawing::Colour secondaryColour)
: ImageId(ImageId(index).WithPrimary(primaryColour).WithSecondary(secondaryColour))
{
}
constexpr ImageId(uint32_t index, colour_t primaryColour, colour_t secondaryColour, colour_t tertiaryColour)
constexpr ImageId(
uint32_t index, OpenRCT2::Drawing::Colour primaryColour, OpenRCT2::Drawing::Colour secondaryColour,
OpenRCT2::Drawing::Colour tertiaryColour)
: ImageId(ImageId(index).WithPrimary(primaryColour).WithSecondary(secondaryColour).WithTertiary(tertiaryColour))
{
}
@@ -129,19 +131,19 @@ public:
return _primary;
}
colour_t GetPrimary() const
OpenRCT2::Drawing::Colour GetPrimary() const
{
return _primary;
return static_cast<OpenRCT2::Drawing::Colour>(_primary);
}
colour_t GetSecondary() const
OpenRCT2::Drawing::Colour GetSecondary() const
{
return _secondary;
return static_cast<OpenRCT2::Drawing::Colour>(_secondary);
}
colour_t GetTertiary() const
OpenRCT2::Drawing::Colour GetTertiary() const
{
return _tertiary;
return static_cast<OpenRCT2::Drawing::Colour>(_tertiary);
}
ImageCatalogue GetCatalogue() const;
@@ -176,18 +178,18 @@ public:
return result;
}
[[nodiscard]] constexpr ImageId WithPrimary(colour_t colour) const
[[nodiscard]] constexpr ImageId WithPrimary(OpenRCT2::Drawing::Colour colour) const
{
ImageId result = *this;
result._primary = colour;
result._primary = EnumValue(colour);
result._flags |= kFlagPrimary;
return result;
}
[[nodiscard]] constexpr ImageId WithSecondary(colour_t colour) const
[[nodiscard]] constexpr ImageId WithSecondary(OpenRCT2::Drawing::Colour colour) const
{
ImageId result = *this;
result._secondary = colour;
result._secondary = EnumValue(colour);
result._flags |= kFlagSecondary;
return result;
}
@@ -200,10 +202,10 @@ public:
return result;
}
[[nodiscard]] constexpr ImageId WithTertiary(colour_t tertiary) const
[[nodiscard]] constexpr ImageId WithTertiary(OpenRCT2::Drawing::Colour tertiary) const
{
ImageId result = *this;
result._tertiary = tertiary;
result._tertiary = EnumValue(tertiary);
result._flags &= ~kFlagPrimary;
result._flags |= kFlagSecondary;
if (!(_flags & kFlagSecondary))
@@ -215,7 +217,7 @@ public:
return result;
}
[[nodiscard]] ImageId WithTransparency(colour_t colour) const
[[nodiscard]] ImageId WithTransparency(OpenRCT2::Drawing::Colour colour) const
{
return WithTransparency(GetGlassPaletteId(colour));
}
+1 -2
View File
@@ -9,7 +9,6 @@
#include "Rectangle.h"
#include "../interface/Colour.h"
#include "../interface/ColourWithFlags.h"
#include "../world/Location.hpp"
#include "ColourMap.h"
@@ -53,7 +52,7 @@ namespace OpenRCT2::Drawing::Rectangle
const auto rightBottom = ScreenCoordsXY{ rect.GetRight(), rect.GetBottom() };
if (colour.flags.has(ColourFlag::translucent))
{
auto palette = kTranslucentWindowPalettes[colour.colour];
auto palette = kTranslucentWindowPalettes[EnumValue(colour.colour)];
switch (borderStyle)
{
-1
View File
@@ -14,7 +14,6 @@
#include "../core/CodepointView.hpp"
#include "../core/EnumUtils.hpp"
#include "../core/String.hpp"
#include "../interface/Colour.h"
#include "../localisation/Formatter.h"
#include "../localisation/Formatting.h"
#include "../localisation/LocalisationService.h"
+1 -1
View File
@@ -56,7 +56,7 @@ public:
for (int32_t line = 0; line < LineCount; ++line)
{
DrawText(rt, lineCoords, tempPaint, buffer);
tempPaint.Colour = COLOUR_NULL;
tempPaint.Colour = OpenRCT2::Drawing::kColourNull;
buffer = GetStringEnd(buffer) + 1;
lineCoords.y += LineHeight;
}
+12 -12
View File
@@ -9,7 +9,7 @@
#pragma once
#include "../interface/Colour.h"
#include "../drawing/Colour.h"
#include "../interface/ColourWithFlags.h"
#include "../localisation/StringIdType.h"
#include "Font.h"
@@ -50,7 +50,7 @@ enum class TextDarkness : uint8_t
struct TextPaint
{
ColourWithFlags Colour = { COLOUR_BLACK };
ColourWithFlags Colour = { OpenRCT2::Drawing::Colour::black };
::FontStyle FontStyle = FontStyle::medium;
TextUnderline UnderlineText = TextUnderline::off;
TextAlignment Alignment = TextAlignment::left;
@@ -61,7 +61,7 @@ struct TextPaint
: Colour(colour)
{
}
TextPaint(colour_t colour)
TextPaint(OpenRCT2::Drawing::Colour colour)
: Colour(ColourWithFlags{ colour })
{
}
@@ -83,7 +83,7 @@ struct TextPaint
, FontStyle(fontStyle)
{
}
TextPaint(colour_t colour, ::FontStyle fontStyle)
TextPaint(OpenRCT2::Drawing::Colour colour, ::FontStyle fontStyle)
: Colour(ColourWithFlags{ colour })
, FontStyle(fontStyle)
{
@@ -93,7 +93,7 @@ struct TextPaint
, UnderlineText(underlineText)
{
}
TextPaint(colour_t colour, TextUnderline underlineText)
TextPaint(OpenRCT2::Drawing::Colour colour, TextUnderline underlineText)
: Colour(ColourWithFlags{ colour })
, UnderlineText(underlineText)
{
@@ -103,7 +103,7 @@ struct TextPaint
, Alignment(alignment)
{
}
TextPaint(colour_t colour, TextAlignment alignment)
TextPaint(OpenRCT2::Drawing::Colour colour, TextAlignment alignment)
: Colour(ColourWithFlags{ colour })
, Alignment(alignment)
{
@@ -131,7 +131,7 @@ struct TextPaint
, UnderlineText(underlineText)
{
}
TextPaint(colour_t colour, ::FontStyle fontStyle, TextUnderline underlineText)
TextPaint(OpenRCT2::Drawing::Colour colour, ::FontStyle fontStyle, TextUnderline underlineText)
: Colour(ColourWithFlags{ colour })
, FontStyle(fontStyle)
, UnderlineText(underlineText)
@@ -143,7 +143,7 @@ struct TextPaint
, Alignment(alignment)
{
}
TextPaint(colour_t colour, ::FontStyle fontStyle, TextAlignment alignment)
TextPaint(OpenRCT2::Drawing::Colour colour, ::FontStyle fontStyle, TextAlignment alignment)
: Colour(ColourWithFlags{ colour })
, FontStyle(fontStyle)
, Alignment(alignment)
@@ -155,7 +155,7 @@ struct TextPaint
, Darkness(darkness)
{
}
TextPaint(colour_t colour, ::FontStyle fontStyle, TextDarkness darkness)
TextPaint(OpenRCT2::Drawing::Colour colour, ::FontStyle fontStyle, TextDarkness darkness)
: Colour(ColourWithFlags{ colour })
, FontStyle(fontStyle)
, Darkness(darkness)
@@ -167,7 +167,7 @@ struct TextPaint
, Alignment(alignment)
{
}
TextPaint(colour_t colour, TextUnderline underlineText, TextAlignment alignment)
TextPaint(OpenRCT2::Drawing::Colour colour, TextUnderline underlineText, TextAlignment alignment)
: Colour(ColourWithFlags{ colour })
, UnderlineText(underlineText)
, Alignment(alignment)
@@ -187,7 +187,7 @@ struct TextPaint
, Alignment(alignment)
{
}
TextPaint(colour_t colour, ::FontStyle fontStyle, TextUnderline underlineText, TextAlignment alignment)
TextPaint(OpenRCT2::Drawing::Colour colour, ::FontStyle fontStyle, TextUnderline underlineText, TextAlignment alignment)
: Colour(ColourWithFlags{ colour })
, FontStyle(fontStyle)
, UnderlineText(underlineText)
@@ -201,7 +201,7 @@ struct TextPaint
, Darkness(darkness)
{
}
TextPaint(colour_t colour, ::FontStyle fontStyle, TextAlignment alignment, TextDarkness darkness)
TextPaint(OpenRCT2::Drawing::Colour colour, ::FontStyle fontStyle, TextAlignment alignment, TextDarkness darkness)
: Colour(ColourWithFlags{ colour })
, FontStyle(fontStyle)
, Alignment(alignment)
+1 -1
View File
@@ -569,7 +569,7 @@ void X8DrawingContext::DrawSpriteSolid(RenderTarget& rt, const ImageId image, in
palette[0] = PaletteIndex::transparent;
const auto spriteCoords = ScreenCoordsXY{ x, y };
GfxDrawSpritePaletteSetSoftware(rt, ImageId(image.GetIndex(), 0), spriteCoords, PaletteMap(palette));
GfxDrawSpritePaletteSetSoftware(rt, ImageId(image.GetIndex(), Colour::black), spriteCoords, PaletteMap(palette));
}
void X8DrawingContext::DrawGlyph(RenderTarget& rt, const ImageId image, int32_t x, int32_t y, const PaletteMap& paletteMap)
+1 -1
View File
@@ -100,7 +100,7 @@ void Balloon::Pop(bool playSound)
}
}
void Balloon::Create(const CoordsXYZ& balloonPos, int32_t colour, bool isPopped)
void Balloon::Create(const CoordsXYZ& balloonPos, Drawing::Colour colour, bool isPopped)
{
auto* balloon = getGameState().entities.CreateEntity<Balloon>();
if (balloon == nullptr)
+7 -2
View File
@@ -15,14 +15,19 @@ class DataSerialiser;
struct CoordsXYZ;
struct PaintSession;
namespace OpenRCT2::Drawing
{
enum class Colour : uint8_t;
}
struct Balloon : EntityBase
{
static constexpr auto cEntityType = EntityType::balloon;
uint16_t frame;
uint16_t popped;
uint8_t time_to_move;
uint8_t colour;
static void Create(const CoordsXYZ& balloonPos, int32_t colour, bool isPopped);
OpenRCT2::Drawing::Colour colour;
static void Create(const CoordsXYZ& balloonPos, OpenRCT2::Drawing::Colour colour, bool isPopped);
void Update();
void Pop(bool playSound);
void Press();
+97 -92
View File
@@ -517,8 +517,8 @@ static void ApplyEasterEggToNearbyGuests(Guest& guest)
void Guest::GivePassingGuestPurpleClothes(Guest& passingPeep)
{
passingPeep.TshirtColour = COLOUR_BRIGHT_PURPLE;
passingPeep.TrousersColour = COLOUR_BRIGHT_PURPLE;
passingPeep.TshirtColour = Drawing::Colour::brightPurple;
passingPeep.TrousersColour = Drawing::Colour::brightPurple;
passingPeep.Invalidate();
}
@@ -1672,16 +1672,21 @@ static bool GuestDecideAndBuyItem(Guest& guest, Ride& ride, const ShopItem shopI
switch (shopItem)
{
case ShopItem::tShirt:
guest.TshirtColour = hasRandomShopColour ? ScenarioRandMax(kColourNumNormal) : ride.trackColours[0].main;
guest.TshirtColour = hasRandomShopColour ? static_cast<Drawing::Colour>(ScenarioRandMax(Drawing::kColourNumNormal))
: ride.trackColours[0].main;
break;
case ShopItem::hat:
guest.HatColour = hasRandomShopColour ? ScenarioRandMax(kColourNumNormal) : ride.trackColours[0].main;
guest.HatColour = hasRandomShopColour ? static_cast<Drawing::Colour>(ScenarioRandMax(Drawing::kColourNumNormal))
: ride.trackColours[0].main;
break;
case ShopItem::balloon:
guest.BalloonColour = hasRandomShopColour ? ScenarioRandMax(kColourNumNormal) : ride.trackColours[0].main;
guest.BalloonColour = hasRandomShopColour ? static_cast<Drawing::Colour>(ScenarioRandMax(Drawing::kColourNumNormal))
: ride.trackColours[0].main;
break;
case ShopItem::umbrella:
guest.UmbrellaColour = hasRandomShopColour ? ScenarioRandMax(kColourNumNormal) : ride.trackColours[0].main;
guest.UmbrellaColour = hasRandomShopColour
? static_cast<Drawing::Colour>(ScenarioRandMax(Drawing::kColourNumNormal))
: ride.trackColours[0].main;
break;
case ShopItem::map:
guest.ResetPathfindGoal();
@@ -7125,95 +7130,95 @@ static constexpr PeepNauseaTolerance nausea_tolerance_distribution[] = {
};
/** rct2: 0x009823BC */
static constexpr uint8_t kTrouserColours[] = {
COLOUR_BLACK,
COLOUR_GREY,
COLOUR_LIGHT_BROWN,
COLOUR_SATURATED_BROWN,
COLOUR_DARK_BROWN,
COLOUR_SALMON_PINK,
COLOUR_BLACK,
COLOUR_GREY,
COLOUR_LIGHT_BROWN,
COLOUR_SATURATED_BROWN,
COLOUR_DARK_BROWN,
COLOUR_SALMON_PINK,
COLOUR_BLACK,
COLOUR_GREY,
COLOUR_LIGHT_BROWN,
COLOUR_SATURATED_BROWN,
COLOUR_DARK_BROWN,
COLOUR_SALMON_PINK,
COLOUR_DARK_PURPLE,
COLOUR_LIGHT_PURPLE,
COLOUR_DARK_BLUE,
COLOUR_SATURATED_GREEN,
COLOUR_SATURATED_RED,
COLOUR_DARK_ORANGE,
COLOUR_BORDEAUX_RED,
COLOUR_DARK_OLIVE_DARK,
COLOUR_OLIVE_DARK,
COLOUR_DEEP_WATER,
COLOUR_DULL_BROWN_DARK,
static constexpr Drawing::Colour kTrouserColours[] = {
Drawing::Colour::black,
Drawing::Colour::grey,
Drawing::Colour::lightBrown,
Drawing::Colour::saturatedBrown,
Drawing::Colour::darkBrown,
Drawing::Colour::salmonPink,
Drawing::Colour::black,
Drawing::Colour::grey,
Drawing::Colour::lightBrown,
Drawing::Colour::saturatedBrown,
Drawing::Colour::darkBrown,
Drawing::Colour::salmonPink,
Drawing::Colour::black,
Drawing::Colour::grey,
Drawing::Colour::lightBrown,
Drawing::Colour::saturatedBrown,
Drawing::Colour::darkBrown,
Drawing::Colour::salmonPink,
Drawing::Colour::darkPurple,
Drawing::Colour::lightPurple,
Drawing::Colour::darkBlue,
Drawing::Colour::saturatedGreen,
Drawing::Colour::saturatedRed,
Drawing::Colour::darkOrange,
Drawing::Colour::bordeauxRed,
Drawing::Colour::armyGreen,
Drawing::Colour::hunterGreen,
Drawing::Colour::deepWater,
Drawing::Colour::umber,
};
/** rct2: 0x009823D5 */
static constexpr uint8_t kTshirtColours[] = {
COLOUR_BLACK,
COLOUR_GREY,
COLOUR_LIGHT_BROWN,
COLOUR_SATURATED_BROWN,
COLOUR_DARK_BROWN,
COLOUR_SALMON_PINK,
COLOUR_BLACK,
COLOUR_GREY,
COLOUR_LIGHT_BROWN,
COLOUR_SATURATED_BROWN,
COLOUR_DARK_BROWN,
COLOUR_SALMON_PINK,
COLOUR_DARK_PURPLE,
COLOUR_LIGHT_PURPLE,
COLOUR_DARK_BLUE,
COLOUR_SATURATED_GREEN,
COLOUR_SATURATED_RED,
COLOUR_DARK_ORANGE,
COLOUR_BORDEAUX_RED,
COLOUR_WHITE,
COLOUR_BRIGHT_PURPLE,
COLOUR_LIGHT_BLUE,
COLOUR_DARK_WATER,
COLOUR_DARK_GREEN,
COLOUR_MOSS_GREEN,
COLOUR_BRIGHT_GREEN,
COLOUR_OLIVE_GREEN,
COLOUR_DARK_OLIVE_GREEN,
COLOUR_YELLOW,
COLOUR_LIGHT_ORANGE,
COLOUR_BRIGHT_RED,
COLOUR_DARK_PINK,
COLOUR_BRIGHT_PINK,
COLOUR_DARK_OLIVE_DARK,
COLOUR_DARK_OLIVE_LIGHT,
COLOUR_SATURATED_BROWN_LIGHT,
COLOUR_BORDEAUX_RED_DARK,
COLOUR_BORDEAUX_RED_LIGHT,
COLOUR_GRASS_GREEN_DARK,
COLOUR_GRASS_GREEN_LIGHT,
COLOUR_OLIVE_DARK,
COLOUR_OLIVE_LIGHT,
COLOUR_SATURATED_GREEN_LIGHT,
COLOUR_TAN_DARK,
COLOUR_TAN_LIGHT,
COLOUR_DULL_PURPLE_LIGHT,
COLOUR_DULL_GREEN_DARK,
COLOUR_DULL_GREEN_LIGHT,
COLOUR_SATURATED_PURPLE_DARK,
COLOUR_SATURATED_PURPLE_LIGHT,
COLOUR_ORANGE_LIGHT,
COLOUR_DEEP_WATER,
COLOUR_MAGENTA_LIGHT,
COLOUR_DULL_BROWN_DARK,
COLOUR_DULL_BROWN_LIGHT,
static constexpr Drawing::Colour kTshirtColours[] = {
Drawing::Colour::black,
Drawing::Colour::grey,
Drawing::Colour::lightBrown,
Drawing::Colour::saturatedBrown,
Drawing::Colour::darkBrown,
Drawing::Colour::salmonPink,
Drawing::Colour::black,
Drawing::Colour::grey,
Drawing::Colour::lightBrown,
Drawing::Colour::saturatedBrown,
Drawing::Colour::darkBrown,
Drawing::Colour::salmonPink,
Drawing::Colour::darkPurple,
Drawing::Colour::lightPurple,
Drawing::Colour::darkBlue,
Drawing::Colour::saturatedGreen,
Drawing::Colour::saturatedRed,
Drawing::Colour::darkOrange,
Drawing::Colour::bordeauxRed,
Drawing::Colour::white,
Drawing::Colour::brightPurple,
Drawing::Colour::lightBlue,
Drawing::Colour::darkWater,
Drawing::Colour::darkGreen,
Drawing::Colour::mossGreen,
Drawing::Colour::brightGreen,
Drawing::Colour::oliveGreen,
Drawing::Colour::darkOliveGreen,
Drawing::Colour::yellow,
Drawing::Colour::lightOrange,
Drawing::Colour::brightRed,
Drawing::Colour::darkPink,
Drawing::Colour::brightPink,
Drawing::Colour::armyGreen,
Drawing::Colour::honeyDew,
Drawing::Colour::tan,
Drawing::Colour::maroon,
Drawing::Colour::coralPink,
Drawing::Colour::forestGreen,
Drawing::Colour::chartreuse,
Drawing::Colour::hunterGreen,
Drawing::Colour::celadon,
Drawing::Colour::limeGreen,
Drawing::Colour::sepia,
Drawing::Colour::peach,
Drawing::Colour::periwinkle,
Drawing::Colour::viridian,
Drawing::Colour::seafoamGreen,
Drawing::Colour::violet,
Drawing::Colour::lavender,
Drawing::Colour::pastelOrange,
Drawing::Colour::deepWater,
Drawing::Colour::pastelPink,
Drawing::Colour::umber,
Drawing::Colour::beige,
};
// clang-format on
Loaded 100 of 266 files, more files were not shown because too many files have changed in this diff. Show more