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

Method LoadFromStream

CryGame/GameLoading.cpp:707–1406  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

705
706//////////////////////////////////////////////////////////////////////////
707bool CXGame::LoadFromStream(CStream &stm, bool isdemo)
708{
709
710 if(IsMultiplayer())
711 {
712 assert(0);
713 m_pLog->LogError("ERROR: LoadFromStream IsMultiplayer=true"); // severe problem - stream is different for MP
714 return false;
715 }
716
717 m_bIsLoadingLevelFromFile = true;
718 // [anton] make sure physical world has the most recent IsMultiplayer flag before loading
719 m_pSystem->GetIPhysicalWorld()->GetPhysVars()->bMultiplayer = IsMultiplayer() ? 1:0;
720
721 CScriptObjectStream scriptStream;
722 scriptStream.Create(m_pScriptSystem);
723 scriptStream.Attach(&stm);
724
725 string sMagic;
726 stm.Read(sMagic);
727 if(strcmp(sMagic.c_str(), SAVEMAGIC))
728 {
729 m_pLog->LogToConsole("ERROR: this is not a valid savegame file");
730 m_bIsLoadingLevelFromFile = false;
731 return false;
732 };
733
734 int nVersion;
735 stm.Read(nVersion);
736
737 stm.SetStreamVersion(nVersion);
738
739 switch (nVersion)
740 {
741 case SAVEVERSION:
742 return LoadFromStream_RELEASEVERSION(stm,isdemo,scriptStream);
743 case PATCH1_SAVEVERSION:
744 return LoadFromStream_PATCH_1(stm,isdemo,scriptStream);
745 // add more here as more patches are released
746 }
747
748 if(nVersion!=PATCH1_SAVEVERSION && nVersion!=PATCH2_SAVEVERSION)
749 {
750 m_pLog->LogToConsole("ERROR: savegame file from different version of the game");
751 m_bIsLoadingLevelFromFile = false;
752 return false;
753 };
754
755 IBitStream *pBitStream=GetIBitStream();
756
757 IEntitySystem *pEntitySystem=m_pSystem->GetIEntitySystem();
758 IEntityClassRegistry *pECR=GetClassRegistry();
759 IEntity *pEnt=NULL;
760 CEntityDesc ed;
761 int localPlayerId=0;
762
763 string sLevelName;
764 string sMissionName;

Callers 1

StartDemoPlayMethod · 0.80

Calls 15

CryErrorFunction · 0.85
LoadPropertiesFunction · 0.85
GetPhysVarsMethod · 0.80
GetIPhysicalWorldMethod · 0.80
SetStreamVersionMethod · 0.80
GetIEntitySystemMethod · 0.80
GetISoundSystemMethod · 0.80
GetIConsoleMethod · 0.80
GetCVarMethod · 0.80
GetILogMethod · 0.80
DemoConnectMethod · 0.80
EnableEventPostingMethod · 0.80

Tested by

no test coverage detected