diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-06-07 18:32:51 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-06-07 18:32:51 +0200 |
commit | 27eaa10873a5039df2dca03311acc9f7479c73ae (patch) | |
tree | 97fb45327ebf874dc43387190a573fd929379681 | |
parent | fix (diff) | |
parent | Merge branch 'miami' of https://github.com/GTAmodding/re3 into miami (diff) | |
download | re3-27eaa10873a5039df2dca03311acc9f7479c73ae.tar re3-27eaa10873a5039df2dca03311acc9f7479c73ae.tar.gz re3-27eaa10873a5039df2dca03311acc9f7479c73ae.tar.bz2 re3-27eaa10873a5039df2dca03311acc9f7479c73ae.tar.lz re3-27eaa10873a5039df2dca03311acc9f7479c73ae.tar.xz re3-27eaa10873a5039df2dca03311acc9f7479c73ae.tar.zst re3-27eaa10873a5039df2dca03311acc9f7479c73ae.zip |
-rw-r--r-- | src/render/Hud.cpp | 91 | ||||
-rw-r--r-- | src/render/Hud.h | 5 |
2 files changed, 46 insertions, 50 deletions
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 697a1483..98982d18 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -20,6 +20,7 @@ #include "TxdStore.h" #include "User.h" #include "World.h" +#include <animation\CutsceneMgr.h> // Game has colors inlined in code. // For easier modification we collect them here: @@ -356,6 +357,7 @@ void CHud::Draw() */ if (weaponInfo->m_nModelId <= 0) { + RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); Sprites[WeaponType].Draw( CRect(SCREEN_SCALE_FROM_RIGHT(99.0f), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(91.0f)), CRGBA(255, 255, 255, 255), @@ -389,7 +391,7 @@ void CHud::Draw() CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.8f)); CFont::SetJustifyOff(); CFont::SetCentreOn(); - CFont::SetCentreSize(SCREEN_SCALE_X(640.0f)); + CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)); CFont::SetPropOn(); CFont::SetDropShadowPosition(0); CFont::SetFontStyle(FONT_STANDARD); @@ -412,9 +414,9 @@ void CHud::Draw() CFont::SetRightJustifyWrap(0.0f); CFont::SetRightJustifyOn(); CFont::SetPropOff(); + CFont::SetFontStyle(FONT_HEADING); CFont::SetDropShadowPosition(2); CFont::SetDropColor(CRGBA(0, 0, 0, 255)); - CFont::SetFontStyle(FONT_HEADING); if (m_ItemToFlash == ITEM_HEALTH && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_HEALTH @@ -431,18 +433,13 @@ void CHud::Draw() #endif AsciiToUnicode(sTemp, sPrint); - /*CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrint); - - if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); - }*/ CFont::SetColor(HEALTH_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(65.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); + // CFont::SetColor(HEALTH_COLOR); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 54.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); } } } @@ -453,7 +450,7 @@ void CHud::Draw() if (m_ItemToFlash == ITEM_ARMOUR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_ARMOUR) { CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y)); if (playerPed->m_fArmour > 1.0f) { - AsciiToUnicode("[", sPrintIcon); + AsciiToUnicode("<", sPrintIcon); #ifdef FIX_BUGS sprintf(sTemp, "%03d", int32(playerPed->m_fArmour + 0.5f)); #else @@ -461,19 +458,13 @@ void CHud::Draw() #endif AsciiToUnicode(sTemp, sPrint); - CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrint); - - if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); - } - CFont::SetColor(ARMOUR_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) { - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); + // CFont::SetColor(ARMOUR_COLOR); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f + 52.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); } } } @@ -496,8 +487,6 @@ void CHud::Draw() CFont::SetRightJustifyOn(); CFont::SetPropOn(); CFont::SetFontStyle(FONT_STANDARD); - CFont::SetDropShadowPosition(2); // TODO(Miami): Remove that, VC keeps that open above - CFont::SetDropColor(CRGBA(0,0,0,alpha)); // TODO(Miami): Remove that, VC keeps that open above AsciiToUnicode(">", sPrintIcon); @@ -519,8 +508,6 @@ void CHud::Draw() } } } - - CFont::SetDropShadowPosition(0); // TODO(Miami): Remove that, VC keeps that open } /* @@ -601,9 +588,9 @@ void CHud::Draw() CFont::SetBackgroundOff(); if (FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_SPANISH) - CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.8f), SCREEN_SCALE_Y(1.2f)); + CFont::SetScale(SCREEN_SCALE_X(1.7f * 0.8f), SCREEN_SCALE_Y(1.8f)); else - CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); + CFont::SetScale(SCREEN_SCALE_X(1.7f), SCREEN_SCALE_Y(1.8f)); CFont::SetSlantRefPoint(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f)); CFont::SetSlant(0.15f); @@ -614,8 +601,6 @@ void CHud::Draw() CFont::SetDropShadowPosition(2); CFont::SetDropColor(CRGBA(0, 0, 0, fZoneAlpha)); CFont::SetFontStyle(FONT_BANK); - //CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); - //CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint); CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha)); CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f), m_ZoneToPrint); @@ -702,9 +687,9 @@ void CHud::Draw() CFont::SetBackgroundOff(); if (FrontEndMenuManager.m_PrefsLanguage != LANGUAGE_ITALIAN && FrontEndMenuManager.m_PrefsLanguage != LANGUAGE_SPANISH) - CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); + CFont::SetScale(SCREEN_SCALE_X(1.7f), SCREEN_SCALE_Y(1.8f)); else - CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f)); + CFont::SetScale(SCREEN_SCALE_X(1.7f * 0.85f), SCREEN_SCALE_Y(1.8f)); CFont::SetSlantRefPoint(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(105.0f)); CFont::SetSlant(0.15f); @@ -712,11 +697,11 @@ void CHud::Draw() CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); + CFont::SetFontStyle(FONT_BANK); CFont::SetDropShadowPosition(2); + CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha)); CFont::SetDropColor(CRGBA(0, 0, 0, fVehicleAlpha)); - CFont::SetFontStyle(FONT_BANK); - CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha)); CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(105.0f), m_pVehicleNameToPrint); CFont::SetSlant(0.f); @@ -738,20 +723,16 @@ void CHud::Draw() CFont::SetBackgroundOff(); CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y)); CFont::SetBackGroundOnlyTextOff(); - CFont::SetDropShadowPosition(2); - CFont::SetDropColor(CRGBA(0, 0, 0, 255)); CFont::SetPropOff(); CFont::SetFontStyle(FONT_HEADING); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); + CFont::SetDropShadowPosition(2); + CFont::SetDropColor(CRGBA(0, 0, 0, 255)); sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes()); AsciiToUnicode(sTemp, sPrint); - CFont::SetColor(CRGBA(0, 0, 0, 255)); - - //CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), sPrint); - CFont::SetColor(CLOCK_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint); @@ -1019,26 +1000,42 @@ void CHud::Draw() /* DrawSubtitles */ - if (m_Message[0] && !m_BigMessage[2][0] && (FrontEndMenuManager.m_PrefsShowSubtitles == 1 || !TheCamera.m_WideScreenOn)) { + if (m_Message[0] && !m_BigMessage[2][0]) { CFont::SetJustifyOff(); CFont::SetBackgroundOff(); CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128)); - CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.120f)); CFont::SetCentreOn(); CFont::SetPropOn(); + CFont::SetDropShadowPosition(0); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetColor(CRGBA(225, 225, 225, 255)); - float offsetX = SCREEN_SCALE_X(40.0f) + SCREEN_SCALE_X(8.0f); - float center = SCREEN_SCALE_FROM_RIGHT(50.0f) - SCREEN_SCALE_X(8.0f) - offsetX; - CFont::SetCentreSize(center); + static bool onceItWasWidescreen = false; - const int16 shadow = 1; - CFont::SetDropShadowPosition(shadow); - CFont::SetDropColor(CRGBA(0, 0, 0, 255)); - CFont::SetColor(CRGBA(235, 235, 235, 255)); + if (TheCamera.m_WideScreenOn) { + onceItWasWidescreen = true; + + if (FrontEndMenuManager.m_PrefsShowSubtitles || !CCutsceneMgr::IsRunning()) { + CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(60.0f)); + CFont::SetScale(SCREEN_SCALE_X(0.58f), SCREEN_SCALE_Y(1.2f)); + CFont::PrintString(SCREEN_WIDTH / 2.f, SCREEN_SCALE_FROM_BOTTOM(80.0f), m_Message); + } + } else { + if (onceItWasWidescreen) + m_Message[0] = '\0'; - // I'm not sure shadow substaction was intentional here, might be a leftover if CFont::PrintString was used for a shadow draw call - CFont::PrintString(center / 2.0f + offsetX - SCREEN_SCALE_X(shadow), SCREEN_SCALE_Y(4.0f) + SCREEN_SCALE_FROM_BOTTOM(68.0f) - SCREEN_SCALE_Y(shadow), m_Message); + onceItWasWidescreen = false; + CFont::DrawFonts(); + CFont::SetDropShadowPosition(2); + CFont::SetDropColor(CRGBA(0, 0, 0, 255)); + CFont::SetScale(SCREEN_SCALE_X(0.58f), SCREEN_SCALE_Y(1.22f)); + + float offsetX = SCREEN_SCALE_X(140.0f) + SCREEN_SCALE_X(8.0f); + float center = SCREEN_SCALE_FROM_RIGHT(20.0f) - SCREEN_SCALE_X(8.0f) - offsetX; + CFont::SetCentreSize(center); + + CFont::PrintString(center / 2.0f + offsetX, SCREEN_SCALE_FROM_BOTTOM(105.f + 2.0f), m_Message); + } CFont::SetDropShadowPosition(0); } diff --git a/src/render/Hud.h b/src/render/Hud.h index db92e32c..f8ca4f6d 100644 --- a/src/render/Hud.h +++ b/src/render/Hud.h @@ -51,9 +51,8 @@ enum eSprites NUM_HUD_SPRITES, }; -// TODO(Miami): Make those 0.7f - 1.25f once fonts have been ported -#define HUD_TEXT_SCALE_X 0.8f -#define HUD_TEXT_SCALE_Y 1.35f +#define HUD_TEXT_SCALE_X 0.7f +#define HUD_TEXT_SCALE_Y 1.25f class CHud { |