From a0fb2a6d7ca82f59800d4561c8ede4d0e769af31 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Wed, 18 Oct 2017 08:30:21 +0200 Subject: [PATCH] Fix game console overflowing when using TTF for rendering. --- src/openrct2/drawing/ttf.c | 5 +++++ src/openrct2/interface/console.c | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/openrct2/drawing/ttf.c b/src/openrct2/drawing/ttf.c index 150015326f..209fcecf44 100644 --- a/src/openrct2/drawing/ttf.c +++ b/src/openrct2/drawing/ttf.c @@ -157,6 +157,11 @@ static void ttf_surface_cache_dispose_all() void ttf_toggle_hinting() { + if (!gUseTrueTypeFont) + { + return; + } + for (sint32 i = 0; i < FONT_SIZE_COUNT; i++) { TTFFontDescriptor *fontDesc = &(gCurrentTTFFontSet->size[i]); diff --git a/src/openrct2/interface/console.c b/src/openrct2/interface/console.c index 7d2243a903..ec07a3190f 100644 --- a/src/openrct2/interface/console.c +++ b/src/openrct2/interface/console.c @@ -230,8 +230,9 @@ void console_draw(rct_drawpixelinfo *dpi) break; } } + x = _consoleLeft + 4; - y = _consoleBottom - 15; + y = _consoleBottom - lineHeight - 5; // Draw current line lineCh = lineBuffer; @@ -248,9 +249,12 @@ void console_draw(rct_drawpixelinfo *dpi) gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, PALETTE_INDEX_144); } - gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 21, _consoleRight, _consoleBottom - 21, PALETTE_INDEX_14); - gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 20, _consoleRight, _consoleBottom - 20, PALETTE_INDEX_11); + // Input area top border + gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - lineHeight - 11, _consoleRight, _consoleBottom - lineHeight - 11, PALETTE_INDEX_14); + gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - lineHeight - 10, _consoleRight, _consoleBottom - lineHeight - 10, PALETTE_INDEX_11); + + // Input area bottom border gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 1, _consoleRight, _consoleBottom - 1, PALETTE_INDEX_14); gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 0, _consoleRight, _consoleBottom - 0, PALETTE_INDEX_12); } @@ -399,8 +403,7 @@ void console_scroll(sint32 linesToScroll) // Calculates the amount of visible lines, based on the console size, excluding the input line. static sint32 console_get_num_visible_lines() { - const sint32 lineHeight = 10; - return ((_consoleBottom - 22 - _consoleTop) / lineHeight) - 1; + return ceil((_consoleBottom - _consoleTop) / font_get_line_height(gCurrentFontSpriteBase)) - 1; } void console_clear()