MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / LevelInit

Method LevelInit

core/sourcemod.cpp:279–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277
278static bool g_LevelEndBarrier = false;
279bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background)
280{
281 /* Seed rand() globally per map */
282 srand(time(NULL));
283
284 g_Players.MaxPlayersChanged();
285
286 /* If we're not loaded... */
287 if (!g_Loaded)
288 {
289 /* Do all global initialization now */
290 StartSourceMod(true);
291 }
292
293 m_IsMapLoading = true;
294 m_ExecPluginReload = true;
295
296 /* Notify! */
297 SMGlobalClass *pBase = SMGlobalClass::head;
298 while (pBase)
299 {
300 pBase->OnSourceModLevelChange(pMapName);
301 pBase = pBase->m_pGlobalClassNext;
302 }
303
304 DoGlobalPluginLoads();
305
306 m_IsMapLoading = false;
307
308 /* Notify! */
309 pBase = SMGlobalClass::head;
310 while (pBase)
311 {
312 pBase->OnSourceModPluginsLoaded();
313 pBase = pBase->m_pGlobalClassNext;
314 }
315
316 if (!g_pOnMapInit)
317 {
318 g_pOnMapInit = forwardsys->CreateForward("OnMapInit", ET_Ignore, 1, NULL, Param_String);
319 }
320
321 if (!g_pOnMapEnd)
322 {
323 g_pOnMapEnd = forwardsys->CreateForward("OnMapEnd", ET_Ignore, 0, NULL);
324 }
325
326 g_LevelEndBarrier = true;
327
328 int parseError;
329 size_t position;
330 bool success = logicore.ParseEntityLumpString(pMapEntities, parseError, position);
331
332 logicore.SetEntityLumpWritable(true);
333 g_pOnMapInit->PushString(pMapName);
334 g_pOnMapInit->Execute();
335 logicore.SetEntityLumpWritable(false);
336

Callers

nothing calls this directly

Calls 7

MaxPlayersChangedMethod · 0.80
CreateForwardMethod · 0.80
PushStringMethod · 0.80
ExecuteMethod · 0.45
LogErrorMethod · 0.45

Tested by

no test coverage detected