mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Do not stop the jingles sounds (win and lost) when ending a game
It uses a list of sounds to skip. The fade is apply on all other sounds. - It concerns the issue #9.
This commit is contained in:
parent
102e87d434
commit
9076c2bc92
@ -20,6 +20,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctime>
|
||||
#include <set>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unordered_map>
|
||||
@ -3031,7 +3032,10 @@ CEvent::ChangePhase (Uint32 phase)
|
||||
|
||||
// FIXME: pause is better if the game is not stop but just interrupted
|
||||
if (m_phase == EV_PHASE_PLAY && m_phase != phase)
|
||||
m_pSound->StopAllSounds (false);
|
||||
{
|
||||
static const std::set<Sint32> except = {SOUND_WIN, SOUND_LOST};
|
||||
m_pSound->StopAllSounds (false, &except);
|
||||
}
|
||||
|
||||
m_phase = phase; // change de phase
|
||||
m_index = index;
|
||||
|
@ -28,13 +28,16 @@
|
||||
// Stops all sounds.
|
||||
|
||||
bool
|
||||
CSound::StopAllSounds (bool immediat)
|
||||
CSound::StopAllSounds (bool immediat, const std::set<Sint32> * except)
|
||||
{
|
||||
for (Sint32 i = 0; i < MAXSOUND; i++)
|
||||
{
|
||||
if (!m_lpSDL[i])
|
||||
continue;
|
||||
|
||||
if (except && except->find (i) != except->end ())
|
||||
continue;
|
||||
|
||||
if (Mix_Playing (i + 1) == SDL_TRUE)
|
||||
{
|
||||
if (immediat)
|
||||
|
@ -20,11 +20,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL_mixer.h>
|
||||
#include <set>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <SDL2/SDL_mixer.h>
|
||||
|
||||
#include "blupi.h"
|
||||
|
||||
#define MAXSOUND 100
|
||||
@ -63,7 +65,7 @@ public:
|
||||
bool IsStoppedOnDemand ();
|
||||
void AdaptVolumeMusic ();
|
||||
void SetSuspendSkip (Sint32 nb);
|
||||
bool StopAllSounds (bool immediat);
|
||||
bool StopAllSounds (bool immediat, const std::set<Sint32> * except = nullptr);
|
||||
|
||||
protected:
|
||||
bool m_bState;
|
||||
|
Loading…
x
Reference in New Issue
Block a user