mirror of https://github.com/OpenRCT2/OpenRCT2.git
Make gfx_draw_sprite_raw_masked_software use ScreenCoordsXY object
This commit is contained in:
parent
0f106da7eb
commit
ec33551b24
|
@ -595,8 +595,8 @@ void FASTCALL gfx_sprite_to_buffer(DrawSpriteArgs& args)
|
|||
*
|
||||
* rct2: 0x00681DE2
|
||||
*/
|
||||
void FASTCALL
|
||||
gfx_draw_sprite_raw_masked_software(rct_drawpixelinfo* dpi, int32_t x, int32_t y, int32_t maskImage, int32_t colourImage)
|
||||
void FASTCALL gfx_draw_sprite_raw_masked_software(
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& scrCoords, int32_t maskImage, int32_t colourImage)
|
||||
{
|
||||
int32_t left, top, right, bottom, width, height;
|
||||
auto imgMask = gfx_get_g1_element(maskImage & 0x7FFFF);
|
||||
|
@ -609,7 +609,7 @@ void FASTCALL
|
|||
// Only BMP format is supported for masking
|
||||
if (!(imgMask->flags & G1_FLAG_BMP) || !(imgColour->flags & G1_FLAG_BMP))
|
||||
{
|
||||
gfx_draw_sprite_software(dpi, ImageId::FromUInt32(colourImage), { x, y });
|
||||
gfx_draw_sprite_software(dpi, ImageId::FromUInt32(colourImage), scrCoords);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -623,21 +623,20 @@ void FASTCALL
|
|||
width = std::min(imgMask->width, imgColour->width);
|
||||
height = std::min(imgMask->height, imgColour->height);
|
||||
|
||||
x += imgMask->x_offset;
|
||||
y += imgMask->y_offset;
|
||||
auto offsetCoords = scrCoords + ScreenCoordsXY{ imgMask->x_offset, imgMask->y_offset };
|
||||
|
||||
left = std::max<int32_t>(dpi->x, x);
|
||||
top = std::max<int32_t>(dpi->y, y);
|
||||
right = std::min(dpi->x + dpi->width, x + width);
|
||||
bottom = std::min(dpi->y + dpi->height, y + height);
|
||||
left = std::max<int32_t>(dpi->x, offsetCoords.x);
|
||||
top = std::max<int32_t>(dpi->y, offsetCoords.y);
|
||||
right = std::min(dpi->x + dpi->width, offsetCoords.x + width);
|
||||
bottom = std::min(dpi->y + dpi->height, offsetCoords.y + height);
|
||||
|
||||
width = right - left;
|
||||
height = bottom - top;
|
||||
if (width < 0 || height < 0)
|
||||
return;
|
||||
|
||||
int32_t skipX = left - x;
|
||||
int32_t skipY = top - y;
|
||||
int32_t skipX = left - offsetCoords.x;
|
||||
int32_t skipY = top - offsetCoords.y;
|
||||
|
||||
uint8_t const* maskSrc = imgMask->offset + (skipY * imgMask->width) + skipX;
|
||||
uint8_t const* colourSrc = imgColour->offset + (skipY * imgColour->width) + skipX;
|
||||
|
|
|
@ -637,8 +637,8 @@ void FASTCALL gfx_draw_sprite_solid(rct_drawpixelinfo* dpi, int32_t image, const
|
|||
void FASTCALL gfx_draw_sprite_software(rct_drawpixelinfo* dpi, ImageId imageId, const ScreenCoordsXY& spriteCoords);
|
||||
void FASTCALL gfx_draw_sprite_palette_set_software(
|
||||
rct_drawpixelinfo* dpi, ImageId imageId, const ScreenCoordsXY& coords, const PaletteMap& paletteMap);
|
||||
void FASTCALL
|
||||
gfx_draw_sprite_raw_masked_software(rct_drawpixelinfo* dpi, int32_t x, int32_t y, int32_t maskImage, int32_t colourImage);
|
||||
void FASTCALL gfx_draw_sprite_raw_masked_software(
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& scrCoords, int32_t maskImage, int32_t colourImage);
|
||||
|
||||
// string
|
||||
void gfx_draw_string(rct_drawpixelinfo* dpi, const_utf8string buffer, uint8_t colour, const ScreenCoordsXY& coords);
|
||||
|
|
|
@ -735,7 +735,7 @@ void X8DrawingContext::DrawSprite(uint32_t image, int32_t x, int32_t y, uint32_t
|
|||
|
||||
void X8DrawingContext::DrawSpriteRawMasked(int32_t x, int32_t y, uint32_t maskImage, uint32_t colourImage)
|
||||
{
|
||||
gfx_draw_sprite_raw_masked_software(_dpi, x, y, maskImage, colourImage);
|
||||
gfx_draw_sprite_raw_masked_software(_dpi, { x, y }, maskImage, colourImage);
|
||||
}
|
||||
|
||||
void X8DrawingContext::DrawSpriteSolid(uint32_t image, int32_t x, int32_t y, uint8_t colour)
|
||||
|
|
Loading…
Reference in New Issue