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:
lotodore
2007-06-16 09:48:23 +00:00
parent af9f799b51
commit 5c63a12104
9 changed files with 26 additions and 52 deletions
-2
View File
@@ -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::logPlayerWinGame(std::string playerName, int gameID) {}
void ServerGuiWrapper::fadeOutHumanPlayerCards() {}
void ServerGuiWrapper::SignalNetClientConnect(int actionID) { if (myClientcb) myClientcb->SignalNetClientConnect(actionID); }
void ServerGuiWrapper::SignalNetClientGameInfo(int actionID) { if (myClientcb) myClientcb->SignalNetClientGameInfo(actionID); }
void ServerGuiWrapper::SignalNetClientError(int errorID, int osErrorID) { if (myClientcb) myClientcb->SignalNetClientError(errorID, osErrorID); }
-2
View File
@@ -86,8 +86,6 @@ public:
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
void logPlayerWinGame(std::string playerName, int gameID);
void fadeOutHumanPlayerCards();
void SignalNetClientConnect(int actionID);
void SignalNetClientGameInfo(int actionID);
void SignalNetClientError(int errorID, int osErrorID);
-2
View File
@@ -88,8 +88,6 @@ public:
virtual void startTimeoutAnimation(int playerId, int timeoutSec) =0;
virtual void stopTimeoutAnimation(int playerId) =0;
virtual void fadeOutHumanPlayerCards() =0;
//log.cpp
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
virtual void logNewGameHandMsg(int gameID, int HandID) =0;
-2
View File
@@ -97,8 +97,6 @@ void GuiWrapper::disableMyButtons() { myW->signalDisableMyButtons(); }
void GuiWrapper::startTimeoutAnimation(int playerId, int timeoutSec) { myW->signalStartTimeoutAnimation(playerId, timeoutSec); }
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::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
void GuiWrapper::logPlayerWinsMsg(int playerID, int pot) { myLog->signalLogPlayerWinsMsg(playerID, pot); }
-2
View File
@@ -96,8 +96,6 @@ public:
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
void logPlayerWinGame(std::string playerName, int gameID);
void fadeOutHumanPlayerCards();
void SignalNetClientConnect(int actionID);
void SignalNetClientGameInfo(int actionID);
void SignalNetClientError(int errorID, int osErrorID);
+13 -23
View File
@@ -629,9 +629,6 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
connect(this, SIGNAL(signalNetServerPlayerJoined(QString)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(QString)));
connect(this, SIGNAL(signalNetServerPlayerLeft(QString)), myStartNetworkGameDialog, SLOT(removePlayer(QString)));
connect(this, SIGNAL(signalFadeOutHumanPlayerCards()), this, SLOT( fadeOutHumanPlayerCards()));
//Sound
mySDLPlayer = new SDLPlayer(myConfig);
@@ -841,8 +838,9 @@ void mainWindowImpl::callSettingsDialog() {
}
}
}
//Audio Clean?
if (myConfig->readConfigInt("PlaySoundEffects") == 0) { mySDLPlayer->audioDone(); }
// Re-init audio.
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"));
//play sounds if exist
if(myConfig->readConfigInt("PlaySoundEffects")) mySDLPlayer->playSound(actionArray[playerAction].toStdString(), playerID);
mySDLPlayer->playSound(actionArray[playerAction].toStdString(), playerID);
}
if (playerAction == 1) {
// groupBoxArray[i]->setDisabled(TRUE);
if(playerID != 0) {
if (playerAction == 1) { // FOLD
if (playerID == 0) {
holeCardsArray[0][0]->startFadeOut(10);
holeCardsArray[0][1]->startFadeOut(10);
}
else {
holeCardsArray[playerID][0]->setPixmap(onePix, FALSE);
holeCardsArray[playerID][1]->setPixmap(onePix, FALSE);
}
@@ -1584,12 +1585,6 @@ void mainWindowImpl::myFold(){
currentHand->getPlayerArray()[0]->setMyAction(1);
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
currentHand->setLastPlayersTurn(0);
@@ -1809,7 +1804,8 @@ void mainWindowImpl::myActionDone() {
// TODO: Should not call in networking game.
disableMyButtons();
nextPlayerAnimation();
if (!mySession->isNetworkClientRunning())
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::quitPokerTH() {
-4
View File
@@ -129,8 +129,6 @@ signals:
void signalNetServerPlayerJoined(QString playerName);
void signalNetServerPlayerLeft(QString playerName);
void signalFadeOutHumanPlayerCards();
public slots:
void initGui(int speed);
@@ -270,8 +268,6 @@ public slots:
void localGameModification();
void networkGameModification();
void fadeOutHumanPlayerCards();
void quitPokerTH();
+13 -11
View File
@@ -18,6 +18,7 @@ using namespace std;
SDLPlayer::SDLPlayer(ConfigFile *c)
: soundData(NULL), currentChannel(0) , audioEnabled(0), myConfig(c)
{
SDL_Init(SDL_INIT_AUDIO);
initAudio();
}
@@ -25,21 +26,23 @@ SDLPlayer::SDLPlayer(ConfigFile *c)
SDLPlayer::~SDLPlayer()
{
closeAudio();
SDL_Quit();
}
void SDLPlayer::initAudio() {
audio_rate = 44100;
audio_format = AUDIO_S16; /* 16-bit stereo */
audio_channels = 2;
audio_buffers = 4096;
sound = NULL;
if (myConfig->readConfigInt("PlaySoundEffects"))
{
audio_rate = 44100;
audio_format = AUDIO_S16; /* 16-bit stereo */
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);
audioEnabled = 1;
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) == 0) {
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
audioEnabled = 1;
}
}
}
@@ -121,5 +124,4 @@ void SDLPlayer::closeAudio() {
audioDone();
Mix_CloseAudio();
}
SDL_Quit();
}
-4
View File
@@ -640,11 +640,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
// Refresh GUI
if (tmpPlayer->getMyID() == 0)
{
client.GetGui().disableMyButtons();
if (tmpPlayer->getMyAction() == PLAYER_ACTION_FOLD)
client.GetGui().fadeOutHumanPlayerCards();
}
client.GetGui().refreshAction(tmpPlayer->getMyID(), tmpPlayer->getMyAction());
client.GetGui().refreshPot();
client.GetGui().refreshSet();