| 216 | } |
| 217 | |
| 218 | bool 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 | |
| 275 | void SoundObject::SimulateTitles() |
nothing calls this directly
no test coverage detected