fixes to last HUD commits

This commit is contained in:
erorcun 2020-12-20 05:49:55 +03:00
parent 0bea6d039b
commit ae7cb92437
6 changed files with 22 additions and 11 deletions

View File

@ -161,6 +161,8 @@ cMusicManager::DisplayRadioStationName()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_HEADING);
CFont::SetCentreOn(); CFont::SetCentreOn();
// Reminder: Game doesn't have "scaling" at all, it just stretches, and it's team's decision here to not let centered text occupy all the screen.
// Disable ASPECT_RATIO_SCALE and it'll go back to default behaviour; stretching.
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)); CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
#ifdef FIX_BUGS #ifdef FIX_BUGS

View File

@ -1129,6 +1129,7 @@ CMenuManager::Draw()
#endif #endif
} }
// Not a bug, we just want HFoV+ on menu
#ifdef ASPECT_RATIO_SCALE #ifdef ASPECT_RATIO_SCALE
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)); CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
#else #else

View File

@ -134,7 +134,7 @@ void MessageScreen(char *msg)
#endif #endif
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetWrapx(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-190)); CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(190));
#ifdef FIX_BUGS #ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f)); CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
#else #else
@ -901,13 +901,17 @@ void CGame::InitialiseWhenRestarting(void)
CSprite2d *splash = LoadSplash(NULL); CSprite2d *splash = LoadSplash(NULL);
splash->Draw(rect, color, color, color, color); splash->Draw(rect, color, color, color, color);
#ifdef FIX_BUGS #ifdef FIX_BUGS
splash->DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(110.0f), SCREEN_WIDTH-SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(300.0f)), CRGBA(50, 50, 50, 192)); splash->DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(110.0f), SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_Y(300.0f)), CRGBA(50, 50, 50, 192));
#else #else
splash->DrawRect(CRect(20.0f, 110.0f, SCREEN_WIDTH-20.0f, 300.0f), CRGBA(50, 50, 50, 192)); splash->DrawRect(CRect(20.0f, 110.0f, SCREEN_WIDTH-20.0f, 300.0f), CRGBA(50, 50, 50, 192));
#endif #endif
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
#ifdef ASPECT_RATIO_SCALE
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(160.0f)); // because SCREEN_SCALE_FROM_RIGHT(x) != SCREEN_SCALE_X(640-x)
#else
CFont::SetWrapx(SCREEN_SCALE_X(480.0f)); CFont::SetWrapx(SCREEN_SCALE_X(480.0f));
#endif
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f)); CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_X(480.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(480.0f));

View File

@ -1146,7 +1146,6 @@ DisplayGameDebugText()
AsciiToUnicode(str, ustr); AsciiToUnicode(str, ustr);
// Let's not scale those numbers, they look better that way :eyes:
CFont::SetPropOff(); CFont::SetPropOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
#ifdef FIX_BUGS #ifdef FIX_BUGS
@ -1159,7 +1158,7 @@ DisplayGameDebugText()
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
#ifdef FIX_BUGS #ifdef FIX_BUGS
CFont::SetWrapx(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)); CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
#else #else
CFont::SetWrapx(DEFAULT_SCREEN_WIDTH); CFont::SetWrapx(DEFAULT_SCREEN_WIDTH);
#endif #endif

View File

@ -332,8 +332,8 @@ CFont::Initialise(void)
SetJustifyOff(); SetJustifyOff();
SetCentreOff(); SetCentreOff();
#ifdef FIX_BUGS #ifdef FIX_BUGS
SetWrapx(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)); SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)); SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
#else #else
SetWrapx(DEFAULT_SCREEN_WIDTH); SetWrapx(DEFAULT_SCREEN_WIDTH);
SetCentreSize(DEFAULT_SCREEN_WIDTH); SetCentreSize(DEFAULT_SCREEN_WIDTH);

View File

@ -516,9 +516,9 @@ void CHud::Draw()
Sprites[WeaponType].Draw( Sprites[WeaponType].Draw(
CRect( CRect(
SCREEN_WIDTH-SCREEN_SCALE_X(WEAPON_X), SCREEN_SCALE_FROM_RIGHT(WEAPON_X),
SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_Y(27.0f),
SCREEN_WIDTH-SCREEN_SCALE_X(WEAPON_X)+SCREEN_SCALE_X(64.0f), SCREEN_SCALE_FROM_RIGHT(WEAPON_X)+SCREEN_SCALE_X(64.0f),
SCREEN_SCALE_Y(27.0f)+SCREEN_SCALE_Y(64.0f)), SCREEN_SCALE_Y(27.0f)+SCREEN_SCALE_Y(64.0f)),
CRGBA(255, 255, 255, 255), CRGBA(255, 255, 255, 255),
0.015f, 0.015f,
@ -1029,7 +1029,7 @@ void CHud::Draw()
CFont::SetRightJustifyWrap(0.0f); CFont::SetRightJustifyWrap(0.0f);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetColor(CRGBA(244, 20, 20, 255)); CFont::SetColor(CRGBA(244, 20, 20, 255));
CFont::SetWrapx(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)); CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
CFont::SetPropOff(); CFont::SetPropOff();
CFont::SetBackGroundOnlyTextOn(); CFont::SetBackGroundOnlyTextOn();
@ -1171,7 +1171,7 @@ void CHud::Draw()
CFont::SetRightJustifyOff(); CFont::SetRightJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetCentreOff(); CFont::SetCentreOff();
CFont::SetWrapx(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)); CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetPropOff(); CFont::SetPropOff();
CFont::SetFontStyle(FONT_PAGER); CFont::SetFontStyle(FONT_PAGER);
@ -1809,7 +1809,12 @@ void CHud::DrawAfterFade()
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.2f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_WIDTH-SCREEN_SCALE_X(20.0f)); // Not bug, we just want these kind of texts to be wrapped at the center.
#ifdef ASPECT_RATIO_SCALE
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20.0f));
#else
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f));
#endif
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));