MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / LoadLevelCS

Method LoadLevelCS

CryGame/Game.cpp:1440–1563  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////// ! Load a level on the local machine (connecting with a local client) @param dedicated if true the local client will not be created @param keepclient if true the current client server connection will be kept @param szMapName name of the level that has to be loaded @param szMissionName name of the mission that has to be loaded

Source from the content-addressed store, hash-verified

1438*/
1439//////////////////////////////////////////////////////////////////////////
1440void CXGame::LoadLevelCS(bool keepclient, const char *szMapName, const char *szMissionName, bool listen)
1441{
1442 // need to reset timers as well
1443 m_pScriptTimerMgr->Reset();
1444
1445 if (m_pUISystem)
1446 {
1447 m_pUISystem->GetScriptObjectUI()->OnSwitch(0);
1448 m_pUISystem->StopAllVideo();
1449 m_p3DEngine->Enable(1);
1450
1451 m_pSystem->GetILog()->Log("UISystem: Enabled 3D Engine!");
1452 }
1453#if !defined(LINUX)
1454 if (m_pSystem->GetIMovieSystem())
1455 m_pSystem->GetIMovieSystem()->StopAllCutScenes();
1456 //m_lstPlayedCutScenes.clear();
1457#endif
1458 bool bDedicated=GetSystem()->IsDedicated();
1459
1460 string strGameType = g_GameType->GetString();
1461
1462 AutoSuspendTimeQuota AutoSuspender(GetSystem()->GetStreamEngine());
1463
1464 assert( szMissionName != 0 );
1465
1466 string sLevelFolder = szMapName;
1467 if (sLevelFolder.find('\\') == string::npos && sLevelFolder.find('/') == string::npos)
1468 {
1469 // This is just a map name, not a folder.
1470 sLevelFolder = GetLevelsFolder() + "/" + sLevelFolder;
1471 }
1472
1473 IConsole *pConsole=GetSystem()->GetIConsole();
1474 IInput *pInput=GetSystem()->GetIInput(); // might be 0 (e.g. dedicated server)
1475
1476 if(pInput)
1477 pInput->SetMouseExclusive(false);
1478
1479 //if(!*szMissionName) szMissionName = "Multiplayer";
1480
1481 if (!IsMultiplayer())
1482 {
1483 m_pSystem->GetIConsole()->Clear();
1484 m_pSystem->GetIConsole()->SetScrollMax(600);
1485 m_pSystem->GetIConsole()->ShowConsole(true);
1486
1487 string sLoadingScreenTexture = string("levels/") + string(szMapName) + string("/loadscreen_") + string(szMapName) + ".dds";
1488
1489 m_pSystem->GetIConsole()->SetLoadingImage(sLoadingScreenTexture.c_str());
1490 m_pSystem->GetIConsole()->ResetProgressBar(0x7fffffff);
1491 m_pSystem->GetILog()->UpdateLoadingScreen(""); // just to draw the console
1492 }
1493
1494 if (m_pClient && !keepclient)
1495 {
1496 ShutdownClient();
1497 }

Callers 3

LoadLevelMethod · 0.80
LoadLevelListenMethod · 0.80
LoadLevelMPServerMethod · 0.80

Calls 15

OnSwitchMethod · 0.80
GetScriptObjectUIMethod · 0.80
GetILogMethod · 0.80
GetIMovieSystemMethod · 0.80
GetStreamEngineMethod · 0.80
GetIConsoleMethod · 0.80
SetMouseExclusiveMethod · 0.80
SetScrollMaxMethod · 0.80
SetLoadingImageMethod · 0.80
ResetProgressBarMethod · 0.80
GetServerTypeMethod · 0.80
XConnectMethod · 0.80

Tested by

no test coverage detected