|
4 | 4 |
|
5 | 5 | TOSHI_NAMESPACE_USING |
6 | 6 |
|
7 | | -IMPLEMENT_DYNCREATE(AFrontEndSplashState, ARootState) |
| 7 | +IMPLEMENT_DYNCREATE(AFrontEndSplashState, AFrontendState) |
8 | 8 |
|
9 | | -AFrontEndSplashState::AFrontEndSplashState(TBOOL a_bUnk, TFLOAT a_fUnk) |
| 9 | +AFrontEndSplashState::AFrontEndSplashState(TBOOL a_bInitialise, TFLOAT a_fUnk) |
10 | 10 | { |
11 | | - |
| 11 | + m_bInitialise = a_bInitialise; |
| 12 | + m_bMovieStarted = TFALSE; |
| 13 | + m_iLogoScreenIndex = 0; |
| 14 | + m_bLogoScreenSet = TFALSE; |
12 | 15 | } |
13 | 16 |
|
14 | 17 | void AFrontEndSplashState::OnActivate() |
15 | 18 | { |
16 | 19 | ARootState::OnActivate(); |
17 | 20 | AMoviePlayer* pMoviePlayer = g_oTheApp.GetRootTask()->GetMoviePlayer(); |
| 21 | + |
| 22 | + //AGUISystem::GetGUISystem()->Get; |
| 23 | + |
18 | 24 | pMoviePlayer->SetDoAudio(TTRUE); |
19 | 25 | pMoviePlayer->InitializeMoviePlayer(); |
20 | 26 | } |
21 | 27 |
|
22 | 28 | TBOOL AFrontEndSplashState::OnUpdate(TFLOAT a_fDeltaTime) |
23 | 29 | { |
24 | | - static TBOOL s_StartMovie = TTRUE; |
25 | | - |
26 | 30 | AMoviePlayer* pMoviePlayer = g_oTheApp.GetRootTask()->GetMoviePlayer(); |
27 | 31 |
|
| 32 | + if (m_bInitialise) { |
| 33 | + static TFLOAT s_fStopLoadingSounds = 0.0f; |
| 34 | + static TFLOAT s_fStartLoadingSounds = 5.0f; |
| 35 | + static TFLOAT s_fTimeLeftLoadingSounds = 5.0f; |
| 36 | + if (s_fStopLoadingSounds < s_fTimeLeftLoadingSounds) { |
| 37 | + if (s_fTimeLeftLoadingSounds < s_fStartLoadingSounds && s_bLoadedSound) { |
| 38 | + // ASoundManager |
| 39 | + s_bLoadedSound = TTRUE; |
| 40 | + } |
| 41 | + s_fTimeLeftLoadingSounds -= a_fDeltaTime; |
| 42 | + return ARootState::OnUpdate(a_fDeltaTime); |
| 43 | + } |
| 44 | + if (!m_bLogoScreenSet) { |
| 45 | + m_oHUDState.ClearBackgroundPicture(); |
| 46 | + m_oHUDState.SetBackgroundMatLib(sm_asLogoScreens[m_iLogoScreenIndex]); |
| 47 | + m_bLogoScreenSet = TTRUE; |
| 48 | + } |
| 49 | + if (RunLogoState(a_fDeltaTime)) { |
| 50 | + return ARootState::OnUpdate(a_fDeltaTime); |
| 51 | + } |
| 52 | + } |
| 53 | + |
| 54 | + if (!m_bMovieStarted) { |
| 55 | + m_bMovieStarted = TTRUE; |
| 56 | + } |
| 57 | + static TBOOL s_StartMovie = TTRUE; |
28 | 58 | if (s_StartMovie) { |
29 | 59 | s_StartMovie = TFALSE; |
30 | 60 | if (pMoviePlayer && !pMoviePlayer->IsMoviePlaying()) { |
31 | 61 | pMoviePlayer->StartMovie((TPCHAR)"Intro", TFALSE, (TPCHAR)"Intro", TTRUE); |
32 | 62 | } |
33 | 63 | } |
| 64 | + else if (!pMoviePlayer) { |
| 65 | + //SetStartScreen(); |
| 66 | + } |
| 67 | + else { |
| 68 | + if (!pMoviePlayer->IsMoviePlaying()) { |
| 69 | + pMoviePlayer->RenderMovie(TFALSE); |
| 70 | + //SetStartScreen(); |
| 71 | + } |
| 72 | + else { |
| 73 | + pMoviePlayer->RenderMovie(TTRUE); |
| 74 | + } |
| 75 | + } |
34 | 76 |
|
35 | 77 | return ARootState::OnUpdate(a_fDeltaTime); |
36 | 78 | } |
| 79 | + |
| 80 | +void AFrontEndSplashState::OnInsertion() |
| 81 | +{ |
| 82 | + AFrontendState::OnInsertion(); |
| 83 | + if (m_bInitialise) { |
| 84 | + m_oHUDState.SetBackgroundMatLib("Data/Matlibs/bkg_Lic_pc.tml"); |
| 85 | + } |
| 86 | +} |
| 87 | + |
| 88 | +TBOOL AFrontEndSplashState::RunLogoState(TFLOAT a_fDeltaTime) |
| 89 | +{ |
| 90 | + if (m_iLogoScreenIndex <= 0) { |
| 91 | + return TFALSE; |
| 92 | + } |
| 93 | + TFLOAT curLogoTime = m_fLogoDisplayTime + a_fDeltaTime; |
| 94 | + if (sm_fLogoDisplayTime <= curLogoTime) { |
| 95 | + m_iLogoScreenIndex++; |
| 96 | + m_fLogoDisplayTime = 0; |
| 97 | + if (m_iLogoScreenIndex <= 0) { |
| 98 | + return TFALSE; |
| 99 | + } |
| 100 | + m_oHUDState.ClearBackgroundPicture(); |
| 101 | + m_oHUDState.SetBackgroundMatLib(sm_asLogoScreens[m_iLogoScreenIndex]); |
| 102 | + } |
| 103 | + else { |
| 104 | + m_fLogoDisplayTime = curLogoTime; |
| 105 | + } |
| 106 | + return TTRUE; |
| 107 | +} |
0 commit comments