From fc33d5df645de3c62adc758dc8c58687c301bf19 Mon Sep 17 00:00:00 2001 From: David Reid Date: Thu, 22 Oct 2015 18:08:46 +1000 Subject: [PATCH] Fix incorrect positioning of centered strings when scaling is applied. This partially address issue #87. --- src/client/cl_screen.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/client/cl_screen.c b/src/client/cl_screen.c index 8100a743..85f2083b 100644 --- a/src/client/cl_screen.c +++ b/src/client/cl_screen.c @@ -253,6 +253,8 @@ SCR_DrawCenterString(void) int x, y; int remaining; float scale; + const int char_unscaled_width = 8; + const int char_unscaled_height = 8; /* the finale prints the characters one at a time */ remaining = 9999; @@ -282,10 +284,10 @@ SCR_DrawCenterString(void) } } - x = ((viddef.width - l * 8) / 2) / scale; + x = ((viddef.width / scale) - (l * char_unscaled_width)) / 2; SCR_AddDirtyPoint(x, y); - for (j = 0; j < l; j++, x += 8) + for (j = 0; j < l; j++, x += char_unscaled_width) { Draw_CharScaled(x * scale, y * scale, start[j], scale); @@ -295,9 +297,9 @@ SCR_DrawCenterString(void) } } - SCR_AddDirtyPoint(x, y + 8); + SCR_AddDirtyPoint(x, y + char_unscaled_height); - y += 8; + y += char_unscaled_height; while (*start && *start != '\n') {