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

Method LoadLevel

Code/CryEngine/CryAction/LevelSystem.cpp:1189–1513  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1187
1188//------------------------------------------------------------------------
1189ILevelInfo* CLevelSystem::LoadLevel(const char* _levelName)
1190{
1191#ifndef NO_LIVECREATE
1192 CLiveCreateLevelLoadingBracket liveCreateLoadingBracket;
1193#endif
1194
1195 gEnv->pSystem->SetSystemGlobalState(ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START);
1196
1197 MEMSTAT_CONTEXT_FMT(EMemStatContextTypes::MSC_Other, 0, "Level load (%s)", _levelName);
1198
1199 CryLog("Level system is loading \"%s\"", _levelName);
1200 INDENT_LOG_DURING_SCOPE();
1201
1202 char levelName[256];
1203 string sNextLevel(_levelName);
1204 cry_strcpy(levelName, _levelName);
1205
1206 // Not remove a scope!!!
1207 {
1208 LOADING_TIME_PROFILE_SECTION;
1209
1210 //m_levelLoadStartTime = gEnv->pTimer->GetAsyncTime();
1211
1212 CLevelInfo* pLevelInfo = GetLevelInfoInternal(levelName);
1213
1214 if (!pLevelInfo)
1215 {
1216 // alert the listener
1217 OnLevelNotFound(levelName);
1218
1219 return 0;
1220 }
1221
1222 m_bLevelLoaded = false;
1223
1224 const bool bLoadingSameLevel = m_lastLevelName.compareNoCase(levelName) == 0;
1225 m_lastLevelName = levelName;
1226
1227 //////////////////////////////////////////////////////////////////////////
1228 // Read main level info.
1229 if (!pLevelInfo->ReadInfo())
1230 {
1231 OnLoadingError(pLevelInfo, "Failed to read level info (level.pak might be corrupted)!");
1232 return 0;
1233 }
1234 //////////////////////////////////////////////////////////////////////////
1235
1236 m_pCurrentLevelInfo = pLevelInfo;
1237
1238 gEnv->pConsole->SetScrollMax(600);
1239 ICVar* con_showonload = gEnv->pConsole->GetCVar("con_showonload");
1240 if (con_showonload && con_showonload->GetIVal() != 0)
1241 {
1242 gEnv->pConsole->ShowConsole(true);
1243 ICVar* g_enableloadingscreen = gEnv->pConsole->GetCVar("g_enableloadingscreen");
1244 if (g_enableloadingscreen)
1245 g_enableloadingscreen->Set(0);
1246 ICVar* gfx_loadtimethread = gEnv->pConsole->GetCVar("gfx_loadtimethread");

Callers

nothing calls this directly

Calls 15

CryLogFunction · 0.85
cry_strcpyFunction · 0.85
stringClass · 0.85
SActionEventClass · 0.85
GetFileNameFunction · 0.85
CryGetIMemReplayFunction · 0.85
GetISystemFunction · 0.85
SetSystemGlobalStateMethod · 0.80
ReadInfoMethod · 0.80
SetScrollMaxMethod · 0.80
AddGlobalAreaMethod · 0.80
SetThreadStateMethod · 0.80

Tested by

no test coverage detected