mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 21:43:06 +01:00
Fix drawing of money text when zoomed in
This commit is contained in:
@@ -887,15 +887,10 @@ void OpenGLDrawingContext::DrawGlyph(uint32_t image, int32_t x, int32_t y, const
|
||||
|
||||
const auto texture = _textureCache->GetOrLoadGlyphTexture(image, palette);
|
||||
|
||||
int32_t drawOffsetX = g1Element->x_offset;
|
||||
int32_t drawOffsetY = g1Element->y_offset;
|
||||
int32_t drawWidth = static_cast<uint16_t>(g1Element->width);
|
||||
int32_t drawHeight = static_cast<uint16_t>(g1Element->height);
|
||||
|
||||
int32_t left = x + drawOffsetX;
|
||||
int32_t top = y + drawOffsetY;
|
||||
int32_t right = left + drawWidth;
|
||||
int32_t bottom = top + drawHeight;
|
||||
int32_t left = x + g1Element->x_offset;
|
||||
int32_t top = y + g1Element->y_offset;
|
||||
int32_t right = left + static_cast<uint16_t>(g1Element->width);
|
||||
int32_t bottom = top + static_cast<uint16_t>(g1Element->height);
|
||||
|
||||
if (left > right)
|
||||
{
|
||||
@@ -906,10 +901,20 @@ void OpenGLDrawingContext::DrawGlyph(uint32_t image, int32_t x, int32_t y, const
|
||||
std::swap(top, bottom);
|
||||
}
|
||||
|
||||
left += _offsetX;
|
||||
top += _offsetY;
|
||||
right += _offsetX;
|
||||
bottom += _offsetY;
|
||||
left -= _dpi->x;
|
||||
top -= _dpi->y;
|
||||
right -= _dpi->x;
|
||||
bottom -= _dpi->y;
|
||||
|
||||
left = left / _dpi->zoom_level;
|
||||
top = top / _dpi->zoom_level;
|
||||
right = right / _dpi->zoom_level;
|
||||
bottom = bottom / _dpi->zoom_level;
|
||||
|
||||
left += _spriteOffsetX;
|
||||
top += _spriteOffsetY;
|
||||
right += _spriteOffsetX;
|
||||
bottom += _spriteOffsetY;
|
||||
|
||||
DrawRectCommand& command = _commandBuffers.rects.allocate();
|
||||
|
||||
|
||||
@@ -1118,24 +1118,12 @@ void paint_floating_money_effect(
|
||||
session->LastPSString = ps;
|
||||
}
|
||||
|
||||
static rct_drawpixelinfo draw_pixel_info_crop_by_zoom(const rct_drawpixelinfo& dpi)
|
||||
{
|
||||
auto result = dpi;
|
||||
result.x = dpi.x * dpi.zoom_level;
|
||||
result.y = dpi.y * dpi.zoom_level;
|
||||
result.width = dpi.width / dpi.zoom_level;
|
||||
result.height = dpi.height / dpi.zoom_level;
|
||||
result.zoom_level = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006860C3
|
||||
*/
|
||||
void paint_draw_money_structs(rct_drawpixelinfo* dpi, paint_string_struct* ps)
|
||||
{
|
||||
auto dpi2 = draw_pixel_info_crop_by_zoom(*dpi);
|
||||
do
|
||||
{
|
||||
char buffer[256]{};
|
||||
@@ -1151,6 +1139,6 @@ void paint_draw_money_structs(rct_drawpixelinfo* dpi, paint_string_struct* ps)
|
||||
}
|
||||
|
||||
gfx_draw_string_with_y_offsets(
|
||||
&dpi2, buffer, COLOUR_BLACK, { ps->x, ps->y }, reinterpret_cast<int8_t*>(ps->y_offsets), forceSpriteFont);
|
||||
dpi, buffer, COLOUR_BLACK, { ps->x, ps->y }, reinterpret_cast<int8_t*>(ps->y_offsets), forceSpriteFont);
|
||||
} while ((ps = ps->next) != nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user