diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 32fe590066..b6affaa324 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -2389,7 +2389,7 @@ static void sub_6CBCE2( rct_drawpixelinfo* dpi, ride_id_t rideIndex, int32_t trackType, int32_t trackDirection, int32_t liftHillAndInvertedState, const CoordsXY& originCoords, int32_t originZ) { - paint_session* session = paint_session_alloc(dpi, 0); + paint_session* session = PaintSessionAlloc(dpi, 0); trackDirection &= 3; auto ride = get_ride(rideIndex); @@ -2469,9 +2469,9 @@ static void sub_6CBCE2( gMapSize = preserveMapSize; gMapSizeMaxXY = preserveMapSizeMaxXY; - paint_session_arrange(session); - paint_draw_structs(session); - paint_session_free(session); + PaintSessionArrange(session); + PaintDrawStructs(session); + PaintSessionFree(session); } /** diff --git a/src/openrct2/cmdline/BenchSpriteSort.cpp b/src/openrct2/cmdline/BenchSpriteSort.cpp index e73d5c53fd..db59000371 100644 --- a/src/openrct2/cmdline/BenchSpriteSort.cpp +++ b/src/openrct2/cmdline/BenchSpriteSort.cpp @@ -147,7 +147,7 @@ static void BM_paint_session_arrange(benchmark::State& state, const std::vector< state.PauseTiming(); std::copy_n(local_s, std::size(sessions), sessions.begin()); state.ResumeTiming(); - paint_session_arrange(&sessions[0]); + PaintSessionArrange(&sessions[0]); benchmark::DoNotOptimize(sessions); } state.SetItemsProcessed(state.iterations() * std::size(sessions)); diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index a6ac793a39..d0efeee57f 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -305,11 +305,11 @@ void lightfx_prepare_light_list() dpi.zoom_level = _current_view_zoom_front; dpi.width = 1; - paint_session* session = paint_session_alloc(&dpi, w->viewport->flags); - paint_session_generate(session); - paint_session_arrange(session); + paint_session* session = PaintSessionAlloc(&dpi, w->viewport->flags); + PaintSessionGenerate(session); + PaintSessionArrange(session); auto info = set_interaction_info_from_paint_session(session, VIEWPORT_INTERACTION_MASK_NONE); - paint_session_free(session); + PaintSessionFree(session); // log_warning("[%i, %i]", dpi->x, dpi->y); diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 5214ec53a3..d91aa0fa31 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -857,12 +857,12 @@ static void record_session(const paint_session* session, std::vector* recorded_sessions, size_t record_index) { - paint_session_generate(session); + PaintSessionGenerate(session); if (recorded_sessions != nullptr) { record_session(session, recorded_sessions, record_index); } - paint_session_arrange(session); + PaintSessionArrange(session); } static void viewport_paint_column(paint_session* session) @@ -880,7 +880,7 @@ static void viewport_paint_column(paint_session* session) gfx_clear(&session->DPI, colour); } - paint_draw_structs(session); + PaintDrawStructs(session); if (gConfigGeneral.render_weather_gloom && !gTrackDesignSaveMode && !(session->ViewFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES) && !(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) @@ -890,10 +890,10 @@ static void viewport_paint_column(paint_session* session) if (session->PSStringHead != nullptr) { - paint_draw_money_structs(&session->DPI, session->PSStringHead); + PaintDrawMoneyStructs(&session->DPI, session->PSStringHead); } - paint_session_free(session); + PaintSessionFree(session); } /** @@ -970,7 +970,7 @@ void viewport_paint( // Splits the area into 32 pixel columns and renders them for (x = alignedX; x < rightBorder; x += 32, index++) { - paint_session* session = paint_session_alloc(&dpi1, viewFlags); + paint_session* session = PaintSessionAlloc(&dpi1, viewFlags); columns.push_back(session); rct_drawpixelinfo& dpi2 = session->DPI; @@ -1676,11 +1676,11 @@ InteractionInfo get_map_coordinates_from_pos_window(rct_window* window, const Sc dpi.zoom_level = myviewport->zoom; dpi.width = 1; - paint_session* session = paint_session_alloc(&dpi, myviewport->flags); - paint_session_generate(session); - paint_session_arrange(session); + paint_session* session = PaintSessionAlloc(&dpi, myviewport->flags); + PaintSessionGenerate(session); + PaintSessionArrange(session); info = set_interaction_info_from_paint_session(session, flags & 0xFFFF); - paint_session_free(session); + PaintSessionFree(session); } return info; } diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index f7dd2b8fde..0348a1ebad 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -50,13 +50,12 @@ bool gShowDirtyVisuals; bool gPaintBoundingBoxes; bool gPaintBlockedTiles; -static void paint_attached_ps(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t viewFlags); -static void paint_ps_image_with_bounding_boxes( - rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y); -static void paint_ps_image(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y); -static uint32_t paint_ps_colourify_image(uint32_t imageId, uint8_t spriteType, uint32_t viewFlags); +static void PaintAttachedPS(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t viewFlags); +static void PaintPSImageWithBoundingBoxes(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y); +static void PaintPSImage(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y); +static uint32_t PaintPSColourifyImage(uint32_t imageId, uint8_t spriteType, uint32_t viewFlags); -static void paint_session_add_ps_to_quadrant(paint_session* session, paint_struct* ps, int32_t positionHash) +static void PaintSessionAddPSToQuadrant(paint_session* session, paint_struct* ps, int32_t positionHash) { uint32_t paintQuadrantIndex = std::clamp(positionHash / 32, 0, MAX_PAINT_QUADRANTS - 1); ps->quadrant_index = paintQuadrantIndex; @@ -159,7 +158,7 @@ static paint_struct* sub_9819_c( * * rct2: 0x0068B6C2 */ -void paint_session_generate(paint_session* session) +void PaintSessionGenerate(paint_session* session) { rct_drawpixelinfo* dpi = &session->DPI; LocationXY16 mapTile = { static_cast(dpi->x & 0xFFE0), static_cast((dpi->y - 16) & 0xFFE0) }; @@ -268,12 +267,12 @@ void paint_session_generate(paint_session* session) } template -static bool check_bounding_box(const paint_struct_bound_box& initialBBox, const paint_struct_bound_box& currentBBox) +static bool CheckBoundingBox(const paint_struct_bound_box& initialBBox, const paint_struct_bound_box& currentBBox) { return false; } -template<> bool check_bounding_box<0>(const paint_struct_bound_box& initialBBox, const paint_struct_bound_box& currentBBox) +template<> bool CheckBoundingBox<0>(const paint_struct_bound_box& initialBBox, const paint_struct_bound_box& currentBBox) { if (initialBBox.z_end >= currentBBox.z && initialBBox.y_end >= currentBBox.y && initialBBox.x_end >= currentBBox.x && !(initialBBox.z < currentBBox.z_end && initialBBox.y < currentBBox.y_end && initialBBox.x < currentBBox.x_end)) @@ -283,7 +282,7 @@ template<> bool check_bounding_box<0>(const paint_struct_bound_box& initialBBox, return false; } -template<> bool check_bounding_box<1>(const paint_struct_bound_box& initialBBox, const paint_struct_bound_box& currentBBox) +template<> bool CheckBoundingBox<1>(const paint_struct_bound_box& initialBBox, const paint_struct_bound_box& currentBBox) { if (initialBBox.z_end >= currentBBox.z && initialBBox.y_end >= currentBBox.y && initialBBox.x_end < currentBBox.x && !(initialBBox.z < currentBBox.z_end && initialBBox.y < currentBBox.y_end && initialBBox.x >= currentBBox.x_end)) @@ -293,7 +292,7 @@ template<> bool check_bounding_box<1>(const paint_struct_bound_box& initialBBox, return false; } -template<> bool check_bounding_box<2>(const paint_struct_bound_box& initialBBox, const paint_struct_bound_box& currentBBox) +template<> bool CheckBoundingBox<2>(const paint_struct_bound_box& initialBBox, const paint_struct_bound_box& currentBBox) { if (initialBBox.z_end >= currentBBox.z && initialBBox.y_end < currentBBox.y && initialBBox.x_end < currentBBox.x && !(initialBBox.z < currentBBox.z_end && initialBBox.y >= currentBBox.y_end && initialBBox.x >= currentBBox.x_end)) @@ -303,7 +302,7 @@ template<> bool check_bounding_box<2>(const paint_struct_bound_box& initialBBox, return false; } -template<> bool check_bounding_box<3>(const paint_struct_bound_box& initialBBox, const paint_struct_bound_box& currentBBox) +template<> bool CheckBoundingBox<3>(const paint_struct_bound_box& initialBBox, const paint_struct_bound_box& currentBBox) { if (initialBBox.z_end >= currentBBox.z && initialBBox.y_end < currentBBox.y && initialBBox.x_end >= currentBBox.x && !(initialBBox.z < currentBBox.z_end && initialBBox.y >= currentBBox.y_end && initialBBox.x < currentBBox.x_end)) @@ -314,7 +313,7 @@ template<> bool check_bounding_box<3>(const paint_struct_bound_box& initialBBox, } template -static paint_struct* paint_arrange_structs_helper_rotation(paint_struct* ps_next, uint16_t quadrantIndex, uint8_t flag) +static paint_struct* PaintArrangeStructsHelperRotation(paint_struct* ps_next, uint16_t quadrantIndex, uint8_t flag) { paint_struct* ps; paint_struct* ps_temp; @@ -383,7 +382,7 @@ static paint_struct* paint_arrange_structs_helper_rotation(paint_struct* ps_next const paint_struct_bound_box& currentBBox = ps_next->bounds; - const bool compareResult = check_bounding_box<_TRotation>(initialBBox, currentBBox); + const bool compareResult = CheckBoundingBox<_TRotation>(initialBBox, currentBBox); if (compareResult) { @@ -399,18 +398,18 @@ static paint_struct* paint_arrange_structs_helper_rotation(paint_struct* ps_next } } -static paint_struct* paint_arrange_structs_helper(paint_struct* ps_next, uint16_t quadrantIndex, uint8_t flag, uint8_t rotation) +static paint_struct* PaintArrangeStructsHelper(paint_struct* ps_next, uint16_t quadrantIndex, uint8_t flag, uint8_t rotation) { switch (rotation) { case 0: - return paint_arrange_structs_helper_rotation<0>(ps_next, quadrantIndex, flag); + return PaintArrangeStructsHelperRotation<0>(ps_next, quadrantIndex, flag); case 1: - return paint_arrange_structs_helper_rotation<1>(ps_next, quadrantIndex, flag); + return PaintArrangeStructsHelperRotation<1>(ps_next, quadrantIndex, flag); case 2: - return paint_arrange_structs_helper_rotation<2>(ps_next, quadrantIndex, flag); + return PaintArrangeStructsHelperRotation<2>(ps_next, quadrantIndex, flag); case 3: - return paint_arrange_structs_helper_rotation<3>(ps_next, quadrantIndex, flag); + return PaintArrangeStructsHelperRotation<3>(ps_next, quadrantIndex, flag); } return nullptr; } @@ -419,7 +418,7 @@ static paint_struct* paint_arrange_structs_helper(paint_struct* ps_next, uint16_ * * rct2: 0x00688217 */ -void paint_session_arrange(paint_session* session) +void PaintSessionArrange(paint_session* session) { paint_struct* psHead = &session->PaintHead; @@ -444,18 +443,18 @@ void paint_session_arrange(paint_session* session) } } while (++quadrantIndex <= session->QuadrantFrontIndex); - paint_struct* ps_cache = paint_arrange_structs_helper( + paint_struct* ps_cache = PaintArrangeStructsHelper( psHead, session->QuadrantBackIndex & 0xFFFF, PAINT_QUADRANT_FLAG_NEXT, session->CurrentRotation); quadrantIndex = session->QuadrantBackIndex; while (++quadrantIndex < session->QuadrantFrontIndex) { - ps_cache = paint_arrange_structs_helper(ps_cache, quadrantIndex & 0xFFFF, 0, session->CurrentRotation); + ps_cache = PaintArrangeStructsHelper(ps_cache, quadrantIndex & 0xFFFF, 0, session->CurrentRotation); } } } -static void paint_draw_struct(paint_session* session, paint_struct* ps) +static void PaintDrawStruct(paint_session* session, paint_struct* ps) { rct_drawpixelinfo* dpi = &session->DPI; @@ -476,23 +475,23 @@ static void paint_draw_struct(paint_session* session, paint_struct* ps) } } - uint32_t imageId = paint_ps_colourify_image(ps->image_id, ps->sprite_type, session->ViewFlags); + uint32_t imageId = PaintPSColourifyImage(ps->image_id, ps->sprite_type, session->ViewFlags); if (gPaintBoundingBoxes && dpi->zoom_level == 0) { - paint_ps_image_with_bounding_boxes(dpi, ps, imageId, x, y); + PaintPSImageWithBoundingBoxes(dpi, ps, imageId, x, y); } else { - paint_ps_image(dpi, ps, imageId, x, y); + PaintPSImage(dpi, ps, imageId, x, y); } if (ps->children != nullptr) { - paint_draw_struct(session, ps->children); + PaintDrawStruct(session, ps->children); } else { - paint_attached_ps(dpi, ps, session->ViewFlags); + PaintAttachedPS(dpi, ps, session->ViewFlags); } } @@ -500,13 +499,13 @@ static void paint_draw_struct(paint_session* session, paint_struct* ps) * * rct2: 0x00688485 */ -void paint_draw_structs(paint_session* session) +void PaintDrawStructs(paint_session* session) { paint_struct* ps = &session->PaintHead; for (ps = ps->next_quadrant_ps; ps;) { - paint_draw_struct(session, ps); + PaintDrawStruct(session, ps); ps = ps->next_quadrant_ps; } @@ -517,14 +516,14 @@ void paint_draw_structs(paint_session* session) * rct2: 0x00688596 * Part of 0x688485 */ -static void paint_attached_ps(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t viewFlags) +static void PaintAttachedPS(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t viewFlags) { attached_paint_struct* attached_ps = ps->attached_ps; for (; attached_ps; attached_ps = attached_ps->next) { auto screenCoords = ScreenCoordsXY{ attached_ps->x + ps->x, attached_ps->y + ps->y }; - uint32_t imageId = paint_ps_colourify_image(attached_ps->image_id, ps->sprite_type, viewFlags); + uint32_t imageId = PaintPSColourifyImage(attached_ps->image_id, ps->sprite_type, viewFlags); if (attached_ps->flags & PAINT_STRUCT_FLAG_IS_MASKED) { gfx_draw_sprite_raw_masked(dpi, screenCoords, imageId, attached_ps->colour_image_id); @@ -536,7 +535,7 @@ static void paint_attached_ps(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t } } -static void paint_ps_image_with_bounding_boxes(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y) +static void PaintPSImageWithBoundingBoxes(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y) { const uint8_t colour = BoundBoxDebugColours[ps->sprite_type]; const uint8_t rotation = get_current_rotation(); @@ -612,7 +611,7 @@ static void paint_ps_image_with_bounding_boxes(rct_drawpixelinfo* dpi, paint_str gfx_draw_line(dpi, { screenCoordBackTop, screenCoordLeftTop }, colour); gfx_draw_line(dpi, { screenCoordBackTop, screenCoordRightTop }, colour); - paint_ps_image(dpi, ps, imageId, x, y); + PaintPSImage(dpi, ps, imageId, x, y); // vertical front gfx_draw_line(dpi, { screenCoordFrontTop, screenCoordFrontBottom }, colour); @@ -622,7 +621,7 @@ static void paint_ps_image_with_bounding_boxes(rct_drawpixelinfo* dpi, paint_str gfx_draw_line(dpi, { screenCoordFrontTop, screenCoordRightTop }, colour); } -static void paint_ps_image(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y) +static void PaintPSImage(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y) { if (ps->flags & PAINT_STRUCT_FLAG_IS_MASKED) { @@ -632,7 +631,7 @@ static void paint_ps_image(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t im gfx_draw_sprite(dpi, imageId, { x, y }, ps->tertiary_colour); } -static uint32_t paint_ps_colourify_image(uint32_t imageId, uint8_t spriteType, uint32_t viewFlags) +static uint32_t PaintPSColourifyImage(uint32_t imageId, uint8_t spriteType, uint32_t viewFlags) { constexpr uint32_t primaryColour = COLOUR_BRIGHT_YELLOW; constexpr uint32_t secondaryColour = COLOUR_GREY; @@ -681,12 +680,12 @@ static uint32_t paint_ps_colourify_image(uint32_t imageId, uint8_t spriteType, u return imageId; } -paint_session* paint_session_alloc(rct_drawpixelinfo* dpi, uint32_t viewFlags) +paint_session* PaintSessionAlloc(rct_drawpixelinfo* dpi, uint32_t viewFlags) { return GetContext()->GetPainter()->CreateSession(dpi, viewFlags); } -void paint_session_free([[maybe_unused]] paint_session* session) +void PaintSessionFree([[maybe_unused]] paint_session* session) { GetContext()->GetPainter()->ReleaseSession(session); } @@ -711,7 +710,7 @@ paint_struct* sub_98196C( assert(static_cast(bound_box_length_y) == static_cast(bound_box_length_y)); session->LastRootPS = nullptr; - session->UnkF1AD2C = nullptr; + session->LastAttachedPS = nullptr; if (session->NextFreePaintStruct >= session->EndOfPaintStructArray) { @@ -830,7 +829,7 @@ paint_struct* sub_98196C( positionHash = coord_3d.x - coord_3d.y + 0x2000; break; } - paint_session_add_ps_to_quadrant(session, ps, positionHash); + PaintSessionAddPSToQuadrant(session, ps, positionHash); session->NextFreePaintStruct++; @@ -859,7 +858,7 @@ paint_struct* sub_98197C( int16_t bound_box_offset_y, int16_t bound_box_offset_z) { session->LastRootPS = nullptr; - session->UnkF1AD2C = nullptr; + session->LastAttachedPS = nullptr; CoordsXYZ offset = { x_offset, y_offset, z_offset }; CoordsXYZ boundBoxSize = { bound_box_length_x, bound_box_length_y, bound_box_length_z }; @@ -889,7 +888,7 @@ paint_struct* sub_98197C( } int32_t positionHash = attach.x + attach.y; - paint_session_add_ps_to_quadrant(session, ps, positionHash); + PaintSessionAddPSToQuadrant(session, ps, positionHash); session->NextFreePaintStruct++; return ps; @@ -920,7 +919,7 @@ paint_struct* sub_98198C( assert(static_cast(bound_box_length_y) == static_cast(bound_box_length_y)); session->LastRootPS = nullptr; - session->UnkF1AD2C = nullptr; + session->LastAttachedPS = nullptr; CoordsXYZ offset = { x_offset, y_offset, z_offset }; CoordsXYZ boundBoxSize = { bound_box_length_x, bound_box_length_y, bound_box_length_z }; @@ -999,11 +998,11 @@ paint_struct* sub_98199C( * @param y (cx) * @return (!CF) success */ -bool paint_attach_to_previous_attach(paint_session* session, uint32_t image_id, int16_t x, int16_t y) +bool PaintAttachToPreviousAttach(paint_session* session, uint32_t image_id, int16_t x, int16_t y) { - if (session->UnkF1AD2C == nullptr) + if (session->LastAttachedPS == nullptr) { - return paint_attach_to_previous_ps(session, image_id, x, y); + return PaintAttachToPreviousPS(session, image_id, x, y); } if (session->NextFreePaintStruct >= session->EndOfPaintStructArray) @@ -1016,12 +1015,12 @@ bool paint_attach_to_previous_attach(paint_session* session, uint32_t image_id, ps->y = y; ps->flags = 0; - attached_paint_struct* ebx = session->UnkF1AD2C; + attached_paint_struct* previousAttachedPS = session->LastAttachedPS; ps->next = nullptr; - ebx->next = ps; + previousAttachedPS->next = ps; - session->UnkF1AD2C = ps; + session->LastAttachedPS = ps; session->NextFreePaintStruct++; @@ -1036,7 +1035,7 @@ bool paint_attach_to_previous_attach(paint_session* session, uint32_t image_id, * @param y (cx) * @return (!CF) success */ -bool paint_attach_to_previous_ps(paint_session* session, uint32_t image_id, int16_t x, int16_t y) +bool PaintAttachToPreviousPS(paint_session* session, uint32_t image_id, int16_t x, int16_t y) { if (session->NextFreePaintStruct >= session->EndOfPaintStructArray) { @@ -1062,7 +1061,7 @@ bool paint_attach_to_previous_ps(paint_session* session, uint32_t image_id, int1 ps->next = oldFirstAttached; - session->UnkF1AD2C = ps; + session->LastAttachedPS = ps; return true; } @@ -1077,7 +1076,7 @@ bool paint_attach_to_previous_ps(paint_session* session, uint32_t image_id, int1 * @param y_offsets (di) * @param rotation (ebp) */ -void paint_floating_money_effect( +void PaintFloatingMoneyEffect( paint_session* session, money32 amount, rct_string_id string_id, int16_t y, int16_t z, int8_t y_offsets[], int16_t offset_x, uint32_t rotation) { @@ -1122,7 +1121,7 @@ void paint_floating_money_effect( * * rct2: 0x006860C3 */ -void paint_draw_money_structs(rct_drawpixelinfo* dpi, paint_string_struct* ps) +void PaintDrawMoneyStructs(rct_drawpixelinfo* dpi, paint_string_struct* ps) { do { diff --git a/src/openrct2/paint/Paint.h b/src/openrct2/paint/Paint.h index 9eb9f19f3a..4e9950e186 100644 --- a/src/openrct2/paint/Paint.h +++ b/src/openrct2/paint/Paint.h @@ -148,7 +148,7 @@ struct paint_session paint_entry* NextFreePaintStruct; CoordsXY SpritePosition; paint_struct* LastRootPS; - attached_paint_struct* UnkF1AD2C; + attached_paint_struct* LastAttachedPS; ViewportInteractionItem InteractionType; uint8_t CurrentRotation; support_height SupportSegments[9]; @@ -218,18 +218,18 @@ paint_struct* sub_98199C_rotated( void paint_util_push_tunnel_rotated(paint_session* session, uint8_t direction, uint16_t height, uint8_t type); -bool paint_attach_to_previous_attach(paint_session* session, uint32_t image_id, int16_t x, int16_t y); -bool paint_attach_to_previous_ps(paint_session* session, uint32_t image_id, int16_t x, int16_t y); -void paint_floating_money_effect( +bool PaintAttachToPreviousAttach(paint_session* session, uint32_t image_id, int16_t x, int16_t y); +bool PaintAttachToPreviousPS(paint_session* session, uint32_t image_id, int16_t x, int16_t y); +void PaintFloatingMoneyEffect( paint_session* session, money32 amount, rct_string_id string_id, int16_t y, int16_t z, int8_t y_offsets[], int16_t offset_x, uint32_t rotation); -paint_session* paint_session_alloc(rct_drawpixelinfo* dpi, uint32_t viewFlags); -void paint_session_free(paint_session* session); -void paint_session_generate(paint_session* session); -void paint_session_arrange(paint_session* session); -void paint_draw_structs(paint_session* session); -void paint_draw_money_structs(rct_drawpixelinfo* dpi, paint_string_struct* ps); +paint_session* PaintSessionAlloc(rct_drawpixelinfo* dpi, uint32_t viewFlags); +void PaintSessionFree(paint_session* session); +void PaintSessionGenerate(paint_session* session); +void PaintSessionArrange(paint_session* session); +void PaintDrawStructs(paint_session* session); +void PaintDrawMoneyStructs(rct_drawpixelinfo* dpi, paint_string_struct* ps); // TESTING #ifdef __TESTPAINT__ diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 597c05fcd3..74f79b1128 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -164,7 +164,7 @@ paint_session* Painter::CreateSession(rct_drawpixelinfo* dpi, uint32_t viewFlags session->EndOfPaintStructArray = &session->PaintStructs[4000 - 1]; session->NextFreePaintStruct = session->PaintStructs; session->LastRootPS = nullptr; - session->UnkF1AD2C = nullptr; + session->LastAttachedPS = nullptr; session->ViewFlags = viewFlags; for (auto& quadrant : session->Quadrants) { diff --git a/src/openrct2/paint/sprite/Paint.Misc.cpp b/src/openrct2/paint/sprite/Paint.Misc.cpp index b49c158d71..d199835636 100644 --- a/src/openrct2/paint/sprite/Paint.Misc.cpp +++ b/src/openrct2/paint/sprite/Paint.Misc.cpp @@ -55,7 +55,7 @@ void misc_paint(paint_session* session, const SpriteBase* misc, int32_t imageDir if (moneyEffect == nullptr) return; auto [stringId, value] = moneyEffect->GetStringId(); - paint_floating_money_effect( + PaintFloatingMoneyEffect( session, value, stringId, moneyEffect->y, moneyEffect->z, const_cast(&money_wave[moneyEffect->Wiggle % 22]), moneyEffect->OffsetX, session->CurrentRotation); break; diff --git a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp index 30211e6329..782e04c276 100644 --- a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp @@ -169,17 +169,17 @@ static void large_scenery_sign_paint_line( int32_t image_id = (textImage + glyph_offset + glyph_type) | textColour; if (direction == 3) { - paint_attach_to_previous_ps(session, image_id, x_offset, -div_to_minus_infinity(acc, 2)); + PaintAttachToPreviousPS(session, image_id, x_offset, -div_to_minus_infinity(acc, 2)); } else { if (text->flags & LARGE_SCENERY_TEXT_FLAG_VERTICAL) { - paint_attach_to_previous_ps(session, image_id, x_offset, div_to_minus_infinity(acc, 2)); + PaintAttachToPreviousPS(session, image_id, x_offset, div_to_minus_infinity(acc, 2)); } else { - paint_attach_to_previous_attach(session, image_id, x_offset, div_to_minus_infinity(acc, 2)); + PaintAttachToPreviousAttach(session, image_id, x_offset, div_to_minus_infinity(acc, 2)); } } x_offset += large_scenery_sign_get_glyph(text, codepoint)->width; diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index 60948bef0f..4a5abafd87 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -515,9 +515,9 @@ static void viewport_surface_smoothen_edge( const uint32_t image_id = maskImageBase + byte_97B444[self.slope]; - if (paint_attach_to_previous_ps(session, image_id, 0, 0)) + if (PaintAttachToPreviousPS(session, image_id, 0, 0)) { - attached_paint_struct* out = session->UnkF1AD2C; + attached_paint_struct* out = session->LastAttachedPS; // set content and enable masking out->colour_image_id = get_surface_pattern(neighbour.terrain, cl); out->flags |= PAINT_STRUCT_FLAG_IS_MASKED; @@ -844,7 +844,7 @@ static void viewport_surface_draw_tile_side_top( const uint8_t incline = (cornerHeight2 - cornerHeight1) + 1; const uint32_t image_id = get_edge_image(terrain, 3) + (edge == EDGE_TOPLEFT ? 3 : 0) + incline; // var_c; const int16_t y = (height - cornerHeight1) * COORDS_Z_PER_TINY_Z; - paint_attach_to_previous_ps(session, image_id, 0, y); + PaintAttachToPreviousPS(session, image_id, 0, y); return; } base_image_id = get_edge_image(terrain, 1) + (edge == EDGE_TOPLEFT ? 5 : 0); // var_04 @@ -1138,7 +1138,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_OWNED) { assert(surfaceShape < std::size(byte_97B444)); - paint_attach_to_previous_ps(session, SPR_TERRAIN_SELECTION_SQUARE + byte_97B444[surfaceShape], 0, 0); + PaintAttachToPreviousPS(session, SPR_TERRAIN_SELECTION_SQUARE + byte_97B444[surfaceShape], 0, 0); } else if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_AVAILABLE) { @@ -1155,7 +1155,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED) { assert(surfaceShape < std::size(byte_97B444)); - paint_attach_to_previous_ps(session, SPR_TERRAIN_SELECTION_DOTTED + byte_97B444[surfaceShape], 0, 0); + PaintAttachToPreviousPS(session, SPR_TERRAIN_SELECTION_DOTTED + byte_97B444[surfaceShape], 0, 0); } else if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) { @@ -1185,7 +1185,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c // loc_661089: const uint32_t eax = ((((mapSelectionType - 9) + rotation) & 3) + 0x21) << 19; const uint32_t image_id = (SPR_TERRAIN_SELECTION_EDGE + byte_97B444[surfaceShape]) | eax | IMAGE_TYPE_REMAP; - paint_attach_to_previous_ps(session, image_id, 0, 0); + PaintAttachToPreviousPS(session, image_id, 0, 0); } else if (mapSelectionType >= MAP_SELECT_TYPE_QUARTER_0) { @@ -1193,7 +1193,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c // Selection split into four quarter segments const uint32_t eax = ((((mapSelectionType - MAP_SELECT_TYPE_QUARTER_0) + rotation) & 3) + 0x27) << 19; const uint32_t image_id = (SPR_TERRAIN_SELECTION_QUARTER + byte_97B444[surfaceShape]) | eax | IMAGE_TYPE_REMAP; - paint_attach_to_previous_ps(session, image_id, 0, 0); + PaintAttachToPreviousPS(session, image_id, 0, 0); } else if (mapSelectionType <= MAP_SELECT_TYPE_FULL) { @@ -1206,7 +1206,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c eax = (eax + 0x21) << 19; const uint32_t image_id = (SPR_TERRAIN_SELECTION_CORNER + byte_97B444[surfaceShape]) | eax | IMAGE_TYPE_REMAP; - paint_attach_to_previous_ps(session, image_id, 0, 0); + PaintAttachToPreviousPS(session, image_id, 0, 0); } else { @@ -1241,7 +1241,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c } const uint32_t image_id = (SPR_TERRAIN_SELECTION_CORNER + byte_97B444[surfaceShape]) | colours | IMAGE_TYPE_REMAP; - paint_attach_to_previous_ps(session, image_id, 0, 0); + PaintAttachToPreviousPS(session, image_id, 0, 0); break; } } @@ -1260,7 +1260,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c { const uint8_t image_offset = byte_97B444[surfaceShape]; const uint32_t image_id = get_surface_image(session, terrain_type, image_offset, rotation, 1, false, true); - paint_attach_to_previous_ps(session, image_id, 0, 0); + PaintAttachToPreviousPS(session, image_id, 0, 0); } if (!(session->ViewFlags & VIEWPORT_FLAG_HIDE_VERTICAL)) @@ -1310,7 +1310,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c | PALETTE_WATER << 19; sub_98196C(session, image_id, 0, 0, 32, 32, -1, waterHeight); - paint_attach_to_previous_ps(session, SPR_WATER_OVERLAY + image_offset, 0, 0); + PaintAttachToPreviousPS(session, SPR_WATER_OVERLAY + image_offset, 0, 0); if (!(session->ViewFlags & VIEWPORT_FLAG_HIDE_VERTICAL)) { diff --git a/src/openrct2/ride/gentle/Dodgems.cpp b/src/openrct2/ride/gentle/Dodgems.cpp index 6ec10ab489..5d2cb7fe31 100644 --- a/src/openrct2/ride/gentle/Dodgems.cpp +++ b/src/openrct2/ride/gentle/Dodgems.cpp @@ -33,7 +33,7 @@ static void paint_dodgems_roof(paint_session* session, int32_t height, int32_t o sub_98196C(session, image_id, 0, 0, 32, 32, 2, height); image_id = (SPR_DODGEMS_ROOF_GLASS + offset) | (PALETTE_DARKEN_3 << 19) | IMAGE_TYPE_TRANSPARENT; - paint_attach_to_previous_ps(session, image_id, 0, 0); + PaintAttachToPreviousPS(session, image_id, 0, 0); } static void paint_dodgems( diff --git a/test/testpaint/PaintIntercept.cpp b/test/testpaint/PaintIntercept.cpp index 2f828be4b3..7198261f42 100644 --- a/test/testpaint/PaintIntercept.cpp +++ b/test/testpaint/PaintIntercept.cpp @@ -390,7 +390,7 @@ paint_struct* sub_98199C( bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, session->CurrentRotation); } -bool paint_attach_to_previous_ps(paint_session* session, uint32_t image_id, int16_t x, int16_t y) +bool PaintAttachToPreviousPS(paint_session* session, uint32_t image_id, int16_t x, int16_t y) { return false; }