From 57b5a47b9dee5be890b6b2c23e6d21a30beafc42 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 19 Jun 2017 23:06:41 +0000 Subject: [PATCH] Scale menu spacers by font zoom. git-svn-id: https://svn.eduke32.com/eduke32@6199 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/menus.cpp | 6 +++--- source/duke3d/src/menus.h | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index ba5366168..7aef8b494 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -3984,7 +3984,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current ++numvalidentries; // assumes height == font->get_yline()! - totalheight += entry->type == Spacer ? ((MenuSpacer_t*)entry->entry)->height : entry->font->get_yline(); + totalheight += entry->type == Spacer ? entry->getSpacerHeight() : entry->font->get_yline(); } calculatedentryspacing = (klabs(menu->format->bottomcutoff) - menu->format->pos.y - totalheight) / (numvalidentries > 1 ? numvalidentries - 1 : 1); @@ -3998,7 +3998,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current if (entry == NULL) continue; - int32_t const height = entry->type == Spacer ? ((MenuSpacer_t*)entry->entry)->height : entry->font->get_yline(); + int32_t const height = entry->type == Spacer ? entry->getSpacerHeight() : entry->font->get_yline(); y += height; totalHeight = y; @@ -4042,7 +4042,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current if (dodraw) textsize = Menu_Text(origin.x + x, origin.y + y_upper + y - menu->scrollPos, entry->font, entry->name, status, ydim_upper, ydim_lower); - height = entry->type == Spacer ? ((MenuSpacer_t*)entry->entry)->height : entry->font->get_yline(); // max(textsize.y, entry->font->get_yline()); // bluefont Q ruins this + height = entry->type == Spacer ? entry->getSpacerHeight() : entry->font->get_yline(); // max(textsize.y, entry->font->get_yline()); // bluefont Q ruins this if (entry->format->width < 0) status |= MT_XRight; diff --git a/source/duke3d/src/menus.h b/source/duke3d/src/menus.h index c3fe66a38..abc8ea76f 100644 --- a/source/duke3d/src/menus.h +++ b/source/duke3d/src/menus.h @@ -324,6 +324,11 @@ typedef struct MenuEntry_t int32_t getMarginBottom() const { return scale(format->marginBottom, font->zoom, 65536); } int32_t getIndent() const { return scale(format->indent, font->zoom, 65536); } + int32_t getSpacerHeight() const + { + Bassert(type == Spacer); + return scale(((MenuSpacer_t *)entry)->height, font->zoom, 65536); + } } MenuEntry_t;