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

Method LoadAIState

CryGame/XPlayer.cpp:7116–7240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7114}
7115
7116void CPlayer::LoadAIState(CStream & stm, CScriptObjectStream & scriptStream)
7117{
7118 IScriptSystem *pScriptSystem = m_pGame->GetSystem()->GetIScriptSystem();
7119 HSCRIPTFUNCTION loadOverallFunction=NULL;
7120 if( m_pEntity->GetScriptObject() && m_pEntity->GetScriptObject()->GetValue("OnLoadOverall", loadOverallFunction) )
7121 {
7122 pScriptSystem->BeginCall(loadOverallFunction);
7123 pScriptSystem->PushFuncParam(m_pEntity->GetScriptObject());
7124 pScriptSystem->PushFuncParam(scriptStream.GetScriptObject());
7125 pScriptSystem->EndCall();
7126 }
7127
7128 if (!m_bIsAI)
7129 return;
7130
7131 IAIObject *pObject = m_pEntity->GetAI();
7132 pObject->Load(stm);
7133
7134 int nGunOut=0;
7135 stm.Read(nGunOut);
7136 if (nGunOut)
7137 {
7138 SetWeaponPositionState(WEAPON_POS_HOLD);
7139 m_pEntity->GetScriptObject()->SetValue("AI_GunOut",1);
7140
7141 m_pScriptSystem->BeginCall("BasicAI","MakeAlerted");
7142 m_pScriptSystem->PushFuncParam(m_pEntity->GetScriptObject());
7143 m_pScriptSystem->EndCall();
7144 }
7145
7146 char str[255];
7147 stm.Read(str,255);
7148
7149 if (stricmp(str,"NA"))
7150 {
7151 ICryCharInstance *pCharacter = m_pEntity->GetCharInterface()->GetCharacter(0);
7152 if (pCharacter)
7153 {
7154 CryCharAnimationParams ccap;
7155 ccap.fBlendInTime = 0;
7156 ccap.fBlendOutTime = 0;
7157 ccap.nLayerID = 3;
7158 pCharacter->StartAnimation(str,ccap);
7159 }
7160 }
7161
7162
7163 stm.Read(str,255);
7164 if (stricmp(str,"NA"))
7165 {
7166 _SmartScriptObject pCurrentConversation(m_pScriptSystem,true);
7167 if (!m_pEntity->GetScriptObject()->GetValue("CurrentConversation",pCurrentConversation))
7168 {
7169 // get the saved conversation
7170 int conv_id;
7171 stm.Read(conv_id);
7172 _SmartScriptObject pNewConversation(m_pScriptSystem,true);
7173 _SmartScriptObject pConvManager(m_pScriptSystem,true);

Callers 2

LoadFromStreamMethod · 0.45

Calls 15

BeginCallMethod · 0.80
PushFuncParamMethod · 0.80
GetCharInterfaceMethod · 0.80
GetGlobalValueMethod · 0.80
GetIEntitySystemMethod · 0.80
stricmpFunction · 0.50
GetIScriptSystemMethod · 0.45
GetSystemMethod · 0.45
GetScriptObjectMethod · 0.45
GetValueMethod · 0.45
EndCallMethod · 0.45
GetAIMethod · 0.45

Tested by

no test coverage detected