All sounds are now only played if sound output is on (even the ping in network game). Audio is only initialized if it is enabled. Fixed double sounds in network games. Simplified fading out cards on fold.
This commit is contained in:
@@ -102,8 +102,6 @@ void ServerGuiWrapper::logDealBoardCardsMsg(int roundID, int card1, int card2, i
|
|||||||
void ServerGuiWrapper::logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt, std::string showHas) {}
|
void ServerGuiWrapper::logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt, std::string showHas) {}
|
||||||
void ServerGuiWrapper::logPlayerWinGame(std::string playerName, int gameID) {}
|
void ServerGuiWrapper::logPlayerWinGame(std::string playerName, int gameID) {}
|
||||||
|
|
||||||
void ServerGuiWrapper::fadeOutHumanPlayerCards() {}
|
|
||||||
|
|
||||||
void ServerGuiWrapper::SignalNetClientConnect(int actionID) { if (myClientcb) myClientcb->SignalNetClientConnect(actionID); }
|
void ServerGuiWrapper::SignalNetClientConnect(int actionID) { if (myClientcb) myClientcb->SignalNetClientConnect(actionID); }
|
||||||
void ServerGuiWrapper::SignalNetClientGameInfo(int actionID) { if (myClientcb) myClientcb->SignalNetClientGameInfo(actionID); }
|
void ServerGuiWrapper::SignalNetClientGameInfo(int actionID) { if (myClientcb) myClientcb->SignalNetClientGameInfo(actionID); }
|
||||||
void ServerGuiWrapper::SignalNetClientError(int errorID, int osErrorID) { if (myClientcb) myClientcb->SignalNetClientError(errorID, osErrorID); }
|
void ServerGuiWrapper::SignalNetClientError(int errorID, int osErrorID) { if (myClientcb) myClientcb->SignalNetClientError(errorID, osErrorID); }
|
||||||
|
|||||||
@@ -86,8 +86,6 @@ public:
|
|||||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
|
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
|
||||||
void logPlayerWinGame(std::string playerName, int gameID);
|
void logPlayerWinGame(std::string playerName, int gameID);
|
||||||
|
|
||||||
void fadeOutHumanPlayerCards();
|
|
||||||
|
|
||||||
void SignalNetClientConnect(int actionID);
|
void SignalNetClientConnect(int actionID);
|
||||||
void SignalNetClientGameInfo(int actionID);
|
void SignalNetClientGameInfo(int actionID);
|
||||||
void SignalNetClientError(int errorID, int osErrorID);
|
void SignalNetClientError(int errorID, int osErrorID);
|
||||||
|
|||||||
@@ -88,8 +88,6 @@ public:
|
|||||||
virtual void startTimeoutAnimation(int playerId, int timeoutSec) =0;
|
virtual void startTimeoutAnimation(int playerId, int timeoutSec) =0;
|
||||||
virtual void stopTimeoutAnimation(int playerId) =0;
|
virtual void stopTimeoutAnimation(int playerId) =0;
|
||||||
|
|
||||||
virtual void fadeOutHumanPlayerCards() =0;
|
|
||||||
|
|
||||||
//log.cpp
|
//log.cpp
|
||||||
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
|
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
|
||||||
virtual void logNewGameHandMsg(int gameID, int HandID) =0;
|
virtual void logNewGameHandMsg(int gameID, int HandID) =0;
|
||||||
|
|||||||
@@ -97,8 +97,6 @@ void GuiWrapper::disableMyButtons() { myW->signalDisableMyButtons(); }
|
|||||||
void GuiWrapper::startTimeoutAnimation(int playerId, int timeoutSec) { myW->signalStartTimeoutAnimation(playerId, timeoutSec); }
|
void GuiWrapper::startTimeoutAnimation(int playerId, int timeoutSec) { myW->signalStartTimeoutAnimation(playerId, timeoutSec); }
|
||||||
void GuiWrapper::stopTimeoutAnimation(int playerId) { myW->signalStopTimeoutAnimation(playerId); }
|
void GuiWrapper::stopTimeoutAnimation(int playerId) { myW->signalStopTimeoutAnimation(playerId); }
|
||||||
|
|
||||||
void GuiWrapper::fadeOutHumanPlayerCards() { myW->signalFadeOutHumanPlayerCards(); }
|
|
||||||
|
|
||||||
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
|
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
|
||||||
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
|
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
|
||||||
void GuiWrapper::logPlayerWinsMsg(int playerID, int pot) { myLog->signalLogPlayerWinsMsg(playerID, pot); }
|
void GuiWrapper::logPlayerWinsMsg(int playerID, int pot) { myLog->signalLogPlayerWinsMsg(playerID, pot); }
|
||||||
|
|||||||
@@ -96,8 +96,6 @@ public:
|
|||||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
|
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
|
||||||
void logPlayerWinGame(std::string playerName, int gameID);
|
void logPlayerWinGame(std::string playerName, int gameID);
|
||||||
|
|
||||||
void fadeOutHumanPlayerCards();
|
|
||||||
|
|
||||||
void SignalNetClientConnect(int actionID);
|
void SignalNetClientConnect(int actionID);
|
||||||
void SignalNetClientGameInfo(int actionID);
|
void SignalNetClientGameInfo(int actionID);
|
||||||
void SignalNetClientError(int errorID, int osErrorID);
|
void SignalNetClientError(int errorID, int osErrorID);
|
||||||
|
|||||||
@@ -629,9 +629,6 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
connect(this, SIGNAL(signalNetServerPlayerJoined(QString)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(QString)));
|
connect(this, SIGNAL(signalNetServerPlayerJoined(QString)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(QString)));
|
||||||
connect(this, SIGNAL(signalNetServerPlayerLeft(QString)), myStartNetworkGameDialog, SLOT(removePlayer(QString)));
|
connect(this, SIGNAL(signalNetServerPlayerLeft(QString)), myStartNetworkGameDialog, SLOT(removePlayer(QString)));
|
||||||
|
|
||||||
connect(this, SIGNAL(signalFadeOutHumanPlayerCards()), this, SLOT( fadeOutHumanPlayerCards()));
|
|
||||||
|
|
||||||
|
|
||||||
//Sound
|
//Sound
|
||||||
mySDLPlayer = new SDLPlayer(myConfig);
|
mySDLPlayer = new SDLPlayer(myConfig);
|
||||||
|
|
||||||
@@ -841,8 +838,9 @@ void mainWindowImpl::callSettingsDialog() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Audio Clean?
|
// Re-init audio.
|
||||||
if (myConfig->readConfigInt("PlaySoundEffects") == 0) { mySDLPlayer->audioDone(); }
|
mySDLPlayer->closeAudio();
|
||||||
|
mySDLPlayer->initAudio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1078,13 +1076,16 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
|||||||
actionLabelArray[playerID]->setPixmap(QPixmap(":/actions/resources/graphics/actions/action_"+actionArray[playerAction]+".png"));
|
actionLabelArray[playerID]->setPixmap(QPixmap(":/actions/resources/graphics/actions/action_"+actionArray[playerAction]+".png"));
|
||||||
|
|
||||||
//play sounds if exist
|
//play sounds if exist
|
||||||
if(myConfig->readConfigInt("PlaySoundEffects")) mySDLPlayer->playSound(actionArray[playerAction].toStdString(), playerID);
|
mySDLPlayer->playSound(actionArray[playerAction].toStdString(), playerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerAction == 1) {
|
if (playerAction == 1) { // FOLD
|
||||||
// groupBoxArray[i]->setDisabled(TRUE);
|
|
||||||
|
if (playerID == 0) {
|
||||||
if(playerID != 0) {
|
holeCardsArray[0][0]->startFadeOut(10);
|
||||||
|
holeCardsArray[0][1]->startFadeOut(10);
|
||||||
|
}
|
||||||
|
else {
|
||||||
holeCardsArray[playerID][0]->setPixmap(onePix, FALSE);
|
holeCardsArray[playerID][0]->setPixmap(onePix, FALSE);
|
||||||
holeCardsArray[playerID][1]->setPixmap(onePix, FALSE);
|
holeCardsArray[playerID][1]->setPixmap(onePix, FALSE);
|
||||||
}
|
}
|
||||||
@@ -1584,12 +1585,6 @@ void mainWindowImpl::myFold(){
|
|||||||
currentHand->getPlayerArray()[0]->setMyAction(1);
|
currentHand->getPlayerArray()[0]->setMyAction(1);
|
||||||
currentHand->getPlayerArray()[0]->setMyTurn(0);
|
currentHand->getPlayerArray()[0]->setMyTurn(0);
|
||||||
|
|
||||||
if (!mySession->isNetworkClientRunning())
|
|
||||||
{
|
|
||||||
holeCardsArray[0][0]->startFadeOut(10);
|
|
||||||
holeCardsArray[0][1]->startFadeOut(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
//set that i was the last active player. need this for unhighlighting groupbox
|
//set that i was the last active player. need this for unhighlighting groupbox
|
||||||
currentHand->setLastPlayersTurn(0);
|
currentHand->setLastPlayersTurn(0);
|
||||||
|
|
||||||
@@ -1809,7 +1804,8 @@ void mainWindowImpl::myActionDone() {
|
|||||||
// TODO: Should not call in networking game.
|
// TODO: Should not call in networking game.
|
||||||
disableMyButtons();
|
disableMyButtons();
|
||||||
|
|
||||||
nextPlayerAnimation();
|
if (!mySession->isNetworkClientRunning())
|
||||||
|
nextPlayerAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::nextPlayerAnimation() {
|
void mainWindowImpl::nextPlayerAnimation() {
|
||||||
@@ -2646,12 +2642,6 @@ void mainWindowImpl::networkGameModification() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::fadeOutHumanPlayerCards() {
|
|
||||||
|
|
||||||
holeCardsArray[0][0]->startFadeOut(10);
|
|
||||||
holeCardsArray[0][1]->startFadeOut(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mainWindowImpl::closeEvent(QCloseEvent *event) { quitPokerTH(); }
|
void mainWindowImpl::closeEvent(QCloseEvent *event) { quitPokerTH(); }
|
||||||
|
|
||||||
void mainWindowImpl::quitPokerTH() {
|
void mainWindowImpl::quitPokerTH() {
|
||||||
|
|||||||
@@ -129,8 +129,6 @@ signals:
|
|||||||
void signalNetServerPlayerJoined(QString playerName);
|
void signalNetServerPlayerJoined(QString playerName);
|
||||||
void signalNetServerPlayerLeft(QString playerName);
|
void signalNetServerPlayerLeft(QString playerName);
|
||||||
|
|
||||||
void signalFadeOutHumanPlayerCards();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void initGui(int speed);
|
void initGui(int speed);
|
||||||
@@ -270,8 +268,6 @@ public slots:
|
|||||||
void localGameModification();
|
void localGameModification();
|
||||||
void networkGameModification();
|
void networkGameModification();
|
||||||
|
|
||||||
void fadeOutHumanPlayerCards();
|
|
||||||
|
|
||||||
void quitPokerTH();
|
void quitPokerTH();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ using namespace std;
|
|||||||
SDLPlayer::SDLPlayer(ConfigFile *c)
|
SDLPlayer::SDLPlayer(ConfigFile *c)
|
||||||
: soundData(NULL), currentChannel(0) , audioEnabled(0), myConfig(c)
|
: soundData(NULL), currentChannel(0) , audioEnabled(0), myConfig(c)
|
||||||
{
|
{
|
||||||
|
SDL_Init(SDL_INIT_AUDIO);
|
||||||
initAudio();
|
initAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,21 +26,23 @@ SDLPlayer::SDLPlayer(ConfigFile *c)
|
|||||||
SDLPlayer::~SDLPlayer()
|
SDLPlayer::~SDLPlayer()
|
||||||
{
|
{
|
||||||
closeAudio();
|
closeAudio();
|
||||||
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLPlayer::initAudio() {
|
void SDLPlayer::initAudio() {
|
||||||
|
|
||||||
audio_rate = 44100;
|
if (myConfig->readConfigInt("PlaySoundEffects"))
|
||||||
audio_format = AUDIO_S16; /* 16-bit stereo */
|
{
|
||||||
audio_channels = 2;
|
audio_rate = 44100;
|
||||||
audio_buffers = 4096;
|
audio_format = AUDIO_S16; /* 16-bit stereo */
|
||||||
sound = NULL;
|
audio_channels = 2;
|
||||||
|
audio_buffers = 4096;
|
||||||
|
sound = NULL;
|
||||||
|
|
||||||
SDL_Init(SDL_INIT_AUDIO);
|
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) == 0) {
|
||||||
|
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
|
||||||
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) == 0) {
|
audioEnabled = 1;
|
||||||
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
|
}
|
||||||
audioEnabled = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,5 +124,4 @@ void SDLPlayer::closeAudio() {
|
|||||||
audioDone();
|
audioDone();
|
||||||
Mix_CloseAudio();
|
Mix_CloseAudio();
|
||||||
}
|
}
|
||||||
SDL_Quit();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -640,11 +640,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
|
|
||||||
// Refresh GUI
|
// Refresh GUI
|
||||||
if (tmpPlayer->getMyID() == 0)
|
if (tmpPlayer->getMyID() == 0)
|
||||||
{
|
|
||||||
client.GetGui().disableMyButtons();
|
client.GetGui().disableMyButtons();
|
||||||
if (tmpPlayer->getMyAction() == PLAYER_ACTION_FOLD)
|
|
||||||
client.GetGui().fadeOutHumanPlayerCards();
|
|
||||||
}
|
|
||||||
client.GetGui().refreshAction(tmpPlayer->getMyID(), tmpPlayer->getMyAction());
|
client.GetGui().refreshAction(tmpPlayer->getMyID(), tmpPlayer->getMyAction());
|
||||||
client.GetGui().refreshPot();
|
client.GetGui().refreshPot();
|
||||||
client.GetGui().refreshSet();
|
client.GetGui().refreshSet();
|
||||||
|
|||||||
Reference in New Issue
Block a user