~stratagus/stratagus/sdl2

« back to all changes in this revision

Viewing changes to src/sound/sound.cpp

  • Committer: cybermind
  • Date: 2015-03-15 17:56:45 UTC
  • Revision ID: iddqd_mail@mail.ru-20150315175645-qhz3h0rgs1p9nxsa
[+] Introduced crash dump writing for win32
[-] Fixed crash if engine is tried to play unloaded sound

Show diffs side-by-side

added added

removed removed

Lines of Context:
304
304
*/
305
305
void PlayUnitSound(const CUnit &unit, CSound *sound)
306
306
{
 
307
        if (!sound) {
 
308
                return;
 
309
        }
307
310
        Origin source = {&unit, unsigned(UnitNumber(unit))};
308
311
        unsigned char volume = CalculateVolume(false, ViewPointDistanceToUnit(unit), sound->Range);
309
312
        if (volume == 0) {
326
329
*/
327
330
void PlayMissileSound(const Missile &missile, CSound *sound)
328
331
{
 
332
        if (!sound) {
 
333
                return;
 
334
        }
329
335
        int stereo = ((missile.position.x + (missile.Type->G ? missile.Type->G->Width / 2 : 0) +
330
336
                                   UI.SelectedViewport->MapPos.x * PixelTileSize.x) * 256 /
331
337
                                  ((UI.SelectedViewport->MapWidth - 1) * PixelTileSize.x)) - 128;
353
359
*/
354
360
void PlayGameSound(CSound *sound, unsigned char volume, bool always)
355
361
{
 
362
        if (!sound) {
 
363
                return;
 
364
        }
356
365
        Origin source = {NULL, 0};
357
366
 
358
367
        CSample *sample = ChooseSample(sound, false, source);