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

Method LoadGame

Code/CryEngine/CryAction/Serialization/GameSerialize.cpp:578–960  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////// TODO: split maybe into some separate classes...

Source from the content-addressed store, hash-verified

576//////////////////////////////////////////////////////////////////////////
577// TODO: split maybe into some separate classes...
578ELoadGameResult CGameSerialize::LoadGame(CCryAction* pCryAction, const char* method, const char* path, SGameStartParams& startParams, bool requireQuickLoad)
579{
580 struct SLoadGameAutoCleanup
581 {
582 SLoadGameAutoCleanup(bool _pauseStreaming)
583 : pauseStreaming(_pauseStreaming)
584 {
585 if (pauseStreaming)
586 {
587 // Pause streaming engine for anything but sound, video and flash.
588 uint32 nMask = (1 << eStreamTaskTypeFlash) | (1 << eStreamTaskTypeVideo) | STREAM_TASK_TYPE_AUDIO_ALL; // Unblock specified streams
589 nMask = ~nMask; // Invert mask, bit set means blocking type.
590 GetISystem()->GetStreamEngine()->PauseStreaming(true, nMask);
591 }
592
593 gEnv->pSystem->SetThreadState(ESubsys_Physics, false);
594 }
595 ~SLoadGameAutoCleanup()
596 {
597 if (pauseStreaming)
598 {
599 GetISystem()->GetStreamEngine()->PauseStreaming(false, -1);
600 }
601
602 gEnv->pSystem->SetThreadState(ESubsys_Physics, true);
603 }
604 bool pauseStreaming;
605 } autoCleanup(requireQuickLoad);
606
607 if (gEnv->IsEditor())
608 {
609 if (CCryActionCVars::Get().g_allowSaveLoadInEditor == 0)
610 {
611 const char* const szSafeName = path ? path : "<UNKNOWN>";
612 GameWarning("Ignoring editor loadgame \"%s\"", szSafeName);
613 return eLGR_Failed;
614 }
615 }
616 else if (!IsUserSignedIn(pCryAction))
617 {
618 return eLGR_Failed;
619 }
620
621 CryGetIMemReplay()->AddLabel("Loadgame_start");
622 Checkpoint total(CHECKPOINT_OUTPUT, "TotalTime");
623 Checkpoint checkpoint(CHECKPOINT_OUTPUT);
624
625 // stop all deferred physics events in the fly
626 if (gEnv->p3DEngine)
627 {
628 IDeferredPhysicsEventManager* pDeferredPhysicsEventManager = gEnv->p3DEngine->GetDeferredPhysicsEventManager();
629 if (pDeferredPhysicsEventManager)
630 pDeferredPhysicsEventManager->ClearDeferredEvents();
631 }
632
633 Clean();
634
635 // need to leave the player entity in the list, else it won't get

Callers

nothing calls this directly

Calls 15

CryGetIMemReplayFunction · 0.85
GetISystemFunction · 0.85
strcmpFunction · 0.85
CryLogFunction · 0.85
GetLevelInfoFunction · 0.85
binary_findFunction · 0.85
CryLogAlwaysFunction · 0.85
ClearDeferredEventsMethod · 0.80
SendEventToAllMethod · 0.80

Tested by

no test coverage detected