MCPcopy Create free account
hub / github.com/MergHQ/CRYENGINE / PrepareNextLevel

Method PrepareNextLevel

Code/CryEngine/CryAction/LevelSystem.cpp:1583–1630  ·  view source on GitHub ↗

------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1581
1582//------------------------------------------------------------------------
1583void CLevelSystem::PrepareNextLevel(const char* levelName)
1584{
1585 m_levelLoadStartTime = gEnv->pTimer->GetAsyncTime();
1586 CLevelInfo* pLevelInfo = GetLevelInfoInternal(levelName);
1587 if (!pLevelInfo)
1588 {
1589 // alert the listener
1590 //OnLevelNotFound(levelName);
1591 return;
1592 }
1593
1594 gEnv->pConsole->SetScrollMax(600);
1595 ICVar* con_showonload = gEnv->pConsole->GetCVar("con_showonload");
1596 if (con_showonload && con_showonload->GetIVal() != 0)
1597 {
1598 gEnv->pConsole->ShowConsole(true);
1599 ICVar* g_enableloadingscreen = gEnv->pConsole->GetCVar("g_enableloadingscreen");
1600 if (g_enableloadingscreen)
1601 g_enableloadingscreen->Set(0);
1602 ICVar* gfx_loadtimethread = gEnv->pConsole->GetCVar("gfx_loadtimethread");
1603 if (gfx_loadtimethread)
1604 gfx_loadtimethread->Set(0);
1605 }
1606
1607 // force a Lua deep garbage collection
1608 {
1609 gEnv->pScriptSystem->ForceGarbageCollection();
1610 }
1611
1612 // swap to the level heap
1613 CCryAction::GetCryAction()->SwitchToLevelHeap(levelName);
1614
1615 // Open pak file for a new level.
1616 pLevelInfo->OpenLevelPak();
1617
1618 // switched to level heap, so now imm start the loading screen (renderer will be reinitialized in the levelheap)
1619 gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_LOAD_START_LOADINGSCREEN, (UINT_PTR)pLevelInfo, 0);
1620 gEnv->pSystem->SetSystemGlobalState(ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_PREPARE);
1621
1622 // Inform resource manager about loading of the new level.
1623 GetISystem()->GetIResourceManager()->PrepareLevel(pLevelInfo->GetPath(), pLevelInfo->GetName());
1624
1625 // Disable locking of resources to allow everything to be offloaded.
1626
1627 //string filename = PathUtil::Make( pLevelInfo->GetPath(),"resourcelist.txt" );
1628 //gEnv->pCryPak->GetResourceList(ICryPak::RFOM_NextLevel)->Load( filename.c_str() );
1629
1630}
1631
1632//------------------------------------------------------------------------
1633void CLevelSystem::OnLevelNotFound(const char* levelName)

Callers 3

MapCmdMethod · 0.80
OnStepMethod · 0.80
LoadGameMethod · 0.80

Calls 15

GetISystemFunction · 0.85
SetScrollMaxMethod · 0.80
OpenLevelPakMethod · 0.80
SetSystemGlobalStateMethod · 0.80
PrepareLevelMethod · 0.80
GetIResourceManagerMethod · 0.80
GetAsyncTimeMethod · 0.45
GetCVarMethod · 0.45
GetIValMethod · 0.45
ShowConsoleMethod · 0.45

Tested by

no test coverage detected