diff options
author | Roman Masanin <36927roma@gmail.com> | 2020-10-03 00:52:37 +0200 |
---|---|---|
committer | Roman Masanin <36927roma@gmail.com> | 2020-10-03 00:52:37 +0200 |
commit | 55d94c99b8ef758b7a1016734dbfc6acba5c7e7d (patch) | |
tree | b838285cbdeae5e390a0bdf3dbd552ce3c1c7130 /src/render | |
parent | fix ternary operator (diff) | |
parent | Merge pull request #737 from theR4K/miamiDev (diff) | |
download | re3-55d94c99b8ef758b7a1016734dbfc6acba5c7e7d.tar re3-55d94c99b8ef758b7a1016734dbfc6acba5c7e7d.tar.gz re3-55d94c99b8ef758b7a1016734dbfc6acba5c7e7d.tar.bz2 re3-55d94c99b8ef758b7a1016734dbfc6acba5c7e7d.tar.lz re3-55d94c99b8ef758b7a1016734dbfc6acba5c7e7d.tar.xz re3-55d94c99b8ef758b7a1016734dbfc6acba5c7e7d.tar.zst re3-55d94c99b8ef758b7a1016734dbfc6acba5c7e7d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/render/Credits.cpp | 26 | ||||
-rw-r--r-- | src/render/Draw.cpp | 11 | ||||
-rw-r--r-- | src/render/Font.cpp | 16 | ||||
-rw-r--r-- | src/render/Hud.cpp | 87 | ||||
-rw-r--r-- | src/render/Hud.h | 1 |
5 files changed, 73 insertions, 68 deletions
diff --git a/src/render/Credits.cpp b/src/render/Credits.cpp index 4f02eca4..75342bad 100644 --- a/src/render/Credits.cpp +++ b/src/render/Credits.cpp @@ -14,14 +14,6 @@ bool CCredits::bCreditsGoing; uint32 CCredits::CreditsStartTime; -#ifdef ASPECT_RATIO_SCALE -#define SCALE_AND_CENTER(x) ScaleAndCenterX(x) -extern float ScaleAndCenterX(float x); -#else -#define SCALE_AND_CENTER(x) SCREEN_STRETCH_X(x) -#endif - - void CCredits::Init(void) { @@ -81,7 +73,7 @@ CCredits::Render(void) scrolloffset = (CTimer::GetTimeInMilliseconds() - CreditsStartTime) / 24.0f; CFont::SetJustifyOff(); CFont::SetBackgroundOff(); - CFont::SetCentreSize(SCALE_AND_CENTER(DEFAULT_SCREEN_WIDTH * 0.75f)); + CFont::SetCentreSize(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH * 0.75f)); CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetFontStyle(FONT_STANDARD); @@ -429,7 +421,7 @@ CCredits::Render(void) PrintCreditText(0.65f, 0.65f, TheText.Get("CRED129"), lineoffset, scrolloffset); PrintCreditSpace(1.5f, lineoffset); - CFont::SetCentreSize(SCALE_AND_CENTER(DEFAULT_SCREEN_WIDTH * 0.8f)); + CFont::SetCentreSize(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH * 0.8f)); PrintCreditText(1.1f, 0.8f, TheText.Get("CRD111A"), lineoffset, scrolloffset); PrintCreditSpace(0.5f, lineoffset); @@ -477,7 +469,7 @@ CCredits::Render(void) PrintCreditSpace(0.5f, lineoffset); PrintCreditText(0.65f, 0.65f, TheText.Get("CRD134I"), lineoffset, scrolloffset); - CFont::SetCentreSize(SCALE_AND_CENTER(DEFAULT_SCREEN_WIDTH * 0.7f)); + CFont::SetCentreSize(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH * 0.7f)); PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.1f, 0.8f, TheText.Get("CRED135"), lineoffset, scrolloffset); @@ -513,7 +505,7 @@ CCredits::Render(void) PrintCreditText(1.1f, 1.1f, TheText.Get("CRD140L"), lineoffset, scrolloffset); PrintCreditSpace(1.5f, lineoffset); - CFont::SetCentreSize(SCALE_AND_CENTER(DEFAULT_SCREEN_WIDTH * 0.85f)); + CFont::SetCentreSize(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH * 0.85f)); PrintCreditText(0.95f, 0.7f, TheText.Get("CRED259"), lineoffset, scrolloffset); PrintCreditSpace(0.5f, lineoffset); @@ -594,7 +586,7 @@ CCredits::Render(void) PrintCreditText(0.65f, 0.65f, TheText.Get("CRED172"), lineoffset, scrolloffset); PrintCreditSpace(0.5f, lineoffset); - CFont::SetCentreSize(SCALE_AND_CENTER(DEFAULT_SCREEN_WIDTH * 0.75f)); + CFont::SetCentreSize(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH * 0.75f)); PrintCreditSpace(1.5f, lineoffset); PrintCreditText(0.95f, 0.7f, TheText.Get("CRED217"), lineoffset, scrolloffset); @@ -717,7 +709,7 @@ CCredits::Render(void) PrintCreditText(0.65f, 0.65f, TheText.Get("CRED332"), lineoffset, scrolloffset); PrintCreditSpace(1.5f, lineoffset); - CFont::SetCentreSize(SCALE_AND_CENTER(DEFAULT_SCREEN_WIDTH * 0.8f)); + CFont::SetCentreSize(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH * 0.8f)); PrintCreditText(0.95f, 0.7f, TheText.Get("CRED333"), lineoffset, scrolloffset); PrintCreditSpace(0.5f, lineoffset); @@ -755,7 +747,7 @@ CCredits::Render(void) PrintCreditSpace(1.5f, lineoffset); - CFont::SetCentreSize(SCALE_AND_CENTER(DEFAULT_SCREEN_WIDTH * 0.75f)); + CFont::SetCentreSize(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH * 0.75f)); PrintCreditText(0.95f, 0.7f, TheText.Get("CRED267"), lineoffset, scrolloffset); PrintCreditSpace(0.5f, lineoffset); @@ -818,6 +810,4 @@ CCredits::Render(void) bool CCredits::AreCreditsDone(void) { return !bCreditsGoing; -} - -#undef SCALE_AND_CENTER
\ No newline at end of file +}
\ No newline at end of file diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index ab360aac..131534a3 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -69,3 +69,14 @@ CDraw::SetFOV(float fov) #endif ms_fFOV = fov; } + +#ifdef ASPECT_RATIO_SCALE +float +ScaleAndCenterX(float x) +{ + if (SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) + return x; + else + return (SCREEN_WIDTH - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)) / 2 + SCREEN_SCALE_X(x); +} +#endif
\ No newline at end of file diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 1e60083b..c0cc333a 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -228,8 +228,8 @@ CFont::Initialise(void) SetColor(CRGBA(0xFF, 0xFF, 0xFF, 0)); SetJustifyOff(); SetCentreOff(); - SetWrapx(DEFAULT_SCREEN_WIDTH); - SetCentreSize(DEFAULT_SCREEN_WIDTH); + SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH)); + SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH)); SetBackgroundOff(); SetBackgroundColor(CRGBA(0x80, 0x80, 0x80, 0x80)); SetBackGroundOnlyTextOff(); @@ -996,22 +996,10 @@ CFont::GetStringWidth(wchar *s, bool spaces) { for (wchar c = *s; (c != ' ' || spaces) && c != '\0'; c = *(++s)) { if (c == '~') { - - // This is original code -#if 0 s++; while (*s != '~') { s++; } -#else - // TODO(Miami): This is my code to prevent fuck up until InsertPlayerControlKeysInString is done - if (*(s + 1) != '~') { - s++; - while (*s != '~') { - s++; - } - } -#endif } else { w += GetCharacterSize(c - ' '); diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index c05a3d31..36815ab5 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -405,7 +405,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(DEFAULT_SCREEN_WIDTH)); + CFont::SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH)); CFont::SetPropOn(); CFont::SetDropShadowPosition(0); CFont::SetFontStyle(FONT_STANDARD); @@ -886,7 +886,7 @@ void CHud::Draw() CFont::SetRightJustifyWrap(0.0f); CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); CFont::SetColor(CRGBA(244, 20, 20, 255)); - CFont::SetWrapx(SCREEN_SCALE_X(640.0f)); + CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH)); CFont::SetPropOff(); CFont::SetBackGroundOnlyTextOn(); @@ -1024,8 +1024,8 @@ void CHud::Draw() else CFont::SetCentreOff(); - CFont::SetWrapx(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fWrapX)); - CFont::SetCentreSize(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fCenterSize)); + CFont::SetWrapx(SCALE_AND_CENTER_X(CTheScripts::IntroTextLines[i].m_fWrapX)); + CFont::SetCentreSize(SCALE_AND_CENTER_X(CTheScripts::IntroTextLines[i].m_fCenterSize)); if (CTheScripts::IntroTextLines[i].m_bBackground) CFont::SetBackgroundOn(); @@ -1045,7 +1045,7 @@ void CHud::Draw() CFont::SetPropOff(); CFont::SetFontStyle(FONT_LOCALE(CTheScripts::IntroTextLines[i].m_nFont)); - CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - CTheScripts::IntroTextLines[i].m_fAtX), SCREEN_SCALE_Y(DEFAULT_SCREEN_HEIGHT - CTheScripts::IntroTextLines[i].m_fAtY), CTheScripts::IntroTextLines[i].m_Text); + CFont::PrintString(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH - CTheScripts::IntroTextLines[i].m_fAtX), SCREEN_SCALE_Y(DEFAULT_SCREEN_HEIGHT - CTheScripts::IntroTextLines[i].m_fAtY), CTheScripts::IntroTextLines[i].m_Text); } } for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroRectangles); i++) { @@ -1250,10 +1250,12 @@ void CHud::Draw() } CFont::SetPropOn(); CFont::SetCentreOn(); - CFont::SetCentreSize(SCREEN_SCALE_X(590.0f)); + CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(50.0f)); CFont::SetColor(CRGBA(255, 255, 0, BigMessageAlpha[0])); // unused color CFont::SetFontStyle(FONT_HEADING); + // Appearently sliding text in here was abandoned very early, since this text is centered now. + if (BigMessageX[0] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) { BigMessageInUse[0] += CTimer::GetTimeStep(); @@ -1268,7 +1270,7 @@ void CHud::Draw() } } else { - BigMessageX[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f); + BigMessageX[0] += SCREEN_SCALE_X((CTimer::GetTimeStepInMilliseconds() * 0.3f)); BigMessageAlpha[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f); if (BigMessageAlpha[0] > 255.0f) @@ -1282,7 +1284,7 @@ void CHud::Draw() } else { BigMessageAlpha[0] = 0.0f; - BigMessageX[0] = -60.0f; + BigMessageX[0] = SCREEN_SCALE_FROM_RIGHT(DEFAULT_SCREEN_WIDTH + 60.0f); BigMessageInUse[0] = 1.0f; } } @@ -1293,7 +1295,7 @@ void CHud::Draw() // WastedBustedText if (m_BigMessage[2][0]) { if (BigMessageInUse[2] != 0.0f) { - BigMessageAlpha[2] += (CTimer::GetTimeStepInSeconds() * 255.0f); + BigMessageAlpha[2] += (CTimer::GetTimeStepInMilliseconds() * 0.4f); if (BigMessageAlpha[2] > 255.0f) BigMessageAlpha[2] = 255.0f; @@ -1330,6 +1332,7 @@ void CHud::Draw() } } +// --MIAMI: Done void CHud::DrawAfterFade() { RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST); @@ -1360,8 +1363,8 @@ void CHud::DrawAfterFade() else CFont::SetCentreOff(); - CFont::SetWrapx(SCREEN_SCALE_X(line.m_fWrapX)); - CFont::SetCentreSize(SCREEN_SCALE_X(line.m_fCenterSize)); + CFont::SetWrapx(SCALE_AND_CENTER_X(line.m_fWrapX)); + CFont::SetCentreSize(SCALE_AND_CENTER_X(line.m_fCenterSize)); if (line.m_bBackground) CFont::SetBackgroundOn(); else @@ -1379,7 +1382,7 @@ void CHud::DrawAfterFade() CFont::SetPropOff(); CFont::SetFontStyle(line.m_nFont); - CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - line.m_fAtX), SCREEN_SCALE_Y(DEFAULT_SCREEN_HEIGHT - line.m_fAtY), line.m_Text); + CFont::PrintString(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH - line.m_fAtX), SCREEN_SCALE_Y(DEFAULT_SCREEN_HEIGHT - line.m_fAtY), line.m_Text); } } for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroRectangles); i++) { @@ -1407,7 +1410,7 @@ void CHud::DrawAfterFade() CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f)); CFont::SetCentreOn(); CFont::SetPropOn(); - CFont::SetCentreSize(SCREEN_SCALE_X(600.0f)); + CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(40.0f)); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetDropShadowPosition(2); CFont::SetDropColor(CRGBA(0, 0, 0, 255)); @@ -1421,7 +1424,7 @@ void CHud::DrawAfterFade() CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f)); CFont::SetCentreOn(); CFont::SetPropOn(); - CFont::SetCentreSize(SCREEN_SCALE_X(620.0f)); + CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(60.0f)); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetDropShadowPosition(2); CFont::SetDropColor(CRGBA(0, 0, 0, 255)); @@ -1451,7 +1454,7 @@ void CHud::DrawAfterFade() } break; case 2: - OddJob2Timer += (20.0f * CTimer::GetTimeStep()); + OddJob2Timer += CTimer::GetTimeStepInMilliseconds(); if (OddJob2Timer > 1500) { OddJob2On = 3; } @@ -1476,20 +1479,18 @@ void CHud::DrawAfterFade() CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.2f)); CFont::SetCentreOn(); CFont::SetPropOn(); - CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f)); - CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(80.0f)); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); - + CFont::SetDropShadowPosition(2); + CFont::SetDropColor(CRGBA(0, 0, 0, 255)); #ifdef BETA_SLIDING_TEXT - CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]); CFont::SetColor(ODDJOB2_COLOR); - CFont::PrintString(SCREEN_WIDTH / 2 - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]); + CFont::PrintString(SCREEN_WIDTH / 2 - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_SCALE_Y(217.0f), m_BigMessage[5]); #else - CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]); CFont::SetColor(ODDJOB2_COLOR); - CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]); + CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_Y(217.0f), m_BigMessage[5]); #endif } } @@ -1502,6 +1503,7 @@ void CHud::DrawAfterFade() CFont::SetJustifyOff(); CFont::SetBackgroundOff(); + // will be overwritten below if (CGame::frenchGame || FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_SPANISH) CFont::SetScale(SCREEN_SCALE_X(0.884f), SCREEN_SCALE_Y(1.36f)); else @@ -1511,41 +1513,45 @@ void CHud::DrawAfterFade() CFont::SetRightJustifyWrap(0.0f); CFont::SetRightJustifyOn(); CFont::SetFontStyle(FONT_BANK); + CFont::SetScale(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_AMERICAN ? SCREEN_SCALE_X(1.7f) : SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.8f)); + if (BigMessageX[1] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) { BigMessageInUse[1] += CTimer::GetTimeStep(); if (BigMessageInUse[1] >= 120.0f) { BigMessageInUse[1] = 120.0f; - BigMessageAlpha[1] -= (CTimer::GetTimeStepInMilliseconds() * 0.3f); + BigMessageAlpha[1] -= CTimer::GetTimeStepInMilliseconds(); } if (BigMessageAlpha[1] <= 0) { m_BigMessage[1][0] = 0; + BigMessageInUse[1] = 0.0f; BigMessageAlpha[1] = 0.0f; } } else { - BigMessageX[1] += (CTimer::GetTimeStepInMilliseconds() * 0.3f); - BigMessageAlpha[1] += (CTimer::GetTimeStepInMilliseconds() * 0.3f); + BigMessageX[1] += SCREEN_SCALE_X((CTimer::GetTimeStepInMilliseconds() * 0.3f)); + BigMessageAlpha[1] += CTimer::GetTimeStepInMilliseconds(); if (BigMessageAlpha[1] > 255.0f) BigMessageAlpha[1] = 255.0f; } - CFont::SetDropShadowPosition(2); - CFont::SetDropColor(CRGBA(40, 40, 40, BigMessageAlpha[1])); - //CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1])); - //CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[1]); + CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1])); // what was that for? + CFont::SetDropShadowPosition(2); + CFont::SetDropColor(CRGBA(0, 0, 0, BigMessageAlpha[1])); CFont::SetColor(CRGBA(MISSIONTITLE_COLOR.r, MISSIONTITLE_COLOR.g, MISSIONTITLE_COLOR.b, BigMessageAlpha[1])); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]); - } - else { - BigMessageAlpha[1] = 0.0f; - BigMessageX[1] = -60.0f; +#ifdef BETA_SLIDING_TEXT + CFont::PrintString(BigMessageX[1], SCREEN_SCALE_FROM_BOTTOM(140.0f), m_BigMessage[1]); +#else + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(140.0f), m_BigMessage[1]); +#endif + } else { + m_ZoneFadeTimer = 0; + BigMessageX[1] = SCREEN_SCALE_FROM_RIGHT(DEFAULT_SCREEN_WIDTH + 60.0f); BigMessageInUse[1] = 1.0f; m_ZoneState = 0; } - } - else { + } else { BigMessageInUse[1] = 0.0f; } } @@ -1925,3 +1931,12 @@ float CHud::DrawFadeState(DRAW_FADE_STATE fadingElement, int forceFadingIn) return clamp(alpha, 0.0f, 255.0f); } + +void +CHud::ResetWastedText(void) +{ + BigMessageInUse[2] = 0.0f; + BigMessageInUse[0] = 0.0f; + m_BigMessage[2][0] = 0; + m_BigMessage[0][0] = 0; +}
\ No newline at end of file diff --git a/src/render/Hud.h b/src/render/Hud.h index 4dd52aa8..f4c0d8c4 100644 --- a/src/render/Hud.h +++ b/src/render/Hud.h @@ -140,4 +140,5 @@ public: static void SetZoneName(wchar *name); static void Shutdown(); static float DrawFadeState(DRAW_FADE_STATE, int); + static void ResetWastedText(void); }; |