summaryrefslogtreecommitdiffstats
path: root/src/render/Hud.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-05-22 01:44:01 +0200
committereray orçunus <erayorcunus@gmail.com>2020-05-22 02:48:12 +0200
commita5f23a03424cf312add998edce6ef4122c0a29d4 (patch)
treeb05a0255a5742a13e90a3a8f735190e4dd7f5706 /src/render/Hud.cpp
parentMerge pull request #573 from Nick007J/miami (diff)
downloadre3-a5f23a03424cf312add998edce6ef4122c0a29d4.tar
re3-a5f23a03424cf312add998edce6ef4122c0a29d4.tar.gz
re3-a5f23a03424cf312add998edce6ef4122c0a29d4.tar.bz2
re3-a5f23a03424cf312add998edce6ef4122c0a29d4.tar.lz
re3-a5f23a03424cf312add998edce6ef4122c0a29d4.tar.xz
re3-a5f23a03424cf312add998edce6ef4122c0a29d4.tar.zst
re3-a5f23a03424cf312add998edce6ef4122c0a29d4.zip
Diffstat (limited to '')
-rw-r--r--src/render/Hud.cpp88
1 files changed, 59 insertions, 29 deletions
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 7289d70c..96149573 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -102,6 +102,7 @@ uint32 CHud::m_WeaponState;
uint32 CHud::m_WeaponTimer;
uint32 CHud::m_LastDisplayScore;
+uint32 CHud::m_LastWanted;
CSprite2d CHud::Sprites[NUM_HUD_SPRITES];
@@ -483,33 +484,46 @@ void CHud::Draw()
/*
DrawWantedLevel
*/
- CFont::SetBackgroundOff();
- CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y));
- CFont::SetJustifyOff();
- CFont::SetCentreOff();
- CFont::SetRightJustifyOn();
- CFont::SetPropOn();
- CFont::SetFontStyle(FONT_HEADING);
- CFont::SetDropShadowPosition(2); // TODO(Miami): Remove that, VC keeps that open above
+ if (m_LastWanted == playerPed->m_pWanted->m_nWantedLevel)
+ alpha = CHud::DrawFadeState(HUD_WANTED_FADING, 0);
+ else {
+ alpha = CHud::DrawFadeState(HUD_WANTED_FADING, 1);
+ m_LastWanted = playerPed->m_pWanted->m_nWantedLevel;
+ }
- AsciiToUnicode("]", sPrintIcon);
+ if (m_WantedState != FADED_OUT) {
+ CFont::SetBackgroundOff();
+ CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y));
+ CFont::SetJustifyOff();
+ CFont::SetCentreOff();
+ CFont::SetRightJustifyOn();
+ CFont::SetPropOn();
+ CFont::SetFontStyle(FONT_HEADING);
+ 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
- for (int i = 0; i < 6; i++) {
- if (playerPed->m_pWanted->m_nWantedLevel > i
- && (CTimer::GetTimeInMilliseconds() > playerPed->m_pWanted->m_nLastWantedLevelChange
- + 2000 || CTimer::GetFrameCounter() & 4)) {
+ AsciiToUnicode("]", sPrintIcon);
- CFont::SetColor(WANTED_COLOR);
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
+ for (int i = 0; i < 6; i++) {
+ if (playerPed->m_pWanted->m_nWantedLevel > i
+ && (CTimer::GetTimeInMilliseconds() > playerPed->m_pWanted->m_nLastWantedLevelChange
+ + 2000 || CTimer::GetFrameCounter() & 4)) {
- // TODO(Miami): There is one more condition in here
- }else if (playerPed->m_pWanted->m_nWantedLevel <= i) {
- CFont::SetColor(NOTWANTED_COLOR);
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
+ WANTED_COLOR.a = alpha;
+ CFont::SetColor(WANTED_COLOR);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
+
+ // TODO(Miami): There is one more condition in here
+ }
+ else if (playerPed->m_pWanted->m_nWantedLevel <= i) {
+ NOTWANTED_COLOR.a = alpha;
+ CFont::SetColor(NOTWANTED_COLOR);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
+ }
}
- }
- CFont::SetDropShadowPosition(0); // TODO(Miami): Remove that, VC keeps that open
+ CFont::SetDropShadowPosition(0); // TODO(Miami): Remove that, VC keeps that open
+ }
/*
DrawZoneName
@@ -1503,20 +1517,28 @@ void CHud::Initialise()
PagerSoundPlayed = 0;
PagerXOffset = 150.0f;
- m_WantedFadeTimer = 0;
+#ifdef HUD_AUTO_FADE
+ m_EnergyLostState = START_FADE_OUT;
+ m_WantedState = START_FADE_OUT;
+ m_DisplayScoreState = START_FADE_OUT;
+ m_WeaponState = START_FADE_OUT;
+#else
+ m_EnergyLostState = FADE_DISABLED;
m_WantedState = FADE_DISABLED;
+ m_DisplayScoreState = FADE_DISABLED;
+ m_WeaponState = FADE_DISABLED;
+#endif
+ m_WantedFadeTimer = 0;
m_WantedTimer = 0;
m_EnergyLostFadeTimer = 0;
- m_EnergyLostState = FADE_DISABLED;
m_EnergyLostTimer = 0;
m_DisplayScoreFadeTimer = 0;
- m_DisplayScoreState = FADE_DISABLED;
m_DisplayScoreTimer = 0;
m_WeaponFadeTimer = 0;
- m_WeaponState = FADE_DISABLED;
m_WeaponTimer = 0;
m_LastDisplayScore = CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney;
+ m_LastWanted = 0;
CTxdStore::PopCurrentTxd();
}
@@ -1542,20 +1564,28 @@ void CHud::ReInitialise() {
PagerSoundPlayed = 0;
PagerXOffset = 150.0f;
- m_WantedFadeTimer = 0;
+#ifdef HUD_AUTO_FADE
+ m_EnergyLostState = START_FADE_OUT;
+ m_WantedState = START_FADE_OUT;
+ m_DisplayScoreState = START_FADE_OUT;
+ m_WeaponState = START_FADE_OUT;
+#else
+ m_EnergyLostState = FADE_DISABLED;
m_WantedState = FADE_DISABLED;
+ m_DisplayScoreState = FADE_DISABLED;
+ m_WeaponState = FADE_DISABLED;
+#endif
+ m_WantedFadeTimer = 0;
m_WantedTimer = 0;
m_EnergyLostFadeTimer = 0;
- m_EnergyLostState = FADE_DISABLED;
m_EnergyLostTimer = 0;
m_DisplayScoreFadeTimer = 0;
- m_DisplayScoreState = FADE_DISABLED;
m_DisplayScoreTimer = 0;
m_WeaponFadeTimer = 0;
- m_WeaponState = FADE_DISABLED;
m_WeaponTimer = 0;
m_LastDisplayScore = CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney;
+ m_LastWanted = 0;
}
wchar LastBigMessage[6][128];