From b0fd5f93d7e41dce8ffc7a7177e5944c890adb25 Mon Sep 17 00:00:00 2001 From: pizza2004 Date: Tue, 3 Nov 2020 03:59:00 -0700 Subject: [PATCH] Refactor UI/Interface misc to TitleCase (#13354) * Refactor LandTool to Namespace * Refactor Theme to TitleCase * Refactor ViewportInteraction to TitleCase --- src/openrct2-ui/UiContext.cpp | 2 +- src/openrct2-ui/WindowManager.cpp | 2 +- src/openrct2-ui/input/MouseInput.cpp | 8 +- src/openrct2-ui/interface/InGameConsole.cpp | 4 +- src/openrct2-ui/interface/LandTool.cpp | 6 +- src/openrct2-ui/interface/LandTool.h | 9 +- src/openrct2-ui/interface/Theme.cpp | 70 +++++++------- src/openrct2-ui/interface/Theme.h | 44 ++++----- .../interface/ViewportInteraction.cpp | 64 ++++++------- src/openrct2-ui/interface/Window.cpp | 2 +- src/openrct2-ui/windows/ClearScenery.cpp | 2 +- .../windows/EditorBottomToolbar.cpp | 2 +- src/openrct2-ui/windows/GameBottomToolbar.cpp | 6 +- src/openrct2-ui/windows/Land.cpp | 6 +- src/openrct2-ui/windows/LandRights.cpp | 2 +- src/openrct2-ui/windows/Map.cpp | 4 +- src/openrct2-ui/windows/MapGen.cpp | 8 +- src/openrct2-ui/windows/MapTooltip.cpp | 2 +- src/openrct2-ui/windows/Options.cpp | 12 +-- src/openrct2-ui/windows/Park.cpp | 2 +- src/openrct2-ui/windows/Ride.cpp | 4 +- src/openrct2-ui/windows/RideConstruction.cpp | 2 +- src/openrct2-ui/windows/RideList.cpp | 2 +- src/openrct2-ui/windows/ScenarioSelect.cpp | 8 +- src/openrct2-ui/windows/SceneryScatter.cpp | 2 +- src/openrct2-ui/windows/ServerStart.cpp | 2 +- src/openrct2-ui/windows/Staff.cpp | 6 +- src/openrct2-ui/windows/Themes.cpp | 92 +++++++++---------- .../windows/TitleCommandEditor.cpp | 4 +- src/openrct2-ui/windows/TopToolbar.cpp | 2 +- src/openrct2-ui/windows/TrackDesignPlace.cpp | 4 +- src/openrct2-ui/windows/Water.cpp | 2 +- src/openrct2/interface/Viewport.h | 14 +-- 33 files changed, 202 insertions(+), 199 deletions(-) diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index 6dde2721af..9fa8913b3a 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -134,7 +134,7 @@ public: void Draw(rct_drawpixelinfo* dpi) override { - auto bgColour = theme_get_colour(WC_CHAT, 0); + auto bgColour = ThemeGetColour(WC_CHAT, 0); chat_draw(dpi, bgColour); _inGameConsole.Draw(dpi); } diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 1dd66d30e0..b6bf32c290 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -30,7 +30,7 @@ class WindowManager final : public IWindowManager public: void Init() override { - theme_manager_initialise(); + ThemeManagerInitialise(); window_guest_list_init_vars(); window_new_ride_init_vars(); } diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index 033b4210b6..09cdcc0b73 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -346,7 +346,7 @@ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, int32_t sta if (_ticksSinceDragStart < 500) { // If the user pressed the right mouse button for less than 500 ticks, interpret as right click - viewport_interaction_right_click(screenCoords); + ViewportInteractionRightClick(screenCoords); } } break; @@ -399,7 +399,7 @@ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, int32_t sta } else if (!(_inputFlags & INPUT_FLAG_4)) { - viewport_interaction_left_click(screenCoords); + ViewportInteractionLeftClick(screenCoords); } } break; @@ -1087,7 +1087,7 @@ void ProcessMouseOver(const ScreenCoordsXY& screenCoords) case WWT_VIEWPORT: if (!(_inputFlags & INPUT_FLAG_TOOL_ACTIVE)) { - if (viewport_interaction_left_over(screenCoords)) + if (ViewportInteractionLeftOver(screenCoords)) { SetCursor(CursorID::HandPoint); return; @@ -1140,7 +1140,7 @@ void ProcessMouseOver(const ScreenCoordsXY& screenCoords) } } - viewport_interaction_right_over(screenCoords); + ViewportInteractionRightOver(screenCoords); SetCursor(cursorId); } diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index 0248670e51..d9ca7a1dd5 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -271,7 +271,7 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const // Set font gCurrentFontSpriteBase = (gConfigInterface.console_small_font ? FONT_SPRITE_BASE_SMALL : FONT_SPRITE_BASE_MEDIUM); gCurrentFontFlags = 0; - uint8_t textColour = NOT_TRANSLUCENT(theme_get_colour(WC_CONSOLE, 1)); + uint8_t textColour = NOT_TRANSLUCENT(ThemeGetColour(WC_CONSOLE, 1)); const int32_t lineHeight = font_get_line_height(gCurrentFontSpriteBase); const int32_t maxLines = GetNumVisibleLines(); @@ -301,7 +301,7 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const dpi, { { _consoleLeft, _consoleBottom - lineHeight - 10 }, { _consoleRight, _consoleBottom - 1 } }, PALETTE_51); // Paint background colour. - uint8_t backgroundColour = theme_get_colour(WC_CONSOLE, 0); + uint8_t backgroundColour = ThemeGetColour(WC_CONSOLE, 0); gfx_fill_rect_inset( dpi, _consoleLeft, _consoleTop, _consoleRight, _consoleBottom, backgroundColour, INSET_RECT_FLAG_FILL_NONE); gfx_fill_rect_inset( diff --git a/src/openrct2-ui/interface/LandTool.cpp b/src/openrct2-ui/interface/LandTool.cpp index 0c146180a1..9ef4ddfbf1 100644 --- a/src/openrct2-ui/interface/LandTool.cpp +++ b/src/openrct2-ui/interface/LandTool.cpp @@ -44,7 +44,7 @@ ObjectEntryIndex gLandToolTerrainEdge; money32 gWaterToolRaiseCost; money32 gWaterToolLowerCost; -uint32_t land_tool_size_to_sprite_index(uint16_t size) +uint32_t LandTool::SizeToSpriteIndex(uint16_t size) { if (size <= MAX_TOOL_SIZE_WITH_SPRITE) { @@ -56,7 +56,7 @@ uint32_t land_tool_size_to_sprite_index(uint16_t size) } } -void land_tool_show_surface_style_dropdown(rct_window* w, rct_widget* widget, uint8_t currentSurfaceType) +void LandTool::ShowSurfaceStyleDropdown(rct_window* w, rct_widget* widget, uint8_t currentSurfaceType) { auto& objManager = GetContext()->GetObjectManager(); @@ -89,7 +89,7 @@ void land_tool_show_surface_style_dropdown(rct_window* w, rct_widget* widget, ui gDropdownDefaultIndex = defaultIndex; } -void land_tool_show_edge_style_dropdown(rct_window* w, rct_widget* widget, uint8_t currentEdgeType) +void LandTool::ShowEdgeStyleDropdown(rct_window* w, rct_widget* widget, uint8_t currentEdgeType) { auto& objManager = GetContext()->GetObjectManager(); diff --git a/src/openrct2-ui/interface/LandTool.h b/src/openrct2-ui/interface/LandTool.h index 5cda075721..1a4295aa95 100644 --- a/src/openrct2-ui/interface/LandTool.h +++ b/src/openrct2-ui/interface/LandTool.h @@ -26,6 +26,9 @@ extern ObjectEntryIndex gLandToolTerrainEdge; extern money32 gWaterToolRaiseCost; extern money32 gWaterToolLowerCost; -uint32_t land_tool_size_to_sprite_index(uint16_t size); -void land_tool_show_surface_style_dropdown(rct_window* w, rct_widget* widget, uint8_t currentSurfaceType); -void land_tool_show_edge_style_dropdown(rct_window* w, rct_widget* widget, uint8_t currentEdgeType); +namespace LandTool +{ + uint32_t SizeToSpriteIndex(uint16_t size); + void ShowSurfaceStyleDropdown(rct_window* w, rct_widget* widget, uint8_t currentSurfaceType); + void ShowEdgeStyleDropdown(rct_window* w, rct_widget* widget, uint8_t currentEdgeType); +} // namespace LandTool diff --git a/src/openrct2-ui/interface/Theme.cpp b/src/openrct2-ui/interface/Theme.cpp index d5907412cb..debad2e272 100644 --- a/src/openrct2-ui/interface/Theme.cpp +++ b/src/openrct2-ui/interface/Theme.cpp @@ -625,7 +625,7 @@ namespace ThemeManager if (!configValid) { - String::DiscardDuplicate(&gConfigInterface.current_theme_preset, theme_manager_get_available_theme_config_name(1)); + String::DiscardDuplicate(&gConfigInterface.current_theme_preset, ThemeManagerGetAvailableThemeConfigName(1)); } } @@ -658,38 +658,38 @@ namespace ThemeManager } } // namespace ThemeManager -void theme_manager_load_available_themes() +void ThemeManagerLoadAvailableThemes() { ThemeManager::GetAvailableThemes(&ThemeManager::AvailableThemes); } -size_t theme_manager_get_num_available_themes() +size_t ThemeManagerGetNumAvailableThemes() { return ThemeManager::AvailableThemes.size(); } -const utf8* theme_manager_get_available_theme_path(size_t index) +const utf8* ThemeManagerGetAvailableThemePath(size_t index) { return ThemeManager::AvailableThemes[index].Path.c_str(); } -const utf8* theme_manager_get_available_theme_config_name(size_t index) +const utf8* ThemeManagerGetAvailableThemeConfigName(size_t index) { return ThemeManager::AvailableThemes[index].Name.c_str(); } -const utf8* theme_manager_get_available_theme_name(size_t index) +const utf8* ThemeManagerGetAvailableThemeName(size_t index) { if (index < ThemeManager::NumPredefinedThemes) return language_get_string(PredefinedThemes[index].Name); return ThemeManager::AvailableThemes[index].Name.c_str(); } -size_t theme_manager_get_active_available_theme_index() +size_t ThemeManagerGetAvailableThemeIndex() { return ThemeManager::ActiveAvailableThemeIndex; } -void theme_manager_set_active_available_theme(size_t index) +void ThemeManagerSetActiveAvailableTheme(size_t index) { if (index < ThemeManager::NumPredefinedThemes) { @@ -707,17 +707,17 @@ void theme_manager_set_active_available_theme(size_t index) } } ThemeManager::ActiveAvailableThemeIndex = index; - String::DiscardDuplicate(&gConfigInterface.current_theme_preset, theme_manager_get_available_theme_config_name(index)); + String::DiscardDuplicate(&gConfigInterface.current_theme_preset, ThemeManagerGetAvailableThemeConfigName(index)); - colour_scheme_update_all(); + ColourSchemeUpdateAll(); } -size_t theme_get_index_for_name(const utf8* name) +size_t ThemeGetIndexForName(const utf8* name) { size_t count = ThemeManager::AvailableThemes.size(); for (size_t i = 0; i < count; i++) { - const utf8* tn = theme_manager_get_available_theme_name(i); + const utf8* tn = ThemeManagerGetAvailableThemeName(i); if (String::Equals(tn, name, true)) { return i; @@ -726,7 +726,7 @@ size_t theme_get_index_for_name(const utf8* name) return SIZE_MAX; } -uint8_t theme_get_colour(rct_windowclass wc, uint8_t index) +uint8_t ThemeGetColour(rct_windowclass wc, uint8_t index) { const UIThemeWindowEntry* entry = ThemeManager::CurrentTheme->GetEntry(wc); if (entry == nullptr) @@ -744,7 +744,7 @@ uint8_t theme_get_colour(rct_windowclass wc, uint8_t index) } } -void theme_set_colour(rct_windowclass wc, uint8_t index, colour_t colour) +void ThemeSetColour(rct_windowclass wc, uint8_t index, colour_t colour) { UIThemeWindowEntry entry{}; entry.WindowClass = wc; @@ -767,27 +767,27 @@ void theme_set_colour(rct_windowclass wc, uint8_t index, colour_t colour) entry.Theme.Colours[index] = colour; ThemeManager::CurrentTheme->SetEntry(&entry); - theme_save(); + ThemeSave(); } -uint8_t theme_get_flags() +uint8_t ThemeGetFlags() { return ThemeManager::CurrentTheme->Flags; } -void theme_set_flags(uint8_t flags) +void ThemeSetFlags(uint8_t flags) { ThemeManager::CurrentTheme->Flags = flags; - theme_save(); + ThemeSave(); } -void theme_save() +void ThemeSave() { ThemeManager::EnsureThemeDirectoryExists(); ThemeManager::CurrentTheme->WriteToFile(ThemeManager::CurrentThemePath); } -void theme_rename(const utf8* name) +void ThemeRename(const utf8* name) { const auto oldPath = ThemeManager::CurrentThemePath; @@ -799,19 +799,19 @@ void theme_rename(const utf8* name) ThemeManager::CurrentTheme->Name = name; ThemeManager::CurrentTheme->WriteToFile(ThemeManager::CurrentThemePath); - theme_manager_load_available_themes(); + ThemeManagerLoadAvailableThemes(); for (size_t i = 0; i < ThemeManager::AvailableThemes.size(); i++) { if (Path::Equals(newPath, ThemeManager::AvailableThemes[i].Path)) { ThemeManager::ActiveAvailableThemeIndex = i; - String::DiscardDuplicate(&gConfigInterface.current_theme_preset, theme_manager_get_available_theme_config_name(1)); + String::DiscardDuplicate(&gConfigInterface.current_theme_preset, ThemeManagerGetAvailableThemeConfigName(1)); break; } } } -void theme_duplicate(const utf8* name) +void ThemeDuplicate(const utf8* name) { ThemeManager::EnsureThemeDirectoryExists(); auto newPath = ThemeManager::GetThemeFileName(name); @@ -825,32 +825,32 @@ void theme_duplicate(const utf8* name) ThemeManager::LoadTheme(newPath); - theme_manager_load_available_themes(); + ThemeManagerLoadAvailableThemes(); for (size_t i = 0; i < ThemeManager::AvailableThemes.size(); i++) { if (Path::Equals(newPath, ThemeManager::AvailableThemes[i].Path)) { ThemeManager::ActiveAvailableThemeIndex = i; - String::DiscardDuplicate(&gConfigInterface.current_theme_preset, theme_manager_get_available_theme_config_name(i)); + String::DiscardDuplicate(&gConfigInterface.current_theme_preset, ThemeManagerGetAvailableThemeConfigName(i)); break; } } } -void theme_delete() +void ThemeDelete() { File::Delete(ThemeManager::CurrentThemePath); ThemeManager::LoadTheme(const_cast(&PredefinedThemeRCT2)); ThemeManager::ActiveAvailableThemeIndex = 1; - String::DiscardDuplicate(&gConfigInterface.current_theme_preset, theme_manager_get_available_theme_config_name(1)); + String::DiscardDuplicate(&gConfigInterface.current_theme_preset, ThemeManagerGetAvailableThemeConfigName(1)); } -void theme_manager_initialise() +void ThemeManagerInitialise() { ThemeManager::Initialise(); } -uint8_t theme_desc_get_num_colours(rct_windowclass wc) +uint8_t ThemeDescGetNumColours(rct_windowclass wc) { const WindowThemeDesc* desc = GetWindowThemeDescriptor(wc); if (desc == nullptr) @@ -860,7 +860,7 @@ uint8_t theme_desc_get_num_colours(rct_windowclass wc) return desc->NumColours; } -rct_string_id theme_desc_get_name(rct_windowclass wc) +rct_string_id ThemeDescGetName(rct_windowclass wc) { const WindowThemeDesc* desc = GetWindowThemeDescriptor(wc); if (desc == nullptr) @@ -870,17 +870,17 @@ rct_string_id theme_desc_get_name(rct_windowclass wc) return desc->WindowName; } -void colour_scheme_update_all() +void ColourSchemeUpdateAll() { - window_visit_each([](rct_window* w) { colour_scheme_update(w); }); + window_visit_each([](rct_window* w) { ColourSchemeUpdate(w); }); } -void colour_scheme_update(rct_window* window) +void ColourSchemeUpdate(rct_window* window) { - colour_scheme_update_by_class(window, window->classification); + ColourSchemeUpdateByClass(window, window->classification); } -void colour_scheme_update_by_class(rct_window* window, rct_windowclass classification) +void ColourSchemeUpdateByClass(rct_window* window, rct_windowclass classification) { const WindowTheme* windowTheme; const UIThemeWindowEntry* entry = ThemeManager::CurrentTheme->GetEntry(classification); diff --git a/src/openrct2-ui/interface/Theme.h b/src/openrct2-ui/interface/Theme.h index 19a1148c8f..84405135ec 100644 --- a/src/openrct2-ui/interface/Theme.h +++ b/src/openrct2-ui/interface/Theme.h @@ -21,28 +21,28 @@ enum UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR = 1 << 4, }; -void colour_scheme_update(rct_window* window); -void colour_scheme_update_all(); -void colour_scheme_update_by_class(rct_window* window, rct_windowclass classification); +void ColourSchemeUpdate(rct_window* window); +void ColourSchemeUpdateAll(); +void ColourSchemeUpdateByClass(rct_window* window, rct_windowclass classification); -void theme_manager_initialise(); -void theme_manager_load_available_themes(); -size_t theme_manager_get_num_available_themes(); -const utf8* theme_manager_get_available_theme_path(size_t index); -const utf8* theme_manager_get_available_theme_config_name(size_t index); -const utf8* theme_manager_get_available_theme_name(size_t index); -size_t theme_manager_get_active_available_theme_index(); -void theme_manager_set_active_available_theme(size_t index); -size_t theme_get_index_for_name(const utf8* name); +void ThemeManagerInitialise(); +void ThemeManagerLoadAvailableThemes(); +size_t ThemeManagerGetNumAvailableThemes(); +const utf8* ThemeManagerGetAvailableThemePath(size_t index); +const utf8* ThemeManagerGetAvailableThemeConfigName(size_t index); +const utf8* ThemeManagerGetAvailableThemeName(size_t index); +size_t ThemeManagerGetAvailableThemeIndex(); +void ThemeManagerSetActiveAvailableTheme(size_t index); +size_t ThemeGetIndexForName(const utf8* name); -colour_t theme_get_colour(rct_windowclass wc, uint8_t index); -void theme_set_colour(rct_windowclass wc, uint8_t index, colour_t colour); -uint8_t theme_get_flags(); -void theme_set_flags(uint8_t flags); -void theme_save(); -void theme_rename(const utf8* name); -void theme_duplicate(const utf8* name); -void theme_delete(); +colour_t ThemeGetColour(rct_windowclass wc, uint8_t index); +void ThemeSetColour(rct_windowclass wc, uint8_t index, colour_t colour); +uint8_t ThemeGetFlags(); +void ThemeSetFlags(uint8_t flags); +void ThemeSave(); +void ThemeRename(const utf8* name); +void ThemeDuplicate(const utf8* name); +void ThemeDelete(); -uint8_t theme_desc_get_num_colours(rct_windowclass wc); -rct_string_id theme_desc_get_name(rct_windowclass wc); +uint8_t ThemeDescGetNumColours(rct_windowclass wc); +rct_string_id ThemeDescGetName(rct_windowclass wc); diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index d71e9809b6..9afe6fbb4f 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -40,19 +40,19 @@ #include #include -static void viewport_interaction_remove_scenery(TileElement* tileElement, const CoordsXY& mapCoords); -static void viewport_interaction_remove_footpath(TileElement* tileElement, const CoordsXY& mapCoords); -static void viewport_interaction_remove_footpath_item(TileElement* tileElement, const CoordsXY& mapCoords); -static void viewport_interaction_remove_park_wall(TileElement* tileElement, const CoordsXY& mapCoords); -static void viewport_interaction_remove_large_scenery(TileElement* tileElement, const CoordsXY& mapCoords); -static void viewport_interaction_remove_park_entrance(TileElement* tileElement, CoordsXY mapCoords); -static Peep* viewport_interaction_get_closest_peep(ScreenCoordsXY screenCoords, int32_t maxDistance); +static void ViewportInteractionRemoveScenery(TileElement* tileElement, const CoordsXY& mapCoords); +static void ViewportInteractionRemoveFootpath(TileElement* tileElement, const CoordsXY& mapCoords); +static void ViewportInteractionRemoveFootpathItem(TileElement* tileElement, const CoordsXY& mapCoords); +static void ViewportInteractionRemoveParkWall(TileElement* tileElement, const CoordsXY& mapCoords); +static void ViewportInteractionRemoveLargeScenery(TileElement* tileElement, const CoordsXY& mapCoords); +static void ViewportInteractionRemoveParkEntrance(TileElement* tileElement, CoordsXY mapCoords); +static Peep* ViewportInteractionGetClosestPeep(ScreenCoordsXY screenCoords, int32_t maxDistance); /** * * rct2: 0x006ED9D0 */ -InteractionInfo viewport_interaction_get_item_left(const ScreenCoordsXY& screenCoords) +InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoords) { InteractionInfo info{}; // No click input for scenario editor or track manager @@ -133,7 +133,7 @@ InteractionInfo viewport_interaction_get_item_left(const ScreenCoordsXY& screenC // If nothing is under cursor, find a close by peep if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE) { - auto peep = viewport_interaction_get_closest_peep(screenCoords, 32); + auto peep = ViewportInteractionGetClosestPeep(screenCoords, 32); if (peep != nullptr) { info.Entity = peep; @@ -147,9 +147,9 @@ InteractionInfo viewport_interaction_get_item_left(const ScreenCoordsXY& screenC return info; } -bool viewport_interaction_left_over(const ScreenCoordsXY& screenCoords) +bool ViewportInteractionLeftOver(const ScreenCoordsXY& screenCoords) { - auto info = viewport_interaction_get_item_left(screenCoords); + auto info = ViewportInteractionGetItemLeft(screenCoords); switch (info.SpriteType) { @@ -162,9 +162,9 @@ bool viewport_interaction_left_over(const ScreenCoordsXY& screenCoords) } } -bool viewport_interaction_left_click(const ScreenCoordsXY& screenCoords) +bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) { - auto info = viewport_interaction_get_item_left(screenCoords); + auto info = ViewportInteractionGetItemLeft(screenCoords); switch (info.SpriteType) { @@ -232,7 +232,7 @@ bool viewport_interaction_left_click(const ScreenCoordsXY& screenCoords) * * rct2: 0x006EDE88 */ -InteractionInfo viewport_interaction_get_item_right(const ScreenCoordsXY& screenCoords) +InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoords) { rct_scenery_entry* sceneryEntry; Ride* ride; @@ -496,9 +496,9 @@ InteractionInfo viewport_interaction_get_item_right(const ScreenCoordsXY& screen return info; } -bool viewport_interaction_right_over(const ScreenCoordsXY& screenCoords) +bool ViewportInteractionRightOver(const ScreenCoordsXY& screenCoords) { - auto info = viewport_interaction_get_item_right(screenCoords); + auto info = ViewportInteractionGetItemRight(screenCoords); return info.SpriteType != VIEWPORT_INTERACTION_ITEM_NONE; } @@ -507,10 +507,10 @@ bool viewport_interaction_right_over(const ScreenCoordsXY& screenCoords) * * rct2: 0x006E8A62 */ -bool viewport_interaction_right_click(const ScreenCoordsXY& screenCoords) +bool ViewportInteractionRightClick(const ScreenCoordsXY& screenCoords) { CoordsXYE tileElement; - auto info = viewport_interaction_get_item_right(screenCoords); + auto info = ViewportInteractionGetItemRight(screenCoords); switch (info.SpriteType) { @@ -543,22 +543,22 @@ bool viewport_interaction_right_click(const ScreenCoordsXY& screenCoords) ride_modify(&tileElement); break; case VIEWPORT_INTERACTION_ITEM_SCENERY: - viewport_interaction_remove_scenery(info.Element, info.Loc); + ViewportInteractionRemoveScenery(info.Element, info.Loc); break; case VIEWPORT_INTERACTION_ITEM_FOOTPATH: - viewport_interaction_remove_footpath(info.Element, info.Loc); + ViewportInteractionRemoveFootpath(info.Element, info.Loc); break; case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM: - viewport_interaction_remove_footpath_item(info.Element, info.Loc); + ViewportInteractionRemoveFootpathItem(info.Element, info.Loc); break; case VIEWPORT_INTERACTION_ITEM_PARK: - viewport_interaction_remove_park_entrance(info.Element, info.Loc); + ViewportInteractionRemoveParkEntrance(info.Element, info.Loc); break; case VIEWPORT_INTERACTION_ITEM_WALL: - viewport_interaction_remove_park_wall(info.Element, info.Loc); + ViewportInteractionRemoveParkWall(info.Element, info.Loc); break; case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY: - viewport_interaction_remove_large_scenery(info.Element, info.Loc); + ViewportInteractionRemoveLargeScenery(info.Element, info.Loc); break; case VIEWPORT_INTERACTION_ITEM_BANNER: context_open_detail_window(WD_BANNER, info.Element->AsBanner()->GetIndex()); @@ -572,7 +572,7 @@ bool viewport_interaction_right_click(const ScreenCoordsXY& screenCoords) * * rct2: 0x006E08D2 */ -static void viewport_interaction_remove_scenery(TileElement* tileElement, const CoordsXY& mapCoords) +static void ViewportInteractionRemoveScenery(TileElement* tileElement, const CoordsXY& mapCoords) { auto removeSceneryAction = SmallSceneryRemoveAction( { mapCoords.x, mapCoords.y, tileElement->GetBaseZ() }, tileElement->AsSmallScenery()->GetSceneryQuadrant(), @@ -585,7 +585,7 @@ static void viewport_interaction_remove_scenery(TileElement* tileElement, const * * rct2: 0x006A614A */ -static void viewport_interaction_remove_footpath(TileElement* tileElement, const CoordsXY& mapCoords) +static void ViewportInteractionRemoveFootpath(TileElement* tileElement, const CoordsXY& mapCoords) { rct_window* w; TileElement* tileElement2; @@ -613,7 +613,7 @@ static void viewport_interaction_remove_footpath(TileElement* tileElement, const * * rct2: 0x006A61AB */ -static void viewport_interaction_remove_footpath_item(TileElement* tileElement, const CoordsXY& mapCoords) +static void ViewportInteractionRemoveFootpathItem(TileElement* tileElement, const CoordsXY& mapCoords) { auto footpathAdditionRemoveAction = FootpathAdditionRemoveAction({ mapCoords.x, mapCoords.y, tileElement->GetBaseZ() }); GameActions::Execute(&footpathAdditionRemoveAction); @@ -623,7 +623,7 @@ static void viewport_interaction_remove_footpath_item(TileElement* tileElement, * * rct2: 0x00666C0E */ -void viewport_interaction_remove_park_entrance(TileElement* tileElement, CoordsXY mapCoords) +void ViewportInteractionRemoveParkEntrance(TileElement* tileElement, CoordsXY mapCoords) { int32_t rotation = tileElement->GetDirectionWithOffset(1); switch (tileElement->AsEntrance()->GetSequenceIndex()) @@ -643,7 +643,7 @@ void viewport_interaction_remove_park_entrance(TileElement* tileElement, CoordsX * * rct2: 0x006E57A9 */ -static void viewport_interaction_remove_park_wall(TileElement* tileElement, const CoordsXY& mapCoords) +static void ViewportInteractionRemoveParkWall(TileElement* tileElement, const CoordsXY& mapCoords) { rct_scenery_entry* sceneryEntry = tileElement->AsWall()->GetEntry(); if (sceneryEntry->wall.scrolling_mode != SCROLLING_MODE_NONE) @@ -662,7 +662,7 @@ static void viewport_interaction_remove_park_wall(TileElement* tileElement, cons * * rct2: 0x006B88DC */ -static void viewport_interaction_remove_large_scenery(TileElement* tileElement, const CoordsXY& mapCoords) +static void ViewportInteractionRemoveLargeScenery(TileElement* tileElement, const CoordsXY& mapCoords) { rct_scenery_entry* sceneryEntry = tileElement->AsLargeScenery()->GetEntry(); @@ -680,7 +680,7 @@ static void viewport_interaction_remove_large_scenery(TileElement* tileElement, } } -static Peep* viewport_interaction_get_closest_peep(ScreenCoordsXY screenCoords, int32_t maxDistance) +static Peep* ViewportInteractionGetClosestPeep(ScreenCoordsXY screenCoords, int32_t maxDistance) { rct_window* w; rct_viewport* viewport; @@ -721,7 +721,7 @@ static Peep* viewport_interaction_get_closest_peep(ScreenCoordsXY screenCoords, * * rct2: 0x0068A15E */ -CoordsXY sub_68A15E(const ScreenCoordsXY& screenCoords) +CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoords) { rct_window* window = window_find_from_point(screenCoords); if (window == nullptr || window->viewport == nullptr) diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index a2ddbbec65..80d8873b1c 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -171,7 +171,7 @@ rct_window* window_create( w->var_4AE = 0; w->viewport_smart_follow_sprite = SPRITE_INDEX_NULL; - colour_scheme_update(w); + ColourSchemeUpdate(w); w->Invalidate(); return w; } diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index 49f547fdfa..a9e9a332b1 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -206,7 +206,7 @@ static void window_clear_scenery_invalidate(rct_window* w) | (gClearLargeScenery ? (1 << WIDX_LARGE_SCENERY) : 0) | (gClearFootpath ? (1 << WIDX_FOOTPATH) : 0); // Update the preview image (for tool sizes up to 7) - window_clear_scenery_widgets[WIDX_PREVIEW].image = land_tool_size_to_sprite_index(gLandToolSize); + window_clear_scenery_widgets[WIDX_PREVIEW].image = LandTool::SizeToSpriteIndex(gLandToolSize); } /** diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index 188d416658..7469c82981 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -315,7 +315,7 @@ static void hide_next_step_button() */ void window_editor_bottom_toolbar_invalidate(rct_window* w) { - colour_scheme_update_by_class( + ColourSchemeUpdateByClass( w, (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR : WC_EDITOR_TRACK_BOTTOM_TOOLBAR); uint16_t screenWidth = context_get_width(); diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index 201f4cf345..16e6382a8a 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -283,7 +283,7 @@ static void window_game_bottom_toolbar_invalidate(rct_window* w) if (News::IsQueueEmpty()) { - if (!(theme_get_flags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR)) + if (!(ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR)) { window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WWT_EMPTY; window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].type = WWT_EMPTY; @@ -362,7 +362,7 @@ static void window_game_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* d w->windowPos.x + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right, w->windowPos.y + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].bottom, PALETTE_51); - if (theme_get_flags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) + if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) { // Draw grey background gfx_filter_rect( @@ -381,7 +381,7 @@ static void window_game_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* d { window_game_bottom_toolbar_draw_news_item(dpi, w); } - else if (theme_get_flags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) + else if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) { window_game_bottom_toolbar_draw_middle_panel(dpi, w); } diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index b426c169c6..33d1abc7ca 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -160,10 +160,10 @@ static void window_land_mousedown(rct_window* w, rct_widgetindex widgetIndex, rc switch (widgetIndex) { case WIDX_FLOOR: - land_tool_show_surface_style_dropdown(w, widget, _selectedFloorTexture); + LandTool::ShowSurfaceStyleDropdown(w, widget, _selectedFloorTexture); break; case WIDX_WALL: - land_tool_show_edge_style_dropdown(w, widget, _selectedWallTexture); + LandTool::ShowEdgeStyleDropdown(w, widget, _selectedWallTexture); break; case WIDX_PREVIEW: window_land_inputsize(w); @@ -308,7 +308,7 @@ static void window_land_invalidate(rct_window* w) window_land_widgets[WIDX_FLOOR].image = surfaceImage; window_land_widgets[WIDX_WALL].image = edgeImage; // Update the preview image (for tool sizes up to 7) - window_land_widgets[WIDX_PREVIEW].image = land_tool_size_to_sprite_index(gLandToolSize); + window_land_widgets[WIDX_PREVIEW].image = LandTool::SizeToSpriteIndex(gLandToolSize); } /** diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 63153dd78c..69fe5ae17e 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -227,7 +227,7 @@ static void window_land_rights_invalidate(rct_window* w) : WIDX_BUY_CONSTRUCTION_RIGHTS)); // Update the preview image - window_land_rights_widgets[WIDX_PREVIEW].image = land_tool_size_to_sprite_index(gLandToolSize); + window_land_rights_widgets[WIDX_PREVIEW].image = LandTool::SizeToSpriteIndex(gLandToolSize); // Disable ownership and/or construction buying functions if there are no tiles left for sale if (gLandRemainingOwnershipSales == 0) diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 6c88454f95..9bbb3edc66 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -776,7 +776,7 @@ static void window_map_invalidate(rct_window* w) for (i = 0; i < 4; i++) w->widgets[WIDX_LAND_OWNED_CHECKBOX + i].type = WWT_CHECKBOX; - w->widgets[WIDX_LAND_TOOL].image = land_tool_size_to_sprite_index(_landRightsToolSize); + w->widgets[WIDX_LAND_TOOL].image = LandTool::SizeToSpriteIndex(_landRightsToolSize); } } else @@ -1172,7 +1172,7 @@ static void window_map_set_land_rights_tool_update(const ScreenCoordsXY& screenC static CoordsXYZD place_park_entrance_get_map_position(const ScreenCoordsXY& screenCoords) { CoordsXYZD parkEntranceMapPosition{ 0, 0, 0, INVALID_DIRECTION }; - const CoordsXY mapCoords = sub_68A15E(screenCoords); + const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); parkEntranceMapPosition = { mapCoords.x, mapCoords.y, 0, INVALID_DIRECTION }; if (parkEntranceMapPosition.isNull()) return parkEntranceMapPosition; diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index 837a2a9224..39b86c9b0b 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -557,10 +557,10 @@ static void window_mapgen_base_mousedown(rct_window* w, rct_widgetindex widgetIn w->Invalidate(); break; case WIDX_FLOOR_TEXTURE: - land_tool_show_surface_style_dropdown(w, widget, _floorTexture); + LandTool::ShowSurfaceStyleDropdown(w, widget, _floorTexture); break; case WIDX_WALL_TEXTURE: - land_tool_show_edge_style_dropdown(w, widget, _wallTexture); + LandTool::ShowEdgeStyleDropdown(w, widget, _wallTexture); break; } } @@ -891,10 +891,10 @@ static void window_mapgen_simplex_mousedown(rct_window* w, rct_widgetindex widge w->Invalidate(); break; case WIDX_SIMPLEX_FLOOR_TEXTURE: - land_tool_show_surface_style_dropdown(w, widget, _floorTexture); + LandTool::ShowSurfaceStyleDropdown(w, widget, _floorTexture); break; case WIDX_SIMPLEX_WALL_TEXTURE: - land_tool_show_edge_style_dropdown(w, widget, _wallTexture); + LandTool::ShowEdgeStyleDropdown(w, widget, _wallTexture); break; case WIDX_SIMPLEX_PLACE_TREES_CHECKBOX: _placeTrees ^= 1; diff --git a/src/openrct2-ui/windows/MapTooltip.cpp b/src/openrct2-ui/windows/MapTooltip.cpp index 4a0086a44a..82a20be45c 100644 --- a/src/openrct2-ui/windows/MapTooltip.cpp +++ b/src/openrct2-ui/windows/MapTooltip.cpp @@ -57,7 +57,7 @@ const Formatter& GetMapTooltip() */ void window_map_tooltip_update_visibility() { - if (theme_get_flags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) + if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) { // The map tooltip is drawn by the bottom toolbar window_invalidate_by_class(WC_BOTTOM_TOOLBAR); diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index eaedd0bbff..06cb6f49c2 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -1663,19 +1663,19 @@ static void window_options_controls_mousedown(rct_window* w, rct_widgetindex wid switch (widgetIndex) { case WIDX_THEMES_DROPDOWN: - uint32_t num_items = static_cast(theme_manager_get_num_available_themes()); + uint32_t num_items = static_cast(ThemeManagerGetNumAvailableThemes()); for (size_t i = 0; i < num_items; i++) { gDropdownItemsFormat[i] = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItemsArgs[i] = reinterpret_cast(theme_manager_get_available_theme_name(i)); + gDropdownItemsArgs[i] = reinterpret_cast(ThemeManagerGetAvailableThemeName(i)); } WindowDropdownShowTextCustomWidth( { w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0, Dropdown::Flag::StayOpen, num_items, widget->width() - 3); - Dropdown::SetChecked(static_cast(theme_manager_get_active_available_theme_index()), true); + Dropdown::SetChecked(static_cast(ThemeManagerGetAvailableThemeIndex()), true); widget_invalidate(w, WIDX_THEMES_DROPDOWN); break; } @@ -1691,7 +1691,7 @@ static void window_options_controls_dropdown(rct_window* w, rct_widgetindex widg case WIDX_THEMES_DROPDOWN: if (dropdownIndex != -1) { - theme_manager_set_active_available_theme(dropdownIndex); + ThemeManagerSetActiveAvailableTheme(dropdownIndex); } config_save_default(); break; @@ -1713,8 +1713,8 @@ static void window_options_controls_invalidate(rct_window* w) widget_set_checkbox_value(w, WIDX_TOOLBAR_SHOW_MUTE, gConfigInterface.toolbar_show_mute); widget_set_checkbox_value(w, WIDX_TOOLBAR_SHOW_CHAT, gConfigInterface.toolbar_show_chat); - size_t activeAvailableThemeIndex = theme_manager_get_active_available_theme_index(); - const utf8* activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex); + size_t activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); + const utf8* activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); auto ft = Formatter::Common(); ft.Add(activeThemeName); diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index d7cc9f8b04..3e961ac5b9 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -662,7 +662,7 @@ static void window_park_entrance_invalidate(rct_window* w) window_park_entrance_widgets[WIDX_STATUS].top = w->height - 13; window_park_entrance_widgets[WIDX_STATUS].bottom = w->height - 3; - if (theme_get_flags() & UITHEME_FLAG_USE_LIGHTS_PARK) + if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_PARK) { window_park_entrance_widgets[WIDX_OPEN_OR_CLOSE].type = WWT_EMPTY; if (gScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 7706d4445b..120f755133 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1818,7 +1818,7 @@ static void window_ride_main_mouseup(rct_window* w, rct_widgetindex widgetIndex) static void window_ride_main_resize(rct_window* w) { int32_t minHeight = 180; - if (theme_get_flags() & UITHEME_FLAG_USE_LIGHTS_RIDE) + if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE) { minHeight += 20 + RCT1_LIGHT_OFFSET; @@ -2426,7 +2426,7 @@ static void window_ride_main_invalidate(rct_window* w) window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10); - if (theme_get_flags() & UITHEME_FLAG_USE_LIGHTS_RIDE) + if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE) { window_ride_main_widgets[WIDX_OPEN].type = WWT_EMPTY; window_ride_main_widgets[WIDX_CLOSE_LIGHT].type = WWT_IMGBTN; diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index a8467fa3b7..a38d8d6ee5 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -2151,7 +2151,7 @@ static std::optional ride_get_place_position_from_screen_position(Scre if (!_trackPlaceCtrlState) { - mapCoords = sub_68A15E(screenCoords); + mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); if (mapCoords.isNull()) return std::nullopt; diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index 0381c3e90e..6a86ca3214 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -512,7 +512,7 @@ static void window_ride_list_invalidate(rct_window* w) w->widgets[WIDX_QUICK_DEMOLISH].right = w->width - 2; w->widgets[WIDX_QUICK_DEMOLISH].left = w->width - 25; - if (theme_get_flags() & UITHEME_FLAG_USE_LIGHTS_RIDE) + if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE) { w->widgets[WIDX_OPEN_CLOSE_ALL].type = WWT_EMPTY; w->widgets[WIDX_CLOSE_LIGHT].type = WWT_IMGBTN; diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index dbbdda523c..f09ed029d1 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -424,8 +424,8 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi) window_draw_widgets(w, dpi); - format = (theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) ? STR_SMALL_WINDOW_COLOUR_2_STRINGID - : STR_WINDOW_COLOUR_2_STRINGID; + format = (ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) ? STR_SMALL_WINDOW_COLOUR_2_STRINGID + : STR_WINDOW_COLOUR_2_STRINGID; // Text for each tab for (uint32_t i = 0; i < std::size(ScenarioOriginStringIds); i++) @@ -543,10 +543,10 @@ static void window_scenarioselect_scrollpaint(rct_window* w, rct_drawpixelinfo* uint8_t paletteIndex = ColourMapA[w->colours[1]].mid_light; gfx_clear(dpi, paletteIndex); - rct_string_id highlighted_format = (theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) + rct_string_id highlighted_format = (ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) ? STR_WHITE_STRING : STR_WINDOW_COLOUR_2_STRINGID; - rct_string_id unhighlighted_format = (theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) + rct_string_id unhighlighted_format = (ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) ? STR_WHITE_STRING : STR_BLACK_STRING; diff --git a/src/openrct2-ui/windows/SceneryScatter.cpp b/src/openrct2-ui/windows/SceneryScatter.cpp index 1525ca8708..238005a156 100644 --- a/src/openrct2-ui/windows/SceneryScatter.cpp +++ b/src/openrct2-ui/windows/SceneryScatter.cpp @@ -204,7 +204,7 @@ static void window_scenery_scatter_invalidate(rct_window* w) } // Update the preview image (for tool sizes up to 7) - window_scenery_scatter_widgets[WIDX_PREVIEW].image = land_tool_size_to_sprite_index(gWindowSceneryScatterSize); + window_scenery_scatter_widgets[WIDX_PREVIEW].image = LandTool::SizeToSpriteIndex(gWindowSceneryScatterSize); } static void window_scenery_scatter_paint(rct_window* w, rct_drawpixelinfo* dpi) diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index 2bebd862d8..313e6b5fc7 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -307,7 +307,7 @@ static void window_server_start_textinput(rct_window* w, rct_widgetindex widgetI static void window_server_start_invalidate(rct_window* w) { - colour_scheme_update_by_class(w, WC_SERVER_LIST); + ColourSchemeUpdateByClass(w, WC_SERVER_LIST); widget_set_checkbox_value(w, WIDX_ADVERTISE_CHECKBOX, gConfigNetwork.advertise); auto ft = Formatter::Common(); diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index bd68fb7c92..ac580b81a9 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -735,7 +735,7 @@ void window_staff_unknown_05(rct_window* w) */ void window_staff_stats_invalidate(rct_window* w) { - colour_scheme_update_by_class(w, static_cast(WC_STAFF)); + ColourSchemeUpdateByClass(w, static_cast(WC_STAFF)); if (window_staff_page_widgets[w->page] != w->widgets) { @@ -774,7 +774,7 @@ void window_staff_stats_invalidate(rct_window* w) */ void window_staff_options_invalidate(rct_window* w) { - colour_scheme_update_by_class(w, static_cast(WC_STAFF)); + ColourSchemeUpdateByClass(w, static_cast(WC_STAFF)); if (window_staff_page_widgets[w->page] != w->widgets) { @@ -856,7 +856,7 @@ void window_staff_options_invalidate(rct_window* w) */ void window_staff_overview_invalidate(rct_window* w) { - colour_scheme_update_by_class(w, static_cast(WC_STAFF)); + ColourSchemeUpdateByClass(w, static_cast(WC_STAFF)); if (window_staff_page_widgets[w->page] != w->widgets) { diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index e4a6b2969a..b070f5d3d8 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -354,31 +354,31 @@ static void window_themes_mouseup(rct_window* w, rct_widgetindex widgetIndex) window_close(w); break; case WIDX_THEMES_DUPLICATE_BUTTON:; - activeAvailableThemeIndex = theme_manager_get_active_available_theme_index(); - activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex); + activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); + activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); window_text_input_open( w, widgetIndex, STR_TITLE_EDITOR_ACTION_DUPLICATE, STR_THEMES_PROMPT_ENTER_THEME_NAME, STR_STRING, reinterpret_cast(activeThemeName), 64); break; case WIDX_THEMES_DELETE_BUTTON: - if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { - theme_delete(); + ThemeDelete(); } break; case WIDX_THEMES_RENAME_BUTTON: - if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { - activeAvailableThemeIndex = theme_manager_get_active_available_theme_index(); - activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex); + activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); + activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); window_text_input_open( w, widgetIndex, STR_TRACK_MANAGE_RENAME, STR_THEMES_PROMPT_ENTER_THEME_NAME, STR_STRING, reinterpret_cast(activeThemeName), 64); @@ -501,67 +501,67 @@ static void window_themes_mousedown(rct_window* w, rct_widgetindex widgetIndex, w->Invalidate(); break; case WIDX_THEMES_PRESETS_DROPDOWN: - theme_manager_load_available_themes(); - num_items = static_cast(theme_manager_get_num_available_themes()); + ThemeManagerLoadAvailableThemes(); + num_items = static_cast(ThemeManagerGetNumAvailableThemes()); widget--; for (int32_t i = 0; i < num_items; i++) { gDropdownItemsFormat[i] = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItemsArgs[i] = reinterpret_cast(theme_manager_get_available_theme_name(i)); + gDropdownItemsArgs[i] = reinterpret_cast(ThemeManagerGetAvailableThemeName(i)); } WindowDropdownShowTextCustomWidth( { w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0, Dropdown::Flag::StayOpen, num_items, widget->width() - 3); - Dropdown::SetChecked(static_cast(theme_manager_get_active_available_theme_index()), true); + Dropdown::SetChecked(static_cast(ThemeManagerGetAvailableThemeIndex()), true); break; case WIDX_THEMES_RCT1_RIDE_LIGHTS: - if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { - theme_set_flags(theme_get_flags() ^ UITHEME_FLAG_USE_LIGHTS_RIDE); - theme_save(); + ThemeSetFlags(ThemeGetFlags() ^ UITHEME_FLAG_USE_LIGHTS_RIDE); + ThemeSave(); window_invalidate_all(); } break; case WIDX_THEMES_RCT1_PARK_LIGHTS: - if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { - theme_set_flags(theme_get_flags() ^ UITHEME_FLAG_USE_LIGHTS_PARK); - theme_save(); + ThemeSetFlags(ThemeGetFlags() ^ UITHEME_FLAG_USE_LIGHTS_PARK); + ThemeSave(); window_invalidate_all(); } break; case WIDX_THEMES_RCT1_SCENARIO_FONT: - if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { - theme_set_flags(theme_get_flags() ^ UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT); - theme_save(); + ThemeSetFlags(ThemeGetFlags() ^ UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT); + ThemeSave(); window_invalidate_all(); } break; case WIDX_THEMES_RCT1_BOTTOM_TOOLBAR: - if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { - theme_set_flags(theme_get_flags() ^ UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR); - theme_save(); + ThemeSetFlags(ThemeGetFlags() ^ UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR); + ThemeSave(); window_invalidate_all(); } } @@ -575,10 +575,10 @@ static void window_themes_dropdown(rct_window* w, rct_widgetindex widgetIndex, i if (dropdownIndex != -1) { rct_windowclass wc = get_window_class_tab_index(_colour_index_1); - uint8_t colour = theme_get_colour(wc, _colour_index_2); + uint8_t colour = ThemeGetColour(wc, _colour_index_2); colour = (colour & COLOUR_FLAG_TRANSLUCENT) | dropdownIndex; - theme_set_colour(wc, _colour_index_2, colour); - colour_scheme_update_all(); + ThemeSetColour(wc, _colour_index_2, colour); + ColourSchemeUpdateAll(); window_invalidate_all(); _colour_index_1 = -1; _colour_index_2 = -1; @@ -587,7 +587,7 @@ static void window_themes_dropdown(rct_window* w, rct_widgetindex widgetIndex, i case WIDX_THEMES_PRESETS_DROPDOWN: if (dropdownIndex != -1) { - theme_manager_set_active_available_theme(dropdownIndex); + ThemeManagerSetActiveAvailableTheme(dropdownIndex); } break; } @@ -631,13 +631,13 @@ void window_themes_scrollmousedown(rct_window* w, int32_t scrollIndex, const Scr _colour_index_2 = ((screenCoords.x - _button_offset_x) / 12); rct_windowclass wc = get_window_class_tab_index(_colour_index_1); - int32_t numColours = theme_desc_get_num_colours(wc); + int32_t numColours = ThemeDescGetNumColours(wc); if (_colour_index_2 < numColours) { if (screenCoords.x >= _button_offset_x && screenCoords.x < _button_offset_x + 12 * 6 && y2 >= _button_offset_y && y2 < _button_offset_y + 11) { - if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {}); } @@ -655,7 +655,7 @@ void window_themes_scrollmousedown(rct_window* w, int32_t scrollIndex, const Scr .top + 12; - uint8_t colour = theme_get_colour(wc, _colour_index_2); + uint8_t colour = ThemeGetColour(wc, _colour_index_2); WindowDropdownShowColour(w, &(window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK]), w->colours[1], colour); widget_invalidate(w, WIDX_THEMES_LIST); } @@ -664,13 +664,13 @@ void window_themes_scrollmousedown(rct_window* w, int32_t scrollIndex, const Scr screenCoords.x >= _button_offset_x && screenCoords.x < _button_offset_x + 12 * 6 - 1 && y2 >= _check_offset_y && y2 < _check_offset_y + 11) { - if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) + if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {}); } else { - uint8_t colour = theme_get_colour(wc, _colour_index_2); + uint8_t colour = ThemeGetColour(wc, _colour_index_2); if (colour & COLOUR_FLAG_TRANSLUCENT) { colour &= ~COLOUR_FLAG_TRANSLUCENT; @@ -679,8 +679,8 @@ void window_themes_scrollmousedown(rct_window* w, int32_t scrollIndex, const Scr { colour |= COLOUR_FLAG_TRANSLUCENT; } - theme_set_colour(wc, _colour_index_2, colour); - colour_scheme_update_all(); + ThemeSetColour(wc, _colour_index_2, colour); + ColourSchemeUpdateAll(); window_invalidate_all(); } } @@ -703,15 +703,15 @@ static void window_themes_textinput(rct_window* w, rct_widgetindex widgetIndex, case WIDX_THEMES_RENAME_BUTTON: if (filename_valid_characters(text)) { - if (theme_get_index_for_name(text) == SIZE_MAX) + if (ThemeGetIndexForName(text) == SIZE_MAX) { if (widgetIndex == WIDX_THEMES_DUPLICATE_BUTTON) { - theme_duplicate(text); + ThemeDuplicate(text); } else { - theme_rename(text); + ThemeRename(text); } w->Invalidate(); } @@ -786,11 +786,11 @@ void window_themes_invalidate(rct_window* w) window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WWT_EMPTY; window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].type = WWT_EMPTY; - widget_set_checkbox_value(w, WIDX_THEMES_RCT1_RIDE_LIGHTS, theme_get_flags() & UITHEME_FLAG_USE_LIGHTS_RIDE); - widget_set_checkbox_value(w, WIDX_THEMES_RCT1_PARK_LIGHTS, theme_get_flags() & UITHEME_FLAG_USE_LIGHTS_PARK); + widget_set_checkbox_value(w, WIDX_THEMES_RCT1_RIDE_LIGHTS, ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE); + widget_set_checkbox_value(w, WIDX_THEMES_RCT1_PARK_LIGHTS, ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_PARK); widget_set_checkbox_value( - w, WIDX_THEMES_RCT1_SCENARIO_FONT, theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT); - widget_set_checkbox_value(w, WIDX_THEMES_RCT1_BOTTOM_TOOLBAR, theme_get_flags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR); + w, WIDX_THEMES_RCT1_SCENARIO_FONT, ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT); + widget_set_checkbox_value(w, WIDX_THEMES_RCT1_BOTTOM_TOOLBAR, ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR); } else { @@ -822,8 +822,8 @@ void window_themes_paint(rct_window* w, rct_drawpixelinfo* dpi) dpi, STR_THEMES_LABEL_CURRENT_THEME, nullptr, w->colours[1], w->windowPos + ScreenCoordsXY{ 10, window_themes_widgets[WIDX_THEMES_PRESETS].top + 1 }); - size_t activeAvailableThemeIndex = theme_manager_get_active_available_theme_index(); - const utf8* activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex); + size_t activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); + const utf8* activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); auto ft = Formatter(); ft.Add(activeThemeName); @@ -893,12 +893,12 @@ void window_themes_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t sc } rct_windowclass wc = get_window_class_tab_index(i); - int32_t numColours = theme_desc_get_num_colours(wc); + int32_t numColours = ThemeDescGetNumColours(wc); for (uint8_t j = 0; j < numColours; j++) { - gfx_draw_string_left(dpi, theme_desc_get_name(wc), nullptr, w->colours[1], { 2, screenCoords.y + 4 }); + gfx_draw_string_left(dpi, ThemeDescGetName(wc), nullptr, w->colours[1], { 2, screenCoords.y + 4 }); - uint8_t colour = theme_get_colour(wc, j); + uint8_t colour = ThemeGetColour(wc, j); uint32_t image = SPRITE_ID_PALETTE_COLOUR_1(colour & ~COLOUR_FLAG_TRANSLUCENT) | SPR_PALETTE_BTN; if (i == _colour_index_1 && j == _colour_index_2) { diff --git a/src/openrct2-ui/windows/TitleCommandEditor.cpp b/src/openrct2-ui/windows/TitleCommandEditor.cpp index 3bf3be7218..e643135874 100644 --- a/src/openrct2-ui/windows/TitleCommandEditor.cpp +++ b/src/openrct2-ui/windows/TitleCommandEditor.cpp @@ -580,7 +580,7 @@ static void window_title_command_editor_update(rct_window* w) static void window_title_command_editor_tool_down( rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords) { - auto info = viewport_interaction_get_item_left(screenCoords); + auto info = ViewportInteractionGetItemLeft(screenCoords); if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_SPRITE) { @@ -641,7 +641,7 @@ static void window_title_command_editor_tool_down( static void window_title_command_editor_invalidate(rct_window* w) { - colour_scheme_update_by_class(w, WC_TITLE_EDITOR); + ColourSchemeUpdateByClass(w, WC_TITLE_EDITOR); window_title_command_editor_widgets[WIDX_TEXTBOX_FULL].type = WWT_EMPTY; window_title_command_editor_widgets[WIDX_TEXTBOX_X].type = WWT_EMPTY; diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 88b9cb58b4..15a3e8c78d 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -1547,7 +1547,7 @@ static void sub_6E1F34( // If CTRL not pressed if (!gSceneryCtrlPressed) { - const CoordsXY mapCoords = sub_68A15E(screenPos); + const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenPos); gridPos = mapCoords; if (gridPos.isNull()) diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 5bd8ae6529..c230a4e11b 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -257,7 +257,7 @@ static void window_track_place_toolupdate(rct_window* w, rct_widgetindex widgetI gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; // Get the tool map position - CoordsXY mapCoords = sub_68A15E(screenCoords); + CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); if (mapCoords.isNull()) { window_track_place_clear_provisional(); @@ -322,7 +322,7 @@ static void window_track_place_tooldown(rct_window* w, rct_widgetindex widgetInd gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; - const CoordsXY mapCoords = sub_68A15E(screenCoords); + const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); if (mapCoords.isNull()) return; diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 942ca892bf..611e08ce71 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -182,7 +182,7 @@ static void window_water_invalidate(rct_window* w) w->pressed_widgets |= (1 << WIDX_PREVIEW); // Update the preview image - window_water_widgets[WIDX_PREVIEW].image = land_tool_size_to_sprite_index(gLandToolSize); + window_water_widgets[WIDX_PREVIEW].image = LandTool::SizeToSpriteIndex(gLandToolSize); } /** diff --git a/src/openrct2/interface/Viewport.h b/src/openrct2/interface/Viewport.h index b40a81930f..a0588b237b 100644 --- a/src/openrct2/interface/Viewport.h +++ b/src/openrct2/interface/Viewport.h @@ -151,14 +151,14 @@ InteractionInfo get_map_coordinates_from_pos(const ScreenCoordsXY& screenCoords, InteractionInfo get_map_coordinates_from_pos_window(rct_window* window, const ScreenCoordsXY& screenCoords, int32_t flags); InteractionInfo set_interaction_info_from_paint_session(paint_session* session, uint16_t filter); -InteractionInfo viewport_interaction_get_item_left(const ScreenCoordsXY& screenCoords); -bool viewport_interaction_left_over(const ScreenCoordsXY& screenCoords); -bool viewport_interaction_left_click(const ScreenCoordsXY& screenCoords); -InteractionInfo viewport_interaction_get_item_right(const ScreenCoordsXY& screenCoords); -bool viewport_interaction_right_over(const ScreenCoordsXY& screenCoords); -bool viewport_interaction_right_click(const ScreenCoordsXY& screenCoords); +InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoords); +bool ViewportInteractionLeftOver(const ScreenCoordsXY& screenCoords); +bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords); +InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoords); +bool ViewportInteractionRightOver(const ScreenCoordsXY& screenCoords); +bool ViewportInteractionRightClick(const ScreenCoordsXY& screenCoords); -CoordsXY sub_68A15E(const ScreenCoordsXY& screenCoords); +CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoords); void sub_68B2B7(paint_session* session, const CoordsXY& mapCoords); void viewport_invalidate(rct_viewport* viewport, int32_t left, int32_t top, int32_t right, int32_t bottom);