diff --git a/data/language/de-DE.txt b/data/language/de-DE.txt index 6984cbbe00..9e5b5c57fc 100644 --- a/data/language/de-DE.txt +++ b/data/language/de-DE.txt @@ -3680,6 +3680,18 @@ STR_6437 :Unsichtbar STR_6438 :U STR_6439 :Kachelinspektor: Unsichtbarkeit umschalten STR_6440 :Transparentes Wasser +STR_6441 :Mindestens ein Nicht-Warteschlangenfußwegbelagsobjekt muss ausgewählt sein. +STR_6442 :Mindestens ein Warteschlangenfußwegbelagsobjekt muss ausgewählt sein. +STR_6443 :Mindestens ein Fußweggeländerobjekt muss ausgewählt sein. +STR_6444 :Fußwegbelage +STR_6445 :Fußweggeländer +STR_6446 :{WINDOW_COLOUR_2}Belagsname: {BLACK}{STRINGID} +STR_6447 :{WINDOW_COLOUR_2}Geländername: {BLACK}{STRINGID} +STR_6448 :Nicht unterstütztes Objektformat +STR_6449 :{WINDOW_COLOUR_2}Titel: +STR_6450 :{BLACK}„{STRING}“ +STR_6451 :{BLACK}„{STRING}“ - {STRING} +STR_6452 :{WINDOW_COLOUR_2}Verkauft: {BLACK}{STRING} ############# # Scenarios # diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 7e5cbeb216..a600a26b06 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014-2020 OpenRCT2 developers + * Copyright (c) 2014-2021 OpenRCT2 developers * * For a complete list of all authors, please refer to contributors.md * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 @@ -41,7 +41,7 @@ static constexpr const rct_string_id WINDOW_TITLE = STR_CHANGELOG_TITLE; constexpr int32_t MIN_WW = 300; constexpr int32_t MIN_WH = 250; -static rct_widget window_changelog_widgets[] = { +static rct_widget _windowChangelogWidgets[] = { WINDOW_SHIM(WINDOW_TITLE, WW, WH), MakeWidget({0, 14}, {500, 382}, WindowWidgetType::Resize, WindowColour::Secondary ), // content panel MakeWidget({3, 16}, {495, 366}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_BOTH ), // scroll area @@ -49,265 +49,285 @@ static rct_widget window_changelog_widgets[] = { { WIDGETS_END }, }; -static void window_changelog_close(rct_window *w); -static void window_changelog_mouseup(rct_window *w, rct_widgetindex widgetIndex); -static void window_changelog_resize(rct_window *w); -static void window_changelog_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_changelog_invalidate(rct_window *w); -static void window_changelog_paint(rct_window *w, rct_drawpixelinfo *dpi); -static void window_changelog_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); - -static rct_window_event_list window_changelog_events([](auto& events) -{ - events.close = &window_changelog_close; - events.mouse_up = &window_changelog_mouseup; - events.resize = &window_changelog_resize; - events.get_scroll_size = &window_changelog_scrollgetsize; - events.invalidate = &window_changelog_invalidate; - events.paint = &window_changelog_paint; - events.scroll_paint = &window_changelog_scrollpaint; -}); // clang-format on -static void window_new_version_process_info(); -static void window_changelog_dispose_data(); -static bool window_changelog_read_file(); +class ChangelogWindow final : public Window +{ + const NewVersionInfo* _newVersionInfo; + std::vector _changelogLines; + int32_t _changelogLongestLineWidth = 0; + int _personality = 0; -static const NewVersionInfo* _newVersionInfo; -static std::vector _changelogLines; -static int32_t _changelogLongestLineWidth = 0; -static int _persnality = 0; +public: + /** + * @brief Retrieves the changelog contents. + */ + const std::string GetChangelogText() + { + auto path = GetChangelogPath(); +#if defined(_WIN32) && !defined(__MINGW32__) + auto pathW = String::ToWideChar(path); + auto fs = std::ifstream(pathW, std::ios::in); +#else + auto fs = std::ifstream(path, std::ios::in); +#endif + if (!fs.is_open()) + { + throw std::runtime_error("Unable to open " + path); + } + return std::string((std::istreambuf_iterator(fs)), std::istreambuf_iterator()); + } + + /** + * @brief Set the Changelog Window's Personality, should be called just after creation. Returns true on success + * + * @param personality + */ + bool SetPersonality(int personality) + { + switch (personality) + { + case WV_NEW_VERSION_INFO: + if (!GetContext()->HasNewVersionInfo()) + { + return false; + } + _personality = WV_NEW_VERSION_INFO; + NewVersionProcessInfo(); + enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_OPEN_URL); + widgets[WIDX_OPEN_URL].type = WindowWidgetType::Button; + return true; + + case WV_CHANGELOG: + if (!ReadChangelogFile()) + { + return false; + } + enabled_widgets = (1 << WIDX_CLOSE); + _personality = WV_CHANGELOG; + return true; + + default: + log_error("Invalid personality for changelog window: %d", personality); + return false; + } + } + + void OnOpen() override + { + widgets = _windowChangelogWidgets; + + WindowInitScrollWidgets(this); + min_width = MIN_WW; + min_height = MIN_WH; + max_width = MIN_WW; + max_height = MIN_WH; + } + + void OnResize() override + { + int32_t screenWidth = context_get_width(); + int32_t screenHeight = context_get_height(); + + max_width = (screenWidth * 4) / 5; + max_height = (screenHeight * 4) / 5; + + min_width = MIN_WW; + min_height = MIN_WH; + + auto download_button_width = widgets[WIDX_OPEN_URL].width(); + widgets[WIDX_OPEN_URL].left = (width - download_button_width) / 2; + widgets[WIDX_OPEN_URL].right = widgets[WIDX_OPEN_URL].left + download_button_width; + + if (width < min_width) + { + Invalidate(); + width = min_width; + } + if (height < min_height) + { + Invalidate(); + height = min_height; + } + } + + void OnPrepareDraw() override + { + widgets[WIDX_BACKGROUND].right = width - 1; + widgets[WIDX_BACKGROUND].bottom = height - 1; + widgets[WIDX_TITLE].right = width - 2; + widgets[WIDX_CLOSE].left = width - 13; + widgets[WIDX_CLOSE].right = width - 3; + widgets[WIDX_CONTENT_PANEL].right = width - 1; + widgets[WIDX_CONTENT_PANEL].bottom = height - 1; + widgets[WIDX_SCROLL].right = width - 3; + widgets[WIDX_SCROLL].bottom = height - 22; + widgets[WIDX_OPEN_URL].bottom = height - 5; + widgets[WIDX_OPEN_URL].top = height - 19; + } + + void OnMouseUp(rct_widgetindex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + Close(); + break; + case WIDX_OPEN_URL: + if (_newVersionInfo) + { + GetContext()->GetUiContext()->OpenURL(_newVersionInfo->url); + } + else + { + log_error("Cannot open URL: NewVersionInfo for ChangelogWindow is undefined!"); + } + break; + } + } + + void OnScrollDraw(int32_t scrollIndex, rct_drawpixelinfo& dpi) override + { + const int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM); + + ScreenCoordsXY screenCoords(3, 3 - lineHeight); + for (const auto& line : _changelogLines) + { + screenCoords.y += lineHeight; + if (screenCoords.y + lineHeight < dpi.y || screenCoords.y >= dpi.y + dpi.height) + continue; + + gfx_draw_string(&dpi, screenCoords, line.c_str(), { colours[0] }); + } + } + + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + return ScreenSize( + _changelogLongestLineWidth + 4, + static_cast(_changelogLines.size()) * font_get_line_height(FontSpriteBase::MEDIUM)); + } + + // TODO: This probably should be a utility function defined elsewhere for reusability + /** + * @brief Reimplementation of Window's GetCentrePositionForNewWindow for ChangelogWindow. + * + * @return ScreenCoordsXY + */ + static ScreenCoordsXY GetCentrePositionForNewWindow(int32_t width, int32_t height) + { + auto uiContext = GetContext()->GetUiContext(); + auto screenWidth = uiContext->GetWidth(); + auto screenHeight = uiContext->GetHeight(); + return ScreenCoordsXY{ (screenWidth - width) / 2, std::max(TOP_TOOLBAR_HEIGHT + 1, (screenHeight - height) / 2) }; + } + +private: + /** + * @brief Converts NewVersionInfo into changelog lines + * + */ + void NewVersionProcessInfo() + { + _newVersionInfo = GetContext()->GetNewVersionInfo(); + if (_newVersionInfo != nullptr) + { + char version_info[256]; + + const char* version_info_ptr = _newVersionInfo->name.c_str(); + format_string(version_info, 256, STR_NEW_RELEASE_VERSION_INFO, &version_info_ptr); + + _changelogLines.emplace_back(version_info); + _changelogLines.emplace_back(""); + + ProcessChangelogText(_newVersionInfo->changelog); + } + else + { + log_error("ChangelogWindow: Could not process NewVersionInfo, result was undefined"); + } + } + + /** + * @brief Get the absolute path for the changelog file + * + * @return std::string + */ + std::string GetChangelogPath() + { + auto env = GetContext()->GetPlatformEnvironment(); + return env->GetFilePath(PATHID::CHANGELOG); + } + + /** + * @brief Attempts to read the changelog file, returns true on success + * + */ + bool ReadChangelogFile() + { + std::string _changelogText; + try + { + _changelogText = GetChangelogText(); + } + catch (const std::bad_alloc&) + { + log_error("Unable to allocate memory for changelog.txt"); + return false; + } + catch (const std::exception&) + { + log_error("Unable to read changelog.txt"); + return false; + } + + ProcessChangelogText(_changelogText); + return true; + } + + /** + * @brief Ingests a string of text and splits it into lines for the changelog and updates the longest line width for + * scrolling purposes + * + * @param text + */ + void ProcessChangelogText(const std::string& text) + { + std::string::size_type pos = 0; + std::string::size_type prev = 0; + while ((pos = text.find("\n", prev)) != std::string::npos) + { + _changelogLines.push_back(text.substr(prev, pos - prev)); + prev = pos + 1; + } + + // To get the last substring (or only, if delimiter is not found) + _changelogLines.push_back(text.substr(prev)); + + _changelogLongestLineWidth = 0; + for (const auto& line : _changelogLines) + { + int32_t linewidth = gfx_get_string_width(line.c_str(), FontSpriteBase::MEDIUM); + _changelogLongestLineWidth = std::max(linewidth, _changelogLongestLineWidth); + } + } +}; rct_window* window_changelog_open(int personality) { - rct_window* window; - - window = window_bring_to_front_by_class(WC_CHANGELOG); - if (window != nullptr) + auto* window = window_bring_to_front_by_class(WC_CHANGELOG); + if (window == nullptr) { - return window; + // Create a new centred window + int32_t screenWidth = context_get_width(); + int32_t screenHeight = context_get_height(); + int32_t width = (screenWidth * 4) / 5; + int32_t height = (screenHeight * 4) / 5; + + auto pos = ChangelogWindow::GetCentrePositionForNewWindow(width, height); + auto* newWindow = WindowCreate(WC_CHANGELOG, pos, width, height, WF_RESIZABLE); + newWindow->SetPersonality(personality); + return newWindow; } - - uint64_t enabled_widgets{}; - - window_changelog_widgets[WIDX_OPEN_URL].type = WindowWidgetType::Placeholder; - switch (personality) - { - case WV_NEW_VERSION_INFO: - if (!GetContext()->HasNewVersionInfo()) - { - return nullptr; - } - - _persnality = WV_NEW_VERSION_INFO; - window_new_version_process_info(); - enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_OPEN_URL); - window_changelog_widgets[WIDX_OPEN_URL].type = WindowWidgetType::Button; - break; - - case WV_CHANGELOG: - if (!window_changelog_read_file()) - { - return nullptr; - } - - _persnality = WV_CHANGELOG; - enabled_widgets = (1 << WIDX_CLOSE); - break; - - default: - log_error("Invalid personality for changelog window: %d", personality); - return nullptr; - } - - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); - - window = WindowCreateCentred( - screenWidth * 4 / 5, screenHeight * 4 / 5, &window_changelog_events, WC_CHANGELOG, WF_RESIZABLE); - window->widgets = window_changelog_widgets; - window->enabled_widgets = enabled_widgets; - - WindowInitScrollWidgets(window); - window->min_width = MIN_WW; - window->min_height = MIN_WH; - window->max_width = MIN_WW; - window->max_height = MIN_WH; - return window; } - -static void window_changelog_close([[maybe_unused]] rct_window* w) -{ - window_changelog_dispose_data(); -} - -static void window_changelog_mouseup(rct_window* w, rct_widgetindex widgetIndex) -{ - switch (widgetIndex) - { - case WIDX_CLOSE: - window_close(w); - break; - case WIDX_OPEN_URL: - GetContext()->GetUiContext()->OpenURL(_newVersionInfo->url); - break; - } -} - -static void window_changelog_resize(rct_window* w) -{ - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); - - w->max_width = (screenWidth * 4) / 5; - w->max_height = (screenHeight * 4) / 5; - - w->min_width = MIN_WW; - w->min_height = MIN_WH; - - auto download_button_width = window_changelog_widgets[WIDX_OPEN_URL].width(); - window_changelog_widgets[WIDX_OPEN_URL].left = (w->width - download_button_width) / 2; - window_changelog_widgets[WIDX_OPEN_URL].right = window_changelog_widgets[WIDX_OPEN_URL].left + download_button_width; - - if (w->width < w->min_width) - { - w->Invalidate(); - w->width = w->min_width; - } - if (w->height < w->min_height) - { - w->Invalidate(); - w->height = w->min_height; - } -} - -static void window_changelog_scrollgetsize( - [[maybe_unused]] rct_window* w, [[maybe_unused]] int32_t scrollIndex, int32_t* width, int32_t* height) -{ - *width = _changelogLongestLineWidth + 4; - - const int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM); - *height = static_cast(_changelogLines.size() * lineHeight); -} - -static void window_changelog_invalidate(rct_window* w) -{ - window_changelog_widgets[WIDX_BACKGROUND].right = w->width - 1; - window_changelog_widgets[WIDX_BACKGROUND].bottom = w->height - 1; - window_changelog_widgets[WIDX_TITLE].right = w->width - 2; - window_changelog_widgets[WIDX_CLOSE].left = w->width - 13; - window_changelog_widgets[WIDX_CLOSE].right = w->width - 3; - window_changelog_widgets[WIDX_CONTENT_PANEL].right = w->width - 1; - window_changelog_widgets[WIDX_CONTENT_PANEL].bottom = w->height - 1; - window_changelog_widgets[WIDX_SCROLL].right = w->width - 3; - window_changelog_widgets[WIDX_SCROLL].bottom = w->height - 22; - window_changelog_widgets[WIDX_OPEN_URL].bottom = w->height - 5; - window_changelog_widgets[WIDX_OPEN_URL].top = w->height - 19; -} - -static void window_changelog_paint(rct_window* w, rct_drawpixelinfo* dpi) -{ - WindowDrawWidgets(w, dpi); -} - -static void window_changelog_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, [[maybe_unused]] int32_t scrollIndex) -{ - const int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM); - - ScreenCoordsXY screenCoords(3, 3 - lineHeight); - for (const auto& line : _changelogLines) - { - screenCoords.y += lineHeight; - if (screenCoords.y + lineHeight < dpi->y || screenCoords.y >= dpi->y + dpi->height) - continue; - - gfx_draw_string(dpi, screenCoords, line.c_str(), { w->colours[0] }); - } -} - -static void window_changelog_process_changelog_text(const std::string& text) -{ - std::string::size_type pos = 0; - std::string::size_type prev = 0; - while ((pos = text.find("\n", prev)) != std::string::npos) - { - _changelogLines.push_back(text.substr(prev, pos - prev)); - prev = pos + 1; - } - - // To get the last substring (or only, if delimiter is not found) - _changelogLines.push_back(text.substr(prev)); - - _changelogLongestLineWidth = 0; - for (const auto& line : _changelogLines) - { - auto width = gfx_get_string_width(line.c_str(), FontSpriteBase::MEDIUM); - _changelogLongestLineWidth = std::max(width, _changelogLongestLineWidth); - } -} - -static void window_new_version_process_info() -{ - _newVersionInfo = GetContext()->GetNewVersionInfo(); - - char version_info[256]; - - const char* version_info_ptr = _newVersionInfo->name.c_str(); - format_string(version_info, 256, STR_NEW_RELEASE_VERSION_INFO, &version_info_ptr); - - _changelogLines.emplace_back(version_info); - _changelogLines.emplace_back(""); - - window_changelog_process_changelog_text(_newVersionInfo->changelog); -} - -static void window_changelog_dispose_data() -{ - _changelogLines.clear(); - _changelogLines.shrink_to_fit(); -} - -static std::string GetChangelogPath() -{ - auto env = GetContext()->GetPlatformEnvironment(); - return env->GetFilePath(PATHID::CHANGELOG); -} - -static std::string GetChangelogText() -{ - auto path = GetChangelogPath(); -#if defined(_WIN32) && !defined(__MINGW32__) - auto pathW = String::ToWideChar(path); - auto fs = std::ifstream(pathW, std::ios::in); -#else - auto fs = std::ifstream(path, std::ios::in); -#endif - if (!fs.is_open()) - { - throw std::runtime_error("Unable to open " + path); - } - return std::string((std::istreambuf_iterator(fs)), std::istreambuf_iterator()); -} - -static bool window_changelog_read_file() -{ - std::string _changelogText; - try - { - _changelogText = GetChangelogText(); - } - catch (const std::bad_alloc&) - { - log_error("Unable to allocate memory for changelog.txt"); - return false; - } - catch (const std::exception&) - { - log_error("Unable to read changelog.txt"); - return false; - } - - window_changelog_process_changelog_text(_changelogText); - return true; -} diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 552ac71b61..9923545461 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -668,7 +668,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots return "Unknown"; } - virtual bool LogCompareDataToFile(const std::string& fileName, const GameStateCompareData_t& cmpData) const override + virtual std::string GetCompareDataText(const GameStateCompareData_t& cmpData) const override { std::string outputBuffer; char tempBuffer[1024] = {}; @@ -720,6 +720,12 @@ struct GameStateSnapshots final : public IGameStateSnapshots } } } + return outputBuffer; + } + + virtual bool LogCompareDataToFile(const std::string& fileName, const GameStateCompareData_t& cmpData) const override + { + auto outputBuffer = GetCompareDataText(cmpData); FILE* fp = fopen(fileName.c_str(), "wt"); if (!fp) diff --git a/src/openrct2/GameStateSnapshots.h b/src/openrct2/GameStateSnapshots.h index a155167313..f7490c953d 100644 --- a/src/openrct2/GameStateSnapshots.h +++ b/src/openrct2/GameStateSnapshots.h @@ -103,6 +103,11 @@ struct IGameStateSnapshots * Writes the GameStateCompareData_t into the specified file as readable text. */ virtual bool LogCompareDataToFile(const std::string& fileName, const GameStateCompareData_t& cmpData) const = 0; + + /* + * Generates a string of readable text from GameStateCompareData_t + */ + virtual std::string GetCompareDataText(const GameStateCompareData_t& cmpData) const = 0; }; std::unique_ptr CreateGameStateSnapshots(); diff --git a/src/openrct2/actions/BannerPlaceAction.cpp b/src/openrct2/actions/BannerPlaceAction.cpp index 31a4f3280a..4b256b9be1 100644 --- a/src/openrct2/actions/BannerPlaceAction.cpp +++ b/src/openrct2/actions/BannerPlaceAction.cpp @@ -73,7 +73,7 @@ GameActions::Result::Ptr BannerPlaceAction::Query() const res->Expenditure = ExpenditureType::Landscaping; res->ErrorTitle = STR_CANT_POSITION_THIS_HERE; - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { log_error("No free map elements."); return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE); @@ -129,7 +129,7 @@ GameActions::Result::Ptr BannerPlaceAction::Execute() const res->Expenditure = ExpenditureType::Landscaping; res->ErrorTitle = STR_CANT_POSITION_THIS_HERE; - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { log_error("No free map elements."); return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE); diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index ad74ab0885..59fd4c72a0 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -258,7 +258,7 @@ GameActions::Result::Ptr FootpathPlaceAction::ElementInsertQuery(GameActions::Re { bool entrancePath = false, entranceIsSamePath = false; - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_BUILD_FOOTPATH_HERE); } diff --git a/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp b/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp index bfe98eb155..adb2134393 100644 --- a/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp +++ b/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp @@ -104,7 +104,7 @@ GameActions::Result::Ptr FootpathPlaceFromTrackAction::ElementInsertQuery(GameAc { bool entrancePath = false, entranceIsSamePath = false; - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { return MakeResult(GameActions::Status::NoFreeElements, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE); } diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.cpp b/src/openrct2/actions/LargeSceneryPlaceAction.cpp index 86c4f54f63..eb44faec02 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.cpp +++ b/src/openrct2/actions/LargeSceneryPlaceAction.cpp @@ -119,7 +119,7 @@ GameActions::Result::Ptr LargeSceneryPlaceAction::Query() const } } - if (!map_check_free_elements_and_reorganise(totalNumTiles)) + if (!CheckMapCapacity(sceneryEntry->tiles, totalNumTiles)) { log_error("No free map elements available"); return std::make_unique(GameActions::Status::NoFreeElements); @@ -217,7 +217,7 @@ GameActions::Result::Ptr LargeSceneryPlaceAction::Execute() const res->Position.z = maxHeight; - if (!map_check_free_elements_and_reorganise(totalNumTiles)) + if (!CheckMapCapacity(sceneryEntry->tiles, totalNumTiles)) { log_error("No free map elements available"); return std::make_unique(GameActions::Status::NoFreeElements); @@ -319,6 +319,22 @@ int16_t LargeSceneryPlaceAction::GetTotalNumTiles(rct_large_scenery_tile* tiles) return totalNumTiles; } +bool LargeSceneryPlaceAction::CheckMapCapacity(rct_large_scenery_tile* tiles, int16_t numTiles) const +{ + for (rct_large_scenery_tile* tile = tiles; tile->x_offset != -1; tile++) + { + auto curTile = CoordsXY{ tile->x_offset, tile->y_offset }.Rotate(_loc.direction); + + curTile.x += _loc.x; + curTile.y += _loc.y; + if (!MapCheckCapacityAndReorganise(curTile, numTiles)) + { + return false; + } + } + return true; +} + int16_t LargeSceneryPlaceAction::GetMaxSurfaceHeight(rct_large_scenery_tile* tiles) const { int16_t maxHeight = -1; diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.h b/src/openrct2/actions/LargeSceneryPlaceAction.h index de69775be0..cdefefb304 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.h +++ b/src/openrct2/actions/LargeSceneryPlaceAction.h @@ -50,6 +50,7 @@ public: private: int16_t GetTotalNumTiles(rct_large_scenery_tile * tiles) const; + bool CheckMapCapacity(rct_large_scenery_tile * tiles, int16_t numTiles) const; int16_t GetMaxSurfaceHeight(rct_large_scenery_tile * tiles) const; void SetNewLargeSceneryElement(LargeSceneryElement & sceneryElement, uint8_t tileNum) const; }; diff --git a/src/openrct2/actions/MazePlaceTrackAction.cpp b/src/openrct2/actions/MazePlaceTrackAction.cpp index 71b18401c2..0b5f7d356e 100644 --- a/src/openrct2/actions/MazePlaceTrackAction.cpp +++ b/src/openrct2/actions/MazePlaceTrackAction.cpp @@ -39,7 +39,7 @@ GameActions::Result::Ptr MazePlaceTrackAction::Query() const res->Position = _loc + CoordsXYZ{ 8, 8, 0 }; res->Expenditure = ExpenditureType::RideConstruction; res->ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { res->Error = GameActions::Status::NoFreeElements; res->ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED; @@ -137,7 +137,7 @@ GameActions::Result::Ptr MazePlaceTrackAction::Execute() const return res; } - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { res->Error = GameActions::Status::NoFreeElements; res->ErrorMessage = STR_NONE; diff --git a/src/openrct2/actions/MazeSetTrackAction.cpp b/src/openrct2/actions/MazeSetTrackAction.cpp index 3c5af361ed..322811c418 100644 --- a/src/openrct2/actions/MazeSetTrackAction.cpp +++ b/src/openrct2/actions/MazeSetTrackAction.cpp @@ -51,7 +51,7 @@ GameActions::Result::Ptr MazeSetTrackAction::Query() const res->Position = _loc + CoordsXYZ{ 8, 8, 0 }; res->Expenditure = ExpenditureType::RideConstruction; res->ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { res->Error = GameActions::Status::NoFreeElements; res->ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED; @@ -159,7 +159,7 @@ GameActions::Result::Ptr MazeSetTrackAction::Execute() const return res; } - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { res->Error = GameActions::Status::NoFreeElements; res->ErrorMessage = STR_NONE; diff --git a/src/openrct2/actions/PlaceParkEntranceAction.cpp b/src/openrct2/actions/PlaceParkEntranceAction.cpp index 37839a2674..e29344c3c9 100644 --- a/src/openrct2/actions/PlaceParkEntranceAction.cpp +++ b/src/openrct2/actions/PlaceParkEntranceAction.cpp @@ -51,7 +51,7 @@ GameActions::Result::Ptr PlaceParkEntranceAction::Query() const res->Expenditure = ExpenditureType::LandPurchase; res->Position = { _loc.x, _loc.y, _loc.z }; - if (!map_check_free_elements_and_reorganise(3)) + if (!CheckMapCapacity(3)) { return std::make_unique( GameActions::Status::NoFreeElements, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_NONE); @@ -177,3 +177,25 @@ GameActions::Result::Ptr PlaceParkEntranceAction::Execute() const return res; } + +bool PlaceParkEntranceAction::CheckMapCapacity(int16_t numTiles) const +{ + CoordsXYZ entranceLoc = _loc; + for (uint8_t index = 0; index < 3; index++) + { + if (index == 1) + { + entranceLoc += CoordsDirectionDelta[(_loc.direction - 1) & 0x3]; + } + else if (index == 2) + { + entranceLoc.x += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].x * 2; + entranceLoc.y += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].y * 2; + } + if (!MapCheckCapacityAndReorganise(entranceLoc, numTiles)) + { + return false; + } + } + return true; +} diff --git a/src/openrct2/actions/PlaceParkEntranceAction.h b/src/openrct2/actions/PlaceParkEntranceAction.h index 5c251c2bc5..88d149cbda 100644 --- a/src/openrct2/actions/PlaceParkEntranceAction.h +++ b/src/openrct2/actions/PlaceParkEntranceAction.h @@ -26,4 +26,7 @@ public: void Serialise(DataSerialiser & stream) override; GameActions::Result::Ptr Query() const override; GameActions::Result::Ptr Execute() const override; + +private: + bool CheckMapCapacity(int16_t numTiles) const; }; diff --git a/src/openrct2/actions/PlacePeepSpawnAction.cpp b/src/openrct2/actions/PlacePeepSpawnAction.cpp index 914c1e5615..b4ce3a211f 100644 --- a/src/openrct2/actions/PlacePeepSpawnAction.cpp +++ b/src/openrct2/actions/PlacePeepSpawnAction.cpp @@ -47,12 +47,6 @@ GameActions::Result::Ptr PlacePeepSpawnAction::Query() const res->Expenditure = ExpenditureType::LandPurchase; res->Position = _location; - if (!map_check_free_elements_and_reorganise(3)) - { - return std::make_unique( - GameActions::Status::NoFreeElements, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_NONE); - } - if (!LocationValid(_location) || _location.x <= 16 || _location.y <= 16 || _location.x >= (GetMapSizeUnits() - 16) || _location.y >= (GetMapSizeUnits() - 16)) { diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp index 5cefc1f8b1..991d263acc 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp @@ -50,7 +50,7 @@ GameActions::Result::Ptr RideEntranceExitPlaceAction::Query() const { auto errorTitle = _isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION : STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION; - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { return MakeResult(GameActions::Status::NoFreeElements, errorTitle); } @@ -217,7 +217,7 @@ GameActions::Result::Ptr RideEntranceExitPlaceAction::TrackPlaceQuery(const Coor { auto errorTitle = isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION : STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION; - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(loc)) { return MakeResult(GameActions::Status::NoFreeElements, errorTitle); } diff --git a/src/openrct2/actions/SmallSceneryPlaceAction.cpp b/src/openrct2/actions/SmallSceneryPlaceAction.cpp index 9f990f3b63..df01106163 100644 --- a/src/openrct2/actions/SmallSceneryPlaceAction.cpp +++ b/src/openrct2/actions/SmallSceneryPlaceAction.cpp @@ -111,7 +111,7 @@ GameActions::Result::Ptr SmallSceneryPlaceAction::Query() const res->Position.z = surfaceHeight; } - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { return std::make_unique(GameActions::Status::NoFreeElements); } diff --git a/src/openrct2/actions/TrackPlaceAction.cpp b/src/openrct2/actions/TrackPlaceAction.cpp index 914f585842..09953a419e 100644 --- a/src/openrct2/actions/TrackPlaceAction.cpp +++ b/src/openrct2/actions/TrackPlaceAction.cpp @@ -169,7 +169,7 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const numElements++; } - if (!map_check_free_elements_and_reorganise(numElements)) + if (!CheckMapCapacity(numElements)) { log_warning("Not enough free map elements to place track."); return std::make_unique(GameActions::Status::NoFreeElements, STR_TILE_ELEMENT_LIMIT_REACHED); @@ -650,3 +650,18 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const res->Cost = cost + ((price / 2) * 10); return res; } + +bool TrackPlaceAction::CheckMapCapacity(int16_t numTiles) const +{ + for (const rct_preview_track* trackBlock = TrackBlocks[_trackType]; trackBlock->index != 0xFF; trackBlock++) + { + auto rotatedTrack = CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(_origin.direction); + + auto tileCoords = CoordsXY{ _origin.x, _origin.y } + rotatedTrack; + if (!MapCheckCapacityAndReorganise(tileCoords, numTiles)) + { + return false; + } + } + return true; +} diff --git a/src/openrct2/actions/TrackPlaceAction.h b/src/openrct2/actions/TrackPlaceAction.h index 507bcc7558..8692372f16 100644 --- a/src/openrct2/actions/TrackPlaceAction.h +++ b/src/openrct2/actions/TrackPlaceAction.h @@ -47,4 +47,7 @@ public: void Serialise(DataSerialiser & stream) override; GameActions::Result::Ptr Query() const override; GameActions::Result::Ptr Execute() const override; + +private: + bool CheckMapCapacity(int16_t numTiles) const; }; diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index 22a0c1f6c2..08af5ea4e7 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -266,7 +266,7 @@ GameActions::Result::Ptr WallPlaceAction::Query() const } } - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { return MakeResult(GameActions::Status::NoFreeElements, STR_TILE_ELEMENT_LIMIT_REACHED); } @@ -337,7 +337,7 @@ GameActions::Result::Ptr WallPlaceAction::Execute() const } } - if (!map_check_free_elements_and_reorganise(1)) + if (!MapCheckCapacityAndReorganise(_loc)) { return MakeResult(GameActions::Status::NoFreeElements, STR_TILE_ELEMENT_LIMIT_REACHED); } diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index ed93ddf1b9..3b15e076d9 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -1248,7 +1248,7 @@ static int32_t cc_remove_park_fences(InteractiveConsole& console, [[maybe_unused static int32_t cc_show_limits(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv) { const auto& tileElements = GetTileElements(); - auto tileElementCount = tileElements.size(); + const auto tileElementCount = tileElements.size(); int32_t rideCount = ride_get_count(); int32_t spriteCount = 0; diff --git a/src/openrct2/object/FootpathItemObject.cpp b/src/openrct2/object/FootpathItemObject.cpp index 973f10764d..cb8405f0eb 100644 --- a/src/openrct2/object/FootpathItemObject.cpp +++ b/src/openrct2/object/FootpathItemObject.cpp @@ -24,7 +24,7 @@ void FootpathItemObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStre { stream->Seek(6, OpenRCT2::STREAM_SEEK_CURRENT); _legacyType.flags = stream->ReadValue(); - _legacyType.draw_type = stream->ReadValue(); + _legacyType.draw_type = static_cast(stream->ReadValue()); _legacyType.tool_id = static_cast(stream->ReadValue()); _legacyType.price = stream->ReadValue(); _legacyType.scenery_tab_id = OBJECT_ENTRY_INDEX_NULL; @@ -85,17 +85,17 @@ void FootpathItemObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int3 gfx_draw_sprite(dpi, _legacyType.image, screenCoords - ScreenCoordsXY{ 22, 24 }, 0); } -static uint8_t ParseDrawType(const std::string& s) +static PathBitDrawType ParseDrawType(const std::string& s) { if (s == "lamp") - return PATH_BIT_DRAW_TYPE_LIGHTS; + return PathBitDrawType::Light; if (s == "bin") - return PATH_BIT_DRAW_TYPE_BINS; + return PathBitDrawType::Bin; if (s == "bench") - return PATH_BIT_DRAW_TYPE_BENCHES; + return PathBitDrawType::Bench; if (s == "fountain") - return PATH_BIT_DRAW_TYPE_JUMPING_FOUNTAINS; - return PATH_BIT_DRAW_TYPE_LIGHTS; + return PathBitDrawType::JumpingFountain; + return PathBitDrawType::Light; } void FootpathItemObject::ReadJson(IReadObjectContext* context, json_t& root) diff --git a/src/openrct2/object/LargeSceneryObject.cpp b/src/openrct2/object/LargeSceneryObject.cpp index 8129597814..87da9feb8b 100644 --- a/src/openrct2/object/LargeSceneryObject.cpp +++ b/src/openrct2/object/LargeSceneryObject.cpp @@ -42,8 +42,9 @@ void LargeSceneryObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStre if (_legacyType.flags & LARGE_SCENERY_FLAG_3D_TEXT) { - _3dFont = std::make_unique(); - stream->Read(_3dFont.get()); + rct_large_scenery_text _3dFontLegacy = {}; + stream->Read(&_3dFontLegacy); + _3dFont = std::make_unique(_3dFontLegacy); _legacyType.text = _3dFont.get(); } @@ -207,11 +208,11 @@ std::vector LargeSceneryObject::ReadJsonTiles(json_t& jT return tiles; } -std::unique_ptr LargeSceneryObject::ReadJson3dFont(json_t& j3dFont) +std::unique_ptr LargeSceneryObject::ReadJson3dFont(json_t& j3dFont) { Guard::Assert(j3dFont.is_object(), "LargeSceneryObject::ReadJson3dFont expects parameter j3dFont to be object"); - auto font = std::make_unique(); + auto font = std::make_unique(); auto jOffsets = j3dFont["offsets"]; if (jOffsets.is_array()) @@ -222,7 +223,7 @@ std::unique_ptr LargeSceneryObject::ReadJson3dFont(json_ } font->max_width = Json::GetNumber(j3dFont["maxWidth"]); - font->num_images = Json::GetNumber(j3dFont["numImages"]); + font->num_images = Json::GetNumber(j3dFont["numImages"]); font->flags = Json::GetFlags( j3dFont, @@ -242,14 +243,14 @@ std::unique_ptr LargeSceneryObject::ReadJson3dFont(json_ return font; } -std::vector LargeSceneryObject::ReadJsonOffsets(json_t& jOffsets) +std::vector LargeSceneryObject::ReadJsonOffsets(json_t& jOffsets) { - std::vector offsets; + std::vector offsets; for (auto& jOffset : jOffsets) { if (jOffset.is_object()) { - LocationXY16 offset = {}; + CoordsXY offset = {}; offset.x = Json::GetNumber(jOffset["x"]); offset.y = Json::GetNumber(jOffset["y"]); offsets.push_back(offset); diff --git a/src/openrct2/object/LargeSceneryObject.h b/src/openrct2/object/LargeSceneryObject.h index d9b99d7404..d4ee356e9d 100644 --- a/src/openrct2/object/LargeSceneryObject.h +++ b/src/openrct2/object/LargeSceneryObject.h @@ -21,7 +21,7 @@ private: LargeSceneryEntry _legacyType = {}; uint32_t _baseImageId = 0; std::vector _tiles; - std::unique_ptr _3dFont; + std::unique_ptr _3dFont; public: void* GetLegacyData() override @@ -40,7 +40,7 @@ public: private: static std::vector ReadTiles(OpenRCT2::IStream* stream); static std::vector ReadJsonTiles(json_t& jTiles); - static std::unique_ptr ReadJson3dFont(json_t& j3dFont); - static std::vector ReadJsonOffsets(json_t& jOffsets); + static std::unique_ptr ReadJson3dFont(json_t& j3dFont); + static std::vector ReadJsonOffsets(json_t& jOffsets); static std::vector ReadJsonGlyphs(json_t& jGlyphs); }; diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 2f0c591564..9f1b312d7e 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -1,4 +1,4 @@ -/***************************************************************************** +/***************************************************************************** * Copyright (c) 2014-2020 OpenRCT2 developers * * For a complete list of all authors, please refer to contributors.md @@ -693,9 +693,7 @@ void PaintSessionFree([[maybe_unused]] paint_session* session) paint_struct* PaintAddImageAsParent( paint_session* session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize) { - return PaintAddImageAsParent( - session, image_id, offset.x, offset.y, boundBoxSize.x, boundBoxSize.y, boundBoxSize.z, offset.z, offset.x, offset.y, - offset.z); + return PaintAddImageAsParent(session, image_id, offset, boundBoxSize, offset); } paint_struct* PaintAddImageAsParent( @@ -723,17 +721,12 @@ paint_struct* PaintAddImageAsParent( */ // Track Pieces, Shops. paint_struct* PaintAddImageAsParent( - paint_session* session, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, - int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, int32_t bound_box_offset_x, - int32_t bound_box_offset_y, int32_t bound_box_offset_z) + paint_session* session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, + const CoordsXYZ& boundBoxOffset) { session->LastPS = nullptr; session->LastAttachedPS = nullptr; - CoordsXYZ offset = { x_offset, y_offset, z_offset }; - CoordsXYZ boundBoxSize = { bound_box_length_x, bound_box_length_y, bound_box_length_z }; - CoordsXYZ boundBoxOffset = { bound_box_offset_x, bound_box_offset_y, bound_box_offset_z }; - auto* ps = CreateNormalPaintStruct(session, image_id, offset, boundBoxSize, boundBoxOffset); if (ps == nullptr) { @@ -745,6 +738,16 @@ paint_struct* PaintAddImageAsParent( return ps; } +paint_struct* PaintAddImageAsParent( + paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, + int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x, + int16_t bound_box_offset_y, int16_t bound_box_offset_z) +{ + return PaintAddImageAsParent( + session, image_id, { x_offset, y_offset, z_offset }, { bound_box_length_x, bound_box_length_y, bound_box_length_z }, + { bound_box_offset_x, bound_box_offset_y, bound_box_offset_z }); +} + /** * * rct2: 0x00686EF0, 0x00687056, 0x006871C8, 0x0068733C, 0x0098198C @@ -810,9 +813,7 @@ paint_struct* PaintAddImageAsChild( paint_struct* parentPS = session->LastPS; if (parentPS == nullptr) { - return PaintAddImageAsParent( - session, image_id, offset.x, offset.y, boundBoxLength.x, boundBoxLength.y, boundBoxLength.z, offset.z, - boundBoxOffset.x, boundBoxOffset.y, boundBoxOffset.z); + return PaintAddImageAsParent(session, image_id, offset, boundBoxLength, boundBoxOffset); } auto* ps = CreateNormalPaintStruct(session, image_id, offset, boundBoxLength, boundBoxOffset); diff --git a/src/openrct2/paint/Paint.h b/src/openrct2/paint/Paint.h index 095668ba4a..4b83839a89 100644 --- a/src/openrct2/paint/Paint.h +++ b/src/openrct2/paint/Paint.h @@ -101,9 +101,9 @@ union paint_entry struct sprite_bb { uint32_t sprite_id; - LocationXYZ16 offset; - LocationXYZ16 bb_offset; - LocationXYZ16 bb_size; + CoordsXYZ offset; + CoordsXYZ bb_offset; + CoordsXYZ bb_size; }; enum PAINT_STRUCT_FLAGS @@ -299,6 +299,9 @@ paint_struct* PaintAddImageAsParent( paint_session* session, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, int32_t bound_box_offset_x, int32_t bound_box_offset_y, int32_t bound_box_offset_z); +paint_struct* PaintAddImageAsParent( + paint_session* session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, + const CoordsXYZ& boundBoxOffset); [[nodiscard]] paint_struct* PaintAddImageAsOrphan( paint_session* session, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, int32_t bound_box_offset_x, diff --git a/src/openrct2/paint/Supports.cpp b/src/openrct2/paint/Supports.cpp index 82f3529a64..9acad44050 100644 --- a/src/openrct2/paint/Supports.cpp +++ b/src/openrct2/paint/Supports.cpp @@ -522,9 +522,9 @@ bool wooden_a_supports_paint_setup( { imageId += word_97B3C4[slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]; imageId |= imageColourFlags; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 11, z, 0, 0, z + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 32, 32, 11 }, { 0, 0, z + 2 }); - PaintAddImageAsParent(session, imageId + 4, 0, 0, 32, 32, 11, z + 16, 0, 0, z + 16 + 2); + PaintAddImageAsParent(session, imageId + 4, { 0, 0, z + 16 }, { 32, 32, 11 }, { 0, 0, z + 16 + 2 }); hasSupports = true; } @@ -553,7 +553,7 @@ bool wooden_a_supports_paint_setup( imageId += word_97B3C4[slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]; imageId |= imageColourFlags; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 11, z, 0, 0, z + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 32, 32, 11 }, { 0, 0, z + 2 }); hasSupports = true; } z += 16; @@ -563,7 +563,7 @@ bool wooden_a_supports_paint_setup( if (drawFlatPiece) { int32_t imageId = WoodenSupportImageIds[supportType].flat | imageColourFlags; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 0, z - 2); + PaintAddImageAsParent(session, imageId, { 0, 0, z - 2 }, { 32, 32, 0 }); hasSupports = true; } @@ -575,7 +575,7 @@ bool wooden_a_supports_paint_setup( // Full support int32_t imageId = WoodenSupportImageIds[supportType].full | imageColourFlags; uint8_t ah = height == 2 ? 23 : 28; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, ah, z); + PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 32, 32, ah }); hasSupports = true; z += 32; height -= 2; @@ -585,7 +585,7 @@ bool wooden_a_supports_paint_setup( // Half support int32_t imageId = WoodenSupportImageIds[supportType].half | imageColourFlags; uint8_t ah = height == 1 ? 7 : 12; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, ah, z); + PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 32, 32, ah }); hasSupports = true; z += 16; height -= 1; @@ -698,7 +698,8 @@ bool wooden_b_supports_paint_setup( { imageId += word_97B3C4[session->Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]; - PaintAddImageAsParent(session, imageId | imageColourFlags, 0, 0, 32, 32, 11, baseHeight, 0, 0, baseHeight + 2); + PaintAddImageAsParent( + session, imageId | imageColourFlags, { 0, 0, baseHeight }, { 32, 32, 11 }, { 0, 0, baseHeight + 2 }); baseHeight += 16; PaintAddImageAsParent(session, (imageId + 4) | imageColourFlags, 0, 0, 32, 32, 3, baseHeight, 0, 0, baseHeight + 2); @@ -727,7 +728,8 @@ bool wooden_b_supports_paint_setup( { imageId += word_97B3C4[session->Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]; - PaintAddImageAsParent(session, imageId | imageColourFlags, 0, 0, 32, 32, 3, baseHeight, 0, 0, baseHeight + 2); + PaintAddImageAsParent( + session, imageId | imageColourFlags, { 0, 0, baseHeight }, { 32, 32, 3 }, { 0, 0, baseHeight + 2 }); baseHeight += 16; _9E32B1 = true; @@ -744,7 +746,7 @@ bool wooden_b_supports_paint_setup( else { PaintAddImageAsParent( - session, WoodenSupportImageIds[supportType].flat | imageColourFlags, 0, 0, 32, 32, 0, baseHeight - 2); + session, WoodenSupportImageIds[supportType].flat | imageColourFlags, { 0, 0, baseHeight - 2 }, { 32, 32, 0 }); _9E32B1 = true; } } @@ -886,7 +888,7 @@ bool metal_a_supports_paint_setup( uint32_t image_id = _metalSupportTypeToCrossbeamImages[supportType][ebp]; image_id |= imageColourFlags; - PaintAddImageAsParent(session, image_id, xOffset, yOffset, boundBoxLengthX, boundBoxLengthY, 1, height); + PaintAddImageAsParent(session, image_id, { xOffset, yOffset, height }, { boundBoxLengthX, boundBoxLengthY, 1 }); segment = newSegment; } @@ -905,7 +907,7 @@ bool metal_a_supports_paint_setup( image_id += metal_supports_slope_image_map[supportSegments[segment].slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]; image_id |= imageColourFlags; - PaintAddImageAsParent(session, image_id, xOffset, yOffset, 0, 0, 5, supportSegments[segment].height); + PaintAddImageAsParent(session, image_id, { xOffset, yOffset, supportSegments[segment].height }, { 0, 0, 5 }); height = supportSegments[segment].height + 6; } @@ -929,7 +931,7 @@ bool metal_a_supports_paint_setup( image_id += heightDiff - 1; image_id |= imageColourFlags; - PaintAddImageAsParent(session, image_id, xOffset, yOffset, 0, 0, heightDiff - 1, height); + PaintAddImageAsParent(session, image_id, { xOffset, yOffset, height }, { 0, 0, heightDiff - 1 }); } height += heightDiff; @@ -960,7 +962,7 @@ bool metal_a_supports_paint_setup( if (count == 3 && z == 0x10) image_id++; - PaintAddImageAsParent(session, image_id, xOffset, yOffset, 0, 0, z - 1, height); + PaintAddImageAsParent(session, image_id, { xOffset, yOffset, height }, { 0, 0, z - 1 }); height += z; } @@ -1001,8 +1003,7 @@ bool metal_a_supports_paint_setup( image_id += z - 1; image_id |= imageColourFlags; - PaintAddImageAsParent( - session, image_id, xOffset, yOffset, 0, 0, 0, height, boundBoxOffset.x, boundBoxOffset.y, boundBoxOffset.z); + PaintAddImageAsParent(session, image_id, { xOffset, yOffset, height }, { 0, 0, 0 }, boundBoxOffset); height += z; } @@ -1253,7 +1254,8 @@ bool path_a_supports_paint_setup( uint32_t imageId = (supportType * 24) + word_97B3C4[session->Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK] + pathPaintInfo.BridgeImageId; - PaintAddImageAsParent(session, imageId | imageColourFlags, 0, 0, 32, 32, 11, baseHeight, 0, 0, baseHeight + 2); + PaintAddImageAsParent( + session, imageId | imageColourFlags, { 0, 0, baseHeight }, { 32, 32, 11 }, { 0, 0, baseHeight + 2 }); baseHeight += 16; PaintAddImageAsParent(session, (imageId + 4) | imageColourFlags, 0, 0, 32, 32, 11, baseHeight, 0, 0, baseHeight + 2); @@ -1274,7 +1276,7 @@ bool path_a_supports_paint_setup( uint32_t ebx = (supportType * 24) + word_97B3C4[session->Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK] + pathPaintInfo.BridgeImageId; - PaintAddImageAsParent(session, ebx | imageColourFlags, 0, 0, 32, 32, 11, baseHeight, 0, 0, baseHeight + 2); + PaintAddImageAsParent(session, ebx | imageColourFlags, { 0, 0, baseHeight }, { 32, 32, 11 }, { 0, 0, baseHeight + 2 }); hasSupports = true; baseHeight += 16; diff --git a/src/openrct2/paint/VirtualFloor.cpp b/src/openrct2/paint/VirtualFloor.cpp index 0a97801a7c..7731ec8b0c 100644 --- a/src/openrct2/paint/VirtualFloor.cpp +++ b/src/openrct2/paint/VirtualFloor.cpp @@ -366,13 +366,14 @@ void virtual_floor_paint(paint_session* session) uint8_t dullEdges = 0xF & ~occupiedEdges & ~litEdges; uint8_t paintEdges = ((weAreOccupied || weAreLit) && weAreOwned) ? ~dullEdges : 0xF; + const auto virtualFloorOffset = CoordsXYZ{ 0, 0, _virtualFloorHeight }; if (paintEdges & EDGE_NE) { PaintAddImageAsParent( session, SPR_G2_SELECTION_EDGE_NE | (!(occupiedEdges & EDGE_NE) ? ((litEdges & EDGE_NE) ? remap_lit : remap_base) : remap_edge), - 0, 0, 0, 0, 1, _virtualFloorHeight, 5, 5, _virtualFloorHeight + ((dullEdges & EDGE_NE) ? -2 : 0)); + virtualFloorOffset, { 0, 0, 1 }, { 5, 5, _virtualFloorHeight + ((dullEdges & EDGE_NE) ? -2 : 0) }); } if (paintEdges & EDGE_SE) { @@ -380,7 +381,7 @@ void virtual_floor_paint(paint_session* session) session, SPR_G2_SELECTION_EDGE_SE | (!(occupiedEdges & EDGE_SE) ? ((litEdges & EDGE_SE) ? remap_lit : remap_base) : remap_edge), - 0, 0, 1, 1, 1, _virtualFloorHeight, 16, 27, _virtualFloorHeight + ((dullEdges & EDGE_SE) ? -2 : 0)); + virtualFloorOffset, { 1, 1, 1 }, { 16, 27, _virtualFloorHeight + ((dullEdges & EDGE_SE) ? -2 : 0) }); } if (paintEdges & EDGE_SW) { @@ -388,7 +389,7 @@ void virtual_floor_paint(paint_session* session) session, SPR_G2_SELECTION_EDGE_SW | (!(occupiedEdges & EDGE_SW) ? ((litEdges & EDGE_SW) ? remap_lit : remap_base) : remap_edge), - 0, 0, 1, 1, 1, _virtualFloorHeight, 27, 16, _virtualFloorHeight + ((dullEdges & EDGE_SW) ? -2 : 0)); + virtualFloorOffset, { 1, 1, 1 }, { 27, 16, _virtualFloorHeight + ((dullEdges & EDGE_SW) ? -2 : 0) }); } if (paintEdges & EDGE_NW) { @@ -396,7 +397,7 @@ void virtual_floor_paint(paint_session* session) session, SPR_G2_SELECTION_EDGE_NW | (!(occupiedEdges & EDGE_NW) ? ((litEdges & EDGE_NW) ? remap_lit : remap_base) : remap_edge), - 0, 0, 0, 0, 1, _virtualFloorHeight, 5, 5, _virtualFloorHeight + ((dullEdges & EDGE_NW) ? -2 : 0)); + virtualFloorOffset, { 0, 0, 1 }, { 5, 5, _virtualFloorHeight + ((dullEdges & EDGE_NW) ? -2 : 0) }); } if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Glassy) @@ -406,7 +407,7 @@ void virtual_floor_paint(paint_session* session) { int32_t imageColourFlats = SPR_G2_SURFACE_GLASSY_RECOLOURABLE | IMAGE_TYPE_REMAP | IMAGE_TYPE_TRANSPARENT | EnumValue(FilterPaletteID::PaletteWater) << 19; - PaintAddImageAsParent(session, imageColourFlats, 0, 0, 30, 30, 0, _virtualFloorHeight, 2, 2, _virtualFloorHeight - 3); + PaintAddImageAsParent(session, imageColourFlats, virtualFloorOffset, { 30, 30, 0 }, { 2, 2, _virtualFloorHeight - 3 }); } } diff --git a/src/openrct2/paint/sprite/Paint.Misc.cpp b/src/openrct2/paint/sprite/Paint.Misc.cpp index b4d33e60c7..61352ae456 100644 --- a/src/openrct2/paint/sprite/Paint.Misc.cpp +++ b/src/openrct2/paint/sprite/Paint.Misc.cpp @@ -32,7 +32,7 @@ const uint32_t vehicle_particle_base_sprites[] = { template<> void PaintEntity(paint_session* session, const SteamParticle* particle, int32_t imageDirection) { uint32_t imageId = 22637 + (particle->frame / 256); - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 0, particle->z); + PaintAddImageAsParent(session, imageId, { 0, 0, particle->z }, { 1, 1, 0 }); } template<> void PaintEntity(paint_session* session, const MoneyEffect* moneyEffect, int32_t imageDirection) @@ -63,7 +63,7 @@ template<> void PaintEntity(paint_session* session, const VehicleCrashParticle* return; uint32_t imageId = vehicle_particle_base_sprites[particle->crashed_sprite_base] + particle->frame / 256; imageId = imageId | (particle->colour[0] << 19) | (particle->colour[1] << 24) | IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 0, particle->z); + PaintAddImageAsParent(session, imageId, { 0, 0, particle->z }, { 1, 1, 0 }); } template<> void PaintEntity(paint_session* session, const ExplosionCloud* particle, int32_t imageDirection) @@ -71,7 +71,7 @@ template<> void PaintEntity(paint_session* session, const ExplosionCloud* partic if (particle == nullptr) return; uint32_t imageId = 22878 + (particle->frame / 256); - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 0, particle->z); + PaintAddImageAsParent(session, imageId, { 0, 0, particle->z }, { 1, 1, 0 }); } template<> void PaintEntity(paint_session* session, const CrashSplashParticle* crashSplash, int32_t imageDirection) @@ -79,7 +79,7 @@ template<> void PaintEntity(paint_session* session, const CrashSplashParticle* c if (crashSplash == nullptr) return; uint32_t imageId = 22927 + (crashSplash->frame / 256); - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 0, crashSplash->z); + PaintAddImageAsParent(session, imageId, { 0, 0, crashSplash->z }, { 1, 1, 0 }); } template<> void PaintEntity(paint_session* session, const ExplosionFlare* flare, int32_t imageDirection) @@ -88,7 +88,7 @@ template<> void PaintEntity(paint_session* session, const ExplosionFlare* flare, if (flare == nullptr) return; uint32_t imageId = 22896 + (flare->frame / 256); - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 0, flare->z); + PaintAddImageAsParent(session, imageId, { 0, 0, flare->z }, { 1, 1, 0 }); } constexpr uint32_t JumpingFountainSnowBaseImage = 23037; @@ -141,7 +141,7 @@ template<> void PaintEntity(paint_session* session, const Balloon* balloon, int3 } imageId = imageId | (balloon->colour << 19) | IMAGE_TYPE_REMAP; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 0, balloon->z); + PaintAddImageAsParent(session, imageId, { 0, 0, balloon->z }, { 1, 1, 0 }); } template<> void PaintEntity(paint_session* session, const Duck* duck, int32_t imageDirection) @@ -154,7 +154,7 @@ template<> void PaintEntity(paint_session* session, const Duck* duck, int32_t im uint32_t imageId = duck->GetFrameImage(imageDirection); if (imageId != 0) { - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 0, duck->z); + PaintAddImageAsParent(session, imageId, { 0, 0, duck->z }, { 1, 1, 0 }); } } } diff --git a/src/openrct2/paint/sprite/Paint.Peep.cpp b/src/openrct2/paint/sprite/Paint.Peep.cpp index b5b095d8bf..804e6f5026 100644 --- a/src/openrct2/paint/sprite/Paint.Peep.cpp +++ b/src/openrct2/paint/sprite/Paint.Peep.cpp @@ -87,21 +87,21 @@ template<> void PaintEntity(paint_session* session, const Peep* peep, int32_t im if (baseImageId >= 10717 && baseImageId < 10749) { imageId = (baseImageId + 32) | guest->HatColour << 19 | IMAGE_TYPE_REMAP; - PaintAddImageAsChild(session, imageId, 0, 0, 1, 1, 11, peep->z, 0, 0, peep->z + 5); + PaintAddImageAsChild(session, imageId, { 0, 0, peep->z }, { 1, 1, 11 }, { 0, 0, peep->z + 5 }); return; } if (baseImageId >= 10781 && baseImageId < 10813) { imageId = (baseImageId + 32) | guest->BalloonColour << 19 | IMAGE_TYPE_REMAP; - PaintAddImageAsChild(session, imageId, 0, 0, 1, 1, 11, peep->z, 0, 0, peep->z + 5); + PaintAddImageAsChild(session, imageId, { 0, 0, peep->z }, { 1, 1, 11 }, { 0, 0, peep->z + 5 }); return; } if (baseImageId >= 11197 && baseImageId < 11229) { imageId = (baseImageId + 32) | guest->UmbrellaColour << 19 | IMAGE_TYPE_REMAP; - PaintAddImageAsChild(session, imageId, 0, 0, 1, 1, 11, peep->z, 0, 0, peep->z + 5); + PaintAddImageAsChild(session, imageId, { 0, 0, peep->z }, { 1, 1, 11 }, { 0, 0, peep->z + 5 }); return; } } diff --git a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp index a2ff3a04a7..155a442efb 100644 --- a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp @@ -67,7 +67,7 @@ static void large_scenery_paint_supports( paint_util_set_general_support_height(session, clearanceHeight, 0x20); } -static rct_large_scenery_text_glyph* large_scenery_sign_get_glyph(rct_large_scenery_text* text, uint32_t codepoint) +static rct_large_scenery_text_glyph* large_scenery_sign_get_glyph(LargeSceneryText* text, uint32_t codepoint) { if (codepoint >= std::size(text->glyphs)) { @@ -76,7 +76,7 @@ static rct_large_scenery_text_glyph* large_scenery_sign_get_glyph(rct_large_scen return &text->glyphs[codepoint]; } -static int32_t large_scenery_sign_text_width(const utf8* str, rct_large_scenery_text* text) +static int32_t large_scenery_sign_text_width(const utf8* str, LargeSceneryText* text) { int32_t width = 0; uint32_t codepoint; @@ -87,7 +87,7 @@ static int32_t large_scenery_sign_text_width(const utf8* str, rct_large_scenery_ return width; } -static int32_t large_scenery_sign_text_height(const utf8* str, rct_large_scenery_text* text) +static int32_t large_scenery_sign_text_height(const utf8* str, LargeSceneryText* text) { int32_t height = 0; uint32_t codepoint; @@ -98,7 +98,7 @@ static int32_t large_scenery_sign_text_height(const utf8* str, rct_large_scenery return height; } -static void large_scenery_sign_fit_text(const utf8* str, rct_large_scenery_text* text, bool height, utf8* fitStr, size_t bufLen) +static void large_scenery_sign_fit_text(const utf8* str, LargeSceneryText* text, bool height, utf8* fitStr, size_t bufLen) { utf8* fitStrEnd = fitStr; safe_strcpy(fitStr, str, bufLen); @@ -124,8 +124,8 @@ static int32_t div_to_minus_infinity(int32_t a, int32_t b) } static void large_scenery_sign_paint_line( - paint_session* session, const utf8* str, rct_large_scenery_text* text, int32_t textImage, int32_t textColour, - uint8_t direction, int32_t y_offset) + paint_session* session, const utf8* str, LargeSceneryText* text, int32_t textImage, int32_t textColour, uint8_t direction, + int32_t y_offset) { utf8 fitStr[32]; large_scenery_sign_fit_text(str, text, false, fitStr, sizeof(fitStr)); @@ -190,29 +190,29 @@ static void large_scenery_sign_paint_line( struct boundbox { - LocationXY16 offset; - LocationXY16 length; + CoordsXY offset; + CoordsXY length; }; // clang-format off static constexpr const boundbox s98E3C4[] = { - { 3, 3, 26, 26 }, - { 17, 17, 12, 12 }, - { 17, 3, 12, 12 }, - { 17, 3, 12, 26 }, - { 3, 3, 12, 12 }, - { 3, 3, 26, 26 }, - { 3, 3, 28, 12 }, - { 3, 3, 26, 26 }, - { 3, 17, 12, 12 }, - { 3, 17, 26, 12 }, - { 3, 3, 26, 26 }, - { 3, 3, 26, 26 }, - { 3, 3, 12, 28 }, - { 3, 3, 26, 26 }, - { 3, 3, 26, 26 }, - { 3, 3, 26, 26 }, - { 1, 1, 30, 30 }, + { { 3, 3 }, { 26, 26 } }, + { { 17, 17 }, { 12, 12 } }, + { { 17, 3 }, { 12, 12 } }, + { { 17, 3 }, { 12, 26 } }, + { { 3, 3 }, { 12, 12 } }, + { { 3, 3 }, { 26, 26 } }, + { { 3, 3 }, { 28, 12 } }, + { { 3, 3 }, { 26, 26 } }, + { { 3, 17 }, { 12, 12 } }, + { { 3, 17 }, { 26, 12 } }, + { { 3, 3 }, { 26, 26 } }, + { { 3, 3 }, { 26, 26 } }, + { { 3, 3 }, { 12, 28 } }, + { { 3, 3 }, { 26, 26 } }, + { { 3, 3 }, { 26, 26 } }, + { { 3, 3 }, { 26, 26 } }, + { { 1, 1 }, { 30, 30 } }, }; // clang-format on @@ -244,8 +244,8 @@ void large_scenery_paint(paint_session* session, uint8_t direction, uint16_t hei uint32_t dword_F4387C = 0; image_id |= SPRITE_ID_PALETTE_COLOUR_2( tileElement->AsLargeScenery()->GetPrimaryColour(), tileElement->AsLargeScenery()->GetSecondaryColour()); - LocationXYZ16 boxlength; - LocationXYZ16 boxoffset; + CoordsXYZ boxlength; + CoordsXYZ boxoffset; if (gTrackDesignSaveMode) { if (!track_design_save_contains_tile_element(tileElement)) @@ -264,12 +264,12 @@ void large_scenery_paint(paint_session* session, uint8_t direction, uint16_t hei dword_F4387C = sequenceNum; image_id |= dword_F4387C; } - int32_t ah = tile->z_clearance; - if (ah > 0x80) + int32_t boxlengthZ = tile->z_clearance; + if (boxlengthZ > 0x80) { - ah = 0x80; + boxlengthZ = 0x80; } - ah -= 3; + boxlengthZ -= 3; uint16_t edi = tile->flags; int32_t esi = 16; if (edi & 0xF00) @@ -283,8 +283,9 @@ void large_scenery_paint(paint_session* session, uint8_t direction, uint16_t hei boxoffset.z = height; boxlength.x = s98E3C4[esi].length.x; boxlength.y = s98E3C4[esi].length.y; - boxlength.z = ah; - PaintAddImageAsParent(session, image_id, 0, 0, boxlength.x, boxlength.y, ah, height, boxoffset.x, boxoffset.y, boxoffset.z); + boxlength.z = boxlengthZ; + PaintAddImageAsParent( + session, image_id, 0, 0, boxlength.x, boxlength.y, boxlengthZ, height, boxoffset.x, boxoffset.y, boxoffset.z); if (sceneryEntry->scrolling_mode == SCROLLING_MODE_NONE || direction == 1 || direction == 2) { large_scenery_paint_supports(session, direction, height, tileElement, dword_F4387C, tile); @@ -322,7 +323,7 @@ void large_scenery_paint(paint_session* session, uint8_t direction, uint16_t hei banner->FormatTextTo(ft); utf8 signString[256]; format_string(signString, sizeof(signString), STR_STRINGID, ft.Data()); - rct_large_scenery_text* text = sceneryEntry->text; + LargeSceneryText* text = sceneryEntry->text; int32_t y_offset = (text->offset[(direction & 1)].y * 2); if (text->flags & LARGE_SCENERY_TEXT_FLAG_VERTICAL) { diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index 06ebd812a5..13b3986c06 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -113,7 +113,7 @@ static void path_bit_lights_paint( imageId |= pathBitImageFlags; - PaintAddImageAsParent(session, imageId, 2, 16, 1, 1, 23, height, 3, 16, height + 2); + PaintAddImageAsParent(session, imageId, { 2, 16, height }, { 1, 1, 23 }, { 3, 16, height + 2 }); } if (!(edges & EDGE_SE)) { @@ -124,7 +124,7 @@ static void path_bit_lights_paint( imageId |= pathBitImageFlags; - PaintAddImageAsParent(session, imageId, 16, 30, 1, 0, 23, height, 16, 29, height + 2); + PaintAddImageAsParent(session, imageId, { 16, 30, height }, { 1, 0, 23 }, { 16, 29, height + 2 }); } if (!(edges & EDGE_SW)) @@ -136,7 +136,7 @@ static void path_bit_lights_paint( imageId |= pathBitImageFlags; - PaintAddImageAsParent(session, imageId, 30, 16, 0, 1, 23, height, 29, 16, height + 2); + PaintAddImageAsParent(session, imageId, { 30, 16, height }, { 0, 1, 23 }, { 29, 16, height + 2 }); } if (!(edges & EDGE_NW)) @@ -148,7 +148,7 @@ static void path_bit_lights_paint( imageId |= pathBitImageFlags; - PaintAddImageAsParent(session, imageId, 16, 2, 1, 1, 23, height, 16, 3, height + 2); + PaintAddImageAsParent(session, imageId, { 16, 2, height }, { 1, 1, 23 }, { 16, 3, height + 2 }); } } @@ -182,7 +182,7 @@ static void path_bit_bins_paint( } if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised) - PaintAddImageAsParent(session, imageId, 7, 16, 1, 1, 7, height, 7, 16, height + 2); + PaintAddImageAsParent(session, imageId, { 7, 16, height }, { 1, 1, 7 }, { 7, 16, height + 2 }); } if (!(edges & EDGE_SE)) { @@ -203,7 +203,7 @@ static void path_bit_bins_paint( } if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised) - PaintAddImageAsParent(session, imageId, 16, 25, 1, 1, 7, height, 16, 25, height + 2); + PaintAddImageAsParent(session, imageId, { 16, 25, height }, { 1, 1, 7 }, { 16, 25, height + 2 }); } if (!(edges & EDGE_SW)) @@ -225,7 +225,7 @@ static void path_bit_bins_paint( } if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised) - PaintAddImageAsParent(session, imageId, 25, 16, 1, 1, 7, height, 25, 16, height + 2); + PaintAddImageAsParent(session, imageId, { 25, 16, height }, { 1, 1, 7 }, { 25, 16, height + 2 }); } if (!(edges & EDGE_NW)) @@ -247,7 +247,7 @@ static void path_bit_bins_paint( } if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised) - PaintAddImageAsParent(session, imageId, 16, 7, 1, 1, 7, height, 16, 7, height + 2); + PaintAddImageAsParent(session, imageId, { 16, 7, height }, { 1, 1, 7 }, { 16, 7, height + 2 }); } } @@ -267,7 +267,7 @@ static void path_bit_benches_paint( imageId |= pathBitImageFlags; - PaintAddImageAsParent(session, imageId, 7, 16, 0, 16, 7, height, 6, 8, height + 2); + PaintAddImageAsParent(session, imageId, { 7, 16, height }, { 0, 16, 7 }, { 6, 8, height + 2 }); } if (!(edges & EDGE_SE)) { @@ -278,7 +278,7 @@ static void path_bit_benches_paint( imageId |= pathBitImageFlags; - PaintAddImageAsParent(session, imageId, 16, 25, 16, 0, 7, height, 8, 23, height + 2); + PaintAddImageAsParent(session, imageId, { 16, 25, height }, { 16, 0, 7 }, { 8, 23, height + 2 }); } if (!(edges & EDGE_SW)) @@ -290,7 +290,7 @@ static void path_bit_benches_paint( imageId |= pathBitImageFlags; - PaintAddImageAsParent(session, imageId, 25, 16, 0, 16, 7, height, 23, 8, height + 2); + PaintAddImageAsParent(session, imageId, { 25, 16, height }, { 0, 16, 7 }, { 23, 8, height + 2 }); } if (!(edges & EDGE_NW)) @@ -302,7 +302,7 @@ static void path_bit_benches_paint( imageId |= pathBitImageFlags; - PaintAddImageAsParent(session, imageId, 16, 7, 16, 0, 7, height, 8, 6, height + 2); + PaintAddImageAsParent(session, imageId, { 16, 7, height }, { 16, 0, 7 }, { 8, 6, height + 2 }); } } @@ -316,10 +316,10 @@ static void path_bit_jumping_fountains_paint( uint32_t imageId = pathBitEntry->image; imageId |= pathBitImageFlags; - PaintAddImageAsParent(session, imageId + 1, 0, 0, 1, 1, 2, height, 3, 3, height + 2); - PaintAddImageAsParent(session, imageId + 2, 0, 0, 1, 1, 2, height, 3, 29, height + 2); - PaintAddImageAsParent(session, imageId + 3, 0, 0, 1, 1, 2, height, 29, 29, height + 2); - PaintAddImageAsParent(session, imageId + 4, 0, 0, 1, 1, 2, height, 29, 3, height + 2); + PaintAddImageAsParent(session, imageId + 1, { 0, 0, height }, { 1, 1, 2 }, { 3, 3, height + 2 }); + PaintAddImageAsParent(session, imageId + 2, { 0, 0, height }, { 1, 1, 2 }, { 3, 29, height + 2 }); + PaintAddImageAsParent(session, imageId + 3, { 0, 0, height }, { 1, 1, 2 }, { 29, 29, height + 2 }); + PaintAddImageAsParent(session, imageId + 4, { 0, 0, height }, { 1, 1, 2 }, { 29, 3, height + 2 }); } /** @@ -341,20 +341,20 @@ static void sub_6A4101( & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK) { case 0: - PaintAddImageAsParent(session, 22 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2); - PaintAddImageAsParent(session, 22 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 22 + base_image_id, { 0, 4, height }, { 32, 1, 23 }, { 0, 4, height + 2 }); + PaintAddImageAsParent(session, 22 + base_image_id, { 0, 28, height }, { 32, 1, 23 }, { 0, 28, height + 2 }); break; case 1: - PaintAddImageAsParent(session, 21 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 21 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 21 + base_image_id, { 4, 0, height }, { 1, 32, 23 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 21 + base_image_id, { 28, 0, height }, { 1, 32, 23 }, { 28, 0, height + 2 }); break; case 2: - PaintAddImageAsParent(session, 23 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2); - PaintAddImageAsParent(session, 23 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 23 + base_image_id, { 0, 4, height }, { 32, 1, 23 }, { 0, 4, height + 2 }); + PaintAddImageAsParent(session, 23 + base_image_id, { 0, 28, height }, { 32, 1, 23 }, { 0, 28, height + 2 }); break; case 3: - PaintAddImageAsParent(session, 20 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 20 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 20 + base_image_id, { 4, 0, height }, { 1, 32, 23 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 20 + base_image_id, { 28, 0, height }, { 1, 32, 23 }, { 28, 0, height + 2 }); break; } } @@ -363,52 +363,52 @@ static void sub_6A4101( switch (local_ebp) { case 1: - PaintAddImageAsParent(session, 17 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2); - PaintAddImageAsParent(session, 17 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 17 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 }); + PaintAddImageAsParent(session, 17 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 }); break; case 2: - PaintAddImageAsParent(session, 18 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 18 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 18 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 18 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 }); break; case 3: - PaintAddImageAsParent(session, 17 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2); + PaintAddImageAsParent(session, 17 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 }); PaintAddImageAsParent( session, 18 + base_image_id, 28, 0, 1, 28, 7, height, 28, 4, height + 2); // bound_box_offset_y seems to be a bug - PaintAddImageAsParent(session, 25 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 25 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 28, height + 2 }); break; case 4: - PaintAddImageAsParent(session, 19 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2); - PaintAddImageAsParent(session, 19 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 19 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 }); + PaintAddImageAsParent(session, 19 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 }); break; case 5: - PaintAddImageAsParent(session, 15 + base_image_id, 0, 4, 32, 1, 7, height, 0, 4, height + 2); - PaintAddImageAsParent(session, 15 + base_image_id, 0, 28, 32, 1, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 15 + base_image_id, { 0, 4, height }, { 32, 1, 7 }, { 0, 4, height + 2 }); + PaintAddImageAsParent(session, 15 + base_image_id, { 0, 28, height }, { 32, 1, 7 }, { 0, 28, height + 2 }); break; case 6: - PaintAddImageAsParent(session, 18 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 19 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2); - PaintAddImageAsParent(session, 26 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2); + PaintAddImageAsParent(session, 18 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 19 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 }); + PaintAddImageAsParent(session, 26 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 28, height + 2 }); break; case 8: - PaintAddImageAsParent(session, 16 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 16 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 16 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 16 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 }); break; case 9: - PaintAddImageAsParent(session, 16 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2); - PaintAddImageAsParent(session, 17 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2); - PaintAddImageAsParent(session, 24 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2); + PaintAddImageAsParent(session, 16 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 }); + PaintAddImageAsParent(session, 17 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 }); + PaintAddImageAsParent(session, 24 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 0, height + 2 }); break; case 10: - PaintAddImageAsParent(session, 14 + base_image_id, 4, 0, 1, 32, 7, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 14 + base_image_id, 28, 0, 1, 32, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 14 + base_image_id, { 4, 0, height }, { 1, 32, 7 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 14 + base_image_id, { 28, 0, height }, { 1, 32, 7 }, { 28, 0, height + 2 }); break; case 12: - PaintAddImageAsParent(session, 16 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2); + PaintAddImageAsParent(session, 16 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 }); PaintAddImageAsParent( session, 19 + base_image_id, 0, 28, 28, 1, 7, height, 4, 28, height + 2); // bound_box_offset_x seems to be a bug - PaintAddImageAsParent(session, 27 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 27 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 0, height + 2 }); break; default: // purposely left empty @@ -507,20 +507,20 @@ static void sub_6A4101( & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK) { case 0: - PaintAddImageAsParent(session, 8 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2); - PaintAddImageAsParent(session, 8 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 8 + base_image_id, { 0, 4, height }, { 32, 1, 23 }, { 0, 4, height + 2 }); + PaintAddImageAsParent(session, 8 + base_image_id, { 0, 28, height }, { 32, 1, 23 }, { 0, 28, height + 2 }); break; case 1: - PaintAddImageAsParent(session, 7 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 7 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 7 + base_image_id, { 4, 0, height }, { 1, 32, 23 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 7 + base_image_id, { 28, 0, height }, { 1, 32, 23 }, { 28, 0, height + 2 }); break; case 2: - PaintAddImageAsParent(session, 9 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2); - PaintAddImageAsParent(session, 9 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 9 + base_image_id, { 0, 4, height }, { 32, 1, 23 }, { 0, 4, height + 2 }); + PaintAddImageAsParent(session, 9 + base_image_id, { 0, 28, height }, { 32, 1, 23 }, { 0, 28, height + 2 }); break; case 3: - PaintAddImageAsParent(session, 6 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 6 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 6 + base_image_id, { 4, 0, height }, { 1, 32, 23 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 6 + base_image_id, { 28, 0, height }, { 1, 32, 23 }, { 28, 0, height + 2 }); break; } } @@ -537,128 +537,128 @@ static void sub_6A4101( // purposely left empty break; case 1: - PaintAddImageAsParent(session, 3 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2); - PaintAddImageAsParent(session, 3 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 3 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 }); + PaintAddImageAsParent(session, 3 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 }); break; case 2: - PaintAddImageAsParent(session, 4 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 4 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 4 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 4 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 }); break; case 4: - PaintAddImageAsParent(session, 5 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2); - PaintAddImageAsParent(session, 5 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 5 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 }); + PaintAddImageAsParent(session, 5 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 }); break; case 5: - PaintAddImageAsParent(session, 1 + base_image_id, 0, 4, 32, 1, 7, height, 0, 4, height + 2); - PaintAddImageAsParent(session, 1 + base_image_id, 0, 28, 32, 1, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 1 + base_image_id, { 0, 4, height }, { 32, 1, 7 }, { 0, 4, height + 2 }); + PaintAddImageAsParent(session, 1 + base_image_id, { 0, 28, height }, { 32, 1, 7 }, { 0, 28, height + 2 }); break; case 8: - PaintAddImageAsParent(session, 2 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 2 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 2 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 2 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 }); break; case 10: - PaintAddImageAsParent(session, 0 + base_image_id, 4, 0, 1, 32, 7, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 0 + base_image_id, 28, 0, 1, 32, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 0 + base_image_id, { 4, 0, height }, { 1, 32, 7 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 0 + base_image_id, { 28, 0, height }, { 1, 32, 7 }, { 28, 0, height + 2 }); break; case 3: - PaintAddImageAsParent(session, 3 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2); + PaintAddImageAsParent(session, 3 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 }); PaintAddImageAsParent( session, 4 + base_image_id, 28, 0, 1, 28, 7, height, 28, 4, height + 2); // bound_box_offset_y seems to be a bug if (!(drawnCorners & FOOTPATH_CORNER_0)) { - PaintAddImageAsParent(session, 11 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 11 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 28, height + 2 }); } break; case 6: - PaintAddImageAsParent(session, 4 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2); - PaintAddImageAsParent(session, 5 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2); + PaintAddImageAsParent(session, 4 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 }); + PaintAddImageAsParent(session, 5 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 }); if (!(drawnCorners & FOOTPATH_CORNER_1)) { - PaintAddImageAsParent(session, 12 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2); + PaintAddImageAsParent(session, 12 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 28, height + 2 }); } break; case 9: - PaintAddImageAsParent(session, 2 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2); - PaintAddImageAsParent(session, 3 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 2 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 }); + PaintAddImageAsParent(session, 3 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 }); if (!(drawnCorners & FOOTPATH_CORNER_3)) { - PaintAddImageAsParent(session, 10 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2); + PaintAddImageAsParent(session, 10 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 0, height + 2 }); } break; case 12: - PaintAddImageAsParent(session, 2 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2); + PaintAddImageAsParent(session, 2 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 }); PaintAddImageAsParent( session, 5 + base_image_id, 0, 28, 28, 1, 7, height, 4, 28, height + 2); // bound_box_offset_x seems to be a bug if (!(drawnCorners & FOOTPATH_CORNER_2)) { - PaintAddImageAsParent(session, 13 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 13 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 0, height + 2 }); } break; case 7: - PaintAddImageAsParent(session, 1 + base_image_id, 0, 4, 32, 1, 7, height, 0, 4, height + 2); + PaintAddImageAsParent(session, 1 + base_image_id, { 0, 4, height }, { 32, 1, 7 }, { 0, 4, height + 2 }); if (!(drawnCorners & FOOTPATH_CORNER_0)) { - PaintAddImageAsParent(session, 11 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 11 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 28, height + 2 }); } if (!(drawnCorners & FOOTPATH_CORNER_1)) { - PaintAddImageAsParent(session, 12 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2); + PaintAddImageAsParent(session, 12 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 28, height + 2 }); } break; case 13: - PaintAddImageAsParent(session, 1 + base_image_id, 0, 28, 32, 1, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 1 + base_image_id, { 0, 28, height }, { 32, 1, 7 }, { 0, 28, height + 2 }); if (!(drawnCorners & FOOTPATH_CORNER_2)) { - PaintAddImageAsParent(session, 13 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 13 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 0, height + 2 }); } if (!(drawnCorners & FOOTPATH_CORNER_3)) { - PaintAddImageAsParent(session, 10 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2); + PaintAddImageAsParent(session, 10 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 0, height + 2 }); } break; case 14: - PaintAddImageAsParent(session, 0 + base_image_id, 4, 0, 1, 32, 7, height, 4, 0, height + 2); + PaintAddImageAsParent(session, 0 + base_image_id, { 4, 0, height }, { 1, 32, 7 }, { 4, 0, height + 2 }); if (!(drawnCorners & FOOTPATH_CORNER_1)) { - PaintAddImageAsParent(session, 12 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2); + PaintAddImageAsParent(session, 12 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 28, height + 2 }); } if (!(drawnCorners & FOOTPATH_CORNER_2)) { - PaintAddImageAsParent(session, 13 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 13 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 0, height + 2 }); } break; case 11: - PaintAddImageAsParent(session, 0 + base_image_id, 28, 0, 1, 32, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 0 + base_image_id, { 28, 0, height }, { 1, 32, 7 }, { 28, 0, height + 2 }); if (!(drawnCorners & FOOTPATH_CORNER_0)) { - PaintAddImageAsParent(session, 11 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 11 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 28, height + 2 }); } if (!(drawnCorners & FOOTPATH_CORNER_3)) { - PaintAddImageAsParent(session, 10 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2); + PaintAddImageAsParent(session, 10 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 0, height + 2 }); } break; case 15: if (!(drawnCorners & FOOTPATH_CORNER_0)) { - PaintAddImageAsParent(session, 11 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2); + PaintAddImageAsParent(session, 11 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 28, height + 2 }); } if (!(drawnCorners & FOOTPATH_CORNER_1)) { - PaintAddImageAsParent(session, 12 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2); + PaintAddImageAsParent(session, 12 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 28, height + 2 }); } if (!(drawnCorners & FOOTPATH_CORNER_2)) { - PaintAddImageAsParent(session, 13 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2); + PaintAddImageAsParent(session, 13 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 0, height + 2 }); } if (!(drawnCorners & FOOTPATH_CORNER_3)) { - PaintAddImageAsParent(session, 10 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2); + PaintAddImageAsParent(session, 10 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 0, height + 2 }); } break; } @@ -715,7 +715,7 @@ static void sub_6A3F61( } else if ( (session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) && !(tile_element->AsPath()->IsBroken()) - && !(pathAddEntry->draw_type == PATH_BIT_DRAW_TYPE_BINS)) + && pathAddEntry->draw_type != PathBitDrawType::Bin) { paintScenery = false; } @@ -723,22 +723,22 @@ static void sub_6A3F61( { switch (pathAddEntry->draw_type) { - case PATH_BIT_DRAW_TYPE_LIGHTS: + case PathBitDrawType::Light: path_bit_lights_paint( session, pathAddEntry, tile_element, height, static_cast(connectedEdges), sceneryImageFlags); break; - case PATH_BIT_DRAW_TYPE_BINS: + case PathBitDrawType::Bin: path_bit_bins_paint( session, pathAddEntry, tile_element, height, static_cast(connectedEdges), sceneryImageFlags); break; - case PATH_BIT_DRAW_TYPE_BENCHES: + case PathBitDrawType::Bench: path_bit_benches_paint( session, pathAddEntry, tile_element, height, static_cast(connectedEdges), sceneryImageFlags); break; - case PATH_BIT_DRAW_TYPE_JUMPING_FOUNTAINS: + case PathBitDrawType::JumpingFountain: path_bit_jumping_fountains_paint(session, pathAddEntry, height, sceneryImageFlags, dpi); break; } @@ -994,7 +994,7 @@ void path_paint(paint_session* session, uint16_t height, const TileElement* tile uint32_t imageId = (SPR_HEIGHT_MARKER_BASE + heightMarkerBaseZ / 16) | COLOUR_GREY << 19 | IMAGE_TYPE_REMAP; imageId += get_height_marker_offset(); imageId -= gMapBaseZ; - PaintAddImageAsParent(session, imageId, 16, 16, 1, 1, 0, heightMarkerBaseZ); + PaintAddImageAsParent(session, imageId, { 16, 16, heightMarkerBaseZ }, { 1, 1, 0 }); } auto pathPaintInfo = GetFootpathPaintInfo(pathEl); @@ -1052,8 +1052,8 @@ void path_paint_box_support( uint8_t corners = (((tileElement->AsPath()->GetCorners()) << session->CurrentRotation) & 0xF) | (((tileElement->AsPath()->GetCorners()) << session->CurrentRotation) >> 4); - LocationXY16 boundBoxOffset = { stru_98D804[edges][0], stru_98D804[edges][1] }; - LocationXY16 boundBoxSize = { stru_98D804[edges][2], stru_98D804[edges][3] }; + CoordsXY boundBoxOffset = { stru_98D804[edges][0], stru_98D804[edges][1] }; + CoordsXY boundBoxSize = { stru_98D804[edges][2], stru_98D804[edges][3] }; uint16_t edi = edges | (corners << 4); @@ -1191,9 +1191,9 @@ void path_paint_pole_support( uint8_t edges = ((tileElement->AsPath()->GetEdges() << session->CurrentRotation) & 0xF) | (((tileElement->AsPath()->GetEdges()) << session->CurrentRotation) >> 4); - LocationXY16 boundBoxOffset = { stru_98D804[edges][0], stru_98D804[edges][1] }; + CoordsXY boundBoxOffset = { stru_98D804[edges][0], stru_98D804[edges][1] }; - LocationXY16 boundBoxSize = { stru_98D804[edges][2], stru_98D804[edges][3] }; + CoordsXY boundBoxSize = { stru_98D804[edges][2], stru_98D804[edges][3] }; uint8_t corners = (((tileElement->AsPath()->GetCorners()) << session->CurrentRotation) & 0xF) | (((tileElement->AsPath()->GetCorners()) << session->CurrentRotation) >> 4); diff --git a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp index cd6602da12..e07c6bd115 100644 --- a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp @@ -20,7 +20,7 @@ #include "../Supports.h" #include "Paint.TileElement.h" -static constexpr const LocationXY16 lengths[] = { +static constexpr const CoordsXY lengths[] = { { 12, 26 }, { 26, 12 }, { 12, 26 }, @@ -39,8 +39,8 @@ void scenery_paint(paint_session* session, uint8_t direction, int32_t height, co } const SmallSceneryElement* sceneryElement = tileElement->AsSmallScenery(); session->InteractionType = ViewportInteractionItem::Scenery; - LocationXYZ16 boxlength; - LocationXYZ16 boxoffset; + CoordsXYZ boxlength; + CoordsXYZ boxoffset; boxoffset.x = 0; boxoffset.y = 0; boxoffset.z = height; @@ -76,7 +76,7 @@ void scenery_paint(paint_session* session, uint8_t direction, int32_t height, co if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_HALF_SPACE)) { // 6DFFE3: - static constexpr const LocationXY16 scenery_half_tile_offsets[] = { + static constexpr const CoordsXY scenery_half_tile_offsets[] = { { 3, 3 }, { 3, 17 }, { 17, 3 }, diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index ed831ebc76..58957450de 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -43,7 +43,7 @@ static constexpr const uint8_t byte_97B444[] = }; // rct2: 0x97B464, 0x97B474, 0x97B484, 0x97B494 -static constexpr const LocationXY16 viewport_surface_paint_data[][4] = { +static constexpr const CoordsXY viewport_surface_paint_data[][4] = { { { 32, 0 }, { -32, 32 }, @@ -561,8 +561,8 @@ static void viewport_surface_draw_tile_side_bottom( CoordsXY offset = { 0, 0 }; CoordsXY bounds = { 0, 0 }; - LocationXY16 tunnelBounds = { 1, 1 }; - LocationXY16 tunnelTopBoundBoxOffset = { 0, 0 }; + CoordsXY tunnelBounds = { 1, 1 }; + CoordsXY tunnelTopBoundBoxOffset = { 0, 0 }; const tunnel_entry* tunnelArray; switch (edge) @@ -657,8 +657,7 @@ static void viewport_surface_draw_tile_side_bottom( if (curHeight != cornerHeight1 && curHeight != cornerHeight2) { uint32_t image_id = base_image_id + image_offset; - PaintAddImageAsParent( - session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, curHeight * COORDS_Z_PER_TINY_Z); + PaintAddImageAsParent(session, image_id, { offset, curHeight * COORDS_Z_PER_TINY_Z }, { bounds, 15 }); curHeight++; } } @@ -682,8 +681,7 @@ static void viewport_surface_draw_tile_side_bottom( } const uint32_t image_id = base_image_id + image_offset; - PaintAddImageAsParent( - session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, curHeight * COORDS_Z_PER_TINY_Z); + PaintAddImageAsParent(session, image_id, { offset, curHeight * COORDS_Z_PER_TINY_Z }, { bounds, 15 }); return; } @@ -698,8 +696,7 @@ static void viewport_surface_draw_tile_side_bottom( if (isWater || curHeight != tunnelArray[tunnelIndex].height) { - PaintAddImageAsParent( - session, base_image_id, offset.x, offset.y, bounds.x, bounds.y, 15, curHeight * COORDS_Z_PER_TINY_Z); + PaintAddImageAsParent(session, base_image_id, { offset, curHeight * COORDS_Z_PER_TINY_Z }, { bounds, 15 }); curHeight++; continue; @@ -728,8 +725,8 @@ static void viewport_surface_draw_tile_side_bottom( uint32_t image_id = get_tunnel_image(edgeStyle, tunnelType) + (edge == EDGE_BOTTOMRIGHT ? 2 : 0); PaintAddImageAsParent( - session, image_id, offset.x, offset.y, tunnelBounds.x, tunnelBounds.y, boundBoxLength - 1, zOffset, 0, 0, - boundBoxOffsetZ); + session, image_id, { offset, zOffset }, { tunnelBounds.x, tunnelBounds.y, boundBoxLength - 1 }, + { 0, 0, boundBoxOffsetZ }); boundBoxOffsetZ = curHeight * COORDS_Z_PER_TINY_Z; boundBoxLength = _tunnelHeights[tunnelType][1] * 16; @@ -742,8 +739,9 @@ static void viewport_surface_draw_tile_side_bottom( image_id = get_tunnel_image(edgeStyle, tunnelType) + (edge == EDGE_BOTTOMRIGHT ? 2 : 0) + 1; PaintAddImageAsParent( - session, image_id, offset.x, offset.y, tunnelBounds.x, tunnelBounds.y, boundBoxLength - 1, - curHeight * COORDS_Z_PER_TINY_Z, tunnelTopBoundBoxOffset.x, tunnelTopBoundBoxOffset.y, boundBoxOffsetZ); + session, image_id, { offset, curHeight * COORDS_Z_PER_TINY_Z }, + { tunnelBounds.x, tunnelBounds.y, boundBoxLength - 1 }, + { tunnelTopBoundBoxOffset.x, tunnelTopBoundBoxOffset.y, boundBoxOffsetZ }); curHeight += _tunnelHeights[tunnelType][0]; tunnelIndex++; @@ -877,7 +875,7 @@ static void viewport_surface_draw_tile_side_top( { const uint32_t image_id = base_image_id + image_offset; PaintAddImageAsParent( - session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, cur_height * COORDS_Z_PER_TINY_Z); + session, image_id, { offset.x, offset.y, cur_height * COORDS_Z_PER_TINY_Z }, { bounds.x, bounds.y, 15 }); cur_height++; } } @@ -892,8 +890,7 @@ static void viewport_surface_draw_tile_side_top( while (cur_height < cornerHeight1 && cur_height < neighbourCornerHeight1) { - PaintAddImageAsParent( - session, base_image_id, offset.x, offset.y, bounds.x, bounds.y, 15, cur_height * COORDS_Z_PER_TINY_Z); + PaintAddImageAsParent(session, base_image_id, { offset, cur_height * COORDS_Z_PER_TINY_Z }, { bounds, 15 }); cur_height++; } @@ -909,7 +906,7 @@ static void viewport_surface_draw_tile_side_top( } const uint32_t image_id = base_image_id + image_offset; - PaintAddImageAsParent(session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, cur_height * COORDS_Z_PER_TINY_Z); + PaintAddImageAsParent(session, image_id, { offset, cur_height * COORDS_Z_PER_TINY_Z }, { bounds, 15 }); } /** @@ -995,11 +992,8 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c for (int32_t i = 0; i < 4; i++) { - const LocationXY16& offset = viewport_surface_paint_data[i][rotation]; - const CoordsXY position = { - static_cast(base.x + offset.x), - static_cast(base.y + offset.y), - }; + const CoordsXY& offset = viewport_surface_paint_data[i][rotation]; + const CoordsXY position = base + offset; tile_descriptor& descriptor = tileDescriptors[i + 1]; @@ -1049,10 +1043,10 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c if (session->VerticalTunnelHeight * COORDS_Z_PER_TINY_Z == height) { // Vertical tunnels - PaintAddImageAsParent(session, 1575, 0, 0, 1, 30, 39, height, -2, 1, height - 40); - PaintAddImageAsParent(session, 1576, 0, 0, 30, 1, 0, height, 1, 31, height); - PaintAddImageAsParent(session, 1577, 0, 0, 1, 30, 0, height, 31, 1, height); - PaintAddImageAsParent(session, 1578, 0, 0, 30, 1, 39, height, 1, -2, height - 40); + PaintAddImageAsParent(session, 1575, { 0, 0, height }, { 1, 30, 39 }, { -2, 1, height - 40 }); + PaintAddImageAsParent(session, 1576, { 0, 0, height }, { 30, 1, 0 }, { 1, 31, height }); + PaintAddImageAsParent(session, 1577, { 0, 0, height }, { 1, 30, 0 }, { 31, 1, height }); + PaintAddImageAsParent(session, 1578, { 0, 0, height }, { 30, 1, 39 }, { 1, -2, height - 40 }); } else { @@ -1081,7 +1075,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c imageId |= 0x41880000; } - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, -1, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 32, -1 }); has_surface = true; } @@ -1124,7 +1118,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c image_id |= patrolColour << 19; paint_struct* backup = session->LastPS; - PaintAddImageAsParent(session, image_id, 0, 0, 32, 32, 1, local_height); + PaintAddImageAsParent(session, image_id, { 0, 0, local_height }, { 32, 32, 1 }); session->LastPS = backup; } } @@ -1142,7 +1136,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c const int32_t offset = (direction_reverse(spawn.direction) + rotation) & 3; const uint32_t image_id = (PEEP_SPAWN_ARROW_0 + offset) | 0x20380000; - PaintAddImageAsParent(session, image_id, 0, 0, 32, 32, 19, spawn.z); + PaintAddImageAsParent(session, image_id, { 0, 0, spawn.z }, { 32, 32, 19 }); } } } @@ -1160,7 +1154,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c const CoordsXY& pos = session->MapPosition; const int32_t height2 = (tile_element_height({ pos.x + 16, pos.y + 16 })) + 3; paint_struct* backup = session->LastPS; - PaintAddImageAsParent(session, SPR_LAND_OWNERSHIP_AVAILABLE, 16, 16, 1, 1, 0, height2); + PaintAddImageAsParent(session, SPR_LAND_OWNERSHIP_AVAILABLE, { 16, 16, height2 }, { 1, 1, 0 }); session->LastPS = backup; } } @@ -1177,7 +1171,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c const CoordsXY& pos = session->MapPosition; const int32_t height2 = tile_element_height({ pos.x + 16, pos.y + 16 }); paint_struct* backup = session->LastPS; - PaintAddImageAsParent(session, SPR_LAND_CONSTRUCTION_RIGHTS_AVAILABLE, 16, 16, 1, 1, 0, height2 + 3); + PaintAddImageAsParent(session, SPR_LAND_CONSTRUCTION_RIGHTS_AVAILABLE, { 16, 16, height2 + 3 }, { 1, 1, 0 }); session->LastPS = backup; } } @@ -1232,7 +1226,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c const int32_t image_id = (SPR_TERRAIN_SELECTION_CORNER + byte_97B444[local_surfaceShape]) | 0x21300000; paint_struct* backup = session->LastPS; - PaintAddImageAsParent(session, image_id, 0, 0, 32, 32, 1, local_height); + PaintAddImageAsParent(session, image_id, { 0, 0, local_height }, { 32, 32, 1 }); session->LastPS = backup; } } @@ -1314,7 +1308,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c const int32_t image_id = (SPR_WATER_MASK + image_offset) | IMAGE_TYPE_REMAP | IMAGE_TYPE_TRANSPARENT | EnumValue(FilterPaletteID::PaletteWater) << 19; - PaintAddImageAsParent(session, image_id, 0, 0, 32, 32, -1, waterHeight); + PaintAddImageAsParent(session, image_id, { 0, 0, waterHeight }, { 32, 32, -1 }); const bool transparent = gConfigGeneral.transparent_water || (session->ViewFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE); const uint32_t overlayStart = transparent ? SPR_WATER_OVERLAY : SPR_RCT1_WATER_OVERLAY; @@ -1393,8 +1387,8 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c } PaintAddImageAsParent( - session, image_id, fenceData.offset.x, fenceData.offset.y, fenceData.box_size.x, fenceData.box_size.y, 9, - local_height, fenceData.box_offset.x, fenceData.box_offset.y, local_height + 1); + session, image_id, { fenceData.offset, local_height }, { fenceData.box_size, 9 }, + { fenceData.box_offset, local_height + 1 }); } } diff --git a/src/openrct2/paint/tile_element/Paint.TileElement.cpp b/src/openrct2/paint/tile_element/Paint.TileElement.cpp index 195d4be92a..c38b5c7585 100644 --- a/src/openrct2/paint/tile_element/Paint.TileElement.cpp +++ b/src/openrct2/paint/tile_element/Paint.TileElement.cpp @@ -124,7 +124,7 @@ static void blank_tiles_paint(paint_session* session, int32_t x, int32_t y) session->SpritePosition.x = x; session->SpritePosition.y = y; session->InteractionType = ViewportInteractionItem::None; - PaintAddImageAsParent(session, SPR_BLANK_TILE, 0, 0, 32, 32, -1, 16); + PaintAddImageAsParent(session, SPR_BLANK_TILE, { 0, 0, 16 }, { 32, 32, -1 }); } bool gShowSupportSegmentHeights = false; @@ -200,7 +200,7 @@ static void sub_68B3FB(paint_session* session, int32_t x, int32_t y) session->SpritePosition.y = y; session->InteractionType = ViewportInteractionItem::None; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, -1, arrowZ, 0, 0, arrowZ + 18); + PaintAddImageAsParent(session, imageId, { 0, 0, arrowZ }, { 32, 32, -1 }, { 0, 0, arrowZ + 18 }); } int32_t bx = dx + 52; @@ -362,8 +362,8 @@ static void sub_68B3FB(paint_session* session, int32_t x, int32_t y) int32_t xOffset = sy * 10; int32_t yOffset = -22 + sx * 10; paint_struct* ps = PaintAddImageAsParent( - session, 5504 | imageColourFlats, xOffset, yOffset, 10, 10, 1, segmentHeight, xOffset + 1, yOffset + 16, - segmentHeight); + session, 5504 | imageColourFlats, { xOffset, yOffset, segmentHeight }, { 10, 10, 1 }, + { xOffset + 1, yOffset + 16, segmentHeight }); if (ps != nullptr) { ps->flags &= PAINT_STRUCT_FLAG_IS_MASKED; diff --git a/src/openrct2/paint/tile_element/Paint.Wall.cpp b/src/openrct2/paint/tile_element/Paint.Wall.cpp index 04fc1369e2..ffe208e5df 100644 --- a/src/openrct2/paint/tile_element/Paint.Wall.cpp +++ b/src/openrct2/paint/tile_element/Paint.Wall.cpp @@ -41,8 +41,8 @@ static constexpr const uint8_t byte_9A40CC[] = { static void fence_paint_door( paint_session* session, uint32_t imageId, WallSceneryEntry* wallEntry, uint32_t imageColourFlags, uint32_t tertiaryColour, - uint32_t dword_141F710, LocationXYZ16 offset, LocationXYZ16 boundsR1, LocationXYZ16 boundsR1_, LocationXYZ16 boundsR2, - LocationXYZ16 boundsR2_, LocationXYZ16 boundsL1, LocationXYZ16 boundsL1_) + uint32_t dword_141F710, CoordsXYZ offset, CoordsXYZ boundsR1, CoordsXYZ boundsR1_, CoordsXYZ boundsR2, CoordsXYZ boundsR2_, + CoordsXYZ boundsL1, CoordsXYZ boundsL1_) { if (wallEntry->flags & WALL_SCENERY_HAS_PRIMARY_COLOUR) { @@ -98,8 +98,8 @@ static void fence_paint_door( static void fence_paint_wall( paint_session* session, uint32_t frameNum, const WallSceneryEntry* wallEntry, uint32_t dword_141F710, - uint32_t imageColourFlags, uint32_t dword_141F718, uint32_t tertiaryColour, uint32_t imageOffset, LocationXYZ16 offset, - LocationXYZ16 bounds, LocationXYZ16 boundsOffset) + uint32_t imageColourFlags, uint32_t dword_141F718, uint32_t tertiaryColour, uint32_t imageOffset, CoordsXYZ offset, + CoordsXYZ bounds, CoordsXYZ boundsOffset) { uint32_t baseImageId = wallEntry->image + imageOffset + frameNum; uint32_t imageId = baseImageId; @@ -210,8 +210,8 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons if (wallEntry->flags & WALL_SCENERY_IS_DOOR) { - LocationXYZ16 offset; - LocationXYZ16 boundsR1, boundsR1_, boundsR2, boundsR2_, boundsL1, boundsL1_; + CoordsXYZ offset; + CoordsXYZ boundsR1, boundsR1_, boundsR2, boundsR2_, boundsL1, boundsL1_; uint8_t animationFrame = tile_element->AsWall()->GetAnimationFrame(); // Add the direction as well if (tile_element->AsWall()->AnimationIsBackwards()) @@ -296,7 +296,7 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons } uint32_t imageOffset = 0; - LocationXYZ16 offset = { 0, 0, 0 }, bounds = { 0, 0, 0 }, boundsOffset = { 0, 0, 0 }; + CoordsXYZ offset = { 0, 0, 0 }, bounds = { 0, 0, 0 }, boundsOffset = { 0, 0, 0 }; switch (direction) { diff --git a/src/openrct2/ride/TrackPaint.cpp b/src/openrct2/ride/TrackPaint.cpp index 309f3710b4..a9d4a882bf 100644 --- a/src/openrct2/ride/TrackPaint.cpp +++ b/src/openrct2/ride/TrackPaint.cpp @@ -252,7 +252,7 @@ void track_paint_util_paint_floor( imageId = floorSprites[3]; } - PaintAddImageAsParent(session, imageId | colourFlags, 0, 0, 32, 32, 1, height, 0, 0, height); + PaintAddImageAsParent(session, imageId | colourFlags, { 0, 0, height }, { 32, 32, 1 }, { 0, 0, height }); } void track_paint_util_paint_fences( @@ -274,12 +274,12 @@ void track_paint_util_paint_fences( if (edges & EDGE_SE && track_paint_util_has_fence(EDGE_SE, position, tileElement, ride, rotation)) { imageId = fenceSprites[1] | colourFlags; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 7, height, 0, 30, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 7 }, { 0, 30, height + 2 }); } if (edges & EDGE_SW && track_paint_util_has_fence(EDGE_SW, position, tileElement, ride, rotation)) { imageId = fenceSprites[2] | colourFlags; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 7, height, 30, 0, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 7 }, { 30, 0, height + 2 }); } } @@ -364,7 +364,7 @@ static void track_paint_util_draw_station_impl( imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_SW_NE : SPR_STATION_PLATFORM_SW_NE) | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 0, 0, 32, 8, 1, height + fenceOffsetA); + PaintAddImageAsParent(session, imageId, { 0, 0, height + fenceOffsetA }, { 32, 8, 1 }); // height -= 5 (height) track_paint_util_draw_station_covers(session, EDGE_NW, hasFence, stationObj, coverHeight); // height += 5 (height + 5) @@ -382,7 +382,7 @@ static void track_paint_util_draw_station_impl( { imageId = SPR_STATION_PLATFORM_SW_NE | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 0, 24, 32, 8, 1, height + fenceOffsetA); + PaintAddImageAsParent(session, imageId, { 0, 24, height + fenceOffsetA }, { 32, 8, 1 }); // height += 2 (height + 7) hasFence = track_paint_util_has_fence(EDGE_SE, position, tileElement, ride, session->CurrentRotation); @@ -400,19 +400,19 @@ static void track_paint_util_draw_station_impl( { imageId = SPR_STATION_FENCE_SW_NE | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 0, 31, 32, 1, 7, height + fenceOffsetB); + PaintAddImageAsParent(session, imageId, { 0, 31, height + fenceOffsetB }, { 32, 1, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::BeginStation && direction == 0) { // Addition: draw only small fence if there is an entrance/exit at the beginning imageId = SPR_STATION_FENCE_SMALL_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 31, 23, 1, 8, 7, height + fenceOffsetB); + PaintAddImageAsParent(session, imageId, { 31, 23, height + fenceOffsetB }, { 1, 8, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::EndStation && direction == 2) { // Addition: draw only small fence if there is an entrance/exit at the end imageId = SPR_STATION_LIGHT_BACK_NE_SW | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 31, 23, 1, 8, 7, height + fenceOffsetB); + PaintAddImageAsParent(session, imageId, { 31, 23, height + fenceOffsetB }, { 1, 8, 7 }); } // height -= 7 (height) track_paint_util_draw_station_covers(session, EDGE_SE, hasFence, stationObj, coverHeight); @@ -421,12 +421,12 @@ static void track_paint_util_draw_station_impl( if (tileElement->AsTrack()->GetTrackType() == TrackElemType::BeginStation && direction == 0) { imageId = SPR_STATION_FENCE_SMALL_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 31, 0, 1, 8, 7, height + fenceOffsetB); + PaintAddImageAsParent(session, imageId, { 31, 0, height + fenceOffsetB }, { 1, 8, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::EndStation && direction == 2) { imageId = SPR_STATION_LIGHT_BACK_NE_SW | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 31, 0, 1, 8, 7, height + fenceOffsetB); + PaintAddImageAsParent(session, imageId, { 31, 0, height + fenceOffsetB }, { 1, 8, 7 }); } } else if (direction == 1 || direction == 3) @@ -459,7 +459,7 @@ static void track_paint_util_draw_station_impl( imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_NW_SE : SPR_STATION_PLATFORM_NW_SE) | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 0, 0, 8, 32, 1, height + fenceOffsetA); + PaintAddImageAsParent(session, imageId, { 0, 0, height + fenceOffsetA }, { 8, 32, 1 }); // height -= 5 (height) track_paint_util_draw_station_covers(session, EDGE_NE, hasFence, stationObj, coverHeight); // height += 5 (height + 5) @@ -477,7 +477,7 @@ static void track_paint_util_draw_station_impl( { imageId = SPR_STATION_PLATFORM_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 24, 0, 8, 32, 1, height + fenceOffsetA); + PaintAddImageAsParent(session, imageId, { 24, 0, height + fenceOffsetA }, { 8, 32, 1 }); // height += 2 (height + 7) hasFence = track_paint_util_has_fence(EDGE_SW, position, tileElement, ride, session->CurrentRotation); @@ -495,19 +495,19 @@ static void track_paint_util_draw_station_impl( { imageId = SPR_STATION_FENCE_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 31, 0, 1, 32, 7, height + fenceOffsetB); + PaintAddImageAsParent(session, imageId, { 31, 0, height + fenceOffsetB }, { 1, 32, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::BeginStation && direction == 3) { // Addition: draw only small fence if there is an entrance/exit at the beginning imageId = SPR_STATION_FENCE_SMALL_SW_NE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 23, 31, 8, 1, 7, height + fenceOffsetB); + PaintAddImageAsParent(session, imageId, { 23, 31, height + fenceOffsetB }, { 8, 1, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::EndStation && direction == 1) { // Addition: draw only small fence if there is an entrance/exit at the end imageId = SPR_STATION_LIGHT_BACK_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 23, 31, 8, 1, 7, height + fenceOffsetB); + PaintAddImageAsParent(session, imageId, { 23, 31, height + fenceOffsetB }, { 8, 1, 7 }); } // height -= 7 (height) @@ -517,12 +517,12 @@ static void track_paint_util_draw_station_impl( if (tileElement->AsTrack()->GetTrackType() == TrackElemType::BeginStation && direction == 3) { imageId = SPR_STATION_FENCE_SMALL_SW_NE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 31, 8, 1, 7, height + fenceOffsetB); + PaintAddImageAsParent(session, imageId, { 0, 31, height + fenceOffsetB }, { 8, 1, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::EndStation && direction == 1) { imageId = SPR_STATION_LIGHT_BACK_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 31, 8, 1, 7, height + fenceOffsetB); + PaintAddImageAsParent(session, imageId, { 0, 31, height + fenceOffsetB }, { 8, 1, 7 }); } } } @@ -572,7 +572,7 @@ void track_paint_util_draw_station_inverted( imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_SW_NE : SPR_STATION_PLATFORM_SW_NE) | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 0, 0, 32, 8, 1, height + 6); + PaintAddImageAsParent(session, imageId, { 0, 0, height + 6 }, { 32, 8, 1 }); // height -= 5 (height) track_paint_util_draw_station_covers_2(session, EDGE_NW, hasFence, stationObj, height, stationVariant); // height += 5 (height + 5) @@ -590,7 +590,7 @@ void track_paint_util_draw_station_inverted( { imageId = SPR_STATION_PLATFORM_SW_NE | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 0, 24, 32, 8, 1, height + 6); + PaintAddImageAsParent(session, imageId, { 0, 24, height + 6 }, { 32, 8, 1 }); // height += 2 (height + 7) hasFence = track_paint_util_has_fence(EDGE_SE, position, tileElement, ride, session->CurrentRotation); @@ -608,19 +608,19 @@ void track_paint_util_draw_station_inverted( { imageId = SPR_STATION_INVERTED_FENCE_SW_NE | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 0, 31, 32, 1, 7, height + 8); + PaintAddImageAsParent(session, imageId, { 0, 31, height + 8 }, { 32, 1, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::BeginStation && direction == 0) { // Addition: draw only small fence if there is an entrance/exit at the beginning imageId = SPR_STATION_FENCE_SMALL_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 31, 23, 1, 8, 7, height + 8); + PaintAddImageAsParent(session, imageId, { 31, 23, height + 8 }, { 1, 8, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::EndStation && direction == 2) { // Addition: draw only small fence if there is an entrance/exit at the end imageId = SPR_STATION_LIGHT_BACK_NE_SW | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 31, 23, 1, 8, 7, height + 8); + PaintAddImageAsParent(session, imageId, { 31, 23, height + 8 }, { 1, 8, 7 }); } // height -= 7 (height) track_paint_util_draw_station_covers_2(session, EDGE_SE, hasFence, stationObj, height, stationVariant); @@ -629,12 +629,12 @@ void track_paint_util_draw_station_inverted( if (tileElement->AsTrack()->GetTrackType() == TrackElemType::BeginStation && direction == 0) { imageId = SPR_STATION_FENCE_SMALL_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 31, 0, 1, 8, 7, height + 8); + PaintAddImageAsParent(session, imageId, { 31, 0, height + 8 }, { 1, 8, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::EndStation && direction == 2) { imageId = SPR_STATION_LIGHT_BACK_NE_SW | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 31, 0, 1, 8, 7, height + 8); + PaintAddImageAsParent(session, imageId, { 31, 0, height + 8 }, { 1, 8, 7 }); } } else if (direction == 1 || direction == 3) @@ -667,7 +667,7 @@ void track_paint_util_draw_station_inverted( imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_NW_SE : SPR_STATION_PLATFORM_NW_SE) | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 0, 0, 8, 32, 1, height + 6); + PaintAddImageAsParent(session, imageId, { 0, 0, height + 6 }, { 8, 32, 1 }); // height -= 5 (height) track_paint_util_draw_station_covers_2(session, EDGE_NE, hasFence, stationObj, height, stationVariant); // height += 5 (height + 5) @@ -685,7 +685,7 @@ void track_paint_util_draw_station_inverted( { imageId = SPR_STATION_PLATFORM_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 24, 0, 8, 32, 1, height + 6); + PaintAddImageAsParent(session, imageId, { 24, 0, height + 6 }, { 8, 32, 1 }); // height += 2 (height + 7) hasFence = track_paint_util_has_fence(EDGE_SW, position, tileElement, ride, session->CurrentRotation); @@ -703,19 +703,19 @@ void track_paint_util_draw_station_inverted( { imageId = SPR_STATION_INVERTED_FENCE_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, imageId, 31, 0, 1, 32, 7, height + 8); + PaintAddImageAsParent(session, imageId, { 31, 0, height + 8 }, { 1, 32, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::BeginStation && direction == 3) { // Addition: draw only small fence if there is an entrance/exit at the beginning imageId = SPR_STATION_FENCE_SMALL_SW_NE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 23, 31, 8, 1, 7, height + 8); + PaintAddImageAsParent(session, imageId, { 23, 31, height + 8 }, { 8, 1, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::EndStation && direction == 1) { // Addition: draw only small fence if there is an entrance/exit at the end imageId = SPR_STATION_LIGHT_BACK_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 23, 31, 8, 1, 7, height + 8); + PaintAddImageAsParent(session, imageId, { 23, 31, height + 8 }, { 8, 1, 7 }); } // height -= 7 (height) @@ -725,12 +725,12 @@ void track_paint_util_draw_station_inverted( if (tileElement->AsTrack()->GetTrackType() == TrackElemType::BeginStation && direction == 3) { imageId = SPR_STATION_FENCE_SMALL_SW_NE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 31, 8, 1, 7, height + 8); + PaintAddImageAsParent(session, imageId, { 0, 31, height + 8 }, { 8, 1, 7 }); } else if (tileElement->AsTrack()->GetTrackType() == TrackElemType::EndStation && direction == 1) { imageId = SPR_STATION_LIGHT_BACK_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 31, 8, 1, 7, height + 8); + PaintAddImageAsParent(session, imageId, { 0, 31, height + 8 }, { 8, 1, 7 }); } } } @@ -848,17 +848,17 @@ void track_paint_util_draw_station_platform( bool hasFence = track_paint_util_has_fence(EDGE_NE, position, tileElement, ride, session->CurrentRotation); uint32_t imageId = (hasFence ? SPR_STATION_NARROW_EDGE_FENCED_NE : SPR_STATION_NARROW_EDGE_NE) | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 8, 32, 1, height + zOffset); + PaintAddImageAsParent(session, imageId, { 0, 0, height + zOffset }, { 8, 32, 1 }); track_paint_util_draw_station_covers(session, EDGE_NE, hasFence, stationObj, height); imageId = SPR_STATION_NARROW_EDGE_SW | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 24, 0, 8, 32, 1, height + zOffset); + PaintAddImageAsParent(session, imageId, { 24, 0, height + zOffset }, { 8, 32, 1 }); hasFence = track_paint_util_has_fence(EDGE_SW, position, tileElement, ride, session->CurrentRotation); if (hasFence) { imageId = SPR_STATION_FENCE_NW_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 31, 0, 1, 32, 7, height + zOffset + 2); + PaintAddImageAsParent(session, imageId, { 31, 0, height + zOffset + 2 }, { 1, 32, 7 }); } track_paint_util_draw_station_covers(session, EDGE_SW, hasFence, stationObj, height); } @@ -867,17 +867,17 @@ void track_paint_util_draw_station_platform( bool hasFence = track_paint_util_has_fence(EDGE_NW, position, tileElement, ride, session->CurrentRotation); uint32_t imageId = (hasFence ? SPR_STATION_NARROW_EDGE_FENCED_NW : SPR_STATION_NARROW_EDGE_NW) | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 8, 1, height + zOffset); + PaintAddImageAsParent(session, imageId, { 0, 0, height + zOffset }, { 32, 8, 1 }); track_paint_util_draw_station_covers(session, EDGE_NW, hasFence, stationObj, height); imageId = SPR_STATION_NARROW_EDGE_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 24, 32, 8, 1, height + zOffset); + PaintAddImageAsParent(session, imageId, { 0, 24, height + zOffset }, { 32, 8, 1 }); hasFence = track_paint_util_has_fence(EDGE_SE, position, tileElement, ride, session->CurrentRotation); if (hasFence) { imageId = SPR_STATION_FENCE_SW_NE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 31, 32, 1, 7, height + zOffset + 2); + PaintAddImageAsParent(session, imageId, { 0, 31, height + zOffset + 2 }, { 32, 1, 7 }); } track_paint_util_draw_station_covers(session, EDGE_SE, hasFence, stationObj, height); } @@ -895,17 +895,17 @@ void track_paint_util_draw_pier( hasFence = track_paint_util_has_fence(EDGE_NE, position, tileElement, ride, session->CurrentRotation); imageId = (hasFence ? SPR_STATION_PIER_EDGE_NE_FENCED : SPR_STATION_PIER_EDGE_NE) | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 6, 32, 1, height, 2, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 6, 32, 1 }, { 2, 0, height }); track_paint_util_draw_station_covers(session, EDGE_NE, hasFence, stationObj, height); imageId = SPR_STATION_PIER_EDGE_SW | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 24, 0, 8, 32, 1, height); + PaintAddImageAsParent(session, imageId, { 24, 0, height }, { 8, 32, 1 }); hasFence = track_paint_util_has_fence(EDGE_SW, position, tileElement, ride, session->CurrentRotation); if (hasFence) { imageId = SPR_STATION_PIER_FENCE_SW | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 31, 0, 1, 32, 7, height + 2); + PaintAddImageAsParent(session, imageId, { 31, 0, height + 2 }, { 1, 32, 7 }); } track_paint_util_draw_station_covers(session, EDGE_SW, hasFence, stationObj, height); } @@ -914,17 +914,17 @@ void track_paint_util_draw_pier( hasFence = track_paint_util_has_fence(EDGE_NW, position, tileElement, ride, rotation); imageId = (hasFence ? SPR_STATION_PIER_EDGE_NW_FENCED : SPR_STATION_PIER_EDGE_NW) | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 6, 1, height, 0, 2, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 6, 1 }, { 0, 2, height }); track_paint_util_draw_station_covers(session, EDGE_NW, hasFence, stationObj, height); imageId = SPR_STATION_PIER_EDGE_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 24, 32, 8, 1, height); + PaintAddImageAsParent(session, imageId, { 0, 24, height }, { 32, 8, 1 }); hasFence = track_paint_util_has_fence(EDGE_SE, position, tileElement, ride, rotation); if (hasFence) { imageId = SPR_STATION_PIER_FENCE_SE | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 31, 32, 1, 7, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 31, height + 2 }, { 32, 1, 7 }); } track_paint_util_draw_station_covers(session, EDGE_SE, hasFence, stationObj, height); } @@ -1655,13 +1655,16 @@ void track_paint_util_right_quarter_turn_3_tiles_paint_2_with_height_offset( switch (trackSequence) { case 0: - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, thickness, height, 0, 6, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 32, 20, thickness }, { 0, 6, height + heightOffset }); break; case 2: - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, thickness, height, 16, 16, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 16, 16, thickness }, { 16, 16, height + heightOffset }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, thickness, height, 6, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 20, 32, thickness }, { 6, 0, height + heightOffset }); break; } break; @@ -1670,13 +1673,16 @@ void track_paint_util_right_quarter_turn_3_tiles_paint_2_with_height_offset( switch (trackSequence) { case 0: - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, thickness, height, 6, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 20, 32, thickness }, { 6, 0, height + heightOffset }); break; case 2: - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, thickness, height, 16, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 16, 16, thickness }, { 16, 0, height + heightOffset }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, thickness, height, 0, 6, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 32, 20, thickness }, { 0, 6, height + heightOffset }); break; } break; @@ -1685,13 +1691,16 @@ void track_paint_util_right_quarter_turn_3_tiles_paint_2_with_height_offset( switch (trackSequence) { case 0: - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, thickness, height, 0, 6, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 32, 20, thickness }, { 0, 6, height + heightOffset }); break; case 2: - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, thickness, height, 0, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 16, 16, thickness }, { 0, 0, height + heightOffset }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, thickness, height, 6, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 20, 32, thickness }, { 6, 0, height + heightOffset }); break; } break; @@ -1700,13 +1709,16 @@ void track_paint_util_right_quarter_turn_3_tiles_paint_2_with_height_offset( switch (trackSequence) { case 0: - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, thickness, height, 6, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 20, 32, thickness }, { 6, 0, height + heightOffset }); break; case 2: - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, thickness, height, 0, 16, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 16, 16, thickness }, { 0, 16, height + heightOffset }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, thickness, height, 0, 6, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 32, 20, thickness }, { 0, 6, height + heightOffset }); break; } break; @@ -1848,13 +1860,16 @@ void track_paint_util_left_quarter_turn_3_tiles_paint_with_height_offset( switch (trackSequence) { case 0: - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, thickness, height, 0, 6, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 32, 20, thickness }, { 0, 6, height + heightOffset }); break; case 2: - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, thickness, height, 16, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 16, 16, thickness }, { 16, 0, height + heightOffset }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, thickness, height, 6, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 20, 32, thickness }, { 6, 0, height + heightOffset }); break; } break; @@ -1863,13 +1878,16 @@ void track_paint_util_left_quarter_turn_3_tiles_paint_with_height_offset( switch (trackSequence) { case 0: - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, thickness, height, 6, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 20, 32, thickness }, { 6, 0, height + heightOffset }); break; case 2: - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, thickness, height, 0, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 16, 16, thickness }, { 0, 0, height + heightOffset }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, thickness, height, 0, 6, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 32, 20, thickness }, { 0, 6, height + heightOffset }); break; } break; @@ -1878,13 +1896,16 @@ void track_paint_util_left_quarter_turn_3_tiles_paint_with_height_offset( switch (trackSequence) { case 0: - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, thickness, height, 0, 6, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 32, 20, thickness }, { 0, 6, height + heightOffset }); break; case 2: - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, thickness, height, 0, 16, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 16, 16, thickness }, { 0, 16, height + heightOffset }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, thickness, height, 6, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 20, 32, thickness }, { 6, 0, height + heightOffset }); break; } break; @@ -1893,13 +1914,16 @@ void track_paint_util_left_quarter_turn_3_tiles_paint_with_height_offset( switch (trackSequence) { case 0: - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, thickness, height, 6, 0, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 20, 32, thickness }, { 6, 0, height + heightOffset }); break; case 2: - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, thickness, height, 16, 16, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 16, 16, thickness }, { 16, 16, height + heightOffset }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, thickness, height, 0, 6, height + heightOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 32, 20, thickness }, { 0, 6, height + heightOffset }); break; } break; @@ -1939,16 +1963,20 @@ void track_paint_util_left_quarter_turn_1_tile_paint( switch (direction) { case 0: - PaintAddImageAsParent(session, imageId, 0, 0, 26, 24, thickness, height, 6, 2, height + boundBoxZOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 26, 24, thickness }, { 6, 2, height + boundBoxZOffset }); break; case 1: - PaintAddImageAsParent(session, imageId, 0, 0, 26, 26, thickness, height, 0, 0, height + boundBoxZOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 26, 26, thickness }, { 0, 0, height + boundBoxZOffset }); break; case 2: - PaintAddImageAsParent(session, imageId, 0, 0, 24, 26, thickness, height, 2, 6, height + boundBoxZOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 24, 26, thickness }, { 2, 6, height + boundBoxZOffset }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 0, 24, 24, thickness, height, 6, 6, height + boundBoxZOffset); + PaintAddImageAsParent( + session, imageId, { 0, 0, height }, { 24, 24, thickness }, { 6, 6, height + boundBoxZOffset }); break; } } @@ -2004,11 +2032,11 @@ void track_paint_util_spinning_tunnel_paint(paint_session* session, int8_t thick imageId = trackSpritesGhostTrainSpinningTunnel[direction & 1][1][frame] | colourFlags; if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 0, 26, 1, 23, height, 4, 28, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 26, 1, 23 }, { 4, 28, height }); } else { - PaintAddImageAsParent(session, imageId, 0, 0, 1, 26, 23, height, 28, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 26, 23 }, { 28, 4, height }); } } @@ -2028,24 +2056,24 @@ void track_paint_util_onride_photo_small_paint( switch (direction) { case 0: - PaintAddImageAsParent(session, imageId, 26, 0, 1, 1, 19, height); - PaintAddImageAsParent(session, imageId, 26, 31, 1, 1, 19, height); - PaintAddImageAsParent(session, flashImageId, 6, 0, 1, 1, 19, height); + PaintAddImageAsParent(session, imageId, { 26, 0, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, imageId, { 26, 31, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, flashImageId, { 6, 0, height }, { 1, 1, 19 }); break; case 1: - PaintAddImageAsParent(session, imageId, 0, 6, 1, 1, 19, height); - PaintAddImageAsParent(session, imageId, 31, 6, 1, 1, 19, height); - PaintAddImageAsParent(session, flashImageId, 0, 26, 1, 1, 19, height); + PaintAddImageAsParent(session, imageId, { 0, 6, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, imageId, { 31, 6, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, flashImageId, { 0, 26, height }, { 1, 1, 19 }); break; case 2: - PaintAddImageAsParent(session, imageId, 6, 0, 1, 1, 19, height); - PaintAddImageAsParent(session, imageId, 6, 31, 1, 1, 19, height); - PaintAddImageAsParent(session, flashImageId, 26, 31, 1, 1, 19, height); + PaintAddImageAsParent(session, imageId, { 6, 0, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, imageId, { 6, 31, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, flashImageId, { 26, 31, height }, { 1, 1, 19 }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 26, 1, 1, 19, height); - PaintAddImageAsParent(session, imageId, 31, 26, 1, 1, 19, height); - PaintAddImageAsParent(session, flashImageId, 31, 6, 1, 1, 19, height); + PaintAddImageAsParent(session, imageId, { 0, 26, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, imageId, { 31, 26, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, flashImageId, { 31, 6, height }, { 1, 1, 19 }); break; } } @@ -2066,24 +2094,24 @@ void track_paint_util_onride_photo_paint( switch (direction) { case 0: - PaintAddImageAsParent(session, imageId, 26, 0, 1, 1, 19, height); - PaintAddImageAsParent(session, imageId, 26, 31, 1, 1, 19, height); - PaintAddImageAsParent(session, flashImageId, 6, 0, 1, 1, 19, height); + PaintAddImageAsParent(session, imageId, { 26, 0, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, imageId, { 26, 31, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, flashImageId, { 6, 0, height }, { 1, 1, 19 }); break; case 1: - PaintAddImageAsParent(session, imageId, 0, 6, 1, 1, 19, height); - PaintAddImageAsParent(session, imageId, 31, 6, 1, 1, 19, height); - PaintAddImageAsParent(session, flashImageId, 0, 26, 1, 1, 19, height); + PaintAddImageAsParent(session, imageId, { 0, 6, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, imageId, { 31, 6, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, flashImageId, { 0, 26, height }, { 1, 1, 19 }); break; case 2: - PaintAddImageAsParent(session, imageId, 6, 0, 1, 1, 19, height); - PaintAddImageAsParent(session, imageId, 6, 31, 1, 1, 19, height); - PaintAddImageAsParent(session, flashImageId, 26, 31, 1, 1, 19, height); + PaintAddImageAsParent(session, imageId, { 6, 0, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, imageId, { 6, 31, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, flashImageId, { 26, 31, height }, { 1, 1, 19 }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 26, 1, 1, 19, height); - PaintAddImageAsParent(session, imageId, 31, 26, 1, 1, 19, height); - PaintAddImageAsParent(session, flashImageId, 31, 6, 1, 1, 19, height); + PaintAddImageAsParent(session, imageId, { 0, 26, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, imageId, { 31, 26, height }, { 1, 1, 19 }); + PaintAddImageAsParent(session, flashImageId, { 31, 6, height }, { 1, 1, 19 }); break; } } @@ -2163,7 +2191,8 @@ void track_paint(paint_session* session, Direction direction, int32_t height, co uint32_t imageId = SPRITE_ID_PALETTE_COLOUR_1(COLOUR_LIGHT_BLUE) | (0x1689 + get_height_marker_offset()); auto heightNum = (height + 8) / 16 - gMapBaseZ; - PaintAddImageAsParent(session, imageId + heightNum, 16, 16, 1, 1, 0, height + ax + 3, 1000, 1000, 2047); + PaintAddImageAsParent( + session, imageId + heightNum, { 16, 16, height + ax + 3 }, { 1, 1, 0 }, { 1000, 1000, 2047 }); } } diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 8e8975567c..3ab0c5d5a4 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -4656,7 +4656,7 @@ void Vehicle::UpdateBoatLocation() if (location.ToTileStart() == returnPosition.ToCoordsXY()) { sub_state = 1; - BoatLocation = location; + BoatLocation = location.ToTileStart(); return; } @@ -4700,13 +4700,13 @@ void Vehicle::UpdateBoatLocation() continue; } - BoatLocation = trackLocation; + BoatLocation = trackLocation.ToTileStart(); return; } CoordsXY trackLocation = TrackLocation; trackLocation += CoordsDirectionDelta[curDirection & 3]; - BoatLocation = trackLocation; + BoatLocation = trackLocation.ToTileStart(); } /** diff --git a/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp b/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp index c9c3d11574..920876083d 100644 --- a/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp +++ b/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp @@ -437,13 +437,13 @@ static void air_powered_vertical_rc_track_banked_right_quarter_turn_5( { uint32_t imageId = SPR_AIR_POWERED_VERTICAL_RC_BANKED_QUARTER_TURN_5_FRONT_NW_SW_PART_4 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 26, height, 0, 27, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 26 }, { 0, 27, height }); } else if (direction == 3 && trackSequence == 0) { uint32_t imageId = SPR_AIR_POWERED_VERTICAL_RC_BANKED_QUARTER_TURN_5_FRONT_SE_NE_PART_0 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 26, height, 27, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 26 }, { 27, 0, height }); } track_paint_util_right_quarter_turn_5_tiles_wooden_supports(session, height, direction, trackSequence); @@ -729,7 +729,7 @@ static void air_powered_vertical_rc_track_vertical_slope_up( { floorImageId = SPR_FLOOR_PLANKS | session->TrackColours[SCHEME_SUPPORTS]; } - PaintAddImageAsParent(session, floorImageId, 0, 0, 26, 26, 126, height, 3, 3, height); + PaintAddImageAsParent(session, floorImageId, { 0, 0, height }, { 26, 26, 126 }, { 3, 3, height }); PaintAddImageAsChildRotated(session, direction, supportsImageId, 0, 0, 26, 26, 126, height, 3, 3, height); } else @@ -913,13 +913,13 @@ static void air_powered_vertical_rc_track_booster( if (direction & 1) { uint32_t imageId = SPR_REVERSE_FREEFALL_RC_FLAT_NW_SE | colour; - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 20, 32, 1 }, { 6, 0, height }); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); } else { uint32_t imageId = SPR_REVERSE_FREEFALL_RC_FLAT_SW_NE | colour; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 20, 1 }, { 0, 6, height }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); } diff --git a/src/openrct2/ride/coaster/JuniorRollerCoaster.cpp b/src/openrct2/ride/coaster/JuniorRollerCoaster.cpp index feb8a99dbc..c78eed4ea0 100644 --- a/src/openrct2/ride/coaster/JuniorRollerCoaster.cpp +++ b/src/openrct2/ride/coaster/JuniorRollerCoaster.cpp @@ -1651,7 +1651,7 @@ void junior_rc_paint_station( { // height -= 2 (height - 2) imageId = SPR_STATION_BASE_B_SW_NE | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 28, 1, height - 2, 0, 2, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height - 2 }, { 32, 28, 1 }, { 0, 2, height }); // height += 2 (height) if (tileElement->AsTrack()->GetTrackType() == TrackElemType::EndStation && rideType == RIDE_TYPE_JUNIOR_ROLLER_COASTER) @@ -1673,7 +1673,7 @@ void junior_rc_paint_station( { // height -= 2 (height - 2) imageId = SPR_STATION_BASE_B_NW_SE | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 0, 0, 28, 32, 1, height - 2, 2, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height - 2 }, { 28, 32, 1 }, { 2, 0, height }); // height += 2 (height) if (tileElement->AsTrack()->GetTrackType() == TrackElemType::EndStation && rideType == RIDE_TYPE_JUNIOR_ROLLER_COASTER) @@ -1897,13 +1897,13 @@ static void junior_rc_flat_to_left_bank_paint_setup( image_id = junior_rc_track_pieces_flat_to_left_bank[direction][0] | session->TrackColours[SCHEME_TRACK]; if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 20, 32, 1 }, { 6, 0, height }); paint_util_push_tunnel_right(session, height, 0); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 20, 1 }, { 0, 6, height }); paint_util_push_tunnel_left(session, height, 0); } @@ -1914,11 +1914,11 @@ static void junior_rc_flat_to_left_bank_paint_setup( if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 1, 32, 26, height, 27, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 1, 32, 26 }, { 27, 0, height }); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 1, 26, height, 0, 27, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 1, 26 }, { 0, 27, height }); } } @@ -1945,13 +1945,13 @@ static void junior_rc_flat_to_right_bank_paint_setup( image_id = junior_rc_track_pieces_flat_to_right_bank[direction][0] | session->TrackColours[SCHEME_TRACK]; if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 20, 32, 1 }, { 6, 0, height }); paint_util_push_tunnel_right(session, height, 0); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 20, 1 }, { 0, 6, height }); paint_util_push_tunnel_left(session, height, 0); } @@ -1962,11 +1962,11 @@ static void junior_rc_flat_to_right_bank_paint_setup( if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 1, 32, 26, height, 27, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 1, 32, 26 }, { 27, 0, height }); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 1, 26, height, 0, 27, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 1, 26 }, { 0, 27, height }); } } @@ -2075,12 +2075,12 @@ static void junior_rc_banked_right_quarter_turn_5_tiles_paint_setup( if (direction == 1 && trackSequence == 6) { uint32_t imageId = SPR_JUNIOR_RC_BANKED_QUARTER_TURN_5_TILES_NW_SW_PART_4_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 26, height, 0, 27, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 26 }, { 0, 27, height }); } else if (direction == 3 && trackSequence == 0) { uint32_t imageId = SPR_JUNIOR_RC_BANKED_QUARTER_TURN_5_TILES_SE_NE_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 26, height, 27, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 26 }, { 27, 0, height }); } int32_t supportHeight = height; @@ -2173,11 +2173,11 @@ static void junior_rc_left_bank_to_25_deg_up_paint_setup( image_id = junior_rc_track_pieces_left_banked_to_25_deg_up[direction][0] | session->TrackColours[SCHEME_TRACK]; if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 20, 32, 1 }, { 6, 0, height }); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 20, 1 }, { 0, 6, height }); } if (junior_rc_track_pieces_left_banked_to_25_deg_up[direction][1] != 0) @@ -2186,11 +2186,11 @@ static void junior_rc_left_bank_to_25_deg_up_paint_setup( if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 1, 32, 34, height, 27, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 1, 32, 34 }, { 27, 0, height }); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 1, 34, height, 0, 27, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 1, 34 }, { 0, 27, height }); } } @@ -2233,11 +2233,11 @@ static void junior_rc_right_bank_to_25_deg_up_paint_setup( image_id = junior_rc_track_pieces_right_banked_to_25_deg_up[direction][0] | session->TrackColours[SCHEME_TRACK]; if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 20, 32, 1 }, { 6, 0, height }); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 20, 1 }, { 0, 6, height }); } if (junior_rc_track_pieces_right_banked_to_25_deg_up[direction][1] != 0) @@ -2246,11 +2246,11 @@ static void junior_rc_right_bank_to_25_deg_up_paint_setup( if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 1, 32, 34, height, 27, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 1, 32, 34 }, { 27, 0, height }); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 1, 34, height, 0, 27, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 1, 34 }, { 0, 27, height }); } } @@ -2306,13 +2306,13 @@ static void junior_rc_25_deg_up_to_left_bank_paint_setup( image_id = junior_rc_track_pieces_25_deg_up_to_left_bank[direction][0] | session->TrackColours[SCHEME_TRACK]; if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 20, 32, 1 }, { 6, 0, height }); paint_util_push_tunnel_right(session, tunnelHeight, tunnelType); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 20, 1 }, { 0, 6, height }); paint_util_push_tunnel_left(session, tunnelHeight, tunnelType); } @@ -2323,11 +2323,11 @@ static void junior_rc_25_deg_up_to_left_bank_paint_setup( if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 1, 32, 34, height, 27, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 1, 32, 34 }, { 27, 0, height }); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 1, 34, height, 0, 27, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 1, 34 }, { 0, 27, height }); } } @@ -2367,13 +2367,13 @@ static void junior_rc_25_deg_up_to_right_bank_paint_setup( image_id = junior_rc_track_pieces_25_deg_up_to_right_bank[direction][0] | session->TrackColours[SCHEME_TRACK]; if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 20, 32, 1 }, { 6, 0, height }); paint_util_push_tunnel_right(session, tunnelHeight, tunnelType); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 20, 1 }, { 0, 6, height }); paint_util_push_tunnel_left(session, tunnelHeight, tunnelType); } @@ -2384,11 +2384,11 @@ static void junior_rc_25_deg_up_to_right_bank_paint_setup( if (direction & 1) { - PaintAddImageAsParent(session, image_id, 0, 0, 1, 32, 34, height, 27, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 1, 32, 34 }, { 27, 0, height }); } else { - PaintAddImageAsParent(session, image_id, 0, 0, 32, 1, 34, height, 0, 27, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 1, 34 }, { 0, 27, height }); } } @@ -3027,12 +3027,12 @@ static void junior_rc_right_quarter_turn_3_tiles_bank_paint_setup( if (direction == 1 && trackSequence == 3) { uint32_t imageId = SPR_JUNIOR_RC_BANKED_QUARTER_TURN_3_TILES_NW_SW_PART_2_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 26, height, 0, 27, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 26 }, { 0, 27, height }); } else if (direction == 3 && trackSequence == 0) { uint32_t imageId = SPR_JUNIOR_RC_BANKED_QUARTER_TURN_3_TILES_SE_NE_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 26, height, 27, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 26 }, { 27, 0, height }); } uint8_t supportType[2][4] = { { 1, 0, 0, 2 }, { 2, 0, 0, 1 } }; @@ -3659,13 +3659,13 @@ static void junior_rc_brake_paint_setup( image_id = junior_rc_track_pieces_brake[direction] | session->TrackColours[SCHEME_TRACK]; if (direction & 1) { - PaintAddImageAsParent(session, image_id, 6, 0, 20, 32, 1, height); + PaintAddImageAsParent(session, image_id, { 6, 0, height }, { 20, 32, 1 }); paint_util_push_tunnel_right(session, height, TUNNEL_0); } else { - PaintAddImageAsParent(session, image_id, 0, 6, 32, 20, 1, height); + PaintAddImageAsParent(session, image_id, { 0, 6, height }, { 32, 20, 1 }); paint_util_push_tunnel_left(session, height, TUNNEL_0); } @@ -3695,13 +3695,13 @@ static void junior_rc_block_brake_paint_setup( image_id = junior_rc_track_pieces_block_brake[isBraked][direction] | session->TrackColours[SCHEME_TRACK]; if (direction & 1) { - PaintAddImageAsParent(session, image_id, 6, 0, 20, 32, 1, height); + PaintAddImageAsParent(session, image_id, { 6, 0, height }, { 20, 32, 1 }); paint_util_push_tunnel_right(session, height, TUNNEL_0); } else { - PaintAddImageAsParent(session, image_id, 0, 6, 32, 20, 1, height); + PaintAddImageAsParent(session, image_id, { 0, 6, height }, { 32, 20, 1 }); paint_util_push_tunnel_left(session, height, TUNNEL_0); } @@ -4562,7 +4562,7 @@ static void junior_rc_diag_flat_to_left_bank_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_FLAT_TO_LEFT_BANK_W_E_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 27); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 27 }); } if (trackSequence == 3) { @@ -4589,7 +4589,7 @@ static void junior_rc_diag_flat_to_right_bank_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_FLAT_TO_RIGHT_BANK_E_W_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 27); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 27 }); } if (trackSequence == 3) { @@ -4616,7 +4616,7 @@ static void junior_rc_diag_left_bank_to_flat_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_FLAT_TO_RIGHT_BANK_E_W_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 27); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 27 }); } if (trackSequence == 3) { @@ -4643,7 +4643,7 @@ static void junior_rc_diag_right_bank_to_flat_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_FLAT_TO_LEFT_BANK_W_E_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 27); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 27 }); } if (trackSequence == 3) { @@ -4670,7 +4670,7 @@ static void junior_rc_diag_left_bank_to_25_deg_up_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_LEFT_BANK_TO_25_DEG_UP_W_E_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 35 }); } if (trackSequence == 3) { @@ -4697,7 +4697,7 @@ static void junior_rc_diag_right_bank_to_25_deg_up_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_RIGHT_BANK_TO_25_DEG_UP_E_W_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 35 }); } if (trackSequence == 3) { @@ -4724,7 +4724,7 @@ static void junior_rc_diag_25_deg_up_to_left_bank_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_25_DEG_UP_TO_LEFT_BANK_W_E_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 35 }); } if (trackSequence == 3) { @@ -4751,7 +4751,7 @@ static void junior_rc_diag_25_deg_up_to_right_bank_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_25_DEG_UP_TO_RIGHT_BANK_E_W_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 35 }); } if (trackSequence == 3) { @@ -4778,7 +4778,7 @@ static void junior_rc_diag_left_bank_to_25_deg_down_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_25_DEG_UP_TO_RIGHT_BANK_E_W_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 35 }); } if (trackSequence == 3) { @@ -4805,7 +4805,7 @@ static void junior_rc_diag_right_bank_to_25_deg_down_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_25_DEG_UP_TO_LEFT_BANK_W_E_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 35 }); } if (trackSequence == 3) { @@ -4832,7 +4832,7 @@ static void junior_rc_diag_25_deg_down_to_left_bank_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_RIGHT_BANK_TO_25_DEG_UP_E_W_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 35 }); } if (trackSequence == 3) { @@ -4859,7 +4859,7 @@ static void junior_rc_diag_25_deg_down_to_right_bank_paint_setup( { uint32_t imageId = SPR_JUNIOR_RC_DIAG_LEFT_BANK_TO_25_DEG_UP_W_E_PART_0_2 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35); + PaintAddImageAsParent(session, imageId, { -16, -16, height }, { 32, 32, 0 }, { -16, -16, height + 35 }); } if (trackSequence == 3) { diff --git a/src/openrct2/ride/gentle/CarRide.cpp b/src/openrct2/ride/gentle/CarRide.cpp index cc5799d0a7..1113493bf4 100644 --- a/src/openrct2/ride/gentle/CarRide.cpp +++ b/src/openrct2/ride/gentle/CarRide.cpp @@ -152,11 +152,11 @@ static void paint_car_ride_track_flat( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 6, 32, 20, 1, height); + PaintAddImageAsParent(session, imageId, { 0, 6, height }, { 32, 20, 1 }); } else { - PaintAddImageAsParent(session, imageId, 6, 0, 20, 32, 1, height); + PaintAddImageAsParent(session, imageId, { 6, 0, height }, { 20, 32, 1 }); } if (direction == 0 || direction == 2) @@ -183,11 +183,11 @@ static void paint_car_ride_track_25_deg_up( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 2, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, imageId, { 0, 2, height }, { 32, 20, 1 }, { 0, 6, height }); } else { - PaintAddImageAsParent(session, imageId, 2, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, imageId, { 2, 0, height }, { 20, 32, 1 }, { 6, 0, height }); } switch (direction) @@ -221,11 +221,11 @@ static void paint_car_ride_track_flat_to_25_deg_up( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 2, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, imageId, { 0, 2, height }, { 32, 20, 1 }, { 0, 6, height }); } else { - PaintAddImageAsParent(session, imageId, 2, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, imageId, { 2, 0, height }, { 20, 32, 1 }, { 6, 0, height }); } switch (direction) @@ -259,11 +259,11 @@ static void paint_car_ride_track_25_deg_up_to_flat( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 2, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, imageId, { 0, 2, height }, { 32, 20, 1 }, { 0, 6, height }); } else { - PaintAddImageAsParent(session, imageId, 2, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, imageId, { 2, 0, height }, { 20, 32, 1 }, { 6, 0, height }); } switch (direction) @@ -322,22 +322,22 @@ static void paint_car_ride_station( if (direction == 0 || direction == 2) { imageId = SPR_STATION_BASE_B_SW_NE | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 28, 1, height - 2, 0, 2, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height - 2 }, { 32, 28, 1 }, { 0, 2, height }); } else if (direction == 1 || direction == 3) { imageId = SPR_STATION_BASE_B_NW_SE | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 0, 0, 28, 32, 1, height - 2, 2, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height - 2 }, { 28, 32, 1 }, { 2, 0, height }); } imageId = car_ride_track_pieces_flat[direction] | session->TrackColours[SCHEME_TRACK]; if (direction == 0 || direction == 2) { - PaintAddImageAsChild(session, imageId, 0, 6, 32, 20, 1, height, 0, 0, height); + PaintAddImageAsChild(session, imageId, { 0, 6, height }, { 32, 20, 1 }, { 0, 0, height }); } else { - PaintAddImageAsChild(session, imageId, 6, 0, 20, 32, 1, height, 0, 0, height); + PaintAddImageAsChild(session, imageId, { 6, 0, height }, { 20, 32, 1 }, { 0, 0, height }); } if (direction == 0 || direction == 2) @@ -423,16 +423,16 @@ static void paint_car_ride_track_left_quarter_turn_1_tile( switch (direction) { case 0: - PaintAddImageAsParent(session, imageId, 6, 0, 26, 24, 1, height, 6, 2, height); + PaintAddImageAsParent(session, imageId, { 6, 0, height }, { 26, 24, 1 }, { 6, 2, height }); break; case 1: - PaintAddImageAsParent(session, imageId, 0, 0, 26, 26, 1, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 26, 26, 1 }); break; case 2: - PaintAddImageAsParent(session, imageId, 0, 6, 24, 26, 1, height, 2, 6, height); + PaintAddImageAsParent(session, imageId, { 0, 6, height }, { 24, 26, 1 }, { 2, 6, height }); break; case 3: - PaintAddImageAsParent(session, imageId, 6, 6, 24, 24, 1, height); + PaintAddImageAsParent(session, imageId, { 6, 6, height }, { 24, 24, 1 }); break; } @@ -461,11 +461,11 @@ static void paint_car_ride_track_spinning_tunnel( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 6, 32, 20, 1, height); + PaintAddImageAsParent(session, imageId, { 0, 6, height }, { 32, 20, 1 }); } else { - PaintAddImageAsParent(session, imageId, 6, 0, 20, 32, 1, height); + PaintAddImageAsParent(session, imageId, { 6, 0, height }, { 20, 32, 1 }); } track_paint_util_spinning_tunnel_paint(session, 1, height, direction); @@ -495,16 +495,16 @@ static void paint_car_ride_track_60_deg_up( switch (direction) { case 0: - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 20, 1 }, { 0, 6, height }); break; case 1: - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 98, height, 27, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 98 }, { 27, 0, height }); break; case 2: - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 98, height, 0, 27, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 98 }, { 0, 27, height }); break; case 3: - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 20, 32, 1 }, { 6, 0, height }); break; } @@ -543,11 +543,11 @@ static void paint_car_ride_track_25_deg_up_to_60_deg_up( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 20, 1 }, { 0, 6, height }); } else { - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 20, 32, 1 }, { 6, 0, height }); } if (car_ride_track_pieces_25_deg_up_to_60_deg_up[direction][1] != 0) @@ -556,11 +556,11 @@ static void paint_car_ride_track_25_deg_up_to_60_deg_up( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 66, height, 0, 27, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 66 }, { 0, 27, height }); } else { - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 66, height, 27, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 66 }, { 27, 0, height }); } } @@ -599,11 +599,11 @@ static void paint_car_ride_track_60_deg_up_to_25_deg_up( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 20, 1 }, { 0, 6, height }); } else { - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 20, 32, 1 }, { 6, 0, height }); } if (car_ride_track_pieces_60_deg_up_to_25_deg_up[direction][1] != 0) @@ -612,11 +612,11 @@ static void paint_car_ride_track_60_deg_up_to_25_deg_up( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 66, height, 0, 27, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 66 }, { 0, 27, height }); } else { - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 66, height, 27, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 66 }, { 27, 0, height }); } } @@ -679,11 +679,11 @@ static void paint_car_ride_track_log_bumps( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 6, 32, 20, 1, height); + PaintAddImageAsParent(session, imageId, { 0, 6, height }, { 32, 20, 1 }); } else { - PaintAddImageAsParent(session, imageId, 6, 0, 20, 32, 1, height); + PaintAddImageAsParent(session, imageId, { 6, 0, height }, { 20, 32, 1 }); } if (direction == 0 || direction == 2) diff --git a/src/openrct2/ride/gentle/FlyingSaucers.cpp b/src/openrct2/ride/gentle/FlyingSaucers.cpp index e47ecb9c84..44aaa9b951 100644 --- a/src/openrct2/ride/gentle/FlyingSaucers.cpp +++ b/src/openrct2/ride/gentle/FlyingSaucers.cpp @@ -43,7 +43,7 @@ static void paint_flying_saucers( wooden_a_supports_paint_setup(session, direction & 1, 0, height, session->TrackColours[SCHEME_MISC], nullptr); uint32_t imageId = SPR_FLYING_SAUCERS_FLOOR | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 30, 30, 1, height, 1, 1, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 30, 30, 1 }, { 1, 1, height }); auto ride = get_ride(rideIndex); if (ride != nullptr) diff --git a/src/openrct2/ride/gentle/Maze.cpp b/src/openrct2/ride/gentle/Maze.cpp index 318d1994a6..c3a8f15fb0 100644 --- a/src/openrct2/ride/gentle/Maze.cpp +++ b/src/openrct2/ride/gentle/Maze.cpp @@ -54,7 +54,7 @@ static void maze_paint_setup( uint32_t rotation = session->CurrentRotation; // draw ground int32_t image_id = SPR_TERRAIN_DIRT | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, image_id, 0, 0, 32, 32, 0, height); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 32, 0 }); wooden_a_supports_paint_setup(session, (rotation & 1) ? 0 : 1, 0, height, session->TrackColours[SCHEME_3], nullptr); @@ -81,92 +81,94 @@ static void maze_paint_setup( image_id = base_image_id + SPR_MAZE_OFFSET_WALL_CENTRE; if (maze_entry & MAZE_ENTRY_FLAG_3) - PaintAddImageAsParent(session, image_id, 2, 2, 10, 10, 9, height, 3, 3, height + 2); + PaintAddImageAsParent(session, image_id, { 2, 2, height }, { 10, 10, 9 }, { 3, 3, height + 2 }); if (maze_entry & MAZE_ENTRY_FLAG_7) - PaintAddImageAsParent(session, image_id, 2, 18, 10, 10, 9, height, 3, 19, height + 2); + PaintAddImageAsParent(session, image_id, { 2, 18, height }, { 10, 10, 9 }, { 3, 19, height + 2 }); if (maze_entry & MAZE_ENTRY_FLAG_11) - PaintAddImageAsParent(session, image_id, 18, 18, 10, 10, 9, height, 19, 19, height + 2); + PaintAddImageAsParent(session, image_id, { 18, 18, height }, { 10, 10, 9 }, { 19, 19, height + 2 }); if (maze_entry & MAZE_ENTRY_FLAG_15) - PaintAddImageAsParent(session, image_id, 18, 2, 10, 10, 9, height, 19, 3, height + 2); + PaintAddImageAsParent(session, image_id, { 18, 2, height }, { 10, 10, 9 }, { 19, 3, height + 2 }); image_id = base_image_id + SPR_MAZE_OFFSET_WALL_TOP_LEFT; if (maze_entry & MAZE_ENTRY_FLAG_0) - PaintAddImageAsParent(session, image_id, 2, 0, 10, 1, 9, height, 3, 1, height + 2); + PaintAddImageAsParent(session, image_id, { 2, 0, height }, { 10, 1, 9 }, { 3, 1, height + 2 }); if (maze_entry & MAZE_ENTRY_FLAG_13) - PaintAddImageAsParent(session, image_id, 18, 0, 10, 1, 9, height, 19, 1, height + 2); + PaintAddImageAsParent(session, image_id, { 18, 0, height }, { 10, 1, 9 }, { 19, 1, height + 2 }); image_id = base_image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_RIGHT; if (maze_entry & MAZE_ENTRY_FLAG_5) - PaintAddImageAsParent(session, image_id, 2, 30, 10, 1, 9, height, 3, 30, height + 2); + PaintAddImageAsParent(session, image_id, { 2, 30, height }, { 10, 1, 9 }, { 3, 30, height + 2 }); if (maze_entry & MAZE_ENTRY_FLAG_8) - PaintAddImageAsParent(session, image_id, 18, 30, 10, 1, 9, height, 19, 30, height + 2); + PaintAddImageAsParent(session, image_id, { 18, 30, height }, { 10, 1, 9 }, { 19, 30, height + 2 }); image_id = base_image_id + SPR_MAZE_OFFSET_WALL_TOP_RIGHT; if (maze_entry & MAZE_ENTRY_FLAG_1) - PaintAddImageAsParent(session, image_id, 0, 2, 1, 10, 9, height, 1, 3, height + 2); + PaintAddImageAsParent(session, image_id, { 0, 2, height }, { 1, 10, 9 }, { 1, 3, height + 2 }); if (maze_entry & MAZE_ENTRY_FLAG_4) - PaintAddImageAsParent(session, image_id, 0, 18, 1, 10, 9, height, 1, 19, height + 2); + PaintAddImageAsParent(session, image_id, { 0, 18, height }, { 1, 10, 9 }, { 1, 19, height + 2 }); image_id = base_image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_LEFT; if (maze_entry & MAZE_ENTRY_FLAG_12) - PaintAddImageAsParent(session, image_id, 30, 2, 1, 10, 9, height, 30, 3, height + 2); + PaintAddImageAsParent(session, image_id, { 30, 2, height }, { 1, 10, 9 }, { 30, 3, height + 2 }); if (maze_entry & MAZE_ENTRY_FLAG_9) - PaintAddImageAsParent(session, image_id, 30, 18, 1, 10, 9, height, 30, 19, height + 2); + PaintAddImageAsParent(session, image_id, { 30, 18, height }, { 1, 10, 9 }, { 30, 19, height + 2 }); image_id = base_image_id + SPR_MAZE_OFFSET_WALL_INNER_NE_SW; if (maze_entry & MAZE_ENTRY_FLAG_2) - PaintAddImageAsParent(session, image_id, 2, 14, 10, 4, 9, height, 3, 14, height + 2); + PaintAddImageAsParent(session, image_id, { 2, 14, height }, { 10, 4, 9 }, { 3, 14, height + 2 }); if (maze_entry & MAZE_ENTRY_FLAG_10) - PaintAddImageAsParent(session, image_id, 18, 14, 10, 4, 9, height, 19, 14, height + 2); + PaintAddImageAsParent(session, image_id, { 18, 14, height }, { 10, 4, 9 }, { 19, 14, height + 2 }); image_id = base_image_id + SPR_MAZE_OFFSET_WALL_INNER_NW_SE; if (maze_entry & MAZE_ENTRY_FLAG_14) - PaintAddImageAsParent(session, image_id, 14, 2, 4, 10, 9, height, 14, 3, height + 2); + PaintAddImageAsParent(session, image_id, { 14, 2, height }, { 4, 10, 9 }, { 14, 3, height + 2 }); if (maze_entry & MAZE_ENTRY_FLAG_6) - PaintAddImageAsParent(session, image_id, 14, 18, 4, 10, 9, height, 14, 19, height + 2); + PaintAddImageAsParent(session, image_id, { 14, 18, height }, { 4, 10, 9 }, { 14, 19, height + 2 }); image_id = base_image_id + SPR_MAZE_OFFSET_COLUMN_CORNER; if (maze_entry & (MAZE_ENTRY_FLAG_0 | MAZE_ENTRY_FLAG_1)) - PaintAddImageAsParent(session, image_id, 0, 0, 1, 1, 9, height, 1, 1, height + 2); + PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 1, 1, 9 }, { 1, 1, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_4 | MAZE_ENTRY_FLAG_5)) - PaintAddImageAsParent(session, image_id, 0, 30, 1, 1, 9, height, 1, 30, height + 2); + PaintAddImageAsParent(session, image_id, { 0, 30, height }, { 1, 1, 9 }, { 1, 30, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_8 | MAZE_ENTRY_FLAG_9)) - PaintAddImageAsParent(session, image_id, 30, 30, 1, 1, 9, height, 30, 30, height + 2); + PaintAddImageAsParent(session, image_id, { 30, 30, height }, { 1, 1, 9 }, { 30, 30, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_12 | MAZE_ENTRY_FLAG_13)) - PaintAddImageAsParent(session, image_id, 30, 0, 1, 1, 9, height, 30, 1, height + 2); + PaintAddImageAsParent(session, image_id, { 30, 0, height }, { 1, 1, 9 }, { 30, 1, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_0 | MAZE_ENTRY_FLAG_13 | MAZE_ENTRY_FLAG_14)) PaintAddImageAsParent( - session, base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_LEFT, 14, 0, 2, 1, 9, height, 15, 1, height + 2); + session, base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_LEFT, { 14, 0, height }, { 2, 1, 9 }, { 15, 1, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_5 | MAZE_ENTRY_FLAG_6 | MAZE_ENTRY_FLAG_8)) PaintAddImageAsParent( - session, base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_RIGHT, 14, 30, 2, 1, 9, height, 15, 30, height + 2); + session, base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_RIGHT, { 14, 30, height }, { 2, 1, 9 }, + { 15, 30, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_1 | MAZE_ENTRY_FLAG_2 | MAZE_ENTRY_FLAG_4)) PaintAddImageAsParent( - session, base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_RIGHT, 0, 14, 1, 2, 9, height, 1, 15, height + 2); + session, base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_RIGHT, { 0, 14, height }, { 1, 2, 9 }, { 1, 15, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_9 | MAZE_ENTRY_FLAG_10 | MAZE_ENTRY_FLAG_12)) PaintAddImageAsParent( - session, base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_LEFT, 30, 14, 1, 2, 9, height, 30, 15, height + 2); + session, base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_LEFT, { 30, 14, height }, { 1, 2, 9 }, + { 30, 15, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_2 | MAZE_ENTRY_FLAG_6 | MAZE_ENTRY_FLAG_10 | MAZE_ENTRY_FLAG_14)) { PaintAddImageAsParent( - session, base_image_id + SPR_MAZE_OFFSET_COLUMN_CENTRE, 14, 14, 2, 2, 8, height, 15, 15, height + 2); + session, base_image_id + SPR_MAZE_OFFSET_COLUMN_CENTRE, { 14, 14, height }, { 2, 2, 8 }, { 15, 15, height + 2 }); paint_util_set_segment_support_height(session, SEGMENT_C4, height + 12, 0x20); } diff --git a/src/openrct2/ride/gentle/MerryGoRound.cpp b/src/openrct2/ride/gentle/MerryGoRound.cpp index c9551a6c30..90778ee6d2 100644 --- a/src/openrct2/ride/gentle/MerryGoRound.cpp +++ b/src/openrct2/ride/gentle/MerryGoRound.cpp @@ -68,7 +68,8 @@ static void paint_merry_go_round_structure( } uint32_t imageId = (baseImageId + imageOffset) | imageColourFlags; - PaintAddImageAsParent(session, imageId, xOffset, yOffset, 24, 24, 48, height, xOffset + 16, yOffset + 16, height); + PaintAddImageAsParent( + session, imageId, { xOffset, yOffset, height }, { 24, 24, 48 }, { xOffset + 16, yOffset + 16, height }); rct_drawpixelinfo* dpi = &session->DPI; if (dpi->zoom_level <= 0 && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr) diff --git a/src/openrct2/ride/gentle/MiniGolf.cpp b/src/openrct2/ride/gentle/MiniGolf.cpp index 6e81c31d47..f59eac2b46 100644 --- a/src/openrct2/ride/gentle/MiniGolf.cpp +++ b/src/openrct2/ride/gentle/MiniGolf.cpp @@ -492,13 +492,13 @@ static void paint_mini_golf_track_flat( if (direction & 1) { imageId = SPR_MINI_GOLF_FLAT_NW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 20, 32, 1, height, 6, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 20, 32, 1 }, { 6, 0, height }); paint_util_push_tunnel_right(session, height, TUNNEL_PATH_AND_MINI_GOLF); } else { imageId = SPR_MINI_GOLF_FLAT_SW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 20, 1, height, 0, 6, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 20, 1 }, { 0, 6, height }); paint_util_push_tunnel_left(session, height, TUNNEL_PATH_AND_MINI_GOLF); } @@ -511,18 +511,18 @@ static void paint_mini_golf_track_flat( if (direction & 1) { imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 7, height, 10, 0, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 7 }, { 10, 0, height + 2 }); imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 7, height, 22, 0, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 7 }, { 22, 0, height + 2 }); } else { imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 7, height, 0, 10, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 7 }, { 0, 10, height + 2 }); imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 7, height, 0, 22, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 7 }, { 0, 22, height + 2 }); } } @@ -700,7 +700,7 @@ static void paint_mini_golf_station( if (hasFence) { imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 10, 0, 1, 32, 7, height, 31, 0, height + 2); + PaintAddImageAsParent(session, imageId, { 10, 0, height }, { 1, 32, 7 }, { 31, 0, height + 2 }); } track_paint_util_draw_station_covers(session, EDGE_NE, hasFence, stationObj, height); @@ -723,7 +723,7 @@ static void paint_mini_golf_station( if (hasFence) { imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 0, 10, 32, 1, 7, height, 0, 31, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 10, height }, { 32, 1, 7 }, { 0, 31, height + 2 }); } track_paint_util_draw_station_covers(session, EDGE_NW, hasFence, stationObj, height); @@ -806,11 +806,11 @@ static void paint_mini_golf_track_left_quarter_turn_1_tile( { case 0: imageId = SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_INSIDE_SW_NW | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 0, 0, 5, 5, 5, height, 24, 0, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 5, 5, 5 }, { 24, 0, height + 2 }); break; case 2: imageId = SPR_MINI_GOLF_QUARTER_TURN_1_TILE_FENCE_INSIDE_NE_SE | session->TrackColours[SCHEME_MISC]; - PaintAddImageAsParent(session, imageId, 0, 0, 5, 5, 5, height, 0, 24, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 5, 5, 5 }, { 0, 24, height + 2 }); break; } } @@ -936,11 +936,11 @@ static void paint_mini_golf_hole_c( { case 0x01: case 0x20: - PaintAddImageAsParent(session, imageId, 0, 0, 2, 26, 3, height, 30, 3, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 26, 3 }, { 30, 3, height + 4 }); break; case 0x10: case 0x31: - PaintAddImageAsParent(session, imageId, 0, 0, 26, 2, 3, height, 3, 30, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 26, 2, 3 }, { 3, 30, height + 4 }); break; default: PaintAddImageAsParent( @@ -1013,17 +1013,17 @@ static void paint_mini_golf_hole_d( { case 0x01: case 0x32: - PaintAddImageAsParent(session, imageId, 0, 0, 2, 26, 3, height, 30, 3, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 26, 3 }, { 30, 3, height + 4 }); break; case 0x02: - PaintAddImageAsParent(session, imageId, 0, 0, 23, 2, 3, height, 3, 30, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 23, 2, 3 }, { 3, 30, height + 4 }); break; case 0x10: - PaintAddImageAsParent(session, imageId, 0, 0, 2, 24, 3, height, 30, 3, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 24, 3 }, { 30, 3, height + 4 }); break; case 0x20: case 0x31: - PaintAddImageAsParent(session, imageId, 0, 0, 26, 2, 3, height, 3, 30, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 26, 2, 3 }, { 3, 30, height + 4 }); break; default: PaintAddImageAsParent( @@ -1105,18 +1105,18 @@ static void paint_mini_golf_hole_e( switch ((direction << 4) | trackSequence) { case 0x01: - PaintAddImageAsParent(session, imageId, 0, 0, 2, 26, 3, height, 30, 3, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 26, 3 }, { 30, 3, height + 4 }); break; case 0x02: case 0x20: case 0x31: - PaintAddImageAsParent(session, imageId, 0, 0, 26, 2, 3, height, 3, 30, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 26, 2, 3 }, { 3, 30, height + 4 }); break; case 0x10: - PaintAddImageAsParent(session, imageId, 0, 0, 2, 24, 3, height, 30, 3, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 24, 3 }, { 30, 3, height + 4 }); break; case 0x32: - PaintAddImageAsParent(session, imageId, 0, 0, 2, 23, 3, height, 30, 3, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 23, 3 }, { 30, 3, height + 4 }); break; default: PaintAddImageAsParent( @@ -1274,5 +1274,5 @@ void vehicle_visual_mini_golf_ball( return; uint32_t image_id = rideEntry->vehicles[0].base_image_id; - PaintAddImageAsParent(session, image_id, 0, 0, 1, 1, 0, z, 0, 0, z + 3); + PaintAddImageAsParent(session, image_id, { 0, 0, z }, { 1, 1, 0 }, { 0, 0, z + 3 }); } diff --git a/src/openrct2/ride/thrill/GoKarts.cpp b/src/openrct2/ride/thrill/GoKarts.cpp index 86e566ecd6..6fbbc33c99 100644 --- a/src/openrct2/ride/thrill/GoKarts.cpp +++ b/src/openrct2/ride/thrill/GoKarts.cpp @@ -132,20 +132,20 @@ static void paint_go_karts_track_flat( if (direction == 0 || direction == 2) { imageId = SPR_GO_KARTS_FLAT_SW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 28, 1, height, 0, 2, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 28, 1 }, { 0, 2, height }); imageId = SPR_GO_KARTS_FLAT_FRONT_SW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 3, height, 0, 29, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 3 }, { 0, 29, height + 2 }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); } else { imageId = SPR_GO_KARTS_FLAT_NW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 28, 32, 1, height, 2, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 32, 1 }, { 2, 0, height }); imageId = SPR_GO_KARTS_FLAT_FRONT_NW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 3, height, 29, 0, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 3 }, { 29, 0, height + 2 }); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); } @@ -167,21 +167,21 @@ static void paint_go_karts_track_25_deg_up( imageId = go_karts_track_pieces_25_deg_up[direction][0] | session->TrackColours[SCHEME_TRACK]; if (direction == 0 || direction == 2) { - ps = PaintAddImageAsParent(session, imageId, 0, 0, 32, 28, 1, height, 0, 2, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 28, 1 }, { 0, 2, height }); } else { - ps = PaintAddImageAsParent(session, imageId, 0, 0, 28, 32, 1, height, 2, 0, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 32, 1 }, { 2, 0, height }); } imageId = go_karts_track_pieces_25_deg_up[direction][1] | session->TrackColours[SCHEME_TRACK]; if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 11, height, 0, 29, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 11 }, { 0, 29, height + 2 }); } else { - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 11, height, 29, 0, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 11 }, { 29, 0, height + 2 }); } session->WoodenSupportsPrependTo = ps; @@ -221,21 +221,21 @@ static void paint_go_karts_track_flat_to_25_deg_up( imageId = go_karts_track_pieces_flat_to_25_deg_up[direction][0] | session->TrackColours[SCHEME_TRACK]; if (direction == 0 || direction == 2) { - ps = PaintAddImageAsParent(session, imageId, 0, 0, 32, 28, 1, height, 0, 2, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 28, 1 }, { 0, 2, height }); } else { - ps = PaintAddImageAsParent(session, imageId, 0, 0, 28, 32, 1, height, 2, 0, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 32, 1 }, { 2, 0, height }); } imageId = go_karts_track_pieces_flat_to_25_deg_up[direction][1] | session->TrackColours[SCHEME_TRACK]; if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 11, height, 0, 29, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 11 }, { 0, 29, height + 2 }); } else { - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 11, height, 29, 0, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 11 }, { 29, 0, height + 2 }); } session->WoodenSupportsPrependTo = ps; @@ -275,21 +275,21 @@ static void paint_go_karts_track_25_deg_up_to_flat( imageId = go_karts_track_pieces_25_deg_up_to_flat[direction][0] | session->TrackColours[SCHEME_TRACK]; if (direction == 0 || direction == 2) { - ps = PaintAddImageAsParent(session, imageId, 0, 0, 32, 28, 1, height, 0, 2, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 28, 1 }, { 0, 2, height }); } else { - ps = PaintAddImageAsParent(session, imageId, 0, 0, 28, 32, 1, height, 2, 0, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 32, 1 }, { 2, 0, height }); } imageId = go_karts_track_pieces_25_deg_up_to_flat[direction][1] | session->TrackColours[SCHEME_TRACK]; if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 11, height, 0, 29, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 11 }, { 0, 29, height + 2 }); } else { - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 11, height, 29, 0, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 11 }, { 29, 0, height + 2 }); } session->WoodenSupportsPrependTo = ps; @@ -365,11 +365,11 @@ static void paint_go_karts_station( imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 0, 32, 28, 1, height, 0, 2, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 28, 1 }, { 0, 2, height }); } else { - PaintAddImageAsParent(session, imageId, 0, 0, 28, 32, 1, height, 2, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 32, 1 }, { 2, 0, height }); } if (direction == 0 || direction == 2) @@ -386,13 +386,13 @@ static void paint_go_karts_station( imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 3, height, 0, 29, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 3 }, { 0, 29, height + 2 }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); } else { - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 3, height, 29, 0, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 3 }, { 29, 0, height + 2 }); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); } @@ -417,34 +417,34 @@ static void paint_go_karts_station( case 0: imageId = (hasGreenLight ? SPR_GO_KARTS_START_POLE_GREEN_SW_NE : SPR_GO_KARTS_START_POLE_RED_SW_NE) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 13, height, 1, 1, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 3, 3, 13 }, { 1, 1, height + 4 }); imageId = (hasGreenLight ? SPR_GO_KARTS_START_LIGHTS_GREEN_SW_NE : SPR_GO_KARTS_START_LIGHTS_RED_SW_NE) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 13, height, 1, 28, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 3, 3, 13 }, { 1, 28, height + 4 }); break; case 1: imageId = SPR_GO_KARTS_START_POLE_NW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 13, height, 1, 28, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 3, 3, 13 }, { 1, 28, height + 4 }); imageId = SPR_GO_KARTS_START_LIGHTS_NW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 13, height, 28, 28, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 3, 3, 13 }, { 28, 28, height + 4 }); break; case 2: imageId = SPR_GO_KARTS_START_POLE_NE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 13, height, 28, 1, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 3, 3, 13 }, { 28, 1, height + 4 }); imageId = SPR_GO_KARTS_START_LIGHTS_NE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 13, height, 28, 28, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 3, 3, 13 }, { 28, 28, height + 4 }); break; case 3: imageId = (hasGreenLight ? SPR_GO_KARTS_START_POLE_GREEN_SE_NW : SPR_GO_KARTS_START_POLE_RED_SE_NW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 13, height, 1, 1, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 3, 3, 13 }, { 1, 1, height + 4 }); imageId = (hasGreenLight ? SPR_GO_KARTS_START_LIGHTS_GREEN_SE_NW : SPR_GO_KARTS_START_LIGHTS_RED_SE_NW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 13, height, 28, 1, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 3, 3, 13 }, { 28, 1, height + 4 }); break; } } @@ -466,40 +466,40 @@ static void paint_go_karts_track_left_quarter_turn_1_tile( { case 0: imageId = SPR_GO_KARTS_FLAT_QUARTER_TURN_1_TILE_NW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 28, 1, height, 0, 2, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 28, 1 }, { 0, 2, height }); imageId = SPR_GO_KARTS_FLAT_QUARTER_TURN_1_TILE_EDGE_A_NW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 3, height, 29, 2, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 1, 3 }, { 29, 2, height + 2 }); imageId = SPR_GO_KARTS_FLAT_QUARTER_TURN_1_TILE_EDGE_B_NW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 16, 1, 3, height, 14, 29, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 16, 1, 3 }, { 14, 29, height + 2 }); break; case 1: imageId = SPR_GO_KARTS_FLAT_QUARTER_TURN_1_TILE_NE_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 30, 30, 1, height, 0, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 30, 30, 1 }, { 0, 0, height }); imageId = SPR_GO_KARTS_FLAT_QUARTER_TURN_1_TILE_EDGE_A_NE_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 16, 1, 3, height, 2, 29, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 16, 1, 3 }, { 2, 29, height + 2 }); imageId = SPR_GO_KARTS_FLAT_QUARTER_TURN_1_TILE_EDGE_B_NE_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 16, 3, height, 29, 2, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 16, 3 }, { 29, 2, height + 2 }); break; case 2: imageId = SPR_GO_KARTS_FLAT_QUARTER_TURN_1_TILE_SE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 28, 32, 1, height, 2, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 32, 1 }, { 2, 0, height }); imageId = SPR_GO_KARTS_FLAT_QUARTER_TURN_1_TILE_EDGE_A_SE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 3, height, 2, 2, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 1, 3 }, { 2, 2, height + 2 }); imageId = SPR_GO_KARTS_FLAT_QUARTER_TURN_1_TILE_EDGE_B_SE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 16, 3, height, 29, 14, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 16, 3 }, { 29, 14, height + 2 }); break; case 3: imageId = SPR_GO_KARTS_FLAT_QUARTER_TURN_1_TILE_SW_NW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 1, height, 0, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 32, 1 }, { 0, 0, height }); imageId = SPR_GO_KARTS_FLAT_QUARTER_TURN_1_TILE_EDGE_A_SW_NW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 3, height, 29, 29, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 1, 3 }, { 29, 29, height + 2 }); // The empty sprite isn't drawn break; diff --git a/src/openrct2/ride/thrill/TopSpin.cpp b/src/openrct2/ride/thrill/TopSpin.cpp index b21b5ddf13..acf58a18ea 100644 --- a/src/openrct2/ride/thrill/TopSpin.cpp +++ b/src/openrct2/ride/thrill/TopSpin.cpp @@ -89,7 +89,7 @@ static void top_spin_paint_vehicle( // Left back bottom support image_id += 572; PaintAddImageAsParent( - session, image_id, al, cl, lengthX, lengthY, 90, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ); + session, image_id, { al, cl, height }, { lengthX, lengthY, 90 }, { boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ }); image_id = session->TrackColours[SCHEME_MISC]; if (image_id == IMAGE_TYPE_REMAP) diff --git a/src/openrct2/ride/transport/Chairlift.cpp b/src/openrct2/ride/transport/Chairlift.cpp index ebcecc843a..ce5e9f9083 100644 --- a/src/openrct2/ride/transport/Chairlift.cpp +++ b/src/openrct2/ride/transport/Chairlift.cpp @@ -193,11 +193,11 @@ static void chairlift_paint_station_ne_sw( if (!isStart && !isEnd) { imageId = ((direction == 0) ? SPR_20502 : SPR_20504) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 6, 2, height, 0, 13, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 6, 2 }, { 0, 13, height + 28 }); } imageId = SPR_FLOOR_METAL | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 1, height, 0, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 32, 1 }, { 0, 0, height }); bool hasFence = track_paint_util_has_fence(EDGE_NW, pos, tileElement, ride, session->CurrentRotation); if (hasFence) @@ -217,7 +217,7 @@ static void chairlift_paint_station_ne_sw( if (hasFence) { imageId = SPR_FENCE_METAL_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 27, height, 0, 30, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 27 }, { 0, 30, height + 2 }); } track_paint_util_draw_station_covers(session, EDGE_SE, hasFence, stationObj, height); @@ -226,10 +226,10 @@ static void chairlift_paint_station_ne_sw( if ((direction == 0 && isStart) || (direction == 2 && isEnd)) { imageId = SPR_FENCE_METAL_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 28, 27, height, 30, 2, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 28, 27 }, { 30, 2, height + 4 }); imageId = chairlift_bullwheel_frames[ride->chairlift_bullwheel_rotation / 16384] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 26, height, 14, 14, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 26 }, { 14, 14, height + 4 }); imageId = SPR_CHAIRLIFT_STATION_END_CAP_NE | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsChild(session, imageId, 0, 0, 4, 4, 26, height, 14, 14, height + 4); @@ -239,7 +239,7 @@ static void chairlift_paint_station_ne_sw( else if ((direction == 2 && isStart) || (direction == 0 && isEnd)) { imageId = chairlift_bullwheel_frames[ride->chairlift_bullwheel_rotation / 16384] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 26, height, 14, 14, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 26 }, { 14, 14, height + 4 }); imageId = SPR_CHAIRLIFT_STATION_END_CAP_SW | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsChild(session, imageId, 0, 0, 4, 4, 26, height, 14, 14, height + 4); @@ -250,13 +250,14 @@ static void chairlift_paint_station_ne_sw( if (drawBackColumn) { imageId = SPR_CHAIRLIFT_STATION_COLUMN_NE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 16, 1, 1, 7, height + 2, 1, 16, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 16, height + 2 }, { 1, 1, 7 }, { 1, 16, height + 2 }); } if (drawFrontColumn) { imageId = SPR_CHAIRLIFT_STATION_COLUMN_NE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 30, 16, 1, 1, 7, height + 2, 1, 16, height + 2); // bound offset x is wrong? + PaintAddImageAsParent( + session, imageId, { 30, 16, height + 2 }, { 1, 1, 7 }, { 1, 16, height + 2 }); // bound offset x is wrong? } paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0); @@ -286,11 +287,11 @@ static void chairlift_paint_station_se_nw( if (!isStart && !isEnd) { imageId = ((direction == 1) ? SPR_20503 : SPR_20505) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 6, 32, 2, height, 13, 0, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 6, 32, 2 }, { 13, 0, height + 28 }); } imageId = SPR_FLOOR_METAL | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 1, height, 0, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 32, 1 }, { 0, 0, height }); bool hasFence = track_paint_util_has_fence(EDGE_NE, pos, tileElement, ride, session->CurrentRotation); if (hasFence) @@ -310,7 +311,7 @@ static void chairlift_paint_station_se_nw( if (hasFence) { imageId = SPR_FENCE_METAL_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 27, height, 30, 0, height + 2); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 27 }, { 30, 0, height + 2 }); } track_paint_util_draw_station_covers(session, EDGE_SW, hasFence, stationObj, height); @@ -319,7 +320,7 @@ static void chairlift_paint_station_se_nw( if ((direction == 1 && isStart) || (direction == 3 && isEnd)) { imageId = chairlift_bullwheel_frames[ride->chairlift_bullwheel_rotation / 16384] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 26, height, 14, 14, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 26 }, { 14, 14, height + 4 }); imageId = SPR_CHAIRLIFT_STATION_END_CAP_SE | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsChild(session, imageId, 0, 0, 4, 4, 26, height, 14, 14, height + 4); @@ -329,10 +330,10 @@ static void chairlift_paint_station_se_nw( else if ((direction == 3 && isStart) || (direction == 1 && isEnd)) { imageId = SPR_FENCE_METAL_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 28, 1, 27, height, 2, 30, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 1, 27 }, { 2, 30, height + 4 }); imageId = chairlift_bullwheel_frames[ride->chairlift_bullwheel_rotation / 16384] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 26, height, 14, 14, height + 4); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 26 }, { 14, 14, height + 4 }); imageId = SPR_CHAIRLIFT_STATION_END_CAP_NW | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsChild(session, imageId, 0, 0, 4, 4, 26, height, 14, 14, height + 4); @@ -343,13 +344,14 @@ static void chairlift_paint_station_se_nw( if (drawLeftColumn) { imageId = SPR_CHAIRLIFT_STATION_COLUMN_SE_NW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 16, 0, 1, 1, 7, height + 2, 16, 1, height + 2); + PaintAddImageAsParent(session, imageId, { 16, 0, height + 2 }, { 1, 1, 7 }, { 16, 1, height + 2 }); } if (drawRightColumn) { imageId = SPR_CHAIRLIFT_STATION_COLUMN_SE_NW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 16, 30, 1, 1, 7, height + 2, 16, 1, height + 2); // bound offset x is wrong? + PaintAddImageAsParent( + session, imageId, { 16, 30, height + 2 }, { 1, 1, 7 }, { 16, 1, height + 2 }); // bound offset x is wrong? paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); } @@ -381,13 +383,13 @@ static void chairlift_paint_flat( if (direction & 1) { imageId = SPR_CHAIRLIFT_CABLE_FLAT_SE_NW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 6, 32, 2, height, 13, 0, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 6, 32, 2 }, { 13, 0, height + 28 }); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); } else { imageId = SPR_CHAIRLIFT_CABLE_FLAT_SW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 6, 2, height, 0, 13, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 6, 2 }, { 0, 13, height + 28 }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); } @@ -406,25 +408,25 @@ static void chairlift_paint_25_deg_up( { case 0: imageId = SPR_CHAIRLIFT_CABLE_UP_SW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 6, 2, height, 0, 13, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 6, 2 }, { 0, 13, height + 28 }); paint_util_push_tunnel_left(session, height - 8, TUNNEL_SQUARE_7); break; case 1: imageId = SPR_CHAIRLIFT_CABLE_UP_NW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 6, 32, 2, height, 13, 0, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 6, 32, 2 }, { 13, 0, height + 28 }); paint_util_push_tunnel_right(session, height + 8, TUNNEL_SQUARE_8); break; case 2: imageId = SPR_CHAIRLIFT_CABLE_UP_NE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 6, 2, height, 0, 13, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 6, 2 }, { 0, 13, height + 28 }); paint_util_push_tunnel_left(session, height + 8, TUNNEL_SQUARE_8); break; case 3: imageId = SPR_CHAIRLIFT_CABLE_UP_SE_NW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 6, 32, 2, height, 13, 0, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 6, 32, 2 }, { 13, 0, height + 28 }); paint_util_push_tunnel_right(session, height - 8, TUNNEL_SQUARE_7); break; } @@ -444,40 +446,40 @@ static void chairlift_paint_flat_to_25_deg_up( { case 0: imageId = SPR_20508 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 6, 2, height, 0, 13, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 6, 2 }, { 0, 13, height + 28 }); imageId = SPR_20520 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 25, height, 14, 14, height + 1); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 25 }, { 14, 14, height + 1 }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); break; case 1: imageId = SPR_20509 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 6, 32, 2, height, 13, 0, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 6, 32, 2 }, { 13, 0, height + 28 }); imageId = SPR_20521 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 25, height, 14, 14, height + 1); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 25 }, { 14, 14, height + 1 }); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_8); break; case 2: imageId = SPR_20510 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 6, 2, height, 0, 13, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 6, 2 }, { 0, 13, height + 28 }); imageId = SPR_20522 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 25, height, 14, 14, height + 1); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 25 }, { 14, 14, height + 1 }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_8); break; case 3: imageId = SPR_20511 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 6, 32, 2, height, 13, 0, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 6, 32, 2 }, { 13, 0, height + 28 }); imageId = SPR_20523 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 25, height, 14, 14, height + 1); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 25 }, { 14, 14, height + 1 }); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); break; @@ -499,40 +501,40 @@ static void chairlift_paint_25_deg_up_to_flat( { case 0: imageId = SPR_20512 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 6, 2, height, 0, 13, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 6, 2 }, { 0, 13, height + 28 }); imageId = SPR_20524 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 25, height, 14, 14, height + 1); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 25 }, { 14, 14, height + 1 }); paint_util_push_tunnel_left(session, height - 8, TUNNEL_SQUARE_FLAT); break; case 1: imageId = SPR_20513 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 6, 32, 2, height, 13, 0, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 6, 32, 2 }, { 13, 0, height + 28 }); imageId = SPR_20525 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 25, height, 14, 14, height + 1); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 25 }, { 14, 14, height + 1 }); paint_util_push_tunnel_right(session, height + 8, TUNNEL_14); break; case 2: imageId = SPR_20514 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 6, 2, height, 0, 13, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 6, 2 }, { 0, 13, height + 28 }); imageId = SPR_20526 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 25, height, 14, 14, height + 1); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 25 }, { 14, 14, height + 1 }); paint_util_push_tunnel_left(session, height + 8, TUNNEL_14); break; case 3: imageId = SPR_20515 | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 6, 32, 2, height, 13, 0, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 6, 32, 2 }, { 13, 0, height + 28 }); imageId = SPR_20527 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 4, 4, 25, height, 14, 14, height + 1); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 4, 4, 25 }, { 14, 14, height + 1 }); paint_util_push_tunnel_right(session, height - 8, TUNNEL_SQUARE_FLAT); break; @@ -578,50 +580,50 @@ static void chairlift_paint_left_quarter_turn_1_tile( { case 0: imageId = SPR_CHAIRLIFT_CORNER_NW_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, 2, height, 16, 0, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 16, 16, 2 }, { 16, 0, height + 28 }); imageId = SPR_20532 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 2, 2, 27, height, 16, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 2, 27 }, { 16, 4, height }); imageId = SPR_20536 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 2, 2, 27, height, 28, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 2, 27 }, { 28, 4, height }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); break; case 1: imageId = SPR_CHAIRLIFT_CORNER_NW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, 2, height, 0, 0, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 16, 16, 2 }, { 0, 0, height + 28 }); imageId = SPR_20533 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 2, 2, 27, height, 16, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 2, 27 }, { 16, 4, height }); imageId = SPR_20537 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 2, 2, 27, height, 4, 16, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 2, 27 }, { 4, 16, height }); break; case 2: imageId = SPR_CHAIRLIFT_CORNER_SE_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, 2, height, 0, 16, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 16, 16, 2 }, { 0, 16, height + 28 }); imageId = SPR_20534 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 2, 2, 27, height, 4, 16, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 2, 27 }, { 4, 16, height }); imageId = SPR_20538 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 2, 2, 27, height, 16, 28, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 2, 27 }, { 16, 28, height }); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); break; case 3: imageId = SPR_CHAIRLIFT_CORNER_SW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 16, 16, 2, height, 16, 16, height + 28); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 16, 16, 2 }, { 16, 16, height + 28 }); imageId = SPR_20535 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 2, 2, 27, height, 28, 16, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 2, 27 }, { 28, 16, height }); imageId = SPR_20539 | session->TrackColours[SCHEME_SUPPORTS]; - PaintAddImageAsParent(session, imageId, 0, 0, 2, 2, 27, height, 16, 28, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 2, 27 }, { 16, 28, height }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); diff --git a/src/openrct2/ride/transport/Monorail.cpp b/src/openrct2/ride/transport/Monorail.cpp index d564f70c28..eccd89fa0f 100644 --- a/src/openrct2/ride/transport/Monorail.cpp +++ b/src/openrct2/ride/transport/Monorail.cpp @@ -426,11 +426,11 @@ static void paint_monorail_track_flat( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 6, 32, 20, 3, height); + PaintAddImageAsParent(session, imageId, { 0, 6, height }, { 32, 20, 3 }); } else { - PaintAddImageAsParent(session, imageId, 6, 0, 20, 32, 3, height); + PaintAddImageAsParent(session, imageId, { 6, 0, height }, { 20, 32, 3 }); } if (direction == 0 || direction == 2) @@ -515,11 +515,11 @@ static void paint_monorail_track_25_deg_up( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 6, 32, 20, 3, height); + PaintAddImageAsParent(session, imageId, { 0, 6, height }, { 32, 20, 3 }); } else { - PaintAddImageAsParent(session, imageId, 6, 0, 20, 32, 3, height); + PaintAddImageAsParent(session, imageId, { 6, 0, height }, { 20, 32, 3 }); } switch (direction) @@ -557,11 +557,11 @@ static void paint_monorail_track_flat_to_25_deg_up( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 6, 32, 20, 3, height); + PaintAddImageAsParent(session, imageId, { 0, 6, height }, { 32, 20, 3 }); } else { - PaintAddImageAsParent(session, imageId, 6, 0, 20, 32, 3, height); + PaintAddImageAsParent(session, imageId, { 6, 0, height }, { 20, 32, 3 }); } switch (direction) @@ -599,11 +599,11 @@ static void paint_monorail_track_25_deg_up_to_flat( if (direction == 0 || direction == 2) { - PaintAddImageAsParent(session, imageId, 0, 6, 32, 20, 3, height); + PaintAddImageAsParent(session, imageId, { 0, 6, height }, { 32, 20, 3 }); } else { - PaintAddImageAsParent(session, imageId, 6, 0, 20, 32, 3, height); + PaintAddImageAsParent(session, imageId, { 6, 0, height }, { 20, 32, 3 }); } switch (direction) diff --git a/src/openrct2/ride/water/BoatHire.cpp b/src/openrct2/ride/water/BoatHire.cpp index 9fdf1345d7..c8c9e3e141 100644 --- a/src/openrct2/ride/water/BoatHire.cpp +++ b/src/openrct2/ride/water/BoatHire.cpp @@ -36,21 +36,22 @@ static void paint_boat_hire_track_flat( { uint32_t imageId; + const auto offset = CoordsXYZ{ 0, 0, height }; if (direction & 1) { imageId = SPR_BOAT_HIRE_FLAT_BACK_NW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 3, height, 4, 0, height); + PaintAddImageAsParent(session, imageId, offset, { 1, 32, 3 }, { 4, 0, height }); imageId = SPR_BOAT_HIRE_FLAT_FRONT_NW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 3, height, 28, 0, height); + PaintAddImageAsParent(session, imageId, offset, { 1, 32, 3 }, { 28, 0, height }); } else { imageId = SPR_BOAT_HIRE_FLAT_BACK_SW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 3, height, 0, 4, height); + PaintAddImageAsParent(session, imageId, offset, { 32, 1, 3 }, { 0, 4, height }); imageId = SPR_BOAT_HIRE_FLAT_FRONT_SW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 3, height, 0, 28, height); + PaintAddImageAsParent(session, imageId, offset, { 32, 1, 3 }, { 0, 28, height }); } paint_util_set_segment_support_height( @@ -92,35 +93,36 @@ static void paint_boat_hire_track_left_quarter_turn_1_tile( const TileElement* tileElement) { uint32_t imageId; + const auto offset = CoordsXYZ{ 0, 0, height }; switch (direction) { case 0: imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_BACK_SW_NW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 0, height, 0, 0, height); + PaintAddImageAsParent(session, imageId, offset, { 32, 32, 0 }, { 0, 0, height }); imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_FRONT_SW_NW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 3, height, 28, 28, height + 2); + PaintAddImageAsParent(session, imageId, offset, { 3, 3, 3 }, { 28, 28, height + 2 }); break; case 1: imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_BACK_NW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 0, height, 0, 0, height); + PaintAddImageAsParent(session, imageId, offset, { 32, 32, 0 }, { 0, 0, height }); imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_FRONT_NW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 3, height, 28, 28, height + 2); + PaintAddImageAsParent(session, imageId, offset, { 3, 3, 3 }, { 28, 28, height + 2 }); break; case 2: imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_BACK_NE_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 0, height, 0, 0, height); + PaintAddImageAsParent(session, imageId, offset, { 32, 32, 0 }, { 0, 0, height }); imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_FRONT_NE_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 3, height, 28, 28, height + 2); + PaintAddImageAsParent(session, imageId, offset, { 3, 3, 3 }, { 28, 28, height + 2 }); break; case 3: imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_FRONT_SE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 3, height, 28, 28, height + 2); + PaintAddImageAsParent(session, imageId, offset, { 3, 3, 3 }, { 28, 28, height + 2 }); imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_BACK_SE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 0, height, 0, 0, height); + PaintAddImageAsParent(session, imageId, offset, { 32, 32, 0 }, { 0, 0, height }); break; } diff --git a/src/openrct2/ride/water/RiverRapids.cpp b/src/openrct2/ride/water/RiverRapids.cpp index 00513aa7c1..a7d3ab46b7 100644 --- a/src/openrct2/ride/water/RiverRapids.cpp +++ b/src/openrct2/ride/water/RiverRapids.cpp @@ -285,21 +285,21 @@ static void paint_river_rapids_track_flat( { imageId = (direction == 1 ? SPR_RIVER_RAPIDS_FLAT_NW_SE : SPR_RIVER_RAPIDS_FLAT_SE_NW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 24, 32, 11, height, 4, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 24, 32, 11 }, { 4, 0, height }); imageId = (direction == 1 ? SPR_RIVER_RAPIDS_FLAT_FRONT_NW_SE : SPR_RIVER_RAPIDS_FLAT_FRONT_SE_NW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 3, height, 27, 0, height + 17); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 3 }, { 27, 0, height + 17 }); } else { imageId = (direction == 0 ? SPR_RIVER_RAPIDS_FLAT_SW_NE : SPR_RIVER_RAPIDS_FLAT_NE_SW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 24, 11, height, 0, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 24, 11 }, { 0, 4, height }); imageId = (direction == 0 ? SPR_RIVER_RAPIDS_FLAT_FRONT_SW_NE : SPR_RIVER_RAPIDS_FLAT_FRONT_NE_SW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 3, height, 0, 27, height + 17); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 3 }, { 0, 27, height + 17 }); } wooden_a_supports_paint_setup(session, (direction & 1), 0, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); @@ -339,10 +339,10 @@ static void paint_river_rapids_track_25_deg( { case 0: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 24, 4, height, 0, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 24, 4 }, { 0, 4, height }); imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 34, height, 0, 27, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 34 }, { 0, 27, height + 16 }); wooden_a_supports_paint_setup(session, 0, 9, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_left(session, height - 8, TUNNEL_SQUARE_7); @@ -350,11 +350,11 @@ static void paint_river_rapids_track_25_deg( case 1: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - ps = PaintAddImageAsParent(session, imageId, 0, 0, 24, 32, 4, height, 4, 0, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 24, 32, 4 }, { 4, 0, height }); session->WoodenSupportsPrependTo = ps; imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 34, height, 27, 0, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 34 }, { 27, 0, height + 16 }); wooden_a_supports_paint_setup(session, 1, 10, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_right(session, height + 8, TUNNEL_SQUARE_8); @@ -362,11 +362,11 @@ static void paint_river_rapids_track_25_deg( case 2: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - ps = PaintAddImageAsParent(session, imageId, 0, 0, 32, 24, 4, height, 0, 4, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 24, 4 }, { 0, 4, height }); session->WoodenSupportsPrependTo = ps; imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 34, height, 0, 27, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 34 }, { 0, 27, height + 16 }); wooden_a_supports_paint_setup(session, 0, 11, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_left(session, height + 8, TUNNEL_SQUARE_8); @@ -374,10 +374,10 @@ static void paint_river_rapids_track_25_deg( case 3: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 24, 32, 4, height, 4, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 24, 32, 4 }, { 4, 0, height }); imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 34, height, 27, 0, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 34 }, { 27, 0, height + 16 }); wooden_a_supports_paint_setup(session, 1, 12, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_right(session, height - 8, TUNNEL_SQUARE_7); @@ -398,10 +398,10 @@ static void paint_river_rapids_track_25_deg_to_flat_a( { case 0: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 24, 4, height, 0, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 24, 4 }, { 0, 4, height }); imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 18, height, 0, 27, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 18 }, { 0, 27, height + 16 }); wooden_a_supports_paint_setup(session, 0, 5, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_left(session, height - 8, TUNNEL_SQUARE_FLAT); @@ -409,11 +409,11 @@ static void paint_river_rapids_track_25_deg_to_flat_a( case 1: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - ps = PaintAddImageAsParent(session, imageId, 0, 0, 24, 32, 4, height, 4, 0, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 24, 32, 4 }, { 4, 0, height }); session->WoodenSupportsPrependTo = ps; imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 18, height, 27, 0, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 18 }, { 27, 0, height + 16 }); wooden_a_supports_paint_setup(session, 1, 6, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_right(session, height + 8, TUNNEL_14); @@ -421,11 +421,11 @@ static void paint_river_rapids_track_25_deg_to_flat_a( case 2: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - ps = PaintAddImageAsParent(session, imageId, 0, 0, 32, 24, 4, height, 0, 4, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 24, 4 }, { 0, 4, height }); session->WoodenSupportsPrependTo = ps; imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 18, height, 0, 27, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 18 }, { 0, 27, height + 16 }); wooden_a_supports_paint_setup(session, 0, 7, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_left(session, height + 8, TUNNEL_14); @@ -433,10 +433,10 @@ static void paint_river_rapids_track_25_deg_to_flat_a( case 3: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 24, 32, 4, height, 4, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 24, 32, 4 }, { 4, 0, height }); imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 18, height, 27, 0, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 18 }, { 27, 0, height + 16 }); wooden_a_supports_paint_setup(session, 1, 8, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_right(session, height - 8, TUNNEL_SQUARE_FLAT); @@ -457,10 +457,10 @@ static void paint_river_rapids_track_25_deg_to_flat_b( { case 0: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 24, 11, height, 0, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 24, 11 }, { 0, 4, height }); imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 26, height, 0, 27, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 26 }, { 0, 27, height + 16 }); wooden_a_supports_paint_setup(session, 0, 1, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); @@ -468,11 +468,11 @@ static void paint_river_rapids_track_25_deg_to_flat_b( case 1: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - ps = PaintAddImageAsParent(session, imageId, 0, 0, 24, 32, 11, height, 4, 0, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 24, 32, 11 }, { 4, 0, height }); session->WoodenSupportsPrependTo = ps; imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 26, height, 27, 0, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 26 }, { 27, 0, height + 16 }); wooden_a_supports_paint_setup(session, 1, 2, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_8); @@ -480,11 +480,11 @@ static void paint_river_rapids_track_25_deg_to_flat_b( case 2: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - ps = PaintAddImageAsParent(session, imageId, 0, 0, 32, 24, 11, height, 0, 4, height); + ps = PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 24, 11 }, { 0, 4, height }); session->WoodenSupportsPrependTo = ps; imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 26, height, 0, 27, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 26 }, { 0, 27, height + 16 }); wooden_a_supports_paint_setup(session, 0, 3, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_8); @@ -492,10 +492,10 @@ static void paint_river_rapids_track_25_deg_to_flat_b( case 3: imageId = sprites[direction][0] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 24, 32, 11, height, 4, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 24, 32, 11 }, { 4, 0, height }); imageId = sprites[direction][1] | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 26, height, 27, 0, height + 16); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 26 }, { 27, 0, height + 16 }); wooden_a_supports_paint_setup(session, 1, 4, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); @@ -566,41 +566,41 @@ static void paint_river_rapids_track_left_quarter_turn_1_tile( { case 0: imageId = SPR_RIVER_RAPIDS_LEFT_QUARTER_TURN_1_TILE_SW_NW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 28, 26, 11, height, 4, 2, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 26, 11 }, { 4, 2, height }); imageId = SPR_RIVER_RAPIDS_LEFT_QUARTER_TURN_1_TILE_FRONT_SW_NW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 2, 1, 7, height, 28, 27, height + 13); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 1, 7 }, { 28, 27, height + 13 }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); break; case 1: imageId = SPR_RIVER_RAPIDS_LEFT_QUARTER_TURN_1_TILE_NW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 28, 28, 11, height, 0, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 28, 11 }, { 0, 0, height }); imageId = SPR_RIVER_RAPIDS_QUARTER_TURN_1_TILE_FRONT_LEFT_NW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 30, 7, height, 27, 1, height + 13); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 30, 7 }, { 27, 1, height + 13 }); imageId = SPR_RIVER_RAPIDS_QUARTER_TURN_1_TILE_FRONT_RIGHT_NW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 30, 1, 7, height, 1, 27, height + 13); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 30, 1, 7 }, { 1, 27, height + 13 }); break; case 2: imageId = SPR_RIVER_RAPIDS_LEFT_QUARTER_TURN_1_TILE_NE_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 26, 28, 11, height, 2, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 26, 28, 11 }, { 2, 4, height }); imageId = SPR_RIVER_RAPIDS_LEFT_QUARTER_TURN_1_TILE_FRONT_NE_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 2, 7, height, 27, 28, height + 13); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 2, 7 }, { 27, 28, height + 13 }); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); break; case 3: imageId = SPR_RIVER_RAPIDS_LEFT_QUARTER_TURN_1_TILE_SE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 28, 28, 11, height, 4, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 28, 11 }, { 4, 4, height }); imageId = SPR_RIVER_RAPIDS_LEFT_QUARTER_TURN_1_TILE_FRONT_SE_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 7, height, 28, 28, height + 13); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 1, 7 }, { 28, 28, height + 13 }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); @@ -623,10 +623,10 @@ static void paint_river_rapids_track_right_quarter_turn_1_tile( { case 0: imageId = SPR_RIVER_RAPIDS_RIGHT_QUARTER_TURN_1_TILE_SW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 28, 28, 11, height, 4, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 28, 11 }, { 4, 4, height }); imageId = SPR_RIVER_RAPIDS_RIGHT_QUARTER_TURN_1_TILE_FRONT_SW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 1, 7, height, 28, 28, height + 13); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 1, 7 }, { 28, 28, height + 13 }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); @@ -634,31 +634,31 @@ static void paint_river_rapids_track_right_quarter_turn_1_tile( case 1: imageId = SPR_RIVER_RAPIDS_RIGHT_QUARTER_TURN_1_TILE_SE_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 28, 26, 11, height, 4, 2, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 26, 11 }, { 4, 2, height }); imageId = SPR_RIVER_RAPIDS_RIGHT_QUARTER_TURN_1_TILE_FRONT_SE_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 2, 1, 7, height, 28, 27, height + 13); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 2, 1, 7 }, { 28, 27, height + 13 }); paint_util_push_tunnel_left(session, height, TUNNEL_SQUARE_FLAT); break; case 2: imageId = SPR_RIVER_RAPIDS_RIGHT_QUARTER_TURN_1_TILE_NE_NW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 28, 28, 11, height, 0, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 28, 28, 11 }, { 0, 0, height }); imageId = SPR_RIVER_RAPIDS_QUARTER_TURN_1_TILE_FRONT_LEFT_NW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 30, 7, height, 27, 1, height + 13); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 30, 7 }, { 27, 1, height + 13 }); imageId = SPR_RIVER_RAPIDS_QUARTER_TURN_1_TILE_FRONT_RIGHT_NW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 30, 1, 7, height, 1, 27, height + 13); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 30, 1, 7 }, { 1, 27, height + 13 }); break; case 3: imageId = SPR_RIVER_RAPIDS_RIGHT_QUARTER_TURN_1_TILE_NW_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 26, 28, 11, height, 2, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 26, 28, 11 }, { 2, 4, height }); imageId = SPR_RIVER_RAPIDS_RIGHT_QUARTER_TURN_1_TILE_FRONT_NW_SW | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 28, 7, height, 27, 2, height + 13); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 28, 7 }, { 27, 2, height + 13 }); paint_util_push_tunnel_right(session, height, TUNNEL_SQUARE_FLAT); break; @@ -682,17 +682,17 @@ static void paint_river_rapids_track_waterfall( { imageId = (direction == 1 ? SPR_RIVER_RAPIDS_WATERFALL_NW_SE : SPR_RIVER_RAPIDS_WATERFALL_SE_NW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 24, 32, 11, height, 4, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 24, 32, 11 }, { 4, 0, height }); imageId = (SPR_RIVER_RAPIDS_WATERFALL_BASE_NE_FRAME_0 + frameNum) | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsChild(session, imageId, { 0, 0, height }, { 24, 32, 11 }, { 4, 0, height }); imageId = (SPR_RIVER_RAPIDS_WATERFALL_TOP_NE_FRAME_0 + frameNum) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 27, height, 4, 0, height + 17); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 27 }, { 4, 0, height + 17 }); imageId = (direction == 1 ? SPR_RIVER_RAPIDS_WATERFALL_FRONT_NW_SE : SPR_RIVER_RAPIDS_WATERFALL_FRONT_SE_NW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 27, height, 27, 0, height + 17); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 27 }, { 27, 0, height + 17 }); imageId = (SPR_RIVER_RAPIDS_WATERFALL_SIDE_SW_FRAME_0 + frameNum) | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsChild(session, imageId, { 0, 0, height }, { 1, 32, 27 }, { 27, 0, height + 17 }); @@ -701,17 +701,17 @@ static void paint_river_rapids_track_waterfall( { imageId = (direction == 0 ? SPR_RIVER_RAPIDS_WATERFALL_SW_NE : SPR_RIVER_RAPIDS_WATERFALL_NE_SW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 24, 11, height, 0, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 24, 11 }, { 0, 4, height }); imageId = (SPR_RIVER_RAPIDS_WATERFALL_BASE_NW_FRAME_0 + frameNum) | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsChild(session, imageId, { 0, 0, height }, { 32, 24, 11 }, { 0, 4, height }); imageId = (SPR_RIVER_RAPIDS_WATERFALL_TOP_NW_FRAME_0 + frameNum) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 27, height, 0, 4, height + 17); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 27 }, { 0, 4, height + 17 }); imageId = (direction == 0 ? SPR_RIVER_RAPIDS_WATERFALL_FRONT_SW_NE : SPR_RIVER_RAPIDS_WATERFALL_FRONT_NE_SW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 27, height, 0, 27, height + 17); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 27 }, { 0, 27, height + 17 }); imageId = (SPR_RIVER_RAPIDS_WATERFALL_SIDE_SE_FRAME_0 + frameNum) | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsChild(session, imageId, { 0, 0, height }, { 32, 1, 27 }, { 0, 27, height + 17 }); @@ -744,18 +744,18 @@ static void paint_river_rapids_track_rapids( if (direction & 1) { imageId = (SPR_RIVER_RAPIDS_RAPIDS_NW_SE_FRAME_0 + frameNum) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 24, 32, 11, height, 4, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 24, 32, 11 }, { 4, 0, height }); imageId = SPR_RIVER_RAPIDS_RAPIDS_FRONT_NW_SE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 11, height, 27, 0, height + 17); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 11 }, { 27, 0, height + 17 }); } else { imageId = (SPR_RIVER_RAPIDS_RAPIDS_SW_NE_FRAME_0 + frameNum) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 24, 11, height, 0, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 24, 11 }, { 0, 4, height }); imageId = SPR_RIVER_RAPIDS_RAPIDS_FRONT_SW_NE | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 11, height, 0, 27, height + 17); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 11 }, { 0, 27, height + 17 }); } wooden_a_supports_paint_setup(session, (direction & 1), 0, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); @@ -796,27 +796,27 @@ static void paint_river_rapids_track_whirlpool( { imageId = (direction == 1 ? SPR_RIVER_RAPIDS_FLAT_NW_SE : SPR_RIVER_RAPIDS_FLAT_SE_NW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 24, 32, 11, height, 4, 0, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 24, 32, 11 }, { 4, 0, height }); imageId = (SPR_RIVER_RAPIDS_RAPIDS_WHIRLPOOL_FRAME_0 + frameNum) | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsChild(session, imageId, { 0, 0, height }, { 24, 32, 11 }, { 4, 0, height }); imageId = (direction == 1 ? SPR_RIVER_RAPIDS_FLAT_FRONT_NW_SE : SPR_RIVER_RAPIDS_FLAT_FRONT_SE_NW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 3, height, 27, 0, height + 17); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 32, 3 }, { 27, 0, height + 17 }); } else { imageId = (direction == 0 ? SPR_RIVER_RAPIDS_FLAT_SW_NE : SPR_RIVER_RAPIDS_FLAT_NE_SW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 24, 11, height, 0, 4, height); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 24, 11 }, { 0, 4, height }); imageId = (SPR_RIVER_RAPIDS_RAPIDS_WHIRLPOOL_FRAME_0 + frameNum) | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsChild(session, imageId, { 0, 0, height }, { 32, 24, 11 }, { 0, 4, height }); imageId = (direction == 0 ? SPR_RIVER_RAPIDS_FLAT_FRONT_SW_NE : SPR_RIVER_RAPIDS_FLAT_FRONT_NE_SW) | session->TrackColours[SCHEME_TRACK]; - PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 3, height, 0, 27, height + 17); + PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 32, 1, 3 }, { 0, 27, height + 17 }); } wooden_a_supports_paint_setup(session, (direction & 1), 0, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); diff --git a/src/openrct2/world/Location.hpp b/src/openrct2/world/Location.hpp index fae9ba192a..7fd725fffa 100644 --- a/src/openrct2/world/Location.hpp +++ b/src/openrct2/world/Location.hpp @@ -22,21 +22,6 @@ constexpr const int32_t COORDS_Z_PER_TINY_Z = 16; constexpr const auto NumOrthogonalDirections = 4; -#pragma pack(push, 1) - -struct LocationXY16 -{ - int16_t x, y; -}; -assert_struct_size(LocationXY16, 4); - -struct LocationXYZ16 -{ - int16_t x, y, z; -}; -assert_struct_size(LocationXYZ16, 6); -#pragma pack(pop) - constexpr int32_t COORDS_NULL = 0xFFFF8000; struct ScreenCoordsXY diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index bf19252ad0..7e4352cee6 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -234,7 +234,7 @@ void ReorganiseTileElements() ReorganiseTileElements(_tileElements.size()); } -bool map_check_free_elements_and_reorganise(size_t numElements) +static bool map_check_free_elements_and_reorganise(size_t numElements) { auto freeElements = _tileElements.capacity() - _tileElements.size(); if (freeElements >= numElements) @@ -258,6 +258,14 @@ bool map_check_free_elements_and_reorganise(size_t numElements) } } +static size_t CountElementsOnTile(const CoordsXY& loc); + +bool MapCheckCapacityAndReorganise(const CoordsXY& loc, size_t numElements) +{ + auto numElementsOnTile = CountElementsOnTile(loc); + return map_check_free_elements_and_reorganise(numElementsOnTile + numElements); +} + static void clear_elements_at(const CoordsXY& loc); static ScreenCoordsXY translate_3d_to_2d(int32_t rotation, const CoordsXY& pos); @@ -1174,6 +1182,10 @@ TileElement* tile_element_insert(const CoordsXYZ& loc, int32_t occupiedQuadrants auto numElementsOnTileNew = numElementsOnTileOld + 1; auto* newTileElement = AllocateTileElements(numElementsOnTileNew); auto* originalTileElement = _tileIndex.GetFirstElementAt(tileLoc); + if (newTileElement == nullptr) + { + return nullptr; + } // Set tile index pointer to point to new element block _tileIndex.SetTile(tileLoc, newTileElement); diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index 5202375f90..512b1732c7 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -227,7 +227,7 @@ void tile_element_remove(TileElement* tileElement); void map_remove_all_rides(); void map_invalidate_map_selection_tiles(); void map_invalidate_selection_rect(); -bool map_check_free_elements_and_reorganise(size_t num_elements); +bool MapCheckCapacityAndReorganise(const CoordsXY& loc, size_t numElements = 1); TileElement* tile_element_insert(const CoordsXYZ& loc, int32_t occupiedQuadrants, TileElementType type); template T* TileElementInsert(const CoordsXYZ& loc, int32_t occupiedQuadrants) diff --git a/src/openrct2/world/Scenery.h b/src/openrct2/world/Scenery.h index 66247d9541..45e8ecdf7b 100644 --- a/src/openrct2/world/Scenery.h +++ b/src/openrct2/world/Scenery.h @@ -20,6 +20,8 @@ #define SCENERY_WITHER_AGE_THRESHOLD_1 0x28 #define SCENERY_WITHER_AGE_THRESHOLD_2 0x37 +struct LargeSceneryText; + #pragma pack(push, 1) struct SceneryEntryBase @@ -56,7 +58,10 @@ assert_struct_size(rct_large_scenery_text_glyph, 4); struct rct_large_scenery_text { - LocationXY16 offset[2]; // 0x0 + struct + { + int16_t x, y; + } offset[2]; // 0x0 uint16_t max_width; // 0x8 uint16_t pad_A; // 0xA uint8_t flags; // 0xC @@ -80,7 +85,7 @@ struct LargeSceneryEntry : SceneryEntryBase rct_large_scenery_tile* tiles; ObjectEntryIndex scenery_tab_id; uint8_t scrolling_mode; - rct_large_scenery_text* text; + LargeSceneryText* text; uint32_t text_image; }; @@ -138,11 +143,12 @@ struct WallSceneryEntry : SceneryEntryBase ObjectEntryIndex scenery_tab_id; uint8_t scrolling_mode; }; +enum class PathBitDrawType : uint8_t; struct PathBitEntry : SceneryEntryBase { uint16_t flags; - uint8_t draw_type; + PathBitDrawType draw_type; CursorID tool_id; int16_t price; ObjectEntryIndex scenery_tab_id; @@ -158,6 +164,33 @@ struct BannerSceneryEntry : SceneryEntryBase #pragma pack(pop) +struct LargeSceneryText +{ + CoordsXY offset[2]; + uint16_t max_width; + uint8_t flags; + uint16_t num_images; + rct_large_scenery_text_glyph glyphs[256]; + + LargeSceneryText() = default; + + explicit LargeSceneryText(const rct_large_scenery_text& original) + { + for (size_t i = 0; i < std::size(original.offset); i++) + { + offset[i].x = original.offset[i].x; + offset[i].y = original.offset[i].y; + } + max_width = original.max_width; + flags = original.flags; + num_images = original.num_images; + for (size_t i = 0; i < std::size(original.glyphs); i++) + { + glyphs[i] = original.glyphs[i]; + } + } +}; + struct rct_scenery_group_entry { rct_string_id name; @@ -181,12 +214,12 @@ enum PATH_BIT_FLAG_IS_QUEUE_SCREEN = 1 << 8 }; -enum +enum class PathBitDrawType : uint8_t { - PATH_BIT_DRAW_TYPE_LIGHTS, - PATH_BIT_DRAW_TYPE_BINS, - PATH_BIT_DRAW_TYPE_BENCHES, - PATH_BIT_DRAW_TYPE_JUMPING_FOUNTAINS + Light, + Bin, + Bench, + JumpingFountain, }; enum diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index d76c62f36f..52ad88cbd2 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -316,7 +316,7 @@ namespace OpenRCT2::TileInspector GameActionResultPtr PasteElementAt(const CoordsXY& loc, TileElement element, bool isExecuting) { // Make sure there is enough space for the new element - if (!map_check_free_elements_and_reorganise(1)) + if (!!MapCheckCapacityAndReorganise(loc)) { return std::make_unique(GameActions::Status::NoFreeElements, STR_NONE); } diff --git a/test/testpaint/PaintIntercept.cpp b/test/testpaint/PaintIntercept.cpp index 01eae3bb09..9c38823ce8 100644 --- a/test/testpaint/PaintIntercept.cpp +++ b/test/testpaint/PaintIntercept.cpp @@ -369,6 +369,15 @@ paint_struct* PaintAddImageAsParent( bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, session->CurrentRotation); } +paint_struct* PaintAddImageAsParent( + paint_session* session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, + const CoordsXYZ& boundBoxOffset) +{ + return PaintAddImageAsParent( + session, image_id, offset.x, offset.y, boundBoxSize.x, boundBoxSize.y, boundBoxSize.z, offset.z, boundBoxOffset.x, + boundBoxOffset.y, boundBoxOffset.z); +} + paint_struct* PaintAddImageAsChild( paint_session* session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxLength, const CoordsXYZ& boundBoxOffset) diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 6b3b6364e9..2a0c5a18a8 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -26,30 +27,17 @@ #include #include #include -#include #include #include -#include -#include -#include -#include +#include #include -#include #include -#include -#include -#include #include #include #include using namespace OpenRCT2; -struct GameState_t -{ - rct_sprite sprites[MAX_ENTITIES]; -}; - static bool LoadFileToBuffer(MemoryStream& stream, const std::string& filePath) { FILE* fp = fopen(filePath.c_str(), "rb"); @@ -127,18 +115,15 @@ static bool ExportSave(MemoryStream& stream, std::unique_ptr& context) return true; } -static std::unique_ptr GetGameState(std::unique_ptr& context) +static void RecordGameStateSnapshot(std::unique_ptr& context, MemoryStream& snapshotStream) { - std::unique_ptr res = std::make_unique(); - for (size_t spriteIdx = 0; spriteIdx < MAX_ENTITIES; spriteIdx++) - { - rct_sprite* sprite = reinterpret_cast(GetEntity(spriteIdx)); - if (sprite == nullptr) - res->sprites[spriteIdx].base.Type = EntityType::Null; - else - res->sprites[spriteIdx] = *sprite; - } - return res; + auto* snapshots = context->GetGameStateSnapshots(); + + auto& snapshot = snapshots->CreateSnapshot(); + snapshots->Capture(snapshot); + snapshots->LinkSnapshot(snapshot, gCurrentTicks, scenario_rand_state().s0); + DataSerialiser snapShotDs(true, snapshotStream); + snapshots->SerialiseSnapshot(snapshot, snapShotDs); } static void AdvanceGameTicks(uint32_t ticks, std::unique_ptr& context) @@ -150,368 +135,7 @@ static void AdvanceGameTicks(uint32_t ticks, std::unique_ptr& context) } } -#define COMPARE_FIELD(field) EXPECT_EQ(left.field, right.field) - -static void CompareSpriteDataCommon(const SpriteBase& left, const SpriteBase& right) -{ - COMPARE_FIELD(Type); - COMPARE_FIELD(sprite_index); - COMPARE_FIELD(x); - COMPARE_FIELD(y); - COMPARE_FIELD(z); - // INVESTIGATE: These fields never match but are also not important to the game state. - /* - COMPARE_FIELD(sprite_width); - COMPARE_FIELD(sprite_height_negative); - COMPARE_FIELD(sprite_height_positive); - COMPARE_FIELD(sprite_left); - COMPARE_FIELD(sprite_top); - COMPARE_FIELD(sprite_right); - COMPARE_FIELD(sprite_bottom); - */ - COMPARE_FIELD(sprite_direction); -} - -static void CompareSpriteDataPeep(const Peep& left, const Peep& right) -{ - COMPARE_FIELD(NextLoc.x); - COMPARE_FIELD(NextLoc.y); - COMPARE_FIELD(NextLoc.z); - COMPARE_FIELD(NextFlags); - COMPARE_FIELD(State); - COMPARE_FIELD(SubState); - COMPARE_FIELD(SpriteType); - COMPARE_FIELD(TshirtColour); - COMPARE_FIELD(TrousersColour); - COMPARE_FIELD(DestinationX); - COMPARE_FIELD(DestinationY); - COMPARE_FIELD(DestinationTolerance); - COMPARE_FIELD(Var37); - COMPARE_FIELD(Energy); - COMPARE_FIELD(EnergyTarget); - COMPARE_FIELD(Mass); - COMPARE_FIELD(WindowInvalidateFlags); - COMPARE_FIELD(CurrentRide); - COMPARE_FIELD(CurrentRideStation); - COMPARE_FIELD(CurrentTrain); - COMPARE_FIELD(TimeToSitdown); - COMPARE_FIELD(SpecialSprite); - COMPARE_FIELD(ActionSpriteType); - COMPARE_FIELD(NextActionSpriteType); - COMPARE_FIELD(ActionSpriteImageOffset); - COMPARE_FIELD(Action); - COMPARE_FIELD(ActionFrame); - COMPARE_FIELD(StepProgress); - COMPARE_FIELD(MazeLastEdge); - COMPARE_FIELD(InteractionRideIndex); - COMPARE_FIELD(Id); - COMPARE_FIELD(PathCheckOptimisation); - COMPARE_FIELD(PeepFlags); - COMPARE_FIELD(PathfindGoal.x); - COMPARE_FIELD(PathfindGoal.y); - COMPARE_FIELD(PathfindGoal.z); - COMPARE_FIELD(PathfindGoal.direction); - for (int i = 0; i < 4; i++) - { - COMPARE_FIELD(PathfindHistory[i].x); - COMPARE_FIELD(PathfindHistory[i].y); - COMPARE_FIELD(PathfindHistory[i].z); - COMPARE_FIELD(PathfindHistory[i].direction); - } - COMPARE_FIELD(WalkingFrameNum); -} - -static void CompareSpriteDataGuest(const Guest& left, const Guest& right) -{ - CompareSpriteDataPeep(left, right); - COMPARE_FIELD(OutsideOfPark); - COMPARE_FIELD(GuestNumRides); - COMPARE_FIELD(Happiness); - COMPARE_FIELD(HappinessTarget); - COMPARE_FIELD(Nausea); - COMPARE_FIELD(NauseaTarget); - COMPARE_FIELD(Hunger); - COMPARE_FIELD(Thirst); - COMPARE_FIELD(Toilet); - COMPARE_FIELD(TimeToConsume); - COMPARE_FIELD(Intensity); - COMPARE_FIELD(NauseaTolerance); - COMPARE_FIELD(PaidOnDrink); - for (int i = 0; i < PEEP_MAX_THOUGHTS; i++) - { - COMPARE_FIELD(RideTypesBeenOn[i]); - } - COMPARE_FIELD(ItemFlags); - COMPARE_FIELD(Photo2RideRef); - COMPARE_FIELD(Photo3RideRef); - COMPARE_FIELD(Photo4RideRef); - COMPARE_FIELD(GuestNextInQueue); - COMPARE_FIELD(TimeInQueue); - for (int i = 0; i < 32; i++) - { - COMPARE_FIELD(RidesBeenOn[i]); - } - COMPARE_FIELD(CashInPocket); - COMPARE_FIELD(CashSpent); - COMPARE_FIELD(ParkEntryTime); - COMPARE_FIELD(RejoinQueueTimeout); - COMPARE_FIELD(PreviousRide); - COMPARE_FIELD(PreviousRideTimeOut); - for (int i = 0; i < PEEP_MAX_THOUGHTS; i++) - { - COMPARE_FIELD(Thoughts[i].type); - COMPARE_FIELD(Thoughts[i].item); - COMPARE_FIELD(Thoughts[i].freshness); - COMPARE_FIELD(Thoughts[i].fresh_timeout); - } - COMPARE_FIELD(GuestHeadingToRideId); - COMPARE_FIELD(GuestIsLostCountdown); - COMPARE_FIELD(Photo1RideRef); - COMPARE_FIELD(LitterCount); - COMPARE_FIELD(GuestTimeOnRide); - COMPARE_FIELD(DisgustingCount); - COMPARE_FIELD(PaidToEnter); - COMPARE_FIELD(PaidOnRides); - COMPARE_FIELD(PaidOnFood); - COMPARE_FIELD(PaidOnSouvenirs); - COMPARE_FIELD(AmountOfFood); - COMPARE_FIELD(AmountOfDrinks); - COMPARE_FIELD(AmountOfSouvenirs); - COMPARE_FIELD(VandalismSeen); - COMPARE_FIELD(VoucherType); - COMPARE_FIELD(VoucherRideId); - COMPARE_FIELD(SurroundingsThoughtTimeout); - COMPARE_FIELD(Angriness); - COMPARE_FIELD(TimeLost); - COMPARE_FIELD(DaysInQueue); - COMPARE_FIELD(BalloonColour); - COMPARE_FIELD(UmbrellaColour); - COMPARE_FIELD(HatColour); - COMPARE_FIELD(FavouriteRide); - COMPARE_FIELD(FavouriteRideRating); -} - -static void CompareSpriteDataStaff(const Staff& left, const Staff& right) -{ - CompareSpriteDataPeep(left, right); - - COMPARE_FIELD(AssignedStaffType); - COMPARE_FIELD(MechanicTimeSinceCall); - COMPARE_FIELD(HireDate); - COMPARE_FIELD(StaffId); - COMPARE_FIELD(StaffOrders); - COMPARE_FIELD(StaffMowingTimeout); - COMPARE_FIELD(StaffRidesFixed); - COMPARE_FIELD(StaffRidesInspected); - COMPARE_FIELD(StaffLitterSwept); - COMPARE_FIELD(StaffBinsEmptied); -} - -static void CompareSpriteDataVehicle(const Vehicle& left, const Vehicle& right) -{ - COMPARE_FIELD(SubType); - COMPARE_FIELD(Pitch); - COMPARE_FIELD(bank_rotation); - COMPARE_FIELD(remaining_distance); - COMPARE_FIELD(velocity); - COMPARE_FIELD(acceleration); - COMPARE_FIELD(ride); - COMPARE_FIELD(vehicle_type); - COMPARE_FIELD(colours.body_colour); - COMPARE_FIELD(colours.trim_colour); - COMPARE_FIELD(track_progress); - COMPARE_FIELD(TrackTypeAndDirection); - COMPARE_FIELD(TrackLocation.x); - COMPARE_FIELD(TrackLocation.y); - COMPARE_FIELD(TrackLocation.z); - COMPARE_FIELD(next_vehicle_on_train); - COMPARE_FIELD(prev_vehicle_on_ride); - COMPARE_FIELD(next_vehicle_on_ride); - COMPARE_FIELD(var_44); - COMPARE_FIELD(mass); - COMPARE_FIELD(update_flags); - COMPARE_FIELD(SwingSprite); - COMPARE_FIELD(current_station); - COMPARE_FIELD(SwingPosition); - COMPARE_FIELD(SwingSpeed); - COMPARE_FIELD(status); - COMPARE_FIELD(sub_state); - for (int i = 0; i < 32; i++) - { - COMPARE_FIELD(peep[i]); - } - for (int i = 0; i < 32; i++) - { - COMPARE_FIELD(peep_tshirt_colours[i]); - } - COMPARE_FIELD(num_seats); - COMPARE_FIELD(num_peeps); - COMPARE_FIELD(next_free_seat); - COMPARE_FIELD(restraints_position); - COMPARE_FIELD(spin_speed); - COMPARE_FIELD(sound2_flags); - COMPARE_FIELD(spin_sprite); - COMPARE_FIELD(sound1_id); - COMPARE_FIELD(sound1_volume); - COMPARE_FIELD(sound2_id); - COMPARE_FIELD(sound2_volume); - COMPARE_FIELD(sound_vector_factor); - COMPARE_FIELD(cable_lift_target); - COMPARE_FIELD(speed); - COMPARE_FIELD(powered_acceleration); - COMPARE_FIELD(var_C4); - COMPARE_FIELD(animation_frame); - for (int i = 0; i < 2; i++) - { - COMPARE_FIELD(pad_C6[i]); - } - COMPARE_FIELD(var_C8); - COMPARE_FIELD(var_CA); - COMPARE_FIELD(scream_sound_id); - COMPARE_FIELD(TrackSubposition); - COMPARE_FIELD(num_laps); - COMPARE_FIELD(brake_speed); - COMPARE_FIELD(lost_time_out); - COMPARE_FIELD(vertical_drop_countdown); - COMPARE_FIELD(var_D3); - COMPARE_FIELD(mini_golf_current_animation); - COMPARE_FIELD(mini_golf_flags); - COMPARE_FIELD(ride_subtype); - COMPARE_FIELD(colours_extended); - COMPARE_FIELD(seat_rotation); - COMPARE_FIELD(target_seat_rotation); - COMPARE_FIELD(IsCrashedVehicle); -} - -static void CompareSpriteDataLitter(const Litter& left, const Litter& right) -{ - COMPARE_FIELD(SubType); - COMPARE_FIELD(creationTick); -} - -static void CompareSpriteDataSteamParticle(const SteamParticle& left, const SteamParticle& right) -{ - COMPARE_FIELD(frame); - COMPARE_FIELD(time_to_move); -} - -static void CompareSpriteDataMoneyEffect(const MoneyEffect& left, const MoneyEffect& right) -{ - COMPARE_FIELD(frame); - COMPARE_FIELD(MoveDelay); - COMPARE_FIELD(NumMovements); - COMPARE_FIELD(Vertical); - COMPARE_FIELD(Value); - COMPARE_FIELD(OffsetX); - COMPARE_FIELD(Wiggle); -} - -static void CompareSpriteDataCrashedVehicleParticle(const VehicleCrashParticle& left, const VehicleCrashParticle& right) -{ - COMPARE_FIELD(frame); - COMPARE_FIELD(time_to_live); - for (size_t i = 0; i < std::size(left.colour); i++) - { - COMPARE_FIELD(colour[i]); - } - COMPARE_FIELD(crashed_sprite_base); - COMPARE_FIELD(velocity_x); - COMPARE_FIELD(velocity_y); - COMPARE_FIELD(velocity_z); - COMPARE_FIELD(acceleration_x); - COMPARE_FIELD(acceleration_y); - COMPARE_FIELD(acceleration_z); -} - -static void CompareSpriteDataJumpingFountain(const JumpingFountain& left, const JumpingFountain& right) -{ - COMPARE_FIELD(frame); - COMPARE_FIELD(NumTicksAlive); - COMPARE_FIELD(FountainFlags); - COMPARE_FIELD(TargetX); - COMPARE_FIELD(TargetY); - COMPARE_FIELD(Iteration); - COMPARE_FIELD(FountainType); -} - -static void CompareSpriteDataBalloon(const Balloon& left, const Balloon& right) -{ - COMPARE_FIELD(frame); - COMPARE_FIELD(popped); - COMPARE_FIELD(time_to_move); - COMPARE_FIELD(colour); -} - -static void CompareSpriteDataDuck(const Duck& left, const Duck& right) -{ - COMPARE_FIELD(frame); - COMPARE_FIELD(target_x); - COMPARE_FIELD(target_y); - COMPARE_FIELD(state); -} - -static void CompareSpriteDataMisc(const MiscEntity& left, const MiscEntity& right) -{ - COMPARE_FIELD(frame); -} - -static void CompareSpriteData(const rct_sprite& left, const rct_sprite& right) -{ - CompareSpriteDataCommon(left.base, right.base); - if (left.base.Type == right.base.Type) - { - switch (left.base.Type) - { - case EntityType::Guest: - CompareSpriteDataGuest(static_cast(left.base), static_cast(right.base)); - break; - case EntityType::Staff: - CompareSpriteDataStaff(static_cast(left.base), static_cast(right.base)); - break; - case EntityType::Vehicle: - CompareSpriteDataVehicle(static_cast(left.base), static_cast(right.base)); - break; - case EntityType::Litter: - CompareSpriteDataLitter(static_cast(left.base), static_cast(right.base)); - break; - case EntityType::SteamParticle: - CompareSpriteDataSteamParticle( - static_cast(left.base), static_cast(right.base)); - break; - case EntityType::MoneyEffect: - CompareSpriteDataMoneyEffect( - static_cast(left.base), static_cast(right.base)); - break; - case EntityType::CrashedVehicleParticle: - CompareSpriteDataCrashedVehicleParticle( - static_cast(left.base), static_cast(right.base)); - break; - case EntityType::JumpingFountain: - CompareSpriteDataJumpingFountain( - static_cast(left.base), static_cast(right.base)); - break; - case EntityType::Balloon: - CompareSpriteDataBalloon(static_cast(left.base), static_cast(right.base)); - break; - case EntityType::Duck: - CompareSpriteDataDuck(static_cast(left.base), static_cast(right.base)); - break; - case EntityType::ExplosionCloud: - case EntityType::CrashSplash: - case EntityType::ExplosionFlare: - CompareSpriteDataMisc(static_cast(left.base), static_cast(right.base)); - break; - case EntityType::Null: - break; - default: - break; - } - } -} - -static void CompareStates( - MemoryStream& importBuffer, MemoryStream& exportBuffer, std::unique_ptr& importedState, - std::unique_ptr& exportedState) +static void CompareStates(MemoryStream& importBuffer, MemoryStream& exportBuffer, MemoryStream& snapshotStream) { if (importBuffer.GetLength() != exportBuffer.GetLength()) { @@ -521,14 +145,39 @@ static void CompareStates( static_cast(exportBuffer.GetLength())); } - for (size_t spriteIdx = 0; spriteIdx < MAX_ENTITIES; ++spriteIdx) + std::unique_ptr context = CreateContext(); + EXPECT_NE(context, nullptr); + bool initialised = context->Initialise(); + ASSERT_TRUE(initialised); + + DataSerialiser ds(false, snapshotStream); + IGameStateSnapshots* snapshots = GetContext()->GetGameStateSnapshots(); + + GameStateSnapshot_t& importSnapshot = snapshots->CreateSnapshot(); + snapshots->SerialiseSnapshot(importSnapshot, ds); + + GameStateSnapshot_t& exportSnapshot = snapshots->CreateSnapshot(); + snapshots->SerialiseSnapshot(exportSnapshot, ds); + + try { - if (importedState->sprites[spriteIdx].base.Type == EntityType::Null - && exportedState->sprites[spriteIdx].base.Type == EntityType::Null) + GameStateCompareData_t cmpData = snapshots->Compare(importSnapshot, exportSnapshot); + + // Find out if there are any differences between the two states + auto res = std::find_if( + cmpData.spriteChanges.begin(), cmpData.spriteChanges.end(), + [](const GameStateSpriteChange_t& diff) { return diff.changeType != GameStateSpriteChange_t::EQUAL; }); + + if (res != cmpData.spriteChanges.end()) { - continue; + log_warning("Snapshot data differences. %s", snapshots->GetCompareDataText(cmpData).c_str()); + FAIL(); } - CompareSpriteData(importedState->sprites[spriteIdx], exportedState->sprites[spriteIdx]); + } + catch (const std::runtime_error& err) + { + log_warning("Snapshot data failed to be read. Snapshot not compared. %s", err.what()); + FAIL(); } } @@ -541,9 +190,7 @@ TEST(S6ImportExportBasic, all) MemoryStream importBuffer; MemoryStream exportBuffer; - - std::unique_ptr importedState; - std::unique_ptr exportedState; + MemoryStream snapshotStream; // Load initial park data. { @@ -556,8 +203,7 @@ TEST(S6ImportExportBasic, all) std::string testParkPath = TestData::GetParkPath("BigMapTest.sv6"); ASSERT_TRUE(LoadFileToBuffer(importBuffer, testParkPath)); ASSERT_TRUE(ImportS6(importBuffer, context, false)); - importedState = GetGameState(context); - ASSERT_NE(importedState, nullptr); + RecordGameStateSnapshot(context, snapshotStream); ASSERT_TRUE(ExportSave(exportBuffer, context)); } @@ -572,11 +218,11 @@ TEST(S6ImportExportBasic, all) ASSERT_TRUE(ImportPark(exportBuffer, context, true)); - exportedState = GetGameState(context); - ASSERT_NE(exportedState, nullptr); + RecordGameStateSnapshot(context, snapshotStream); } - CompareStates(importBuffer, exportBuffer, importedState, exportedState); + snapshotStream.SetPosition(0); + CompareStates(importBuffer, exportBuffer, snapshotStream); SUCCEED(); } @@ -590,9 +236,7 @@ TEST(S6ImportExportAdvanceTicks, all) MemoryStream importBuffer; MemoryStream exportBuffer; - - std::unique_ptr importedState; - std::unique_ptr exportedState; + MemoryStream snapshotStream; // Load initial park data. { @@ -608,8 +252,7 @@ TEST(S6ImportExportAdvanceTicks, all) AdvanceGameTicks(1000, context); ASSERT_TRUE(ExportSave(exportBuffer, context)); - importedState = GetGameState(context); - ASSERT_NE(importedState, nullptr); + RecordGameStateSnapshot(context, snapshotStream); } // Import the exported version. @@ -622,11 +265,11 @@ TEST(S6ImportExportAdvanceTicks, all) ASSERT_TRUE(ImportPark(exportBuffer, context, true)); - exportedState = GetGameState(context); - ASSERT_NE(exportedState, nullptr); + RecordGameStateSnapshot(context, snapshotStream); } - CompareStates(importBuffer, exportBuffer, importedState, exportedState); + snapshotStream.SetPosition(0); + CompareStates(importBuffer, exportBuffer, snapshotStream); SUCCEED(); }