MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Simulate

Method Simulate

engine/Poseidon/Audio/DynSound.cpp:218–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218bool SoundObject::Simulate(float deltaT, SimulationImportance prec)
219{
220 if (_hasObject && (!_object || _object->IsDammageDestroyed()))
221 {
222 _sound = nullptr;
223 return false;
224 }
225
226 if (_waiting)
227 {
228 if (IsSpeakingDirect(_sender) || IsSpeakingRadio(_sender))
229 {
230 return true;
231 }
232 _waiting = false;
233 LoadSound();
234 }
235
236 if (_forceTitles || USER_CONFIG.showTitles)
237 {
238 SimulateTitles();
239 }
240
241 if (_paused)
242 {
243 if (_sound)
244 {
245 _sound = nullptr;
246 }
247 }
248 else
249 {
250 if (_soundName.GetLength() > 0 && !_sound)
251 {
252 StartSound();
253 }
254 if (_hasObject && _sound)
255 {
256 if (_object)
257 {
258 _sound->SetPosition(_object->WorldPosition(), _object->WorldSpeed());
259 }
260 else
261 {
262 // object destroyed - stop sound
263 _sound = nullptr;
264 }
265 }
266 if (_sound && _sound->IsTerminated())
267 {
268 _sound = nullptr;
269 }
270 }
271
272 return (_sound != nullptr || ((_forceTitles || USER_CONFIG.showTitles) && _index < _titles.Size()));
273}
274
275void SoundObject::SimulateTitles()

Callers

nothing calls this directly

Calls 15

IsSpeakingDirectFunction · 0.85
IsSpeakingRadioFunction · 0.85
IsOneLoopingSoundMethod · 0.80
OpenAndPlayMethod · 0.80
OpenAndPlayOnceMethod · 0.80
AddSoundMethod · 0.80
GaussMethod · 0.80
IsDammageDestroyedMethod · 0.45
GetLengthMethod · 0.45
SetPositionMethod · 0.45
WorldSpeedMethod · 0.45
IsTerminatedMethod · 0.45

Tested by

no test coverage detected