- 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.
This commit is contained in:
Christoph Oelckers 2020-08-19 16:40:54 +02:00
parent 042caf1b21
commit 94beac937d
3 changed files with 19 additions and 11 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;