diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-03-30 19:10:12 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-03-30 19:10:12 +0200 |
commit | 2607a91d87270709db4303ee8cb9011e2d9146ad (patch) | |
tree | 611cf59f1c46b60908057affe8d86eb9b39a23ad /src/core/Frontend.cpp | |
parent | Add russian lang support (diff) | |
parent | Merge pull request #366 from Nick007J/master (diff) | |
download | re3-2607a91d87270709db4303ee8cb9011e2d9146ad.tar re3-2607a91d87270709db4303ee8cb9011e2d9146ad.tar.gz re3-2607a91d87270709db4303ee8cb9011e2d9146ad.tar.bz2 re3-2607a91d87270709db4303ee8cb9011e2d9146ad.tar.lz re3-2607a91d87270709db4303ee8cb9011e2d9146ad.tar.xz re3-2607a91d87270709db4303ee8cb9011e2d9146ad.tar.zst re3-2607a91d87270709db4303ee8cb9011e2d9146ad.zip |
Diffstat (limited to 'src/core/Frontend.cpp')
-rw-r--r-- | src/core/Frontend.cpp | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index a002835b..72d7d912 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -1354,23 +1354,39 @@ void CMenuManager::DrawFrontEndNormal() m_aFrontEndSprites[currentSprite].Draw(CRect(MENU_X_LEFT_ALIGNED(50.0f), MENU_Y(50.0f), MENU_X_RIGHT_ALIGNED(50.0f), SCREEN_SCALE_FROM_BOTTOM(95.0f)), CRGBA(255, 255, 255, m_nMenuFadeAlpha > 255 ? 255 : m_nMenuFadeAlpha)); + static float fadeAlpha = 0.0f; + static int lastState = 0; + + // reverseAlpha = PS2 fading (wait for 255->0, then change screen) if (m_nMenuFadeAlpha < 255) { - static uint32 LastFade = 0; + if (lastState == 1 && !reverseAlpha) + fadeAlpha = 0.f; if (m_nMenuFadeAlpha <= 0 && reverseAlpha) { reverseAlpha = false; ChangeScreen(pendingScreen, pendingOption, true, false); } else { + float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); + + // +20 per every 33 ms (1000.f/30.f - original frame limiter fps) if (!reverseAlpha) - m_nMenuFadeAlpha += min((CTimer::GetTimeInMillisecondsPauseMode() - LastFade) / 33.0f, 1.0f) * 20.0f; + fadeAlpha += (timestep * 100.f) * 20.f / 33.f; else - m_nMenuFadeAlpha = max(0, m_nMenuFadeAlpha - min((CTimer::GetTimeInMillisecondsPauseMode() - LastFade) / 33.0f, 1.0f) * 30.0f); + fadeAlpha = max(0.0f, fadeAlpha - (timestep * 100.f) * 30.f / 33.f); - LastFade = CTimer::GetTimeInMillisecondsPauseMode(); + m_nMenuFadeAlpha = fadeAlpha; } + lastState = 0; } else { - if (reverseAlpha) - m_nMenuFadeAlpha -= 20; + if (lastState == 0) fadeAlpha = 255.f; + + if (reverseAlpha) { + float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); + fadeAlpha -= (timestep * 100.f) * 30.f / 33.f; + + m_nMenuFadeAlpha = fadeAlpha; + } + lastState = 1; // TODO: what is this? waiting mouse? if(field_518 == 4){ @@ -1568,13 +1584,20 @@ void CMenuManager::DrawFrontEndNormal() } if (m_nMenuFadeAlpha < 255) { - static uint32 LastFade = 0; - // Famous transparent menu bug. 33.0f = 1000.f/30.f (original frame limiter fps) + // Famous transparent menu bug #ifdef FIX_BUGS - m_nMenuFadeAlpha += min((CTimer::GetTimeInMillisecondsPauseMode() - LastFade) / 33.0f, 1.0f) * 20.0f; - LastFade = CTimer::GetTimeInMillisecondsPauseMode(); + static float fadeAlpha = 0.0f; + if (m_nMenuFadeAlpha == 0 && fadeAlpha > 1.0f) fadeAlpha = 0.0f; + + float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); + + // +20 per every 33 ms (1000.f/30.f - original frame limiter fps) + fadeAlpha += (timestep * 100.f) * 20.f / 33.f; + m_nMenuFadeAlpha = fadeAlpha; #else + static uint32 LastFade = 0; + if(CTimer::GetTimeInMillisecondsPauseMode() - LastFade > 10){ m_nMenuFadeAlpha += 20; LastFade = CTimer::GetTimeInMillisecondsPauseMode(); @@ -1694,9 +1717,6 @@ int CMenuManager::GetStartOptionsCntrlConfigScreens() } #endif -#if DONT_USE_SUSPICIOUS_FUNCS -WRAPPER void CMenuManager::InitialiseChangedLanguageSettings() { EAXJMP(0x47A4D0); } -#else void CMenuManager::InitialiseChangedLanguageSettings() { if (m_bFrontEnd_ReloadObrTxtGxt) { @@ -1735,7 +1755,6 @@ void CMenuManager::InitialiseChangedLanguageSettings() } } } -#endif void CMenuManager::LoadAllTextures() { |