bool CScreenPreload::UpdateInterfaceSFX() { if( m_bFirstUpdate ) { m_bFirstUpdate = false; FirstUpdate( ); } if (!CBaseScreen::UpdateInterfaceSFX()) return false; ChainFXList::iterator iter = m_Chains.begin(); bool bAnyActive = false; while (iter != m_Chains.end() && !bAnyActive) { CChainedFX *pChain = (*iter); pChain->Update(); bAnyActive = !pChain->IsIntroDone(); iter++; } bAnyActive = bAnyActive || !UpdateCDKeyValidation( ); if (!bAnyActive ) { bool bSuccess = true; if (m_bWaitingToExit) bSuccess = g_pMissionMgr->FinishExitLevel( ); else bSuccess = g_pMissionMgr->FinishStartGame( ); if (!bSuccess) { if (IsMultiplayerGame()) g_pInterfaceMgr->ConnectionFailed(g_pClientMultiplayerMgr->GetLastConnectionResult()); else g_pInterfaceMgr->LoadFailed(); } } return bAnyActive; }
void CScreenPreload::FirstUpdate( ) { int n = 0; char szTagName[30]; char szAttName[30]; char szFXName[128]; m_bHaveLights = LTFALSE; HOBJECT hCamera = g_pInterfaceMgr->GetInterfaceCamera(); if (!hCamera) return; // Check if we have a mission entry. bool bGotMission = false; if( !g_pMissionMgr->IsCustomLevel( )) { int nNewMission = g_pMissionMgr->GetNewMission( ); int nNewLevel = g_pMissionMgr->GetNewLevel( ); MISSION* pMission = g_pMissionButeMgr->GetMission( nNewMission ); if( pMission ) { int nBriefingId = pMission->aLevels[nNewLevel].nBriefingId; if( nBriefingId >= 0 && !g_pMissionMgr->IsRestoringLevel( )) m_layout = pMission->szBriefLayout; else m_layout = pMission->szLayout; bGotMission = true; } } // If we were unsuccessful in getting info from the mission, then just // use defaults. if( !bGotMission ) { m_layout = "LoadScreenDefault"; } g_pLTClient->GetObjectPos(hCamera, &s_vPos); g_pLTClient->GetObjectRotation(hCamera, &s_rRot); s_vU = s_rRot.Up(); s_vR = s_rRot.Right(); s_vF = s_rRot.Forward(); SAFE_STRCPY(szTagName,m_layout.c_str()); if (!g_pLayoutMgr->Exist(szTagName)) SAFE_STRCPY(szTagName,"LoadScreenDefault"); sprintf(szAttName,"Light%d",n); while (g_pLayoutMgr->HasValue(szTagName,szAttName)) { g_pLayoutMgr->GetString(szTagName,szAttName,szFXName,128); if (strlen(szFXName)) { CreateLightFX(szFXName); } n++; sprintf(szAttName,"Light%d",n); } n = 0; sprintf(szAttName,"PreScale%d",n); while (g_pLayoutMgr->HasValue(szTagName,szAttName)) { g_pLayoutMgr->GetString(szTagName,szAttName,szFXName,128); if (strlen(szFXName)) { CBaseScaleFX *pSFX = CreateScaleFX(szFXName); } n++; sprintf(szAttName,"PreScale%d",n); } n = 0; sprintf(szAttName,"PreFX%d",n); while (g_pLayoutMgr->HasValue(szTagName,szAttName)) { g_pLayoutMgr->GetString(szTagName,szAttName,szFXName,128); if (strlen(szFXName)) { INT_FX* pFX = g_pLayoutMgr->GetFX(szFXName); if (pFX) { g_pInterfaceMgr->AddInterfaceFX(LTNULL, pFX->szFXName,pFX->vPos,pFX->bLoop); } } n++; sprintf(szAttName,"PreFX%d",n); } ChainFXList::iterator iter = m_Chains.begin(); while (iter != m_Chains.end()) { debug_delete(*iter); iter++; } m_Chains.clear(); char szIntroFXName[128] = ""; char szShortFXName[128] = ""; char szLoopFXName[128] = ""; int nFXNum = 0; bool bFound = false; do { szIntroFXName[0] = 0; szShortFXName[0] = 0; szLoopFXName[0] = 0; bFound = false; sprintf(szAttName,"PreIntroFX%d",nFXNum); if (g_pLayoutMgr->HasValue(szTagName,szAttName)) { g_pLayoutMgr->GetString(szTagName,szAttName,szIntroFXName,128); } sprintf(szAttName,"PreLoopFX%d",nFXNum); if (g_pLayoutMgr->HasValue(szTagName,szAttName)) { g_pLayoutMgr->GetString(szTagName,szAttName,szLoopFXName,128); } if (strlen(szIntroFXName) || strlen(szShortFXName) ) //don't start loop-only chains || strlen(szLoopFXName)) { nFXNum++; bFound = true; CChainedFX *pChain = debug_new(CChainedFX); pChain->Init(szIntroFXName,szShortFXName,szLoopFXName); m_Chains.push_back(pChain); } } while (bFound); // Start all the chains. iter = m_Chains.begin(); while (iter != m_Chains.end()) { (*iter)->Start(!!m_bVisited); iter++; } // If we are not joining a lan game and the cdkey hasn't been validated, // we need to do it now. m_eValidatingCDKeyState = kValidatingCDKeyState_None; if( !g_bLAN && g_pClientMultiplayerMgr->GetStartGameRequest( ).m_Type == STARTGAME_CLIENTTCP ) { IServerDirectory *pServerDir = g_pClientMultiplayerMgr->GetServerDir(); if( !pServerDir || !pServerDir->IsCDKeyValid( )) { m_eValidatingCDKeyState = kValidatingCDKeyState_Start; } } }
void CTransitionFXMgr::Init() { int iCurrentFrom = 0; int iCurrentTo = 0; m_bAllowLooping = true; ChainFXList * pChainFXList = LTNULL; // Iterate through all available transitionFX in layout.txt and add // them all to m_TransitionFX unsigned int nChainNum = 0; INT_CHAINFX * pFX = g_pLayoutMgr->GetChainFX(nChainNum); while (pFX) { // build the new ChainFX. CChainedFX * pChainFX = debug_new(CChainedFX); pChainFX->Init(pFX->szIntroName, pFX->szShortIntroName, pFX->szLoopName); pChainFX->m_iFromScreen = pFX->iFromScreen; pChainFX->m_iToScreen = pFX->iToScreen; // Where to add this new ChainFX? // If it's the first, then create a new chainFXList // It it's not, but doesn't match the last "from/to" pair, then create a new ChainFXList // If it matches, then add it to the end of the current ChainFXList if (!pChainFXList) // first time through { // Create a new ChainFXList pChainFXList pChainFXList = debug_new(ChainFXList); // Add the new ChainFXList to m_TransitionFX m_TransitionFX.push_back(pChainFXList); // Add pChainFX to the list pChainFXList pChainFXList->push_back(pChainFX); iCurrentFrom = pFX->iFromScreen; iCurrentTo = pFX->iToScreen; } else if (pFX->iFromScreen != iCurrentFrom || pFX->iToScreen != iCurrentTo) { // Create a new ChainFXList pChainFXList pChainFXList = debug_new(ChainFXList); // Add the new ChainFXList to m_TransitionFX m_TransitionFX.push_back(pChainFXList); // Add pChainFX to the list pChainFXList pChainFXList->push_back(pChainFX); iCurrentFrom = pFX->iFromScreen; iCurrentTo = pFX->iToScreen; } else { // Add pChainFX to the list pChainFXList pChainFXList->push_back(pChainFX); } nChainNum++; pFX = g_pLayoutMgr->GetChainFX(nChainNum); } while (pFX); }