implement sounds when blinds increases (ticket #83)
This commit is contained in:
@@ -1,8 +1,46 @@
|
||||
#include "sdlplayer.h"
|
||||
#include "configfile.h"
|
||||
#include "gametableimpl.h"
|
||||
#include "session.h"
|
||||
#include "game.h"
|
||||
#include "soundevents.h"
|
||||
|
||||
SoundEvents::SoundEvents(ConfigFile *c): myConfig(c)
|
||||
SoundEvents::SoundEvents(ConfigFile *c, gameTableImpl *w): myConfig(c), myW(w)
|
||||
{
|
||||
mySDLPlayer = new SDLPlayer(myConfig);
|
||||
}
|
||||
|
||||
SoundEvents::~SoundEvents()
|
||||
{
|
||||
mySDLPlayer->deleteLater();
|
||||
}
|
||||
|
||||
void SoundEvents::blindsWereSet(int sB)
|
||||
{
|
||||
int currentGameId = myW->getSession()->getCurrentGame()->getMyGameID();
|
||||
if(currentGameId != lastGameId)
|
||||
{
|
||||
lastSBLevel = 0;
|
||||
lastSBValue = sB;
|
||||
lastGameId = currentGameId;
|
||||
}
|
||||
|
||||
if(sB > lastSBValue) {
|
||||
|
||||
lastSBValue = sB;
|
||||
++lastSBLevel;
|
||||
|
||||
if(lastSBLevel == 1 || lastSBLevel == 2)
|
||||
{
|
||||
mySDLPlayer->playSound("blinds_raises_level1", 0);
|
||||
}
|
||||
if(lastSBLevel == 3 || lastSBLevel == 4)
|
||||
{
|
||||
mySDLPlayer->playSound("blinds_raises_level2", 0);
|
||||
}
|
||||
if(lastSBLevel >= 5)
|
||||
{
|
||||
mySDLPlayer->playSound("blinds_raises_level3", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,24 @@
|
||||
|
||||
class SDLPlayer;
|
||||
class ConfigFile;
|
||||
class gameTableImpl;
|
||||
class SoundEvents
|
||||
{
|
||||
public:
|
||||
SoundEvents(ConfigFile*);
|
||||
SoundEvents(ConfigFile*, gameTableImpl*);
|
||||
~SoundEvents();
|
||||
|
||||
void blindsWereSet(int sB);
|
||||
|
||||
|
||||
private:
|
||||
SDLPlayer *mySDLPlayer;
|
||||
gameTableImpl *myW;
|
||||
ConfigFile *myConfig;
|
||||
|
||||
unsigned int lastSBValue;
|
||||
unsigned int lastSBLevel;
|
||||
unsigned int lastGameId;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user