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

Method LoadSound

CrySystem/ScriptObjectSound.cpp:147–186  ·  view source on GitHub ↗

! Load a 2D sound @param sSound filename of the sound @return nil or sound ID in case of success */

Source from the content-addressed store, hash-verified

145 @return nil or sound ID in case of success
146*/
147int CScriptObjectSound::LoadSound(IFunctionHandler *pH)
148{
149 float fVolume=255.0f;
150
151 if (pH->GetParamCount()<1 || pH->GetParamCount()>3)
152 {
153 m_pScriptSystem->RaiseError("Sound.LoadSound wrong number of arguments");
154 return pH->EndFunctionNull();
155 };
156
157 const char *sSound;
158 ISound *pSound;
159 int nFlags=0;
160 int pcount=pH->GetParamCount();
161// int iLocalized;
162 pH->GetParam(1,sSound);
163
164 if (pcount>1)
165 pH->GetParam(2, nFlags);
166
167 if (pcount>2)
168 pH->GetParam(3, fVolume);
169
170 if (m_pSoundSystem)
171 {
172 pSound=m_pSoundSystem->LoadSound(sSound,nFlags);
173 if(pSound)
174 {
175 pSound->SetVolume((int)(fVolume));
176
177 pSound->AddRef();
178 USER_DATA ud=m_pScriptSystem->CreateUserData((INT_PTR)pSound,USER_DATA_SOUND); //AMD Port
179 return pH->EndFunction(ud);
180 }
181 else{
182 m_pScriptSystem->RaiseError("Sound.LoadSound error loading %s",sSound);
183 }
184 }
185 return pH->EndFunctionNull();
186}
187
188
189

Callers 2

Load3DSoundMethod · 0.45
LoadStreamSoundMethod · 0.45

Calls 8

RaiseErrorMethod · 0.80
EndFunctionNullMethod · 0.80
CreateUserDataMethod · 0.80
EndFunctionMethod · 0.80
GetParamCountMethod · 0.45
GetParamMethod · 0.45
SetVolumeMethod · 0.45
AddRefMethod · 0.45

Tested by

no test coverage detected