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

Method LoadRandomExpressions

CryEntitySystem/LipSync.cpp:122–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122bool CLipSync::LoadRandomExpressions(const char *pszExprScript, bool bRaiseError)
123{
124 if ((!m_pScriptSystem) || (!m_pSoundSystem) || (!m_pCharInst))
125 return false; // not initialized
126 if (!pszExprScript)
127 return false;
128 // Check if this expression is already loaded.
129 if (m_loadedExpression == pszExprScript)
130 return true;
131
132 // unloacd all expressions.
133 UnloadRandomExpressions();
134 if (!strlen(pszExprScript))
135 return true;
136
137 ICryCharModel *pModel=m_pCharInst->GetModel();
138 assert(pModel);
139 IAnimationSet *pAnimSet=pModel->GetAnimationSet();
140 assert(pAnimSet);
141
142 // parse random-expressions
143 if (m_pScriptSystem->ExecuteFile(pszExprScript, true, false))
144 {
145 m_loadedExpression = pszExprScript;
146 // Get only filename from path. use it as global key to expressions table.
147 char filename[_MAX_FNAME];
148 _splitpath( pszExprScript,NULL,NULL,filename,NULL );
149
150 _SmartScriptObject pObj(m_pScriptSystem, true);
151 if (m_pScriptSystem->GetGlobalValue( filename,pObj ))
152 {
153 CRandomExprLoadSink LoadSink(bRaiseError, m_pScriptSystem, &pObj, pAnimSet, &m_vecExprPatterns);
154 pObj->Dump(&LoadSink);
155 }
156 else
157 {
158 GameWarning( "LipSync expression script %s does not contain table %s",pszExprScript,filename );
159 }
160 }
161 else
162 {
163 GameWarning( "LipSync expression script %s filed to load",pszExprScript );
164 }
165 return true;
166}
167
168bool CLipSync::UnloadRandomExpressions()
169{

Callers 1

DoRandomExpressionsMethod · 0.80

Calls 6

ExecuteFileMethod · 0.80
GetGlobalValueMethod · 0.80
GameWarningFunction · 0.70
GetModelMethod · 0.45
GetAnimationSetMethod · 0.45
DumpMethod · 0.45

Tested by

no test coverage detected