diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index a6dc9ad70f..a61cb8c40f 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -616,7 +616,7 @@ public: void CloseWindow() override { - drawing_engine_dispose(); + DrawingEngineDispose(); if (_window != nullptr) { SDL_DestroyWindow(_window); @@ -758,7 +758,7 @@ private: _platformUiContext->SetWindowIcon(_window); // Initialise the surface, palette and draw buffer - drawing_engine_init(); + DrawingEngineInit(); OnResize(width, height); UpdateFullscreenResolutions(); @@ -778,7 +778,7 @@ private: _width = static_cast(width / gConfigGeneral.WindowScale); _height = static_cast(height / gConfigGeneral.WindowScale); - drawing_engine_resize(); + DrawingEngineResize(); uint32_t flags = SDL_GetWindowFlags(_window); if ((flags & SDL_WINDOW_MINIMIZED) == 0) diff --git a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp index 171af977d2..2be1a6ceed 100644 --- a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp @@ -165,7 +165,7 @@ public: if (gConfigGeneral.EnableLightFx) { - auto& lightPalette = lightfx_get_palette(); + auto& lightPalette = LightFXGetPalette(); for (int32_t i = 0; i < 256; i++) { const auto& src = lightPalette[i]; @@ -210,7 +210,7 @@ private: int32_t pitch; if (SDL_LockTexture(_screenTexture, nullptr, &pixels, &pitch) == 0) { - lightfx_render_to_texture(pixels, pitch, _bits, _width, _height, _paletteHWMapped, _lightPaletteHWMapped); + LightFXRenderToTexture(pixels, pitch, _bits, _width, _height, _paletteHWMapped, _lightPaletteHWMapped); SDL_UnlockTexture(_screenTexture); } } diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 8a50b098e3..f20a3be205 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -206,7 +206,7 @@ public: { _window = static_cast(_uiContext->GetWindow()); _bitsDPI.DrawingEngine = this; - lightfx_set_available(false); + LightFXSetAvailable(false); } ~OpenGLDrawingEngine() override diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index 90cc844b6b..ccc71b519f 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -33,7 +33,7 @@ static FontStyle InGameConsoleGetFontStyle() static int32_t InGameConsoleGetLineHeight() { - return font_get_line_height(InGameConsoleGetFontStyle()); + return FontGetLineHeight(InGameConsoleGetFontStyle()); } InGameConsole::InGameConsole() diff --git a/src/openrct2-ui/scripting/CustomImages.cpp b/src/openrct2-ui/scripting/CustomImages.cpp index 2d3bd56ed9..b197656063 100644 --- a/src/openrct2-ui/scripting/CustomImages.cpp +++ b/src/openrct2-ui/scripting/CustomImages.cpp @@ -74,7 +74,7 @@ namespace OpenRCT2::Scripting GfxSetG1Element(index, &empty); } } - gfx_object_free_images(range.BaseId, range.Count); + GfxObjectFreeImages(range.BaseId, range.Count); } std::optional AllocateCustomImages(const std::shared_ptr& plugin, uint32_t count) @@ -82,7 +82,7 @@ namespace OpenRCT2::Scripting std::vector images; images.resize(count); - auto base = gfx_object_allocate_images(images.data(), count); + auto base = GfxObjectAllocateImages(images.data(), count); if (base == ImageIndexUndefined) { return {}; @@ -397,7 +397,7 @@ namespace OpenRCT2::Scripting el.flags |= G1_FLAG_RLE_COMPRESSION; } GfxSetG1Element(id, &el); - drawing_engine_invalidate_image(id); + DrawingEngineInvalidateImage(id); } void DukSetPixelData(duk_context* ctx, ImageIndex id, const DukValue& dukPixelData) @@ -464,7 +464,7 @@ namespace OpenRCT2::Scripting GfxSetG1Element(id, &newg1); } - drawing_engine_invalidate_image(id); + DrawingEngineInvalidateImage(id); } } // namespace OpenRCT2::Scripting diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index a984f2ec4f..424560c0dc 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -212,7 +212,7 @@ private: auto const& versionPlaceholder = widgets[WIDX_VERSION]; auto versionPlaceHolderWidth = versionPlaceholder.right - versionPlaceholder.left; auto centreX = versionPlaceholder.left + versionPlaceHolderWidth / 2; - auto centreY = (versionPlaceholder.top + versionPlaceholder.bottom - font_get_line_height(FontStyle::Medium)) / 2; + auto centreY = (versionPlaceholder.top + versionPlaceholder.bottom - FontGetLineHeight(FontStyle::Medium)) / 2; auto centrePos = windowPos + ScreenCoordsXY(centreX, centreY); DrawTextWrapped(&dpi, centrePos, versionPlaceHolderWidth, STR_STRING, ft, { colours[1], TextAlignment::CENTRE }); @@ -233,7 +233,7 @@ private: auto screenCoords = ScreenCoordsXY{ windowPos.x + 200, yPage + 5 }; - int32_t lineHeight = font_get_line_height(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); // Credits DrawTextBasic(&dpi, screenCoords, STR_COPYRIGHT_CS, {}, { TextAlignment::CENTRE }); diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index b11f8911b9..033ef7f30c 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -187,7 +187,7 @@ public: void OnScrollDraw(int32_t scrollIndex, rct_drawpixelinfo& dpi) override { - const int32_t lineHeight = font_get_line_height(FontStyle::Medium); + const int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); ScreenCoordsXY screenCoords(3, 3 - lineHeight); for (const auto& line : _changelogLines) @@ -204,7 +204,7 @@ public: { return ScreenSize( _changelogLongestLineWidth + 4, - static_cast(_changelogLines.size()) * font_get_line_height(FontStyle::Medium)); + static_cast(_changelogLines.size()) * FontGetLineHeight(FontStyle::Medium)); } // TODO: This probably should be a utility function defined elsewhere for reusability diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index 2369d9c908..69f7395137 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -142,7 +142,7 @@ rct_window* WindowErrorOpen(std::string_view title, std::string_view message) GfxWrapString(buffer.data(), width + 1, FontStyle::Medium, &numLines); width = width + 3; - int32_t height = (numLines + 1) * font_get_line_height(FontStyle::Medium) + 4; + int32_t height = (numLines + 1) * FontGetLineHeight(FontStyle::Medium) + 4; int32_t screenWidth = ContextGetWidth(); int32_t screenHeight = ContextGetHeight(); const CursorState* state = ContextGetCursorState(); diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index 8138a40bac..361fb34a30 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -111,7 +111,7 @@ rct_window* WindowGameBottomToolbarOpen() int32_t screenHeight = ContextGetHeight(); // Figure out how much line height we have to work with. - uint32_t line_height = font_get_line_height(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::Medium); uint32_t toolbar_height = line_height * 2 + 12; rct_window* window = WindowCreate( @@ -220,7 +220,7 @@ static OpenRCT2String WindowGameBottomToolbarTooltip(rct_window* w, const Widget static void WindowGameBottomToolbarInvalidate(rct_window* w) { // Figure out how much line height we have to work with. - uint32_t line_height = font_get_line_height(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::Medium); // Reset dimensions as appropriate -- in case we're switching languages. w->height = line_height * 2 + 12; @@ -396,7 +396,7 @@ static void WindowGameBottomToolbarDrawLeftPanel(rct_drawpixelinfo* dpi, rct_win GfxFillRectInset(dpi, { topLeft, bottomRight }, w->colours[1], INSET_RECT_F_30); // Figure out how much line height we have to work with. - uint32_t line_height = font_get_line_height(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::Medium); // Draw money if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) @@ -512,7 +512,7 @@ static void WindowGameBottomToolbarDrawRightPanel(rct_drawpixelinfo* dpi, rct_wi DrawTextBasic(dpi, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); // Figure out how much line height we have to work with. - uint32_t line_height = font_get_line_height(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::Medium); // Temperature screenCoords = { w->windowPos.x + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 15, @@ -662,7 +662,7 @@ static void WindowGameBottomToolbarDrawMiddlePanel(rct_drawpixelinfo* dpi, rct_w w->colours[1], INSET_RECT_F_30); // Figure out how much line height we have to work with. - uint32_t line_height = font_get_line_height(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::Medium); ScreenCoordsXY middleWidgetCoords( w->windowPos.x + middleOutsetWidget->midX(), w->windowPos.y + middleOutsetWidget->top + line_height + 1); diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 10af35ad24..904a98b6c7 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1034,7 +1034,7 @@ private: void StatsBarsDraw(int32_t value, const ScreenCoordsXY& origCoords, rct_drawpixelinfo& dpi, int32_t colour, bool blinkFlag) { auto coords = origCoords; - if (font_get_line_height(FontStyle::Medium) > 10) + if (FontGetLineHeight(FontStyle::Medium) > 10) { coords.y += 1; } diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index f5de815e9d..d46d88cb96 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -162,7 +162,7 @@ public: g1temp.height = 217; g1temp.flags = G1_FLAG_HAS_TRANSPARENCY; GfxSetG1Element(SPR_TEMP, &g1temp); - drawing_engine_invalidate_image(SPR_TEMP); + DrawingEngineInvalidateImage(SPR_TEMP); GfxDrawSprite(&dpi, ImageId(SPR_TEMP), screenPos); screenPos = windowPos + ScreenCoordsXY{ widget->midX(), widget->bottom - 12 }; diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 18fe140c37..e8bcb03d19 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -714,7 +714,7 @@ public: g1temp.x_offset = -8; g1temp.y_offset = -8; GfxSetG1Element(SPR_TEMP, &g1temp); - drawing_engine_invalidate_image(SPR_TEMP); + DrawingEngineInvalidateImage(SPR_TEMP); GfxDrawSprite(&dpi, ImageId(SPR_TEMP), { 0, 0 }); if (selected_tab == PAGE_PEEPS) diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index aaac17af0c..1ab0f5d72b 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -334,7 +334,7 @@ static ScreenCoordsXY WindowMultiplayerInformationGetSize() return _windowInformationSize; } - int32_t lineHeight = font_get_line_height(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); // Base dimensions. const int32_t width = 450; diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index e1e3a5cd15..30771dc2f6 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -50,7 +50,7 @@ private: int32_t _pressedNewsItemIndex{}, _pressedButtonIndex{}, _suspendUpdateTicks{}; static int32_t CalculateItemHeight() { - return 4 * font_get_line_height(FontStyle::Small) + 2; + return 4 * FontGetLineHeight(FontStyle::Small) + 2; } public: @@ -173,7 +173,7 @@ public: void OnScrollDraw(int32_t scrollIndex, rct_drawpixelinfo& dpi) override { - int32_t lineHeight = font_get_line_height(FontStyle::Small); + int32_t lineHeight = FontGetLineHeight(FontStyle::Small); int32_t itemHeight = CalculateItemHeight(); int32_t y = 0; int32_t i = 0; diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 79b2060158..3095c7c026 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -682,13 +682,13 @@ private: { case WIDX_UNCAP_FPS_CHECKBOX: gConfigGeneral.UncapFPS ^= 1; - drawing_engine_set_vsync(gConfigGeneral.UseVSync); + DrawingEngineSetVSync(gConfigGeneral.UseVSync); ConfigSaveDefault(); Invalidate(); break; case WIDX_USE_VSYNC_CHECKBOX: gConfigGeneral.UseVSync ^= 1; - drawing_engine_set_vsync(gConfigGeneral.UseVSync); + DrawingEngineSetVSync(gConfigGeneral.UseVSync); ConfigSaveDefault(); Invalidate(); break; @@ -845,7 +845,7 @@ private: DrawingEngine dstEngine = static_cast(dropdownIndex); gConfigGeneral.DrawingEngine = dstEngine; - bool recreate_window = drawing_engine_requires_new_window(srcEngine, dstEngine); + bool recreate_window = DrawingEngineRequiresNewWindow(srcEngine, dstEngine); RefreshVideo(recreate_window); ConfigSaveDefault(); Invalidate(); @@ -2013,7 +2013,7 @@ private: // Apply vertical alignment if appropriate. int32_t widgetHeight = pathWidget.bottom - pathWidget.top; - int32_t lineHeight = font_get_line_height(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); uint32_t padding = widgetHeight > lineHeight ? (widgetHeight - lineHeight) / 2 : 0; ScreenCoordsXY screenCoords = { windowPos.x + pathWidget.left + 1, windowPos.y + pathWidget.top + static_cast(padding) }; diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 27ab6efe79..6dc68d796b 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -2905,7 +2905,7 @@ static void WindowRideVehiclePaint(rct_window* w, rct_drawpixelinfo* dpi) // Intensity Factor if (rideEntry->intensity_multiplier != 0) { - int32_t lineHeight = font_get_line_height(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); if (lineHeight != 10) screenCoords.x += 150; else diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index 93239b85f7..1bf5aa396a 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -291,10 +291,10 @@ static int32_t GetScenarioListItemSize() return 24; // Scenario title - int32_t lineHeight = font_get_line_height(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); // 'Completed by' line - lineHeight += font_get_line_height(FontStyle::Small); + lineHeight += FontGetLineHeight(FontStyle::Small); return lineHeight; } @@ -566,7 +566,7 @@ static void WindowScenarioselectScrollpaint(rct_window* w, rct_drawpixelinfo* dp const int32_t scenarioItemHeight = GetScenarioListItemSize(); // Scenario title - int32_t scenarioTitleHeight = font_get_line_height(FontStyle::Medium); + int32_t scenarioTitleHeight = FontGetLineHeight(FontStyle::Medium); int32_t y = 0; for (const auto& listItem : _listItems) diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 5f21bf8472..d0d2e40ebb 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -1539,7 +1539,7 @@ public: { auto& listWidget = widgets[WIDX_LIST]; auto centrePos = ScreenCoordsXY{ listWidget.width() / 2, - (listWidget.height() - font_get_line_height(FontStyle::Medium)) / 2 }; + (listWidget.height() - FontGetLineHeight(FontStyle::Medium)) / 2 }; auto ft = Formatter{}; auto textPaint = TextPaint{ colours[1], TextAlignment::CENTRE }; DrawTextWrapped(&dpi, centrePos, listWidth, STR_TILE_INSPECTOR_SELECT_TILE_HINT, ft, textPaint); diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index 5f571dfa36..294282e651 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -39,7 +39,7 @@ public: { int32_t textWidth = FormatTextForTooltip(message); width = textWidth + 3; - height = ((_tooltipNumLines + 1) * font_get_line_height(FontStyle::Small)) + 4; + height = ((_tooltipNumLines + 1) * FontGetLineHeight(FontStyle::Small)) + 4; window_tooltip_widgets[WIDX_BACKGROUND].right = width; window_tooltip_widgets[WIDX_BACKGROUND].bottom = height; diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index c476395504..79fe7c68ad 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -299,7 +299,7 @@ public: g1temp.width = TRACK_MINI_PREVIEW_WIDTH; g1temp.height = TRACK_MINI_PREVIEW_HEIGHT; GfxSetG1Element(SPR_TEMP, &g1temp); - drawing_engine_invalidate_image(SPR_TEMP); + DrawingEngineInvalidateImage(SPR_TEMP); GfxDrawSprite(&clippedDpi, ImageId(SPR_TEMP, NOT_TRANSLUCENT(this->colours[0])), { 0, 0 }); } diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 87d899dd19..ea2c10cfba 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -501,7 +501,7 @@ public: g1temp.height = 217; g1temp.flags = G1_FLAG_HAS_TRANSPARENCY; GfxSetG1Element(SPR_TEMP, &g1temp); - drawing_engine_invalidate_image(SPR_TEMP); + DrawingEngineInvalidateImage(SPR_TEMP); GfxDrawSprite(&dpi, ImageId(SPR_TEMP), trackPreview); screenPos.y = windowPos.y + tdWidget.bottom - 12; diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 7d5903ddfc..13444a4d87 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -194,7 +194,7 @@ namespace OpenRCT2 _objectManager->UnloadAll(); } - gfx_object_check_all_images_freed(); + GfxObjectCheckAllImagesFreed(); GfxUnloadCsg(); GfxUnloadG2(); GfxUnloadG1(); @@ -470,7 +470,7 @@ namespace OpenRCT2 { return false; } - lightfx_init(); + LightFXInit(); } input_reset_place_obj_modifier(); @@ -513,7 +513,7 @@ namespace OpenRCT2 // Fallback to software gConfigGeneral.DrawingEngine = DrawingEngine::Software; ConfigSaveDefault(); - drawing_engine_init(); + DrawingEngineInit(); } } else @@ -541,7 +541,7 @@ namespace OpenRCT2 // Fallback to software gConfigGeneral.DrawingEngine = DrawingEngine::Software; ConfigSaveDefault(); - drawing_engine_init(); + DrawingEngineInit(); } } } @@ -853,7 +853,7 @@ namespace OpenRCT2 } GfxLoadG2(); GfxLoadCsg(); - font_sprite_initialise_characters(); + FontSpriteInitialiseCharacters(); return true; } diff --git a/src/openrct2/Intro.cpp b/src/openrct2/Intro.cpp index d57cc5df37..1d05f9c7c7 100644 --- a/src/openrct2/Intro.cpp +++ b/src/openrct2/Intro.cpp @@ -286,12 +286,12 @@ static void screen_intro_draw_logo(rct_drawpixelinfo* dpi) int32_t imageWidth = 640; int32_t imageX = (screenWidth - imageWidth) / 2; - drawing_engine_invalidate_image(SPR_INTRO_LOGO_00); - drawing_engine_invalidate_image(SPR_INTRO_LOGO_10); - drawing_engine_invalidate_image(SPR_INTRO_LOGO_20); - drawing_engine_invalidate_image(SPR_INTRO_LOGO_01); - drawing_engine_invalidate_image(SPR_INTRO_LOGO_11); - drawing_engine_invalidate_image(SPR_INTRO_LOGO_21); + DrawingEngineInvalidateImage(SPR_INTRO_LOGO_00); + DrawingEngineInvalidateImage(SPR_INTRO_LOGO_10); + DrawingEngineInvalidateImage(SPR_INTRO_LOGO_20); + DrawingEngineInvalidateImage(SPR_INTRO_LOGO_01); + DrawingEngineInvalidateImage(SPR_INTRO_LOGO_11); + DrawingEngineInvalidateImage(SPR_INTRO_LOGO_21); GfxClear(dpi, BACKROUND_COLOUR_LOGO); GfxDrawSprite(dpi, ImageId(SPR_INTRO_LOGO_00), { imageX + 0, 0 }); diff --git a/src/openrct2/cmdline/BenchSpriteSort.cpp b/src/openrct2/cmdline/BenchSpriteSort.cpp index 769e6f7254..7d82a5d869 100644 --- a/src/openrct2/cmdline/BenchSpriteSort.cpp +++ b/src/openrct2/cmdline/BenchSpriteSort.cpp @@ -77,7 +77,7 @@ static std::vector extract_paint_session(std::string_view log_info("Starting..."); if (context->Initialise()) { - drawing_engine_init(); + DrawingEngineInit(); if (!context->LoadParkFromFile(std::string(parkFileName))) { log_error("Failed to load park!"); @@ -125,7 +125,7 @@ static std::vector extract_paint_session(std::string_view ViewportRender(&dpi, &viewport, { { 0, 0 }, { viewport.width, viewport.height } }, &sessions); free(dpi.bits); - drawing_engine_dispose(); + DrawingEngineDispose(); } log_info("Got %u paint sessions.", std::size(sessions)); return sessions; diff --git a/src/openrct2/drawing/Drawing.Sprite.cpp b/src/openrct2/drawing/Drawing.Sprite.cpp index 3c4a4db36e..20671488aa 100644 --- a/src/openrct2/drawing/Drawing.Sprite.cpp +++ b/src/openrct2/drawing/Drawing.Sprite.cpp @@ -70,7 +70,7 @@ static inline uint32_t rctc_to_rct2_index(uint32_t image) } // clang-format on -static void read_and_convert_gxdat(IStream* stream, size_t count, bool is_rctc, rct_g1_element* elements) +static void ReadAndConvertGxDat(IStream* stream, size_t count, bool is_rctc, rct_g1_element* elements) { auto g1Elements32 = std::make_unique(count); stream->Read(g1Elements32.get(), count * sizeof(rct_g1_element_32bit)); @@ -213,7 +213,7 @@ bool GfxLoadG1(const IPlatformEnvironment& env) // Read element headers bool is_rctc = _g1.header.num_entries == SPR_RCTC_G1_END; _g1.elements.resize(_g1.header.num_entries); - read_and_convert_gxdat(&fs, _g1.header.num_entries, is_rctc, _g1.elements.data()); + ReadAndConvertGxDat(&fs, _g1.header.num_entries, is_rctc, _g1.elements.data()); gTinyFontAntiAliased = is_rctc; // Read element data @@ -277,7 +277,7 @@ bool GfxLoadG2() // Read element headers _g2.elements.resize(_g2.header.num_entries); - read_and_convert_gxdat(&fs, _g2.header.num_entries, false, _g2.elements.data()); + ReadAndConvertGxDat(&fs, _g2.header.num_entries, false, _g2.elements.data()); // Read element data _g2.data = fs.ReadArray(_g2.header.total_size); @@ -350,7 +350,7 @@ bool GfxLoadCsg() // Read element headers _csg.elements.resize(_csg.header.num_entries); - read_and_convert_gxdat(&fileHeader, _csg.header.num_entries, false, _csg.elements.data()); + ReadAndConvertGxDat(&fileHeader, _csg.header.num_entries, false, _csg.elements.data()); // Read element data _csg.data = fileData.ReadArray(_csg.header.total_size); @@ -389,7 +389,7 @@ std::optional GfxLoadGx(const std::vector& buffer) // Read element headers gx.elements.resize(gx.header.num_entries); - read_and_convert_gxdat(&istream, gx.header.num_entries, false, gx.elements.data()); + ReadAndConvertGxDat(&istream, gx.header.num_entries, false, gx.elements.data()); // Read element data gx.data = istream.ReadArray(gx.header.total_size); @@ -403,7 +403,7 @@ std::optional GfxLoadGx(const std::vector& buffer) return std::nullopt; } -static std::optional FASTCALL gfx_draw_sprite_get_palette(ImageId imageId) +static std::optional FASTCALL GfxDrawSpriteGetPalette(ImageId imageId) { if (!imageId.HasSecondary()) { @@ -448,7 +448,7 @@ void FASTCALL GfxDrawSpriteSoftware(rct_drawpixelinfo* dpi, const ImageId imageI { if (imageId.HasValue()) { - auto palette = gfx_draw_sprite_get_palette(imageId); + auto palette = GfxDrawSpriteGetPalette(imageId); if (!palette) { palette = PaletteMap::GetDefault(); diff --git a/src/openrct2/drawing/Drawing.String.cpp b/src/openrct2/drawing/Drawing.String.cpp index f999468a82..e67f10b7b1 100644 --- a/src/openrct2/drawing/Drawing.String.cpp +++ b/src/openrct2/drawing/Drawing.String.cpp @@ -40,7 +40,7 @@ enum : uint32_t TEXT_DRAW_FLAG_NO_DRAW = 1u << 31 }; -static int32_t ttf_get_string_width(std::string_view text, FontStyle fontStyle, bool noFormatting); +static int32_t TTFGetStringWidth(std::string_view text, FontStyle fontStyle, bool noFormatting); /** * @@ -84,12 +84,12 @@ int32_t GfxGetStringWidthNewLined(std::string_view text, FontStyle fontStyle) */ int32_t GfxGetStringWidth(std::string_view text, FontStyle fontStyle) { - return ttf_get_string_width(text, fontStyle, false); + return TTFGetStringWidth(text, fontStyle, false); } int32_t GfxGetStringWidthNoFormatting(std::string_view text, FontStyle fontStyle) { - return ttf_get_string_width(text, fontStyle, true); + return TTFGetStringWidth(text, fontStyle, true); } /** @@ -282,7 +282,7 @@ void GfxDrawStringLeftCentred( /** * Changes the palette so that the next character changes colour */ -static void colour_char(uint8_t colour, const uint16_t* current_font_flags, uint8_t* palette_pointer) +static void ColourCharacter(uint8_t colour, const uint16_t* current_font_flags, uint8_t* palette_pointer) { int32_t colour32 = 0; const rct_g1_element* g1 = GfxGetG1Element(SPR_TEXT_PALETTE); @@ -307,7 +307,7 @@ static void colour_char(uint8_t colour, const uint16_t* current_font_flags, uint * Changes the palette so that the next character changes colour * This is specific to changing to a predefined window related colour */ -static void colour_char_window(uint8_t colour, const uint16_t* current_font_flags, uint8_t* palette_pointer) +static void ColourCharacterWindow(uint8_t colour, const uint16_t* current_font_flags, uint8_t* palette_pointer) { int32_t eax; @@ -355,7 +355,7 @@ void DrawStringCentredRaw( } text = const_cast(ch + 1); - screenCoords.y += font_get_line_height(fontStyle); + screenCoords.y += FontGetLineHeight(fontStyle); } } @@ -441,7 +441,7 @@ void DrawNewsTicker( format_string(buffer, 256, format, args); GfxWrapString(buffer, width, FontStyle::Small, &numLines); - lineHeight = font_get_line_height(FontStyle::Small); + lineHeight = FontGetLineHeight(FontStyle::Small); int32_t numCharactersDrawn = 0; int32_t numCharactersToDraw = ticks; @@ -501,10 +501,10 @@ struct text_draw_info const int8_t* y_offset; }; -static void ttf_draw_character_sprite(rct_drawpixelinfo* dpi, int32_t codepoint, text_draw_info* info) +static void TTFDrawCharacterSprite(rct_drawpixelinfo* dpi, int32_t codepoint, text_draw_info* info) { - int32_t characterWidth = font_sprite_get_codepoint_width(info->FontStyle, codepoint); - auto sprite = font_sprite_get_codepoint_sprite(info->FontStyle, codepoint); + int32_t characterWidth = FontSpriteGetCodepointWidth(info->FontStyle, codepoint); + auto sprite = FontSpriteGetCodepointSprite(info->FontStyle, codepoint); if (!(info->flags & TEXT_DRAW_FLAG_NO_DRAW)) { @@ -521,38 +521,38 @@ static void ttf_draw_character_sprite(rct_drawpixelinfo* dpi, int32_t codepoint, info->x += characterWidth; } -static void ttf_draw_string_raw_sprite(rct_drawpixelinfo* dpi, std::string_view text, text_draw_info* info) +static void TTFDrawStringRawSprite(rct_drawpixelinfo* dpi, std::string_view text, text_draw_info* info) { CodepointView codepoints(text); for (auto codepoint : codepoints) { - ttf_draw_character_sprite(dpi, codepoint, info); + TTFDrawCharacterSprite(dpi, codepoint, info); } } #ifndef NO_TTF static int _ttfGlId = 0; -static void ttf_draw_string_raw_ttf(rct_drawpixelinfo* dpi, std::string_view text, text_draw_info* info) +static void TTFDrawStringRawTTF(rct_drawpixelinfo* dpi, std::string_view text, text_draw_info* info) { - if (!ttf_initialise()) + if (!TTFInitialise()) return; - TTFFontDescriptor* fontDesc = ttf_get_font_from_sprite_base(info->FontStyle); + TTFFontDescriptor* fontDesc = TTFGetFontFromSpriteBase(info->FontStyle); if (fontDesc->font == nullptr) { - ttf_draw_string_raw_sprite(dpi, text, info); + TTFDrawStringRawSprite(dpi, text, info); return; } if (info->flags & TEXT_DRAW_FLAG_NO_DRAW) { - info->x += ttf_getwidth_cache_get_or_add(fontDesc->font, text); + info->x += TTFGetWidthCacheGetOrAdd(fontDesc->font, text); return; } uint8_t colour = info->palette[1]; - TTFSurface* surface = ttf_surface_cache_get_or_add(fontDesc->font, text); + TTFSurface* surface = TTFSurfaceCacheGetOrAdd(fontDesc->font, text); if (surface == nullptr) return; @@ -709,7 +709,7 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo* dpi, std::string_view tex #endif // NO_TTF -static void ttf_process_format_code(rct_drawpixelinfo* dpi, const FmtString::token& token, text_draw_info* info) +static void TTFProcessFormatCode(rct_drawpixelinfo* dpi, const FmtString::token& token, text_draw_info* info) { switch (token.kind) { @@ -718,11 +718,11 @@ static void ttf_process_format_code(rct_drawpixelinfo* dpi, const FmtString::tok break; case FormatToken::Newline: info->x = info->startX; - info->y += font_get_line_height(info->FontStyle); + info->y += FontGetLineHeight(info->FontStyle); break; case FormatToken::NewlineSmall: info->x = info->startX; - info->y += font_get_line_height_small(info->FontStyle); + info->y += FontGetLineHeightSmall(info->FontStyle); break; case FormatToken::FontTiny: info->FontStyle = FontStyle::Tiny; @@ -742,19 +742,19 @@ static void ttf_process_format_code(rct_drawpixelinfo* dpi, const FmtString::tok case FormatToken::ColourWindow1: { uint16_t flags = info->flags; - colour_char_window(gCurrentWindowColours[0], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[0], &flags, info->palette); break; } case FormatToken::ColourWindow2: { uint16_t flags = info->flags; - colour_char_window(gCurrentWindowColours[1], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[1], &flags, info->palette); break; } case FormatToken::ColourWindow3: { uint16_t flags = info->flags; - colour_char_window(gCurrentWindowColours[2], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[2], &flags, info->palette); break; } case FormatToken::InlineSprite: @@ -776,7 +776,7 @@ static void ttf_process_format_code(rct_drawpixelinfo* dpi, const FmtString::tok { uint16_t flags = info->flags; auto colourIndex = FormatTokenGetTextColourIndex(token.kind); - colour_char(static_cast(colourIndex), &flags, info->palette); + ColourCharacter(static_cast(colourIndex), &flags, info->palette); } break; } @@ -813,7 +813,7 @@ static bool ShouldUseSpriteForCodepoint(char32_t codepoint) } #endif // NO_TTF -static void ttf_process_string_literal(rct_drawpixelinfo* dpi, std::string_view text, text_draw_info* info) +static void TTFProcessStringLiteral(rct_drawpixelinfo* dpi, std::string_view text, text_draw_info* info) { #ifndef NO_TTF bool isTTF = info->flags & TEXT_DRAW_FLAG_TTF; @@ -823,7 +823,7 @@ static void ttf_process_string_literal(rct_drawpixelinfo* dpi, std::string_view if (!isTTF) { - ttf_draw_string_raw_sprite(dpi, text, info); + TTFDrawStringRawSprite(dpi, text, info); } #ifndef NO_TTF else @@ -846,7 +846,7 @@ static void ttf_process_string_literal(rct_drawpixelinfo* dpi, std::string_view # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" # endif auto len = it.GetIndex() - ttfRunIndex.value(); - ttf_draw_string_raw_ttf(dpi, text.substr(ttfRunIndex.value(), len), info); + TTFDrawStringRawTTF(dpi, text.substr(ttfRunIndex.value(), len), info); # ifdef __MINGW32__ # pragma GCC diagnostic pop # endif @@ -854,7 +854,7 @@ static void ttf_process_string_literal(rct_drawpixelinfo* dpi, std::string_view } // Draw the sprite font glyph - ttf_draw_character_sprite(dpi, codepoint, info); + TTFDrawCharacterSprite(dpi, codepoint, info); } else { @@ -869,24 +869,24 @@ static void ttf_process_string_literal(rct_drawpixelinfo* dpi, std::string_view { // Final TTF run auto len = text.size() - *ttfRunIndex; - ttf_draw_string_raw_ttf(dpi, text.substr(ttfRunIndex.value(), len), info); + TTFDrawStringRawTTF(dpi, text.substr(ttfRunIndex.value(), len), info); } } #endif // NO_TTF } -static void ttf_process_string_codepoint(rct_drawpixelinfo* dpi, codepoint_t codepoint, text_draw_info* info) +static void TTFProcessStringCodepoint(rct_drawpixelinfo* dpi, codepoint_t codepoint, text_draw_info* info) { char buffer[8]{}; utf8_write_codepoint(buffer, codepoint); - ttf_process_string_literal(dpi, buffer, info); + TTFProcessStringLiteral(dpi, buffer, info); } -static void ttf_process_string(rct_drawpixelinfo* dpi, std::string_view text, text_draw_info* info) +static void TTFProcessString(rct_drawpixelinfo* dpi, std::string_view text, text_draw_info* info) { if (info->flags & TEXT_DRAW_FLAG_NO_FORMATTING) { - ttf_process_string_literal(dpi, text, info); + TTFProcessStringLiteral(dpi, text, info); info->maxX = std::max(info->maxX, info->x); info->maxY = std::max(info->maxY, info->y); } @@ -897,16 +897,16 @@ static void ttf_process_string(rct_drawpixelinfo* dpi, std::string_view text, te { if (token.IsLiteral()) { - ttf_process_string_literal(dpi, token.text, info); + TTFProcessStringLiteral(dpi, token.text, info); } else if (token.IsCodepoint()) { auto codepoint = token.GetCodepoint(); - ttf_process_string_codepoint(dpi, codepoint, info); + TTFProcessStringCodepoint(dpi, codepoint, info); } else { - ttf_process_format_code(dpi, token, info); + TTFProcessFormatCode(dpi, token, info); } info->maxX = std::max(info->maxX, info->x); info->maxY = std::max(info->maxY, info->y); @@ -914,7 +914,7 @@ static void ttf_process_string(rct_drawpixelinfo* dpi, std::string_view text, te } } -static void ttf_process_initial_colour(int32_t colour, text_draw_info* info) +static void TTFProcessInitialColour(int32_t colour, text_draw_info* info) { if (colour != TEXT_COLOUR_254 && colour != TEXT_COLOUR_255) { @@ -929,7 +929,7 @@ static void ttf_process_initial_colour(int32_t colour, text_draw_info* info) if (!(info->flags & TEXT_DRAW_FLAG_INSET)) { uint16_t flags = info->flags; - colour_char_window(colour, &flags, reinterpret_cast(&info->palette)); + ColourCharacterWindow(colour, &flags, reinterpret_cast(&info->palette)); } } else @@ -969,7 +969,7 @@ static void ttf_process_initial_colour(int32_t colour, text_draw_info* info) } } -void TtfDrawString( +void TTFDrawString( rct_drawpixelinfo* dpi, const_utf8string text, int32_t colour, const ScreenCoordsXY& coords, bool noFormatting, FontStyle fontStyle, TextDarkness darkness) { @@ -1004,14 +1004,14 @@ void TtfDrawString( } std::memcpy(info.palette, gTextPalette, sizeof(info.palette)); - ttf_process_initial_colour(colour, &info); - ttf_process_string(dpi, text, &info); + TTFProcessInitialColour(colour, &info); + TTFProcessString(dpi, text, &info); std::memcpy(gTextPalette, info.palette, sizeof(info.palette)); dpi->lastStringPos = { info.x, info.y }; } -static int32_t ttf_get_string_width(std::string_view text, FontStyle fontStyle, bool noFormatting) +static int32_t TTFGetStringWidth(std::string_view text, FontStyle fontStyle, bool noFormatting) { text_draw_info info; info.FontStyle = fontStyle; @@ -1034,7 +1034,7 @@ static int32_t ttf_get_string_width(std::string_view text, FontStyle fontStyle, info.flags |= TEXT_DRAW_FLAG_NO_FORMATTING; } - ttf_process_string(nullptr, text, &info); + TTFProcessString(nullptr, text, &info); return info.maxX; } @@ -1064,8 +1064,8 @@ void GfxDrawStringWithYOffsets( } std::memcpy(info.palette, gTextPalette, sizeof(info.palette)); - ttf_process_initial_colour(colour, &info); - ttf_process_string(dpi, text, &info); + TTFProcessInitialColour(colour, &info); + TTFProcessString(dpi, text, &info); std::memcpy(gTextPalette, info.palette, sizeof(info.palette)); dpi->lastStringPos = { info.x, info.y }; diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 45aa6bb0cf..4edda7eb00 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -805,9 +805,9 @@ void UpdatePalette(const uint8_t* colours, int32_t start_index, int32_t num_colo uint8_t g = colours[1]; uint8_t b = colours[0]; - if (lightfx_is_available()) + if (LightFXIsAvailable()) { - lightfx_apply_palette_filter(i, &r, &g, &b); + LightFXApplyPaletteFilter(i, &r, &g, &b); } else { @@ -835,7 +835,7 @@ void UpdatePalette(const uint8_t* colours, int32_t start_index, int32_t num_colo if (!gOpenRCT2Headless) { - drawing_engine_set_palette(gPalette); + DrawingEngineSetPalette(gPalette); } } @@ -847,12 +847,12 @@ void RefreshVideo(bool recreateWindow) } else { - drawing_engine_dispose(); - drawing_engine_init(); - drawing_engine_resize(); + DrawingEngineDispose(); + DrawingEngineInit(); + DrawingEngineResize(); } - drawing_engine_set_palette(gPalette); + DrawingEngineSetPalette(gPalette); GfxInvalidateScreen(); } diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index 15472611ca..894ffd62cb 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -550,7 +550,7 @@ int32_t GfxGetStringWidthNoFormatting(std::string_view text, FontStyle fontStyle int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle); int32_t GfxClipString(char* buffer, int32_t width, FontStyle fontStyle); void ShortenPath(utf8* buffer, size_t bufferSize, const utf8* path, int32_t availableWidth, FontStyle fontStyle); -void TtfDrawString( +void TTFDrawString( rct_drawpixelinfo* dpi, const_utf8string text, int32_t colour, const ScreenCoordsXY& coords, bool noFormatting, FontStyle fontStyle, TextDarkness darkness); diff --git a/src/openrct2/drawing/Font.cpp b/src/openrct2/drawing/Font.cpp index 2a71284b37..770e64b3f6 100644 --- a/src/openrct2/drawing/Font.cpp +++ b/src/openrct2/drawing/Font.cpp @@ -235,7 +235,7 @@ static char32_t _biggestCodepointValue = 0; * * rct2: 0x006C19AC */ -void font_sprite_initialise_characters() +void FontSpriteInitialiseCharacters() { // Compute min and max that helps avoiding lookups for no reason. _smallestCodepointValue = std::numeric_limits::max(); @@ -280,7 +280,7 @@ void font_sprite_initialise_characters() ScrollingTextInitialiseBitmaps(); } -int32_t font_sprite_get_codepoint_offset(int32_t codepoint) +int32_t FontSpriteGetCodepointOffset(int32_t codepoint) { // Only search the table when its in range of the map. if (static_cast(codepoint) >= _smallestCodepointValue @@ -297,9 +297,9 @@ int32_t font_sprite_get_codepoint_offset(int32_t codepoint) return codepoint - 32; } -int32_t font_sprite_get_codepoint_width(FontStyle fontStyle, int32_t codepoint) +int32_t FontSpriteGetCodepointWidth(FontStyle fontStyle, int32_t codepoint) { - int32_t glyphIndex = font_sprite_get_codepoint_offset(codepoint); + int32_t glyphIndex = FontSpriteGetCodepointOffset(codepoint); auto baseFontIndex = EnumValue(fontStyle); if (glyphIndex >= FONT_SPRITE_GLYPH_COUNT) { @@ -321,10 +321,10 @@ int32_t font_sprite_get_codepoint_width(FontStyle fontStyle, int32_t codepoint) return _spriteFontCharacterWidths[baseFontIndex][glyphIndex]; } -ImageId font_sprite_get_codepoint_sprite(FontStyle fontStyle, int32_t codepoint) +ImageId FontSpriteGetCodepointSprite(FontStyle fontStyle, int32_t codepoint) { int32_t offset = EnumValue(fontStyle) * FONT_SPRITE_GLYPH_COUNT; - auto codePointOffset = font_sprite_get_codepoint_offset(codepoint); + auto codePointOffset = FontSpriteGetCodepointOffset(codepoint); if (codePointOffset > FONT_SPRITE_GLYPH_COUNT) { offset = EnumValue(fontStyle) * SPR_G2_GLYPH_COUNT; @@ -333,7 +333,7 @@ ImageId font_sprite_get_codepoint_sprite(FontStyle fontStyle, int32_t codepoint) return ImageId(SPR_CHAR_START + offset + codePointOffset, COLOUR_BLACK); } -int32_t font_get_line_height(FontStyle fontStyle) +int32_t FontGetLineHeight(FontStyle fontStyle) { auto fontSize = EnumValue(fontStyle); #ifndef NO_TTF @@ -345,12 +345,12 @@ int32_t font_get_line_height(FontStyle fontStyle) return SpriteFontLineHeight[fontSize]; } -int32_t font_get_line_height_small(FontStyle fontStyle) +int32_t FontGetLineHeightSmall(FontStyle fontStyle) { - return font_get_line_height(fontStyle) / 2; + return FontGetLineHeight(fontStyle) / 2; } -bool font_supports_string_sprite(const utf8* text) +bool FontSupportsStringSprite(const utf8* text) { const utf8* src = text; @@ -377,7 +377,7 @@ bool font_supports_string_sprite(const utf8* text) return true; } -bool font_supports_string_ttf(const utf8* text, FontStyle fontStyle) +bool FontSupportsStringTTF(const utf8* text, FontStyle fontStyle) { #ifndef NO_TTF const utf8* src = text; @@ -390,7 +390,7 @@ bool font_supports_string_ttf(const utf8* text, FontStyle fontStyle) uint32_t codepoint; while ((codepoint = utf8_get_next(src, &src)) != 0) { - bool supported = ttf_provides_glyph(font, codepoint); + bool supported = TTFProvidesGlyph(font, codepoint); if (!supported) { return false; @@ -402,12 +402,12 @@ bool font_supports_string_ttf(const utf8* text, FontStyle fontStyle) #endif // NO_TTF } -bool font_supports_string(const utf8* text, FontStyle fontStyle) +bool FontSupportsString(const utf8* text, FontStyle fontStyle) { if (LocalisationService_UseTrueTypeFont()) { - return font_supports_string_ttf(text, fontStyle); + return FontSupportsStringTTF(text, fontStyle); } - return font_supports_string_sprite(text); + return FontSupportsStringSprite(text); } diff --git a/src/openrct2/drawing/Font.h b/src/openrct2/drawing/Font.h index 3eea241294..4f8440aef6 100644 --- a/src/openrct2/drawing/Font.h +++ b/src/openrct2/drawing/Font.h @@ -52,12 +52,12 @@ extern TTFFontSetDescriptor* gCurrentTTFFontSet; #endif // NO_TTF -void font_sprite_initialise_characters(); -int32_t font_sprite_get_codepoint_offset(int32_t codepoint); -int32_t font_sprite_get_codepoint_width(FontStyle fontStyle, int32_t codepoint); -ImageId font_sprite_get_codepoint_sprite(FontStyle fontStyle, int32_t codepoint); -int32_t font_get_line_height(FontStyle fontStyle); -int32_t font_get_line_height_small(FontStyle fontStyle); -bool font_supports_string_sprite(const utf8* text); -bool font_supports_string_ttf(const utf8* text, FontStyle fontStyle); -bool font_supports_string(const utf8* text, FontStyle fontStyle); +void FontSpriteInitialiseCharacters(); +int32_t FontSpriteGetCodepointOffset(int32_t codepoint); +int32_t FontSpriteGetCodepointWidth(FontStyle fontStyle, int32_t codepoint); +ImageId FontSpriteGetCodepointSprite(FontStyle fontStyle, int32_t codepoint); +int32_t FontGetLineHeight(FontStyle fontStyle); +int32_t FontGetLineHeightSmall(FontStyle fontStyle); +bool FontSupportsStringSprite(const utf8* text); +bool FontSupportsStringTTF(const utf8* text, FontStyle fontStyle); +bool FontSupportsString(const utf8* text, FontStyle fontStyle); diff --git a/src/openrct2/drawing/Image.cpp b/src/openrct2/drawing/Image.cpp index 9048e66f6c..c8345b3edf 100644 --- a/src/openrct2/drawing/Image.cpp +++ b/src/openrct2/drawing/Image.cpp @@ -186,7 +186,7 @@ static void FreeImageList(uint32_t baseImageId, uint32_t count) _freeLists.push_back({ baseImageId, count }); } -uint32_t gfx_object_allocate_images(const rct_g1_element* images, uint32_t count) +uint32_t GfxObjectAllocateImages(const rct_g1_element* images, uint32_t count) { if (count == 0 || gOpenRCT2NoGraphics) { @@ -204,14 +204,14 @@ uint32_t gfx_object_allocate_images(const rct_g1_element* images, uint32_t count for (uint32_t i = 0; i < count; i++) { GfxSetG1Element(imageId, &images[i]); - drawing_engine_invalidate_image(imageId); + DrawingEngineInvalidateImage(imageId); imageId++; } return baseImageId; } -void gfx_object_free_images(uint32_t baseImageId, uint32_t count) +void GfxObjectFreeImages(uint32_t baseImageId, uint32_t count) { if (baseImageId != 0 && baseImageId != INVALID_IMAGE_ID) { @@ -222,14 +222,14 @@ void gfx_object_free_images(uint32_t baseImageId, uint32_t count) uint32_t imageId = baseImageId + i; rct_g1_element g1 = {}; GfxSetG1Element(imageId, &g1); - drawing_engine_invalidate_image(imageId); + DrawingEngineInvalidateImage(imageId); } FreeImageList(baseImageId, count); } } -void gfx_object_check_all_images_freed() +void GfxObjectCheckAllImagesFreed() { if (_allocatedImageCount != 0) { diff --git a/src/openrct2/drawing/Image.h b/src/openrct2/drawing/Image.h index 6c3ed26db5..4a57ddce1b 100644 --- a/src/openrct2/drawing/Image.h +++ b/src/openrct2/drawing/Image.h @@ -55,9 +55,9 @@ constexpr bool operator!=(const ImageList& lhs, const ImageList& rhs) return !(lhs == rhs); } -uint32_t gfx_object_allocate_images(const rct_g1_element* images, uint32_t count); -void gfx_object_free_images(uint32_t baseImageId, uint32_t count); -void gfx_object_check_all_images_freed(); +uint32_t GfxObjectAllocateImages(const rct_g1_element* images, uint32_t count); +void GfxObjectFreeImages(uint32_t baseImageId, uint32_t count); +void GfxObjectCheckAllImagesFreed(); size_t ImageListGetUsedCount(); size_t ImageListGetMaximum(); const std::list& GetAvailableAllocationRanges(); diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index 553567ec0d..41f50620da 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -85,7 +85,7 @@ static ZoomLevel _current_view_zoom_back_delay{ 0 }; static GamePalette gPalette_light; -static uint8_t calc_light_intensity_lantern(int32_t x, int32_t y) +static uint8_t CalcLightIntensityLantern(int32_t x, int32_t y) { double distance = static_cast(x * x + y * y); @@ -96,7 +96,7 @@ static uint8_t calc_light_intensity_lantern(int32_t x, int32_t y) return static_cast(std::min(255.0, light * 255.0)); } -static uint8_t calc_light_intensity_spot(int32_t x, int32_t y) +static uint8_t CalcLightIntensitySpot(int32_t x, int32_t y) { double distance = static_cast(x * x + y * y); @@ -107,7 +107,7 @@ static uint8_t calc_light_intensity_spot(int32_t x, int32_t y) return static_cast(std::min(255.0, light * 255.0)) >> 4; } -static void calc_rescale_light_half(uint8_t* target, uint8_t* source, uint32_t targetWidth, uint32_t targetHeight) +static void CalcRescaleLightHalf(uint8_t* target, uint8_t* source, uint32_t targetWidth, uint32_t targetHeight) { uint8_t* parcerRead = source; uint8_t* parcerWrite = target; @@ -124,22 +124,22 @@ static void calc_rescale_light_half(uint8_t* target, uint8_t* source, uint32_t t } } -void lightfx_set_available(bool available) +void LightFXSetAvailable(bool available) { _lightfxAvailable = available; } -bool lightfx_is_available() +bool LightFXIsAvailable() { return _lightfxAvailable && gConfigGeneral.EnableLightFx != 0; } -bool lightfx_for_vehicles_is_available() +bool LightFXForVehiclesIsAvailable() { - return lightfx_is_available() && gConfigGeneral.EnableLightFxForVehicles != 0; + return LightFXIsAvailable() && gConfigGeneral.EnableLightFxForVehicles != 0; } -void lightfx_init() +void LightFXInit() { _LightListBack = _LightListA; _LightListFront = _LightListB; @@ -155,7 +155,7 @@ void lightfx_init() { for (int32_t x = 0; x < 256; x++) { - *parcer = calc_light_intensity_lantern(x - 128, y - 128); + *parcer = CalcLightIntensityLantern(x - 128, y - 128); parcer++; } } @@ -166,28 +166,28 @@ void lightfx_init() { for (int32_t x = 0; x < 256; x++) { - *parcer = calc_light_intensity_spot(x - 128, y - 128); + *parcer = CalcLightIntensitySpot(x - 128, y - 128); parcer++; } } - calc_rescale_light_half(_bakedLightTexture_lantern_2, _bakedLightTexture_lantern_3, 128, 128); - calc_rescale_light_half(_bakedLightTexture_lantern_1, _bakedLightTexture_lantern_2, 64, 64); - calc_rescale_light_half(_bakedLightTexture_lantern_0, _bakedLightTexture_lantern_1, 32, 32); + CalcRescaleLightHalf(_bakedLightTexture_lantern_2, _bakedLightTexture_lantern_3, 128, 128); + CalcRescaleLightHalf(_bakedLightTexture_lantern_1, _bakedLightTexture_lantern_2, 64, 64); + CalcRescaleLightHalf(_bakedLightTexture_lantern_0, _bakedLightTexture_lantern_1, 32, 32); - calc_rescale_light_half(_bakedLightTexture_spot_2, _bakedLightTexture_spot_3, 128, 128); - calc_rescale_light_half(_bakedLightTexture_spot_1, _bakedLightTexture_spot_2, 64, 64); - calc_rescale_light_half(_bakedLightTexture_spot_0, _bakedLightTexture_spot_1, 32, 32); + CalcRescaleLightHalf(_bakedLightTexture_spot_2, _bakedLightTexture_spot_3, 128, 128); + CalcRescaleLightHalf(_bakedLightTexture_spot_1, _bakedLightTexture_spot_2, 64, 64); + CalcRescaleLightHalf(_bakedLightTexture_spot_0, _bakedLightTexture_spot_1, 32, 32); } -void lightfx_update_buffers(rct_drawpixelinfo* info) +void LightFXUpdateBuffers(rct_drawpixelinfo* info) { _light_rendered_buffer_front = realloc(_light_rendered_buffer_front, info->width * info->height); _light_rendered_buffer_back = realloc(_light_rendered_buffer_back, info->width * info->height); _pixelInfo = *info; } -void lightfx_prepare_light_list() +void LightFXPrepareLightList() { for (uint32_t light = 0; light < LightListCurrentCountFront; light++) { @@ -401,7 +401,7 @@ void lightfx_prepare_light_list() } } -void lightfx_swap_buffers() +void LightFXSwapBuffers() { void* tmp = _light_rendered_buffer_back; _light_rendered_buffer_back = _light_rendered_buffer_front; @@ -429,7 +429,7 @@ void lightfx_swap_buffers() _current_view_zoom_back_delay = _current_view_zoom_back; } -void lightfx_update_viewport_settings() +void LightFXUpdateViewportSettings() { rct_window* mainWindow = WindowGetMain(); if (mainWindow != nullptr) @@ -442,7 +442,7 @@ void lightfx_update_viewport_settings() } } -void lightfx_render_lights_to_frontbuffer() +void LightFXRenderLightsToFrontBuffer() { if (_light_rendered_buffer_front == nullptr) { @@ -614,17 +614,17 @@ void lightfx_render_lights_to_frontbuffer() } } -void* lightfx_get_front_buffer() +void* LightFXGetFrontBuffer() { return _light_rendered_buffer_front; } -const GamePalette& lightfx_get_palette() +const GamePalette& LightFXGetPalette() { return gPalette_light; } -static void LightfxAdd3DLight( +static void LightFXAdd3DLight( const uint32_t lightHash, const LightFXQualifier qualifier, const uint8_t id, const CoordsXYZ& loc, const LightType lightType) { @@ -671,26 +671,26 @@ static void LightfxAdd3DLight( // log_warning("new 3d light"); } -static void LightfxAdd3DLight(const CoordsXYZ& loc, const LightType lightType) +static void LightFXAdd3DLight(const CoordsXYZ& loc, const LightType lightType) { - LightfxAdd3DLight(((loc.x << 16) | loc.y), LightFXQualifier::Map, loc.z, loc, lightType); + LightFXAdd3DLight(((loc.x << 16) | loc.y), LightFXQualifier::Map, loc.z, loc, lightType); } -void LightfxAdd3DLight(const EntityBase& entity, const uint8_t id, const CoordsXYZ& loc, const LightType lightType) +void LightFXAdd3DLight(const EntityBase& entity, const uint8_t id, const CoordsXYZ& loc, const LightType lightType) { - LightfxAdd3DLight(entity.sprite_index.ToUnderlying(), LightFXQualifier::Entity, id, loc, lightType); + LightFXAdd3DLight(entity.sprite_index.ToUnderlying(), LightFXQualifier::Entity, id, loc, lightType); } -void lightfx_add_3d_light_magic_from_drawing_tile( +void LightFXAdd3DLightMagicFromDrawingTile( const CoordsXY& mapPosition, int16_t offsetX, int16_t offsetY, int16_t offsetZ, LightType lightType) { int16_t x = mapPosition.x + offsetX + 16; int16_t y = mapPosition.y + offsetY + 16; - LightfxAdd3DLight({ x, y, offsetZ }, lightType); + LightFXAdd3DLight({ x, y, offsetZ }, lightType); } -uint32_t lightfx_get_light_polution() +uint32_t LightFXGetLightPolution() { return _lightPolution_front; } @@ -700,10 +700,10 @@ static constexpr const int16_t offsetLookup[] = { }; void LightFxAddLightsMagicVehicle_ObservationTower(const Vehicle* vehicle) { - LightfxAdd3DLight(*vehicle, 0, { vehicle->x, vehicle->y + 16, vehicle->z }, LightType::Spot3); - LightfxAdd3DLight(*vehicle, 1, { vehicle->x + 16, vehicle->y, vehicle->z }, LightType::Spot3); - LightfxAdd3DLight(*vehicle, 2, { vehicle->x - 16, vehicle->y, vehicle->z }, LightType::Spot3); - LightfxAdd3DLight(*vehicle, 3, { vehicle->x, vehicle->y - 16, vehicle->z }, LightType::Spot3); + LightFXAdd3DLight(*vehicle, 0, { vehicle->x, vehicle->y + 16, vehicle->z }, LightType::Spot3); + LightFXAdd3DLight(*vehicle, 1, { vehicle->x + 16, vehicle->y, vehicle->z }, LightType::Spot3); + LightFXAdd3DLight(*vehicle, 2, { vehicle->x - 16, vehicle->y, vehicle->z }, LightType::Spot3); + LightFXAdd3DLight(*vehicle, 3, { vehicle->x, vehicle->y - 16, vehicle->z }, LightType::Spot3); } void LightFxAddLightsMagicVehicle_MineTrainCoaster(const Vehicle* vehicle) @@ -712,13 +712,13 @@ void LightFxAddLightsMagicVehicle_MineTrainCoaster(const Vehicle* vehicle) { int16_t place_x = vehicle->x - offsetLookup[(vehicle->sprite_direction + 0) % 32] * 2; int16_t place_y = vehicle->y - offsetLookup[(vehicle->sprite_direction + 8) % 32] * 2; - LightfxAdd3DLight(*vehicle, 0, { place_x, place_y, vehicle->z }, LightType::Spot3); + LightFXAdd3DLight(*vehicle, 0, { place_x, place_y, vehicle->z }, LightType::Spot3); } } void LightFxAddLightsMagicVehicle_ChairLift(const Vehicle* vehicle) { - LightfxAdd3DLight(*vehicle, 0, { vehicle->x, vehicle->y, vehicle->z - 16 }, LightType::Lantern2); + LightFXAdd3DLight(*vehicle, 0, { vehicle->x, vehicle->y, vehicle->z - 16 }, LightType::Lantern2); } void LightFxAddLightsMagicVehicle_BoatHire(const Vehicle* vehicle) { @@ -732,33 +732,33 @@ void LightFxAddLightsMagicVehicle_BoatHire(const Vehicle* vehicle) int16_t place_y = vehicle_draw->y; place_x -= offsetLookup[(vehicle_draw->sprite_direction + 0) % 32]; place_y -= offsetLookup[(vehicle_draw->sprite_direction + 8) % 32]; - LightfxAdd3DLight(*vehicle, 0, { place_x, place_y, vehicle_draw->z }, LightType::Spot2); + LightFXAdd3DLight(*vehicle, 0, { place_x, place_y, vehicle_draw->z }, LightType::Spot2); place_x -= offsetLookup[(vehicle_draw->sprite_direction + 0) % 32]; place_y -= offsetLookup[(vehicle_draw->sprite_direction + 8) % 32]; - LightfxAdd3DLight(*vehicle, 1, { place_x, place_y, vehicle_draw->z }, LightType::Spot2); + LightFXAdd3DLight(*vehicle, 1, { place_x, place_y, vehicle_draw->z }, LightType::Spot2); } void LightFxAddLightsMagicVehicle_Monorail(const Vehicle* vehicle) { - LightfxAdd3DLight(*vehicle, 0, { vehicle->x, vehicle->y, vehicle->z + 12 }, LightType::Spot2); + LightFXAdd3DLight(*vehicle, 0, { vehicle->x, vehicle->y, vehicle->z + 12 }, LightType::Spot2); int16_t place_x = vehicle->x; int16_t place_y = vehicle->y; if (vehicle == vehicle->TrainHead()) { place_x -= offsetLookup[(vehicle->sprite_direction + 0) % 32] * 2; place_y -= offsetLookup[(vehicle->sprite_direction + 8) % 32] * 2; - LightfxAdd3DLight(*vehicle, 1, { place_x, place_y, vehicle->z + 10 }, LightType::Lantern3); + LightFXAdd3DLight(*vehicle, 1, { place_x, place_y, vehicle->z + 10 }, LightType::Lantern3); place_x -= offsetLookup[(vehicle->sprite_direction + 0) % 32] * 3; place_y -= offsetLookup[(vehicle->sprite_direction + 8) % 32] * 3; - LightfxAdd3DLight(*vehicle, 2, { place_x, place_y, vehicle->z + 2 }, LightType::Lantern3); + LightFXAdd3DLight(*vehicle, 2, { place_x, place_y, vehicle->z + 2 }, LightType::Lantern3); } if (vehicle == vehicle->TrainTail()) { place_x += offsetLookup[(vehicle->sprite_direction + 0) % 32] * 2; place_y += offsetLookup[(vehicle->sprite_direction + 8) % 32] * 2; - LightfxAdd3DLight(*vehicle, 3, { place_x, place_y, vehicle->z + 10 }, LightType::Lantern3); + LightFXAdd3DLight(*vehicle, 3, { place_x, place_y, vehicle->z + 10 }, LightType::Lantern3); place_x += offsetLookup[(vehicle->sprite_direction + 0) % 32] * 2; place_y += offsetLookup[(vehicle->sprite_direction + 8) % 32] * 2; - LightfxAdd3DLight(*vehicle, 4, { place_x, place_y, vehicle->z + 2 }, LightType::Lantern3); + LightFXAdd3DLight(*vehicle, 4, { place_x, place_y, vehicle->z + 2 }, LightType::Lantern3); } } void LightFxAddLightsMagicVehicle_MiniatureRailway(const Vehicle* vehicle) @@ -767,18 +767,18 @@ void LightFxAddLightsMagicVehicle_MiniatureRailway(const Vehicle* vehicle) { int16_t place_x = vehicle->x - offsetLookup[(vehicle->sprite_direction + 0) % 32] * 2; int16_t place_y = vehicle->y - offsetLookup[(vehicle->sprite_direction + 8) % 32] * 2; - LightfxAdd3DLight(*vehicle, 1, { place_x, place_y, vehicle->z + 10 }, LightType::Lantern3); + LightFXAdd3DLight(*vehicle, 1, { place_x, place_y, vehicle->z + 10 }, LightType::Lantern3); place_x -= offsetLookup[(vehicle->sprite_direction + 0) % 32] * 2; place_y -= offsetLookup[(vehicle->sprite_direction + 8) % 32] * 2; - LightfxAdd3DLight(*vehicle, 2, { place_x, place_y, vehicle->z + 2 }, LightType::Lantern3); + LightFXAdd3DLight(*vehicle, 2, { place_x, place_y, vehicle->z + 2 }, LightType::Lantern3); } else { - LightfxAdd3DLight(*vehicle, 0, { vehicle->x, vehicle->y, vehicle->z + 10 }, LightType::Lantern3); + LightFXAdd3DLight(*vehicle, 0, { vehicle->x, vehicle->y, vehicle->z + 10 }, LightType::Lantern3); } } -void LightfxAddLightsMagicVehicle(const Vehicle* vehicle) +void LightFXAddLightsMagicVehicle(const Vehicle* vehicle) { auto ride = vehicle->GetRide(); if (ride == nullptr) @@ -794,18 +794,18 @@ void LightFxAddKioskLights(const CoordsXY& mapPosition, const int32_t height, co uint8_t relativeRotation = (4 - GetCurrentRotation()) % 4; CoordsXY lanternOffset1 = CoordsXY(0, 16).Rotate(relativeRotation); CoordsXY lanternOffset2 = CoordsXY(16, 0).Rotate(relativeRotation); - lightfx_add_3d_light_magic_from_drawing_tile( + LightFXAdd3DLightMagicFromDrawingTile( mapPosition, lanternOffset1.x, lanternOffset1.y, height + zOffset, LightType::Lantern3); - lightfx_add_3d_light_magic_from_drawing_tile( + LightFXAdd3DLightMagicFromDrawingTile( mapPosition, lanternOffset2.x, lanternOffset2.y, height + zOffset, LightType::Lantern3); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, 8, 32, height, LightType::Spot1); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, 32, 8, height, LightType::Spot1); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, -32, 8, height, LightType::Spot1); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, 8, -32, height, LightType::Spot1); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, -8, 32, height, LightType::Spot1); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, 32, -8, height, LightType::Spot1); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, -32, -8, height, LightType::Spot1); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, -8, -32, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, 8, 32, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, 32, 8, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, -32, 8, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, 8, -32, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, -8, 32, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, 32, -8, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, -32, -8, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, -8, -32, height, LightType::Spot1); } void LightFxAddShopLights(const CoordsXY& mapPosition, const uint8_t direction, const int32_t height, const uint8_t zOffset) @@ -814,29 +814,29 @@ void LightFxAddShopLights(const CoordsXY& mapPosition, const uint8_t direction, { CoordsXY spotOffset1 = CoordsXY(-32, 8).Rotate(direction); CoordsXY spotOffset2 = CoordsXY(-32, 4).Rotate(direction); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, spotOffset1.x, spotOffset1.y, height, LightType::Spot1); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, spotOffset2.x, spotOffset2.y, height, LightType::Spot2); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, spotOffset1.x, spotOffset1.y, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, spotOffset2.x, spotOffset2.y, height, LightType::Spot2); } else if (direction == (7 - GetCurrentRotation()) % 4) // Back left Facing Stall { CoordsXY spotOffset1 = CoordsXY(-32, -8).Rotate(direction); CoordsXY spotOffset2 = CoordsXY(-32, -4).Rotate(direction); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, spotOffset1.x, spotOffset1.y, height, LightType::Spot1); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, spotOffset2.x, spotOffset2.y, height, LightType::Spot2); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, spotOffset1.x, spotOffset1.y, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, spotOffset2.x, spotOffset2.y, height, LightType::Spot2); } else // Forward Facing Stall { CoordsXY spotOffset1 = CoordsXY(-32, 8).Rotate(direction); CoordsXY spotOffset2 = CoordsXY(-32, -8).Rotate(direction); CoordsXY lanternOffset = CoordsXY(-16, 0).Rotate(direction); - lightfx_add_3d_light_magic_from_drawing_tile( + LightFXAdd3DLightMagicFromDrawingTile( mapPosition, lanternOffset.x, lanternOffset.y, height + zOffset, LightType::Lantern3); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, spotOffset1.x, spotOffset1.y, height, LightType::Spot1); - lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, spotOffset2.x, spotOffset2.y, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, spotOffset1.x, spotOffset1.y, height, LightType::Spot1); + LightFXAdd3DLightMagicFromDrawingTile(mapPosition, spotOffset2.x, spotOffset2.y, height, LightType::Spot1); } } -void lightfx_apply_palette_filter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b) +void LightFXApplyPaletteFilter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b) { float night = static_cast(pow(gDayNightCycle, 1.5)); @@ -919,7 +919,7 @@ void lightfx_apply_palette_filter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b) reduceColourLit *= night / static_cast(std::pow(std::max(1.01f, 0.4f + lightAvg), 2.0)); float targetLightPollution = reduceColourLit - * std::max(0.0f, 0.0f + 0.000001f * static_cast(lightfx_get_light_polution())); + * std::max(0.0f, 0.0f + 0.000001f * static_cast(LightFXGetLightPolution())); lightPolution -= (lightPolution - targetLightPollution) * 0.001f; // lightPollution /= 1.0f + fogginess * 1.0f; @@ -1007,7 +1007,7 @@ void lightfx_apply_palette_filter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b) } } -static uint8_t mix_light(uint32_t a, uint32_t b, uint32_t intensity) +static uint8_t MixLight(uint32_t a, uint32_t b, uint32_t intensity) { intensity = intensity * 6; uint32_t bMul = (b * intensity) >> 8; @@ -1016,16 +1016,16 @@ static uint8_t mix_light(uint32_t a, uint32_t b, uint32_t intensity) return result; } -void lightfx_render_to_texture( +void LightFXRenderToTexture( void* dstPixels, uint32_t dstPitch, uint8_t* bits, uint32_t width, uint32_t height, const uint32_t* palette, const uint32_t* lightPalette) { - lightfx_update_viewport_settings(); - lightfx_swap_buffers(); - lightfx_prepare_light_list(); - lightfx_render_lights_to_frontbuffer(); + LightFXUpdateViewportSettings(); + LightFXSwapBuffers(); + LightFXPrepareLightList(); + LightFXRenderLightsToFrontBuffer(); - uint8_t* lightBits = static_cast(lightfx_get_front_buffer()); + uint8_t* lightBits = static_cast(LightFXGetFrontBuffer()); if (lightBits == nullptr) { return; @@ -1049,10 +1049,10 @@ void lightfx_render_to_texture( } else { - colour |= mix_light((darkColour >> 0) & 0xFF, (lightColour >> 0) & 0xFF, lightIntensity); - colour |= mix_light((darkColour >> 8) & 0xFF, (lightColour >> 8) & 0xFF, lightIntensity) << 8; - colour |= mix_light((darkColour >> 16) & 0xFF, (lightColour >> 16) & 0xFF, lightIntensity) << 16; - colour |= mix_light((darkColour >> 24) & 0xFF, (lightColour >> 24) & 0xFF, lightIntensity) << 24; + colour |= MixLight((darkColour >> 0) & 0xFF, (lightColour >> 0) & 0xFF, lightIntensity); + colour |= MixLight((darkColour >> 8) & 0xFF, (lightColour >> 8) & 0xFF, lightIntensity) << 8; + colour |= MixLight((darkColour >> 16) & 0xFF, (lightColour >> 16) & 0xFF, lightIntensity) << 16; + colour |= MixLight((darkColour >> 24) & 0xFF, (lightColour >> 24) & 0xFF, lightIntensity) << 24; } *dst++ = colour; } diff --git a/src/openrct2/drawing/LightFX.h b/src/openrct2/drawing/LightFX.h index d6d733deef..e16c7b531a 100644 --- a/src/openrct2/drawing/LightFX.h +++ b/src/openrct2/drawing/LightFX.h @@ -42,28 +42,28 @@ constexpr LightType SetLightTypeSize(LightType type, uint8_t size) return static_cast(((static_cast(type) & ~0x3) | size)); } -void lightfx_set_available(bool available); -bool lightfx_is_available(); -bool lightfx_for_vehicles_is_available(); +void LightFXSetAvailable(bool available); +bool LightFXIsAvailable(); +bool LightFXForVehiclesIsAvailable(); -void lightfx_init(); +void LightFXInit(); -void lightfx_update_buffers(rct_drawpixelinfo*); +void LightFXUpdateBuffers(rct_drawpixelinfo*); -void lightfx_prepare_light_list(); -void lightfx_swap_buffers(); -void lightfx_render_lights_to_frontbuffer(); -void lightfx_update_viewport_settings(); +void LightFXPrepareLightList(); +void LightFXSwapBuffers(); +void LightFXRenderLightsToFrontBuffer(); +void LightFXUpdateViewportSettings(); -void* lightfx_get_front_buffer(); -const GamePalette& lightfx_get_palette(); +void* LightFXGetFrontBuffer(); +const GamePalette& LightFXGetPalette(); -void LightfxAdd3DLight(const EntityBase& entity, const uint8_t id, const CoordsXYZ& loc, const LightType lightType); +void LightFXAdd3DLight(const EntityBase& entity, const uint8_t id, const CoordsXYZ& loc, const LightType lightType); -void lightfx_add_3d_light_magic_from_drawing_tile( +void LightFXAdd3DLightMagicFromDrawingTile( const CoordsXY& mapPosition, int16_t offsetX, int16_t offsetY, int16_t offsetZ, LightType lightType); -void LightfxAddLightsMagicVehicle(const Vehicle* vehicle); +void LightFXAddLightsMagicVehicle(const Vehicle* vehicle); void LightFxAddLightsMagicVehicle_ObservationTower(const Vehicle* vehicle); void LightFxAddLightsMagicVehicle_MineTrainCoaster(const Vehicle* vehicle); void LightFxAddLightsMagicVehicle_ChairLift(const Vehicle* vehicle); @@ -74,9 +74,9 @@ void LightFxAddLightsMagicVehicle_MiniatureRailway(const Vehicle* vehicle); void LightFxAddKioskLights(const CoordsXY& mapPosition, const int32_t height, const uint8_t zOffset); void LightFxAddShopLights(const CoordsXY& mapPosition, const uint8_t direction, const int32_t height, const uint8_t zOffset); -uint32_t lightfx_get_light_polution(); +uint32_t LightFXGetLightPolution(); -void lightfx_apply_palette_filter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b); -void lightfx_render_to_texture( +void LightFXApplyPaletteFilter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b); +void LightFXRenderToTexture( void* dstPixels, uint32_t dstPitch, uint8_t* bits, uint32_t width, uint32_t height, const uint32_t* palette, const uint32_t* lightPalette); diff --git a/src/openrct2/drawing/Line.cpp b/src/openrct2/drawing/Line.cpp index f229399ecc..ef01d5e630 100644 --- a/src/openrct2/drawing/Line.cpp +++ b/src/openrct2/drawing/Line.cpp @@ -16,7 +16,7 @@ * Draws a horizontal line of specified colour to a buffer. * rct2: 0x0068474C */ -static void gfx_draw_line_on_buffer(rct_drawpixelinfo* dpi, char colour, const ScreenCoordsXY& coords, int32_t no_pixels) +static void GfxDrawLineOnBuffer(rct_drawpixelinfo* dpi, char colour, const ScreenCoordsXY& coords, int32_t no_pixels) { ScreenCoordsXY offset{ coords.x - dpi->x, coords.y - dpi->y }; @@ -140,14 +140,14 @@ void GfxDrawLineSoftware(rct_drawpixelinfo* dpi, const ScreenLine& line, int32_t { // Vertical lines are drawn 1 pixel at a time if (steep) - gfx_draw_line_on_buffer(dpi, colour, { y, x }, 1); + GfxDrawLineOnBuffer(dpi, colour, { y, x }, 1); error -= delta_y; if (error < 0) { // Non vertical lines are drawn with as many pixels in a horizontal line as possible if (!steep) - gfx_draw_line_on_buffer(dpi, colour, { x_start, y }, no_pixels); + GfxDrawLineOnBuffer(dpi, colour, { x_start, y }, no_pixels); // Reset non vertical line vars x_start = x + 1; @@ -159,7 +159,7 @@ void GfxDrawLineSoftware(rct_drawpixelinfo* dpi, const ScreenLine& line, int32_t // Catch the case of the last line if (x + 1 == x2 && !steep) { - gfx_draw_line_on_buffer(dpi, colour, { x_start, y }, no_pixels); + GfxDrawLineOnBuffer(dpi, colour, { x_start, y }, no_pixels); } } } diff --git a/src/openrct2/drawing/NewDrawing.cpp b/src/openrct2/drawing/NewDrawing.cpp index 1aa36a3bd1..2e7e06d37d 100644 --- a/src/openrct2/drawing/NewDrawing.cpp +++ b/src/openrct2/drawing/NewDrawing.cpp @@ -51,13 +51,13 @@ static IDrawingEngine* GetDrawingEngine() return result; } -bool drawing_engine_requires_new_window(DrawingEngine srcEngine, DrawingEngine dstEngine) +bool DrawingEngineRequiresNewWindow(DrawingEngine srcEngine, DrawingEngine dstEngine) { bool openGL = srcEngine == DrawingEngine::OpenGL || dstEngine == DrawingEngine::OpenGL; return Platform::RequireNewWindow(openGL); } -void drawing_engine_init() +void DrawingEngineInit() { auto context = GetContext(); if (context != nullptr) @@ -66,7 +66,7 @@ void drawing_engine_init() } } -void drawing_engine_resize() +void DrawingEngineResize() { auto context = GetContext(); if (context != nullptr) @@ -80,7 +80,7 @@ void drawing_engine_resize() } } -void drawing_engine_set_palette(const GamePalette& colours) +void DrawingEngineSetPalette(const GamePalette& colours) { auto context = GetContext(); if (context != nullptr) @@ -93,7 +93,7 @@ void drawing_engine_set_palette(const GamePalette& colours) } } -void drawing_engine_copy_rect(int32_t x, int32_t y, int32_t width, int32_t height, int32_t dx, int32_t dy) +void DrawingEngineCopyRect(int32_t x, int32_t y, int32_t width, int32_t height, int32_t dx, int32_t dy) { auto context = GetContext(); if (context != nullptr) @@ -106,7 +106,7 @@ void drawing_engine_copy_rect(int32_t x, int32_t y, int32_t width, int32_t heigh } } -void drawing_engine_dispose() +void DrawingEngineDispose() { auto context = GetContext(); if (context != nullptr) @@ -115,14 +115,14 @@ void drawing_engine_dispose() } } -rct_drawpixelinfo* drawing_engine_get_dpi() +rct_drawpixelinfo* DrawingEngineGetDpi() { auto context = GetContext(); auto drawingEngine = context->GetDrawingEngine(); return drawingEngine->GetDrawingPixelInfo(); } -bool drawing_engine_has_dirty_optimisations() +bool DrawingEngineHasDirtyOptimisations() { bool result = false; auto drawingEngine = GetDrawingEngine(); @@ -133,7 +133,7 @@ bool drawing_engine_has_dirty_optimisations() return result; } -void drawing_engine_invalidate_image(uint32_t image) +void DrawingEngineInvalidateImage(uint32_t image) { auto drawingEngine = GetDrawingEngine(); if (drawingEngine != nullptr) @@ -142,7 +142,7 @@ void drawing_engine_invalidate_image(uint32_t image) } } -void drawing_engine_set_vsync(bool vsync) +void DrawingEngineSetVSync(bool vsync) { auto drawingEngine = GetDrawingEngine(); if (drawingEngine != nullptr) diff --git a/src/openrct2/drawing/NewDrawing.h b/src/openrct2/drawing/NewDrawing.h index 1e6dac2864..2a258d3bbf 100644 --- a/src/openrct2/drawing/NewDrawing.h +++ b/src/openrct2/drawing/NewDrawing.h @@ -18,14 +18,14 @@ enum class DrawingEngine : int32_t; extern StringId DrawingEngineStringIds[3]; DrawingEngine drawing_engine_get_type(); -bool drawing_engine_requires_new_window(DrawingEngine srcEngine, DrawingEngine dstEngine); -void drawing_engine_init(); -void drawing_engine_resize(); -void drawing_engine_set_palette(const GamePalette& colours); -void drawing_engine_copy_rect(int32_t x, int32_t y, int32_t width, int32_t height, int32_t dx, int32_t dy); -void drawing_engine_dispose(); +bool DrawingEngineRequiresNewWindow(DrawingEngine srcEngine, DrawingEngine dstEngine); +void DrawingEngineInit(); +void DrawingEngineResize(); +void DrawingEngineSetPalette(const GamePalette& colours); +void DrawingEngineCopyRect(int32_t x, int32_t y, int32_t width, int32_t height, int32_t dx, int32_t dy); +void DrawingEngineDispose(); -rct_drawpixelinfo* drawing_engine_get_dpi(); -bool drawing_engine_has_dirty_optimisations(); -void drawing_engine_invalidate_image(uint32_t image); -void drawing_engine_set_vsync(bool vsync); +rct_drawpixelinfo* DrawingEngineGetDpi(); +bool DrawingEngineHasDirtyOptimisations(); +void DrawingEngineInvalidateImage(uint32_t image); +void DrawingEngineSetVSync(bool vsync); diff --git a/src/openrct2/drawing/ScrollingText.cpp b/src/openrct2/drawing/ScrollingText.cpp index 269b5f852d..2e62e2b370 100644 --- a/src/openrct2/drawing/ScrollingText.cpp +++ b/src/openrct2/drawing/ScrollingText.cpp @@ -42,9 +42,9 @@ static uint8_t _characterBitmaps[FONT_SPRITE_GLYPH_COUNT + SPR_G2_GLYPH_COUNT][8 static uint32_t _drawSCrollNextIndex = 0; static std::mutex _scrollingTextMutex; -static void scrolling_text_set_bitmap_for_sprite( +static void ScrollingTextSetBitmapForSprite( std::string_view text, int32_t scroll, uint8_t* bitmap, const int16_t* scrollPositionOffsets, colour_t colour); -static void scrolling_text_set_bitmap_for_ttf( +static void ScrollingTextSetBitmapForTTF( std::string_view text, int32_t scroll, uint8_t* bitmap, const int16_t* scrollPositionOffsets, colour_t colour); static void ScrollingTextInitialiseCharacterBitmaps(uint32_t glyphStart, uint16_t offset, uint16_t count, bool isAntiAliased) @@ -109,9 +109,9 @@ void ScrollingTextInitialiseBitmaps() ScrollingTextInitialiseScrollingText(); } -static uint8_t* font_sprite_get_codepoint_bitmap(int32_t codepoint) +static uint8_t* FontSpriteGetCodepointBitmap(int32_t codepoint) { - auto offset = font_sprite_get_codepoint_offset(codepoint); + auto offset = FontSpriteGetCodepointOffset(codepoint); if (offset >= FONT_SPRITE_GLYPH_COUNT) { return _characterBitmaps[offset - (SPR_G2_CHAR_BEGIN - SPR_CHAR_START) + FONT_SPRITE_GLYPH_COUNT]; @@ -120,7 +120,7 @@ static uint8_t* font_sprite_get_codepoint_bitmap(int32_t codepoint) return _characterBitmaps[offset]; } -static int32_t scrolling_text_get_matching_or_oldest( +static int32_t ScrollingTextGetMatchingOrOldest( StringId stringId, Formatter& ft, uint16_t scroll, uint16_t scrollingMode, colour_t colour) { uint32_t oldestId = 0xFFFFFFFF; @@ -146,7 +146,7 @@ static int32_t scrolling_text_get_matching_or_oldest( return scrollIndex; } -static void scrolling_text_format(utf8* dst, size_t size, rct_draw_scroll_text* scrollText) +static void ScrollingTextFormat(utf8* dst, size_t size, rct_draw_scroll_text* scrollText) { if (gConfigGeneral.UpperCaseBanners) { @@ -1447,7 +1447,7 @@ ImageId ScrollingTextSetup( _drawSCrollNextIndex++; ft.Rewind(); - int32_t scrollIndex = scrolling_text_get_matching_or_oldest(stringId, ft, scroll, scrollingMode, colour); + int32_t scrollIndex = ScrollingTextGetMatchingOrOldest(stringId, ft, scroll, scrollingMode, colour); if (scrollIndex >= SPR_SCROLLING_TEXT_START) return ImageId(scrollIndex); @@ -1462,26 +1462,26 @@ ImageId ScrollingTextSetup( // Create the string to draw utf8 scrollString[256]; - scrolling_text_format(scrollString, 256, scrollText); + ScrollingTextFormat(scrollString, 256, scrollText); const int16_t* scrollingModePositions = _scrollPositions[scrollingMode]; std::fill_n(scrollText->bitmap, 320 * 8, 0x00); if (LocalisationService_UseTrueTypeFont()) { - scrolling_text_set_bitmap_for_ttf(scrollString, scroll, scrollText->bitmap, scrollingModePositions, colour); + ScrollingTextSetBitmapForTTF(scrollString, scroll, scrollText->bitmap, scrollingModePositions, colour); } else { - scrolling_text_set_bitmap_for_sprite(scrollString, scroll, scrollText->bitmap, scrollingModePositions, colour); + ScrollingTextSetBitmapForSprite(scrollString, scroll, scrollText->bitmap, scrollingModePositions, colour); } uint32_t imageId = SPR_SCROLLING_TEXT_START + scrollIndex; - drawing_engine_invalidate_image(imageId); + DrawingEngineInvalidateImage(imageId); return ImageId(imageId); } -static void scrolling_text_set_bitmap_for_sprite( +static void ScrollingTextSetBitmapForSprite( std::string_view text, int32_t scroll, uint8_t* bitmap, const int16_t* scrollPositionOffsets, colour_t colour) { auto characterColour = colour; @@ -1497,8 +1497,8 @@ static void scrolling_text_set_bitmap_for_sprite( CodepointView codepoints(token.text); for (auto codepoint : codepoints) { - auto characterWidth = font_sprite_get_codepoint_width(FontStyle::Tiny, codepoint); - auto characterBitmap = font_sprite_get_codepoint_bitmap(codepoint); + auto characterWidth = FontSpriteGetCodepointWidth(FontStyle::Tiny, codepoint); + auto characterBitmap = FontSpriteGetCodepointBitmap(codepoint); for (; characterWidth != 0; characterWidth--, characterBitmap++) { // Skip any non-displayed columns @@ -1541,14 +1541,14 @@ static void scrolling_text_set_bitmap_for_sprite( } } -static void scrolling_text_set_bitmap_for_ttf( +static void ScrollingTextSetBitmapForTTF( std::string_view text, int32_t scroll, uint8_t* bitmap, const int16_t* scrollPositionOffsets, colour_t colour) { #ifndef NO_TTF - auto fontDesc = ttf_get_font_from_sprite_base(FontStyle::Tiny); + auto fontDesc = TTFGetFontFromSpriteBase(FontStyle::Tiny); if (fontDesc->font == nullptr) { - scrolling_text_set_bitmap_for_sprite(text, scroll, bitmap, scrollPositionOffsets, colour); + ScrollingTextSetBitmapForSprite(text, scroll, bitmap, scrollPositionOffsets, colour); return; } @@ -1573,7 +1573,7 @@ static void scrolling_text_set_bitmap_for_ttf( } } - auto surface = ttf_surface_cache_get_or_add(fontDesc->font, ttfBuffer.c_str()); + auto surface = TTFSurfaceCacheGetOrAdd(fontDesc->font, ttfBuffer.c_str()); if (surface == nullptr) { return; diff --git a/src/openrct2/drawing/TTF.cpp b/src/openrct2/drawing/TTF.cpp index d9e608c3c0..b961e2eb98 100644 --- a/src/openrct2/drawing/TTF.cpp +++ b/src/openrct2/drawing/TTF.cpp @@ -59,14 +59,14 @@ static int32_t _ttfGetWidthCacheMissCount = 0; static std::mutex _mutex; -static TTF_Font* ttf_open_font(const utf8* fontPath, int32_t ptSize); -static void ttf_close_font(TTF_Font* font); -static void ttf_surface_cache_dispose(ttf_cache_entry* entry); -static void ttf_surface_cache_dispose_all(); -static void ttf_getwidth_cache_dispose_all(); -static bool ttf_get_size(TTF_Font* font, std::string_view text, int32_t* outWidth, int32_t* outHeight); -static void ttf_toggle_hinting(bool); -static TTFSurface* ttf_render(TTF_Font* font, std::string_view text); +static TTF_Font* TTFOpenFont(const utf8* fontPath, int32_t ptSize); +static void TTFCloseFont(TTF_Font* font); +static void TTFSurfaceCacheDispose(ttf_cache_entry* entry); +static void TTFSurfaceCacheDisposeAll(); +static void TTFGetWidthCacheDisposeAll(); +static bool TTFGetSize(TTF_Font* font, std::string_view text, int32_t* outWidth, int32_t* outHeight); +static void TTFToggleHinting(bool); +static TTFSurface* TTFRender(TTF_Font* font, std::string_view text); template class FontLockHelper { @@ -88,7 +88,7 @@ public: } }; -static void ttf_toggle_hinting(bool) +static void TTFToggleHinting(bool) { if (!LocalisationService_UseTrueTypeFont()) { @@ -104,11 +104,11 @@ static void ttf_toggle_hinting(bool) if (_ttfSurfaceCacheCount) { - ttf_surface_cache_dispose_all(); + TTFSurfaceCacheDisposeAll(); } } -bool ttf_initialise() +bool TTFInitialise() { FontLockHelper lock(_mutex); @@ -132,7 +132,7 @@ bool ttf_initialise() return false; } - fontDesc->font = ttf_open_font(fontPath.c_str(), fontDesc->ptSize); + fontDesc->font = TTFOpenFont(fontPath.c_str(), fontDesc->ptSize); if (fontDesc->font == nullptr) { log_verbose("Unable to load '%s'", fontPath.c_str()); @@ -140,29 +140,29 @@ bool ttf_initialise() } } - ttf_toggle_hinting(true); + TTFToggleHinting(true); _ttfInitialised = true; return true; } -void ttf_dispose() +void TTFDispose() { FontLockHelper lock(_mutex); if (!_ttfInitialised) return; - ttf_surface_cache_dispose_all(); - ttf_getwidth_cache_dispose_all(); + TTFSurfaceCacheDisposeAll(); + TTFGetWidthCacheDisposeAll(); for (int32_t i = 0; i < FontStyleCount; i++) { TTFFontDescriptor* fontDesc = &(gCurrentTTFFontSet->size[i]); if (fontDesc->font != nullptr) { - ttf_close_font(fontDesc->font); + TTFCloseFont(fontDesc->font); fontDesc->font = nullptr; } } @@ -172,17 +172,17 @@ void ttf_dispose() _ttfInitialised = false; } -static TTF_Font* ttf_open_font(const utf8* fontPath, int32_t ptSize) +static TTF_Font* TTFOpenFont(const utf8* fontPath, int32_t ptSize) { return TTF_OpenFont(fontPath, ptSize); } -static void ttf_close_font(TTF_Font* font) +static void TTFCloseFont(TTF_Font* font) { TTF_CloseFont(font); } -static uint32_t ttf_surface_cache_hash(TTF_Font* font, std::string_view text) +static uint32_t TTFSurfaceCacheHash(TTF_Font* font, std::string_view text) { uint32_t hash = static_cast(((reinterpret_cast(font) * 23) ^ 0xAAAAAAAA) & 0xFFFFFFFF); for (auto c : text) @@ -192,11 +192,11 @@ static uint32_t ttf_surface_cache_hash(TTF_Font* font, std::string_view text) return hash; } -static void ttf_surface_cache_dispose(ttf_cache_entry* entry) +static void TTFSurfaceCacheDispose(ttf_cache_entry* entry) { if (entry->surface != nullptr) { - ttf_free_surface(entry->surface); + TTFFreeSurface(entry->surface); free(entry->text); entry->surface = nullptr; @@ -205,26 +205,26 @@ static void ttf_surface_cache_dispose(ttf_cache_entry* entry) } } -static void ttf_surface_cache_dispose_all() +static void TTFSurfaceCacheDisposeAll() { for (int32_t i = 0; i < TTF_SURFACE_CACHE_SIZE; i++) { - ttf_surface_cache_dispose(&_ttfSurfaceCache[i]); + TTFSurfaceCacheDispose(&_ttfSurfaceCache[i]); _ttfSurfaceCacheCount--; } } -void ttf_toggle_hinting() +void TTFToggleHinting() { FontLockHelper lock(_mutex); - ttf_toggle_hinting(true); + TTFToggleHinting(true); } -TTFSurface* ttf_surface_cache_get_or_add(TTF_Font* font, std::string_view text) +TTFSurface* TTFSurfaceCacheGetOrAdd(TTF_Font* font, std::string_view text) { ttf_cache_entry* entry; - uint32_t hash = ttf_surface_cache_hash(font, text); + uint32_t hash = TTFSurfaceCacheHash(font, text); int32_t index = hash % TTF_SURFACE_CACHE_SIZE; FontLockHelper lock(_mutex); @@ -256,9 +256,9 @@ TTFSurface* ttf_surface_cache_get_or_add(TTF_Font* font, std::string_view text) // Cache miss, replace entry with new surface entry = &_ttfSurfaceCache[index]; - ttf_surface_cache_dispose(entry); + TTFSurfaceCacheDispose(entry); - TTFSurface* surface = ttf_render(font, text); + TTFSurface* surface = TTFRender(font, text); if (surface == nullptr) { return nullptr; @@ -275,7 +275,7 @@ TTFSurface* ttf_surface_cache_get_or_add(TTF_Font* font, std::string_view text) return entry->surface; } -static void ttf_getwidth_cache_dispose(ttf_getwidth_cache_entry* entry) +static void TTFGetWidthCacheDispose(ttf_getwidth_cache_entry* entry) { if (entry->text != nullptr) { @@ -287,20 +287,20 @@ static void ttf_getwidth_cache_dispose(ttf_getwidth_cache_entry* entry) } } -static void ttf_getwidth_cache_dispose_all() +static void TTFGetWidthCacheDisposeAll() { for (int32_t i = 0; i < TTF_GETWIDTH_CACHE_SIZE; i++) { - ttf_getwidth_cache_dispose(&_ttfGetWidthCache[i]); + TTFGetWidthCacheDispose(&_ttfGetWidthCache[i]); _ttfGetWidthCacheCount--; } } -uint32_t ttf_getwidth_cache_get_or_add(TTF_Font* font, std::string_view text) +uint32_t TTFGetWidthCacheGetOrAdd(TTF_Font* font, std::string_view text) { ttf_getwidth_cache_entry* entry; - uint32_t hash = ttf_surface_cache_hash(font, text); + uint32_t hash = TTFSurfaceCacheHash(font, text); int32_t index = hash % TTF_GETWIDTH_CACHE_SIZE; FontLockHelper lock(_mutex); @@ -332,10 +332,10 @@ uint32_t ttf_getwidth_cache_get_or_add(TTF_Font* font, std::string_view text) // Cache miss, replace entry with new width entry = &_ttfGetWidthCache[index]; - ttf_getwidth_cache_dispose(entry); + TTFGetWidthCacheDispose(entry); int32_t width, height; - ttf_get_size(font, text, &width, &height); + TTFGetSize(font, text, &width, &height); _ttfGetWidthCacheMissCount++; @@ -347,25 +347,25 @@ uint32_t ttf_getwidth_cache_get_or_add(TTF_Font* font, std::string_view text) return entry->width; } -TTFFontDescriptor* ttf_get_font_from_sprite_base(FontStyle fontStyle) +TTFFontDescriptor* TTFGetFontFromSpriteBase(FontStyle fontStyle) { FontLockHelper lock(_mutex); return &gCurrentTTFFontSet->size[EnumValue(fontStyle)]; } -bool ttf_provides_glyph(const TTF_Font* font, codepoint_t codepoint) +bool TTFProvidesGlyph(const TTF_Font* font, codepoint_t codepoint) { return TTF_GlyphIsProvided(font, codepoint); } -static bool ttf_get_size(TTF_Font* font, std::string_view text, int32_t* outWidth, int32_t* outHeight) +static bool TTFGetSize(TTF_Font* font, std::string_view text, int32_t* outWidth, int32_t* outHeight) { thread_local std::string buffer; buffer.assign(text); return TTF_SizeUTF8(font, buffer.c_str(), outWidth, outHeight); } -static TTFSurface* ttf_render(TTF_Font* font, std::string_view text) +static TTFSurface* TTFRender(TTF_Font* font, std::string_view text) { thread_local std::string buffer; buffer.assign(text); @@ -377,7 +377,7 @@ static TTFSurface* ttf_render(TTF_Font* font, std::string_view text) return TTF_RenderUTF8_Solid(font, buffer.c_str(), 0x000000FF); } -void ttf_free_surface(TTFSurface* surface) +void TTFFreeSurface(TTFSurface* surface) { free(const_cast(surface->pixels)); free(surface); @@ -387,12 +387,12 @@ void ttf_free_surface(TTFSurface* surface) # include "TTF.h" -bool ttf_initialise() +bool TTFInitialise() { return false; } -void ttf_dispose() +void TTFDispose() { } diff --git a/src/openrct2/drawing/TTF.h b/src/openrct2/drawing/TTF.h index 5f38f9c3d7..9cdf83fc94 100644 --- a/src/openrct2/drawing/TTF.h +++ b/src/openrct2/drawing/TTF.h @@ -13,8 +13,8 @@ #include -bool ttf_initialise(); -void ttf_dispose(); +bool TTFInitialise(); +void TTFDispose(); #ifndef NO_TTF @@ -26,12 +26,12 @@ struct TTFSurface int32_t pitch; }; -TTFFontDescriptor* ttf_get_font_from_sprite_base(FontStyle fontStyle); -void ttf_toggle_hinting(); -TTFSurface* ttf_surface_cache_get_or_add(TTF_Font* font, std::string_view text); -uint32_t ttf_getwidth_cache_get_or_add(TTF_Font* font, std::string_view text); -bool ttf_provides_glyph(const TTF_Font* font, codepoint_t codepoint); -void ttf_free_surface(TTFSurface* surface); +TTFFontDescriptor* TTFGetFontFromSpriteBase(FontStyle fontStyle); +void TTFToggleHinting(); +TTFSurface* TTFSurfaceCacheGetOrAdd(TTF_Font* font, std::string_view text); +uint32_t TTFGetWidthCacheGetOrAdd(TTF_Font* font, std::string_view text); +bool TTFProvidesGlyph(const TTF_Font* font, codepoint_t codepoint); +void TTFFreeSurface(TTFSurface* surface); // TTF_SDLPORT int TTF_Init(void); diff --git a/src/openrct2/drawing/TTFSDLPort.cpp b/src/openrct2/drawing/TTFSDLPort.cpp index f75557ea8c..8a822b8e99 100644 --- a/src/openrct2/drawing/TTFSDLPort.cpp +++ b/src/openrct2/drawing/TTFSDLPort.cpp @@ -1325,7 +1325,7 @@ TTFSurface* TTF_RenderUTF8_Solid(TTF_Font* font, const char* text, [[maybe_unuse if (error) { TTF_SetFTError("Couldn't find glyph", error); - ttf_free_surface(textbuf); + TTFFreeSurface(textbuf); return NULL; } glyph = font->current; @@ -1458,7 +1458,7 @@ TTFSurface* TTF_RenderUTF8_Shaded(TTF_Font* font, const char* text, [[maybe_unus if (error) { TTF_SetFTError("Couldn't find glyph", error); - ttf_free_surface(textbuf); + TTFFreeSurface(textbuf); return NULL; } diff --git a/src/openrct2/drawing/Text.cpp b/src/openrct2/drawing/Text.cpp index 13ddb6039d..b635723b89 100644 --- a/src/openrct2/drawing/Text.cpp +++ b/src/openrct2/drawing/Text.cpp @@ -36,7 +36,7 @@ public: MaxWidth = GfxWrapString(Buffer, width, paint.FontStyle, &LineCount); LineCount += 1; - LineHeight = font_get_line_height(paint.FontStyle); + LineHeight = FontGetLineHeight(paint.FontStyle); } void Draw(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords) @@ -100,7 +100,7 @@ static void DrawText( break; } - TtfDrawString(dpi, text, paint.Colour, alignedCoords, noFormatting, paint.FontStyle, paint.Darkness); + TTFDrawString(dpi, text, paint.Colour, alignedCoords, noFormatting, paint.FontStyle, paint.Darkness); if (paint.UnderlineText == TextUnderline::On) { diff --git a/src/openrct2/drawing/X8DrawingEngine.cpp b/src/openrct2/drawing/X8DrawingEngine.cpp index 26f3de827a..685cd559cc 100644 --- a/src/openrct2/drawing/X8DrawingEngine.cpp +++ b/src/openrct2/drawing/X8DrawingEngine.cpp @@ -122,7 +122,7 @@ X8DrawingEngine::X8DrawingEngine([[maybe_unused]] const std::shared_ptr()) { @@ -2798,7 +2798,7 @@ void Peep::Paint(PaintSession& session, int32_t imageDirection) const return; } - LightfxAdd3DLight(*this, 0, loc, LightType::Spot1); + LightFXAdd3DLight(*this, 0, loc, LightType::Spot1); } } diff --git a/src/openrct2/interface/Chat.cpp b/src/openrct2/interface/Chat.cpp index 4e08ae36fe..c307f7ed10 100644 --- a/src/openrct2/interface/Chat.cpp +++ b/src/openrct2/interface/Chat.cpp @@ -280,7 +280,7 @@ static int32_t ChatHistoryDrawString( int32_t numLines; GfxWrapString(bufferPtr, width, FontStyle::Medium, &numLines); - auto lineHeight = font_get_line_height(FontStyle::Medium); + auto lineHeight = FontGetLineHeight(FontStyle::Medium); int32_t expectedY = screenCoords.y - (numLines * lineHeight); if (expectedY < 50) @@ -308,7 +308,7 @@ int32_t ChatStringWrappedGetHeight(void* args, int32_t width) int32_t numLines; GfxWrapString(bufferPtr, width, FontStyle::Medium, &numLines); - int32_t lineHeight = font_get_line_height(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); int32_t lineY = 0; for (int32_t line = 0; line <= numLines; ++line) diff --git a/src/openrct2/interface/Fonts.cpp b/src/openrct2/interface/Fonts.cpp index 4441a6db4a..3a1add3207 100644 --- a/src/openrct2/interface/Fonts.cpp +++ b/src/openrct2/interface/Fonts.cpp @@ -107,7 +107,7 @@ TTFFontSetDescriptor TTFFontMicroHei = { { static void LoadSpriteFont(LocalisationService& localisationService) { - ttf_dispose(); + TTFDispose(); localisationService.UseTrueTypeFont(false); #ifndef NO_TTF gCurrentTTFFontSet = nullptr; @@ -120,8 +120,8 @@ static bool LoadFont(LocalisationService& localisationService, TTFFontSetDescrip localisationService.UseTrueTypeFont(true); gCurrentTTFFontSet = font; - ttf_dispose(); - bool fontInitialised = ttf_initialise(); + TTFDispose(); + bool fontInitialised = TTFInitialise(); return fontInitialised; } @@ -136,11 +136,11 @@ static bool LoadCustomConfigFont(LocalisationService& localisationService) gConfigFonts.OffsetY, gConfigFonts.HeightMedium, gConfigFonts.HintingThreshold, nullptr }, } }; - ttf_dispose(); + TTFDispose(); localisationService.UseTrueTypeFont(true); gCurrentTTFFontSet = &TTFFontCustom; - bool fontInitialised = ttf_initialise(); + bool fontInitialised = TTFInitialise(); return fontInitialised; } #endif // NO_TTF diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 7b5899d561..c95c17a466 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -1172,7 +1172,7 @@ static int32_t ConsoleCommandSet(InteractiveConsole& console, const arguments_t& gConfigFonts.EnableHinting = (int_val[0] != 0); ConfigSaveDefault(); console.Execute("get enable_hinting"); - ttf_toggle_hinting(); + TTFToggleHinting(); } #endif else if (invalidArgs) diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index 7004663335..ed3812ab4d 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -504,11 +504,11 @@ int32_t CmdlineForGfxbench(const char** argv, int32_t argc) std::unique_ptr context(CreateContext()); if (context->Initialise()) { - drawing_engine_init(); + DrawingEngineInit(); BenchgfxRenderScreenshots(inputPath, context, iterationCount); - drawing_engine_dispose(); + DrawingEngineDispose(); } return 1; @@ -602,7 +602,7 @@ int32_t CmdlineForScreenshot(const char** argv, int32_t argc, ScreenshotOptions* throw std::runtime_error("Failed to initialize context."); } - drawing_engine_init(); + DrawingEngineInit(); if (!context->LoadParkFromFile(inputPath)) { @@ -699,7 +699,7 @@ int32_t CmdlineForScreenshot(const char** argv, int32_t argc, ScreenshotOptions* } ReleaseDPI(dpi); - drawing_engine_dispose(); + DrawingEngineDispose(); return exitCode; } diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 909f4abeb8..ac4cb359d5 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -364,7 +364,7 @@ static void ViewportRedrawAfterShift( if (abs(coords.x) < viewport->width && abs(coords.y) < viewport->height) { // update whole block ? - drawing_engine_copy_rect(viewport->pos.x, viewport->pos.y, viewport->width, viewport->height, coords.x, coords.y); + DrawingEngineCopyRect(viewport->pos.x, viewport->pos.y, viewport->width, viewport->height, coords.x, coords.y); if (coords.x > 0) { @@ -478,9 +478,9 @@ static void ViewportMove(const ScreenCoordsXY& coords, rct_window* w, rct_viewpo if (top >= bottom) return; - if (drawing_engine_has_dirty_optimisations()) + if (DrawingEngineHasDirtyOptimisations()) { - rct_drawpixelinfo* dpi = drawing_engine_get_dpi(); + rct_drawpixelinfo* dpi = DrawingEngineGetDpi(); WindowDrawAll(dpi, left, top, right, bottom); return; } @@ -530,9 +530,9 @@ static void ViewportMove(const ScreenCoordsXY& coords, rct_window* w, rct_viewpo return; } - if (drawing_engine_has_dirty_optimisations()) + if (DrawingEngineHasDirtyOptimisations()) { - rct_drawpixelinfo* dpi = drawing_engine_get_dpi(); + rct_drawpixelinfo* dpi = DrawingEngineGetDpi(); ViewportShiftPixels(dpi, w, viewport, x_diff, y_diff); } diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index b139283bf4..bb414e7902 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -211,6 +211,8 @@ + + @@ -1011,4 +1013,4 @@ - + \ No newline at end of file diff --git a/src/openrct2/localisation/Formatting.cpp b/src/openrct2/localisation/Formatting.cpp index e5680acc1c..81179f3541 100644 --- a/src/openrct2/localisation/Formatting.cpp +++ b/src/openrct2/localisation/Formatting.cpp @@ -402,7 +402,7 @@ namespace OpenRCT2 // Currency symbol auto symbol = currencyDesc->symbol_unicode; auto affix = currencyDesc->affix_unicode; - if (!font_supports_string(symbol, FontStyle::Medium)) + if (!FontSupportsString(symbol, FontStyle::Medium)) { symbol = currencyDesc->symbol_ascii; affix = currencyDesc->affix_ascii; diff --git a/src/openrct2/object/BannerObject.cpp b/src/openrct2/object/BannerObject.cpp index 5e4c5a9e64..a3ebe8244d 100644 --- a/src/openrct2/object/BannerObject.cpp +++ b/src/openrct2/object/BannerObject.cpp @@ -62,13 +62,13 @@ void BannerObject::Load() { GetStringTable().Sort(); _legacyType.name = language_allocate_object_string(GetName()); - _legacyType.image = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + _legacyType.image = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); } void BannerObject::Unload() { language_free_object_string(_legacyType.name); - gfx_object_free_images(_legacyType.image, GetImageTable().GetCount()); + GfxObjectFreeImages(_legacyType.image, GetImageTable().GetCount()); _legacyType.name = 0; _legacyType.image = 0; diff --git a/src/openrct2/object/EntranceObject.cpp b/src/openrct2/object/EntranceObject.cpp index ada08700da..a06b986293 100644 --- a/src/openrct2/object/EntranceObject.cpp +++ b/src/openrct2/object/EntranceObject.cpp @@ -30,13 +30,13 @@ void EntranceObject::Load() { GetStringTable().Sort(); _legacyType.string_idx = language_allocate_object_string(GetName()); - _legacyType.image_id = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + _legacyType.image_id = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); } void EntranceObject::Unload() { language_free_object_string(_legacyType.string_idx); - gfx_object_free_images(_legacyType.image_id, GetImageTable().GetCount()); + GfxObjectFreeImages(_legacyType.image_id, GetImageTable().GetCount()); _legacyType.string_idx = 0; _legacyType.image_id = 0; diff --git a/src/openrct2/object/FootpathItemObject.cpp b/src/openrct2/object/FootpathItemObject.cpp index e4dede6a5d..09bc17a218 100644 --- a/src/openrct2/object/FootpathItemObject.cpp +++ b/src/openrct2/object/FootpathItemObject.cpp @@ -66,7 +66,7 @@ void FootpathItemObject::Load() { GetStringTable().Sort(); _legacyType.name = language_allocate_object_string(GetName()); - _legacyType.image = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + _legacyType.image = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); _legacyType.scenery_tab_id = OBJECT_ENTRY_INDEX_NULL; } @@ -74,7 +74,7 @@ void FootpathItemObject::Load() void FootpathItemObject::Unload() { language_free_object_string(_legacyType.name); - gfx_object_free_images(_legacyType.image, GetImageTable().GetCount()); + GfxObjectFreeImages(_legacyType.image, GetImageTable().GetCount()); _legacyType.name = 0; _legacyType.image = 0; diff --git a/src/openrct2/object/FootpathObject.cpp b/src/openrct2/object/FootpathObject.cpp index 73c26998c3..0c3c76d50e 100644 --- a/src/openrct2/object/FootpathObject.cpp +++ b/src/openrct2/object/FootpathObject.cpp @@ -38,7 +38,7 @@ void FootpathObject::Load() { GetStringTable().Sort(); _legacyType.string_idx = language_allocate_object_string(GetName()); - _legacyType.image = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + _legacyType.image = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); _legacyType.bridge_image = _legacyType.image + 109; _pathSurfaceDescriptor.Name = _legacyType.string_idx; @@ -63,7 +63,7 @@ void FootpathObject::Load() void FootpathObject::Unload() { language_free_object_string(_legacyType.string_idx); - gfx_object_free_images(_legacyType.image, GetImageTable().GetCount()); + GfxObjectFreeImages(_legacyType.image, GetImageTable().GetCount()); _legacyType.string_idx = 0; _legacyType.image = 0; diff --git a/src/openrct2/object/FootpathRailingsObject.cpp b/src/openrct2/object/FootpathRailingsObject.cpp index 6df9fd3c02..27d55f5a84 100644 --- a/src/openrct2/object/FootpathRailingsObject.cpp +++ b/src/openrct2/object/FootpathRailingsObject.cpp @@ -21,7 +21,7 @@ void FootpathRailingsObject::Load() auto numImages = GetImageTable().GetCount(); if (numImages != 0) { - PreviewImageId = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + PreviewImageId = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); BridgeImageId = PreviewImageId + 37; RailingsImageId = PreviewImageId + 1; } @@ -39,7 +39,7 @@ void FootpathRailingsObject::Load() void FootpathRailingsObject::Unload() { language_free_object_string(NameStringId); - gfx_object_free_images(PreviewImageId, GetImageTable().GetCount()); + GfxObjectFreeImages(PreviewImageId, GetImageTable().GetCount()); NameStringId = 0; PreviewImageId = 0; diff --git a/src/openrct2/object/FootpathSurfaceObject.cpp b/src/openrct2/object/FootpathSurfaceObject.cpp index bb34b68a35..35a68722ba 100644 --- a/src/openrct2/object/FootpathSurfaceObject.cpp +++ b/src/openrct2/object/FootpathSurfaceObject.cpp @@ -22,7 +22,7 @@ void FootpathSurfaceObject::Load() auto numImages = GetImageTable().GetCount(); if (numImages != 0) { - PreviewImageId = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + PreviewImageId = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); BaseImageId = PreviewImageId + 1; } @@ -35,7 +35,7 @@ void FootpathSurfaceObject::Load() void FootpathSurfaceObject::Unload() { language_free_object_string(NameStringId); - gfx_object_free_images(PreviewImageId, GetImageTable().GetCount()); + GfxObjectFreeImages(PreviewImageId, GetImageTable().GetCount()); NameStringId = 0; PreviewImageId = 0; diff --git a/src/openrct2/object/LargeSceneryObject.cpp b/src/openrct2/object/LargeSceneryObject.cpp index 98d7cd8ca7..8db79fc1aa 100644 --- a/src/openrct2/object/LargeSceneryObject.cpp +++ b/src/openrct2/object/LargeSceneryObject.cpp @@ -109,7 +109,7 @@ void LargeSceneryObject::Load() { GetStringTable().Sort(); _legacyType.name = language_allocate_object_string(GetName()); - _baseImageId = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + _baseImageId = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); _legacyType.image = _baseImageId; _legacyType.tiles = _tiles.data(); @@ -132,7 +132,7 @@ void LargeSceneryObject::Load() void LargeSceneryObject::Unload() { language_free_object_string(_legacyType.name); - gfx_object_free_images(_baseImageId, GetImageTable().GetCount()); + GfxObjectFreeImages(_baseImageId, GetImageTable().GetCount()); _legacyType.name = 0; _baseImageId = _legacyType.image = 0; diff --git a/src/openrct2/object/MusicObject.cpp b/src/openrct2/object/MusicObject.cpp index 0a1db0abcf..d3f8791d1c 100644 --- a/src/openrct2/object/MusicObject.cpp +++ b/src/openrct2/object/MusicObject.cpp @@ -74,7 +74,7 @@ void MusicObject::Load() } _hasPreview = !!GetImageTable().GetCount(); - _previewImageId = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + _previewImageId = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); } void MusicObject::Unload() diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index f596da2e3c..952476cf53 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -206,7 +206,7 @@ void RideObject::Load() _legacyType.naming.Name = language_allocate_object_string(GetName()); _legacyType.naming.Description = language_allocate_object_string(GetDescription()); _legacyType.capacity = language_allocate_object_string(GetCapacity()); - _legacyType.images_offset = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + _legacyType.images_offset = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); _legacyType.vehicle_preset_list = &_presetColours; int32_t currentCarImagesOffset = _legacyType.images_offset + RCT2::ObjectLimits::MaxRideTypesPerRideEntry; @@ -275,7 +275,7 @@ void RideObject::Unload() language_free_object_string(_legacyType.naming.Name); language_free_object_string(_legacyType.naming.Description); language_free_object_string(_legacyType.capacity); - gfx_object_free_images(_legacyType.images_offset, GetImageTable().GetCount()); + GfxObjectFreeImages(_legacyType.images_offset, GetImageTable().GetCount()); _legacyType.naming.Name = 0; _legacyType.naming.Description = 0; diff --git a/src/openrct2/object/SceneryGroupObject.cpp b/src/openrct2/object/SceneryGroupObject.cpp index 7de4f9e64b..2985f55bb0 100644 --- a/src/openrct2/object/SceneryGroupObject.cpp +++ b/src/openrct2/object/SceneryGroupObject.cpp @@ -57,14 +57,14 @@ void SceneryGroupObject::Load() { GetStringTable().Sort(); _legacyType.name = language_allocate_object_string(GetName()); - _legacyType.image = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + _legacyType.image = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); _legacyType.SceneryEntries.clear(); } void SceneryGroupObject::Unload() { language_free_object_string(_legacyType.name); - gfx_object_free_images(_legacyType.image, GetImageTable().GetCount()); + GfxObjectFreeImages(_legacyType.image, GetImageTable().GetCount()); _legacyType.name = 0; _legacyType.image = 0; diff --git a/src/openrct2/object/SmallSceneryObject.cpp b/src/openrct2/object/SmallSceneryObject.cpp index 0dab3a3ea7..6ec554c3ab 100644 --- a/src/openrct2/object/SmallSceneryObject.cpp +++ b/src/openrct2/object/SmallSceneryObject.cpp @@ -75,7 +75,7 @@ void SmallSceneryObject::Load() { GetStringTable().Sort(); _legacyType.name = language_allocate_object_string(GetName()); - _legacyType.image = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + _legacyType.image = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); _legacyType.scenery_tab_id = OBJECT_ENTRY_INDEX_NULL; @@ -90,7 +90,7 @@ void SmallSceneryObject::Load() void SmallSceneryObject::Unload() { language_free_object_string(_legacyType.name); - gfx_object_free_images(_legacyType.image, GetImageTable().GetCount()); + GfxObjectFreeImages(_legacyType.image, GetImageTable().GetCount()); _legacyType.name = 0; _legacyType.image = 0; diff --git a/src/openrct2/object/StationObject.cpp b/src/openrct2/object/StationObject.cpp index 3483b9ca5b..5aaf4bd2d2 100644 --- a/src/openrct2/object/StationObject.cpp +++ b/src/openrct2/object/StationObject.cpp @@ -25,7 +25,7 @@ void StationObject::Load() auto numImages = GetImageTable().GetCount(); if (numImages != 0) { - BaseImageId = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + BaseImageId = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); uint32_t shelterOffset = (Flags & STATION_OBJECT_FLAGS::IS_TRANSPARENT) ? 32 : 16; if (numImages > shelterOffset) @@ -38,7 +38,7 @@ void StationObject::Load() void StationObject::Unload() { language_free_object_string(NameStringId); - gfx_object_free_images(BaseImageId, GetImageTable().GetCount()); + GfxObjectFreeImages(BaseImageId, GetImageTable().GetCount()); NameStringId = 0; BaseImageId = ImageIndexUndefined; diff --git a/src/openrct2/object/TerrainEdgeObject.cpp b/src/openrct2/object/TerrainEdgeObject.cpp index 63ef73090c..b20bc9fd1b 100644 --- a/src/openrct2/object/TerrainEdgeObject.cpp +++ b/src/openrct2/object/TerrainEdgeObject.cpp @@ -22,7 +22,7 @@ void TerrainEdgeObject::Load() { GetStringTable().Sort(); NameStringId = language_allocate_object_string(GetName()); - IconImageId = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + IconImageId = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); // First image is icon followed by edge images BaseImageId = IconImageId + 1; @@ -31,7 +31,7 @@ void TerrainEdgeObject::Load() void TerrainEdgeObject::Unload() { language_free_object_string(NameStringId); - gfx_object_free_images(IconImageId, GetImageTable().GetCount()); + GfxObjectFreeImages(IconImageId, GetImageTable().GetCount()); NameStringId = 0; IconImageId = 0; diff --git a/src/openrct2/object/TerrainSurfaceObject.cpp b/src/openrct2/object/TerrainSurfaceObject.cpp index 3b63fe0922..d522e55ba0 100644 --- a/src/openrct2/object/TerrainSurfaceObject.cpp +++ b/src/openrct2/object/TerrainSurfaceObject.cpp @@ -25,7 +25,7 @@ void TerrainSurfaceObject::Load() { GetStringTable().Sort(); NameStringId = language_allocate_object_string(GetName()); - IconImageId = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + IconImageId = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); if ((Flags & SMOOTH_WITH_SELF) || (Flags & SMOOTH_WITH_OTHER)) { PatternBaseImageId = IconImageId + 1; @@ -41,7 +41,7 @@ void TerrainSurfaceObject::Load() void TerrainSurfaceObject::Unload() { language_free_object_string(NameStringId); - gfx_object_free_images(IconImageId, GetImageTable().GetCount()); + GfxObjectFreeImages(IconImageId, GetImageTable().GetCount()); NameStringId = 0; IconImageId = 0; diff --git a/src/openrct2/object/WallObject.cpp b/src/openrct2/object/WallObject.cpp index 1943b49130..0d08b5d14d 100644 --- a/src/openrct2/object/WallObject.cpp +++ b/src/openrct2/object/WallObject.cpp @@ -56,13 +56,13 @@ void WallObject::Load() { GetStringTable().Sort(); _legacyType.name = language_allocate_object_string(GetName()); - _legacyType.image = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + _legacyType.image = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); } void WallObject::Unload() { language_free_object_string(_legacyType.name); - gfx_object_free_images(_legacyType.image, GetImageTable().GetCount()); + GfxObjectFreeImages(_legacyType.image, GetImageTable().GetCount()); _legacyType.name = 0; _legacyType.image = 0; diff --git a/src/openrct2/object/WaterObject.cpp b/src/openrct2/object/WaterObject.cpp index 73c053a9d7..ddbae7a05d 100644 --- a/src/openrct2/object/WaterObject.cpp +++ b/src/openrct2/object/WaterObject.cpp @@ -38,7 +38,7 @@ void WaterObject::Load() { GetStringTable().Sort(); _legacyType.string_idx = language_allocate_object_string(GetName()); - _legacyType.image_id = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount()); + _legacyType.image_id = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount()); _legacyType.palette_index_1 = _legacyType.image_id + 1; _legacyType.palette_index_2 = _legacyType.image_id + 4; @@ -47,7 +47,7 @@ void WaterObject::Load() void WaterObject::Unload() { - gfx_object_free_images(_legacyType.image_id, GetImageTable().GetCount()); + GfxObjectFreeImages(_legacyType.image_id, GetImageTable().GetCount()); language_free_object_string(_legacyType.string_idx); _legacyType.string_idx = 0; diff --git a/src/openrct2/paint/Paint.Entity.cpp b/src/openrct2/paint/Paint.Entity.cpp index ae1b69bf55..19545393fa 100644 --- a/src/openrct2/paint/Paint.Entity.cpp +++ b/src/openrct2/paint/Paint.Entity.cpp @@ -117,9 +117,9 @@ void EntityPaintSetup(PaintSession& session, const CoordsXY& pos) { case EntityType::Vehicle: spr->As()->Paint(session, image_direction); - if (lightfx_for_vehicles_is_available()) + if (LightFXForVehiclesIsAvailable()) { - LightfxAddLightsMagicVehicle(spr->As()); + LightFXAddLightsMagicVehicle(spr->As()); } break; case EntityType::Guest: diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 5d87aec0a3..fe5ca03a68 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -912,7 +912,7 @@ void PaintDrawMoneyStructs(rct_drawpixelinfo* dpi, PaintStringStruct* ps) // Use sprite font unless the currency contains characters unsupported by the sprite font auto forceSpriteFont = false; const auto& currencyDesc = CurrencyDescriptors[EnumValue(gConfigGeneral.CurrencyFormat)]; - if (LocalisationService_UseTrueTypeFont() && font_supports_string_sprite(currencyDesc.symbol_unicode)) + if (LocalisationService_UseTrueTypeFont() && FontSupportsStringSprite(currencyDesc.symbol_unicode)) { forceSpriteFont = true; } diff --git a/src/openrct2/paint/tile_element/Paint.Entrance.cpp b/src/openrct2/paint/tile_element/Paint.Entrance.cpp index cc5c11fe78..c64bbbdee2 100644 --- a/src/openrct2/paint/tile_element/Paint.Entrance.cpp +++ b/src/openrct2/paint/tile_element/Paint.Entrance.cpp @@ -81,26 +81,26 @@ static void PaintRideEntranceExitLightEffects(PaintSession& session, int32_t hei { PROFILED_FUNCTION(); - if (lightfx_is_available()) + if (LightFXIsAvailable()) { if (entranceEl.GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE) { - lightfx_add_3d_light_magic_from_drawing_tile(session.MapPosition, 0, 0, height + 45, LightType::Lantern3); + LightFXAdd3DLightMagicFromDrawingTile(session.MapPosition, 0, 0, height + 45, LightType::Lantern3); } switch (entranceEl.GetDirection()) { case 0: - lightfx_add_3d_light_magic_from_drawing_tile(session.MapPosition, 16, 0, height + 16, LightType::Lantern2); + LightFXAdd3DLightMagicFromDrawingTile(session.MapPosition, 16, 0, height + 16, LightType::Lantern2); break; case 1: - lightfx_add_3d_light_magic_from_drawing_tile(session.MapPosition, 0, -16, height + 16, LightType::Lantern2); + LightFXAdd3DLightMagicFromDrawingTile(session.MapPosition, 0, -16, height + 16, LightType::Lantern2); break; case 2: - lightfx_add_3d_light_magic_from_drawing_tile(session.MapPosition, -16, 0, height + 16, LightType::Lantern2); + LightFXAdd3DLightMagicFromDrawingTile(session.MapPosition, -16, 0, height + 16, LightType::Lantern2); break; case 3: - lightfx_add_3d_light_magic_from_drawing_tile(session.MapPosition, 0, 16, height + 16, LightType::Lantern2); + LightFXAdd3DLightMagicFromDrawingTile(session.MapPosition, 0, 16, height + 16, LightType::Lantern2); break; } } @@ -253,9 +253,9 @@ static void PaintParkEntranceLightEffects(PaintSession& session) { PROFILED_FUNCTION(); - if (lightfx_is_available()) + if (LightFXIsAvailable()) { - lightfx_add_3d_light_magic_from_drawing_tile(session.MapPosition, 0, 0, 155, LightType::Lantern3); + LightFXAdd3DLightMagicFromDrawingTile(session.MapPosition, 0, 0, 155, LightType::Lantern3); } } diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index 2d2978a62a..65c74fe582 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -934,7 +934,7 @@ static void PaintLampLightEffects(PaintSession& session, const PathElement& path { PROFILED_FUNCTION(); - if (lightfx_is_available()) + if (LightFXIsAvailable()) { if (pathEl.HasAddition() && !(pathEl.IsBroken())) { @@ -943,19 +943,19 @@ static void PaintLampLightEffects(PaintSession& session, const PathElement& path { if (!(pathEl.GetEdges() & EDGE_NE)) { - lightfx_add_3d_light_magic_from_drawing_tile(session.MapPosition, -16, 0, height + 23, LightType::Lantern3); + LightFXAdd3DLightMagicFromDrawingTile(session.MapPosition, -16, 0, height + 23, LightType::Lantern3); } if (!(pathEl.GetEdges() & EDGE_SE)) { - lightfx_add_3d_light_magic_from_drawing_tile(session.MapPosition, 0, 16, height + 23, LightType::Lantern3); + LightFXAdd3DLightMagicFromDrawingTile(session.MapPosition, 0, 16, height + 23, LightType::Lantern3); } if (!(pathEl.GetEdges() & EDGE_SW)) { - lightfx_add_3d_light_magic_from_drawing_tile(session.MapPosition, 16, 0, height + 23, LightType::Lantern3); + LightFXAdd3DLightMagicFromDrawingTile(session.MapPosition, 16, 0, height + 23, LightType::Lantern3); } if (!(pathEl.GetEdges() & EDGE_NW)) { - lightfx_add_3d_light_magic_from_drawing_tile(session.MapPosition, 0, -16, height + 23, LightType::Lantern3); + LightFXAdd3DLightMagicFromDrawingTile(session.MapPosition, 0, -16, height + 23, LightType::Lantern3); } } } diff --git a/src/openrct2/ride/TrackPaint.cpp b/src/openrct2/ride/TrackPaint.cpp index 7be8113180..9eee144f90 100644 --- a/src/openrct2/ride/TrackPaint.cpp +++ b/src/openrct2/ride/TrackPaint.cpp @@ -2204,7 +2204,7 @@ void PaintTrack(PaintSession& session, Direction direction, int32_t height, cons } } - if (lightfx_is_available()) + if (LightFXIsAvailable()) { uint8_t zOffset = 16; const auto& rtd = ride->GetRideTypeDescriptor();