From 94beac937dfbb036f7d62639041f7bdb0fa65ef9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 19 Aug 2020 16:40:54 +0200 Subject: [PATCH] - scale down the notify display by 2 in RR. Its fonts are double the size as the other games and this must be factored in here for HUD scaling to work as expected. --- source/common/console/c_console.h | 1 + source/core/console/c_console.cpp | 28 +++++++++++++++++----------- source/games/duke/src/game.cpp | 1 + 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/source/common/console/c_console.h b/source/common/console/c_console.h index e88ef0aa6..592556b3a 100644 --- a/source/common/console/c_console.h +++ b/source/common/console/c_console.h @@ -83,6 +83,7 @@ bool C_Responder (event_t *ev); void C_AddTabCommand (const char *name); void C_RemoveTabCommand (const char *name); void C_ClearTabCommands(); // Removes all tab commands +void C_SetNotifyFontScale(int scale); extern const char *console_bar; diff --git a/source/core/console/c_console.cpp b/source/core/console/c_console.cpp index de61abee6..693cb708b 100644 --- a/source/core/console/c_console.cpp +++ b/source/core/console/c_console.cpp @@ -108,6 +108,12 @@ int ConBottom, ConScroll, RowAdjust; uint64_t CursorTicker; constate_e ConsoleState = c_up; +int NotifyFontScale = 1; + +void C_SetNotifyFontScale(int scale) +{ + NotifyFontScale = scale; +} static int TopLine, InsertLine; @@ -795,11 +801,11 @@ void FNotifyBuffer::AddString(int printlevel, FString source) if (AddType == APPENDLINE && Text.Size() > 0 && Text[Text.Size() - 1].PrintLevel == printlevel) { FString str = Text[Text.Size() - 1].Text + source; - lines = V_BreakLines (font, width, str); + lines = V_BreakLines (font, width * NotifyFontScale, str); } else { - lines = V_BreakLines (font, width, source); + lines = V_BreakLines (font, width * NotifyFontScale, source); if (AddType == APPENDLINE) { AddType = NEWLINE; @@ -1064,7 +1070,7 @@ void FNotifyBuffer::Tick() { Text.Delete(0, i); FFont* font = generic_ui ? NewSmallFont : SmallFont ? SmallFont : AlternativeSmallFont; - Top += font->GetHeight(); + Top += font->GetHeight() / NotifyFontScale; } } @@ -1079,10 +1085,10 @@ void FNotifyBuffer::Draw() FFont* font = generic_ui ? NewSmallFont : SmallFont? SmallFont : AlternativeSmallFont; - line = Top + font->GetDisplacement(); + line = Top + font->GetDisplacement() / NotifyFontScale; canskip = true; - lineadv = font->GetHeight (); + lineadv = font->GetHeight () / NotifyFontScale; for (unsigned i = 0; i < Text.Size(); ++ i) { @@ -1107,17 +1113,17 @@ void FNotifyBuffer::Draw() int scale = active_con_scaletext(twod, generic_ui); if (!center) - DrawText(twod, font, color, 0, line, notify.Text, - DTA_VirtualWidth, twod->GetWidth() / scale, - DTA_VirtualHeight, twod->GetHeight() / scale, + DrawText(twod, font, color, 0, line * NotifyFontScale, notify.Text, + DTA_VirtualWidth, twod->GetWidth() / scale * NotifyFontScale, + DTA_VirtualHeight, twod->GetHeight() / scale * NotifyFontScale, DTA_KeepRatio, true, DTA_Alpha, alpha, TAG_DONE); else - DrawText(twod, font, color, (twod->GetWidth() - + DrawText(twod, font, color, (twod->GetWidth() * NotifyFontScale - font->StringWidth (notify.Text) * scale) / 2 / scale, line, notify.Text, - DTA_VirtualWidth, twod->GetWidth() / scale, - DTA_VirtualHeight, twod->GetHeight() / scale, + DTA_VirtualWidth, twod->GetWidth() / scale * NotifyFontScale, + DTA_VirtualHeight, twod->GetHeight() / scale * NotifyFontScale, DTA_KeepRatio, true, DTA_Alpha, alpha, TAG_DONE); line += lineadv; diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp index d9fcaebea..3dbcc0a36 100644 --- a/source/games/duke/src/game.cpp +++ b/source/games/duke/src/game.cpp @@ -339,6 +339,7 @@ static void initTiles() static void Startup(void) { + if (isRR()) C_SetNotifyFontScale(2); ud.god = 0; ud.m_respawn_items = 0; ud.m_respawn_monsters = 0;