mirror of https://github.com/OpenRCT2/OpenRCT2.git
Implement #1260: --transparent switch for screenshot command
This commit is contained in:
parent
f5ac98c1e2
commit
bffc012d16
|
@ -24,6 +24,7 @@ static constexpr const CommandLineOptionDefinition ScreenshotOptionsDef[]
|
|||
{ CMDLINE_TYPE_SWITCH, &options.fix_vandalism, NAC, "fix-vandalism", "fix vandalism for the screenshot" },
|
||||
{ CMDLINE_TYPE_SWITCH, &options.remove_litter, NAC, "remove-litter", "remove litter for the screenshot" },
|
||||
{ CMDLINE_TYPE_SWITCH, &options.tidy_up_park, NAC, "tidy-up-park", "clear grass, water plants, fix vandalism and remove litter" },
|
||||
{ CMDLINE_TYPE_SWITCH, &options.transparent, NAC, "transparent", "make the background transparent" },
|
||||
OptionTableEnd
|
||||
};
|
||||
|
||||
|
|
|
@ -562,6 +562,8 @@ int32_t cmdline_for_screenshot(const char** argv, int32_t argc, ScreenshotOption
|
|||
dpi.bits = (uint8_t*)malloc(dpi.width * dpi.height);
|
||||
dpi.DrawingEngine = context->GetDrawingEngine();
|
||||
|
||||
std::memset(dpi.bits, PALETTE_INDEX_0, dpi.width * dpi.height);
|
||||
|
||||
if (options->hide_guests)
|
||||
{
|
||||
viewport.flags |= VIEWPORT_FLAG_INVISIBLE_PEEPS;
|
||||
|
@ -597,6 +599,11 @@ int32_t cmdline_for_screenshot(const char** argv, int32_t argc, ScreenshotOption
|
|||
CheatsSet(CheatType::RemoveLitter);
|
||||
}
|
||||
|
||||
if (options->transparent)
|
||||
{
|
||||
viewport.flags |= VIEWPORT_FLAG_TRANSPARENT_BACKGROUND;
|
||||
}
|
||||
|
||||
viewport_render(&dpi, &viewport, 0, 0, viewport.width, viewport.height);
|
||||
|
||||
rct_palette renderedPalette;
|
||||
|
|
|
@ -28,6 +28,7 @@ struct ScreenshotOptions
|
|||
bool fix_vandalism = false;
|
||||
bool remove_litter = false;
|
||||
bool tidy_up_park = false;
|
||||
bool transparent = false;
|
||||
};
|
||||
|
||||
void screenshot_check();
|
||||
|
|
|
@ -46,6 +46,7 @@ enum
|
|||
VIEWPORT_FLAG_SEETHROUGH_PATHS = (1 << 16),
|
||||
VIEWPORT_FLAG_CLIP_VIEW = (1 << 17),
|
||||
VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES = (1 << 18),
|
||||
VIEWPORT_FLAG_TRANSPARENT_BACKGROUND = (1 << 19),
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
|
@ -57,7 +57,7 @@ void tile_element_paint_setup(paint_session* session, int32_t x, int32_t y)
|
|||
|
||||
sub_68B3FB(session, x, y);
|
||||
}
|
||||
else
|
||||
else if (!(session->ViewFlags & VIEWPORT_FLAG_TRANSPARENT_BACKGROUND))
|
||||
{
|
||||
blank_tiles_paint(session, x, y);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ void sub_68B2B7(paint_session* session, int32_t x, int32_t y)
|
|||
|
||||
sub_68B3FB(session, x, y);
|
||||
}
|
||||
else
|
||||
else if (!(session->ViewFlags & VIEWPORT_FLAG_TRANSPARENT_BACKGROUND))
|
||||
{
|
||||
blank_tiles_paint(session, x, y);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue