1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Merge pull request #25282 from ZehMatt/force-redraw

Add force redraw debug paint option
This commit is contained in:
Matt
2025-10-02 22:53:01 +03:00
committed by GitHub
7 changed files with 28 additions and 7 deletions

View File

@@ -3842,3 +3842,4 @@ STR_7000 :or
STR_7001 :Ride name
STR_7002 :{STRINGID} {STRINGID}
STR_7003 :Audio file {STRING} is truncated. Expected sample {INT32}, but only {INT32} are available. Consider reinstalling RCT2.
STR_7004 :Force Redraw

View File

@@ -474,6 +474,7 @@ namespace OpenRCT2
STR_DEBUG_PAINT_SHOW_SEGMENT_HEIGHTS = 5901,
STR_DEBUG_PAINT_SHOW_WIDE_PATHS = 6261,
STR_DEBUG_PAINT_STABLE_SORT = 6710,
STR_DEBUG_PAINT_FORCE_REDRAW = 7004,
// Window: DemolishRidePrompt
STR_DEMOLISH = 994,

View File

@@ -366,7 +366,7 @@ public:
void PaintWindows() override
{
if (ClimateHasWeatherEffect())
if (ClimateHasWeatherEffect() || gPaintForceRedraw)
{
WindowUpdateAllViewports();
// OpenGL doesn't support restoring pixels, always redraw.

View File

@@ -29,9 +29,10 @@ namespace OpenRCT2::Ui::Windows
WIDX_TOGGLE_SHOW_BOUND_BOXES,
WIDX_TOGGLE_SHOW_DIRTY_VISUALS,
WIDX_TOGGLE_STABLE_PAINT_SORT,
WIDX_TOGGLE_FORCE_REDRAW,
};
static constexpr ScreenSize kWindowSize = { 200, 8 + (15 * 6) + 8 };
static constexpr ScreenSize kWindowSize = { 200, 8 + (15 * 7) + 8 };
// clang-format off
static constexpr Widget window_debug_paint_widgets[] = {
@@ -42,6 +43,7 @@ namespace OpenRCT2::Ui::Windows
makeWidget({8, 8 + 15 * 3}, { 185, 12}, WidgetType::checkbox, WindowColour::secondary, STR_DEBUG_PAINT_SHOW_BOUND_BOXES ),
makeWidget({8, 8 + 15 * 4}, { 185, 12}, WidgetType::checkbox, WindowColour::secondary, STR_DEBUG_PAINT_SHOW_DIRTY_VISUALS ),
makeWidget({8, 8 + 15 * 5}, { 185, 12}, WidgetType::checkbox, WindowColour::secondary, STR_DEBUG_PAINT_STABLE_SORT ),
makeWidget({8, 8 + 15 * 6}, { 185, 12}, WidgetType::checkbox, WindowColour::secondary, STR_DEBUG_PAINT_FORCE_REDRAW ),
};
// clang-format on
@@ -97,6 +99,11 @@ namespace OpenRCT2::Ui::Windows
gPaintStableSort = !gPaintStableSort;
GfxInvalidateScreen();
break;
case WIDX_TOGGLE_FORCE_REDRAW:
gPaintForceRedraw = !gPaintForceRedraw;
GfxInvalidateScreen();
break;
}
}
@@ -143,6 +150,7 @@ namespace OpenRCT2::Ui::Windows
setCheckboxValue(WIDX_TOGGLE_SHOW_BOUND_BOXES, gPaintBoundingBoxes);
setCheckboxValue(WIDX_TOGGLE_SHOW_DIRTY_VISUALS, gShowDirtyVisuals);
setCheckboxValue(WIDX_TOGGLE_STABLE_PAINT_SORT, gPaintStableSort);
setCheckboxValue(WIDX_TOGGLE_FORCE_REDRAW, gPaintForceRedraw);
}
void onDraw(RenderTarget& rt) override

View File

@@ -87,6 +87,8 @@ uint8_t gTextPalette[0x8] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
bool gPaintForceRedraw{ false };
enum
{
SPR_PALETTE_3100 = 3100,

View File

@@ -505,6 +505,7 @@ extern const TranslucentWindowPalette kTranslucentWindowPalettes[COLOUR_COUNT];
extern ImageId gPickupPeepImage;
extern int32_t gPickupPeepX;
extern int32_t gPickupPeepY;
extern bool gPaintForceRedraw;
bool ClipDrawPixelInfo(RenderTarget& dst, RenderTarget& src, const ScreenCoordsXY& coords, int32_t width, int32_t height);
void GfxSetDirtyBlocks(const ScreenRect& rect);

View File

@@ -184,11 +184,19 @@ void X8DrawingEngine::EndDraw()
void X8DrawingEngine::PaintWindows()
{
// Redraw dirty regions before updating the viewports, otherwise
// when viewports get panned, they copy dirty pixels
DrawAllDirtyBlocks();
WindowUpdateAllViewports();
DrawAllDirtyBlocks();
if (gPaintForceRedraw)
{
WindowUpdateAllViewports();
WindowDrawAll(_mainRT, 0, 0, _width, _height);
}
else
{
// Redraw dirty regions before updating the viewports, otherwise
// when viewports get panned, they copy dirty pixels
DrawAllDirtyBlocks();
WindowUpdateAllViewports();
DrawAllDirtyBlocks();
}
}
void X8DrawingEngine::PaintWeather()