///////////////////////////////////////////////////////////////////// Do common for Client and Server things when opening a new level. /////////////////////////////////////////////////////////////////////
| 1526 | // Do common for Client and Server things when opening a new level. |
| 1527 | ////////////////////////////////////////////////////////////////////////// |
| 1528 | bool CXSystemBase::LoadLevelCommon( SMissionInfo &missionInfo ) |
| 1529 | { |
| 1530 | // Start time of level loading. |
| 1531 | CTimeValue time0 = m_pSystem->GetITimer()->GetCurrTimePrecise(); |
| 1532 | AutoSuspendTimeQuota AutoSuspender(m_pSystem->GetStreamEngine()); |
| 1533 | |
| 1534 | string sPreviousLevelFolder = m_pGame->m_currentLevelFolder; |
| 1535 | m_pGame->m_currentLevel = missionInfo.sLevelName; |
| 1536 | m_pGame->m_currentMission = missionInfo.sMissionName; |
| 1537 | m_pGame->m_currentLevelFolder = missionInfo.sLevelFolder; |
| 1538 | |
| 1539 | // Make level loading image. (ex: Levels\Training\loadscreen_training.dds) |
| 1540 | string sLoadingScreenTexture = missionInfo.sLevelFolder + "/loadscreen_" + missionInfo.sLevelName + ".dds"; |
| 1541 | |
| 1542 | m_pSystem->GetIConsole()->Clear(); |
| 1543 | m_pSystem->GetIConsole()->SetScrollMax(600); |
| 1544 | m_pSystem->GetIConsole()->ShowConsole(true); |
| 1545 | |
| 1546 | m_pSystem->GetIConsole()->SetLoadingImage( sLoadingScreenTexture.c_str() ); |
| 1547 | m_pSystem->GetIConsole()->ResetProgressBar(0x7fffffff); |
| 1548 | m_pSystem->GetILog()->UpdateLoadingScreen(""); // just to draw the console |
| 1549 | |
| 1550 | if (missionInfo.bEditor) |
| 1551 | { |
| 1552 | ////////////////////////////////////////////////////////////////////////// |
| 1553 | if (m_pSystem->GetIProcess()->GetFlags() != PROC_3DENGINE) |
| 1554 | { |
| 1555 | m_pSystem->SetIProcess(m_pGame->m_p3DEngine); |
| 1556 | m_pSystem->GetIProcess()->SetFlags(PROC_3DENGINE); |
| 1557 | } |
| 1558 | m_pGame->Reset(); |
| 1559 | |
| 1560 | OnReadyToLoadLevel( missionInfo ); |
| 1561 | |
| 1562 | ////////////////////////////////////////////////////////////////////////// |
| 1563 | ////////////////////////////////////////////////////////////////////////// |
| 1564 | // Start loading common stuff. |
| 1565 | ////////////////////////////////////////////////////////////////////////// |
| 1566 | |
| 1567 | //init the entity registry |
| 1568 | InitRegistry( missionInfo.sLevelName.c_str() ); |
| 1569 | LoadLanguageTable( missionInfo.sLevelName.c_str(),missionInfo.sMissionName.c_str() ); |
| 1570 | |
| 1571 | /////////////////////////////////////////////////////////////////////////////////////// |
| 1572 | // INITIALIZE AI SYSTEM |
| 1573 | IAISystem *pAISystem = m_pSystem->GetAISystem(); |
| 1574 | if (pAISystem) |
| 1575 | { |
| 1576 | pAISystem->Init(m_pSystem, missionInfo.sLevelName.c_str(), missionInfo.sMissionName.c_str() ); |
| 1577 | IScriptSystem *pScriptSystem = m_pGame->GetScriptSystem(); |
| 1578 | if (!pScriptSystem->ExecuteFile("Scripts/AI/aiconfig.lua")) |
| 1579 | { |
| 1580 | GameWarning( "[AISYSTEM] Cannot load AI CONFIGURATION FILE" ); |
| 1581 | } |
| 1582 | ////////////////////////////////////////////////////////////////////////// |
| 1583 | // Initialize AI Autobalance. |
| 1584 | ////////////////////////////////////////////////////////////////////////// |
| 1585 | pAISystem->GetAutoBalanceInterface()->SetMultipliers( |
nothing calls this directly
no test coverage detected