void PDUShowdown::execute(Base::GameState*) { CTableView* pView = CTableView::Instance(); if (pView) { Player* pPlayer = pView->getPlayer(player_); if (pPlayer) { if (num_cards_ == 0) { // // Player mucks hand - do muck hand animation // unless its the local player // if (!pView->isLocalPlayer(player_)) { pView->InvalidateRect(pPlayer->getCardPaintArea(Player::AllCards)); pPlayer->empty(); GameLogic::Instance().setNextState( new StateShowdown(player_, pPlayer->numCards())); } } else { // // Show player's cards // pView->InvalidateRect(pPlayer->getCardPaintArea(Player::AllCards)); CardEntry* pC = pCards_; for (int i = 0; i < num_cards_; i++, pC++) pPlayer->setCard(i, Card((Base::Suit)pC->suit_, pC->value_)); pPlayer->setShowAll(TRUE); } pView->InvalidateRect( pPlayer->getCardPaintArea(Player::AllCards)); if (message_) pPlayer->setActionText(message_); else pPlayer->setActionText(""); } } }
void PDUActionEcho::execute(GameState* pS) { // Call the corresponding routine to // visualize the action. CTableView* pView = CTableView::Instance(); if (!pView) return; Player* pPlayer = pView->getPlayer(slot_); if (!pPlayer) return; if (pS) { // Let the current state know of the action pS->onCommand(MAKEWPARAM(ID_PDU_ACTIONECHO, 0), reinterpret_cast<LPARAM>(this)); } // Get the state anew because actionecho handling might // have destroyed it pS = GameLogic::Instance().currentState(); if (action_ == PDUAction::Call) { Base::ImplementCall(pPlayer, slot_, amount_); } else if (action_ == PDUAction::Raise) { CChips bet; if (pS) { // Ask state the current bet pS->onCommand(MAKEWPARAM(ID_PDU_GETBET, 0), reinterpret_cast<LPARAM>(&bet)); } Base::ImplementRaise(pPlayer, slot_, bet, amount_); } else if (action_ == PDUAction::Fold) { Base::ImplementFold(pPlayer, slot_); if (pView->isLocalPlayer(slot_) && Base::GameLogic::LeaveTable()) { // User has clicked the Leave Table button // - send logout now Base::SetStatusText(pView, _T("Leaving table...")); if (Global::TableServer()) Global::TableServer()->sendSetupTableLogout(); } } else if (action_ == PDUAction::Ante) { Base::ImplementAnte(pPlayer, slot_, amount_); } else if (action_ == PDUAction::SitOut) { Base::ImplementSitOut(slot_, pPlayer); if (pView->isLocalPlayer(slot_) && Base::GameLogic::LeaveTable()) { // User has clicked the Leave Table button // - send logout now Base::SetStatusText(pView, _T("Leaving table...")); if (Global::TableServer()) Global::TableServer()->sendSetupTableLogout(); } } else { CString s; s.Format("*** Action Echo PDU: unrecognized action: %d", action_); PDU_DEBUG(s); } }
void PDUAnnounce::execute(GameState*) { CTableView* pTable = CTableView::Instance(); bool msgOnly = (winner_ == ANNOUNCE_FLAG_MSG); if (!msgOnly && pTable) { // Tell the current state to quit animations if any GameState* state = GameLogic::Instance().currentState(); if (state) state->onCommand(MAKEWPARAM(ID_STOPANIMATION, 0), 0); pTable->endBettingRound(true); } CChatView* pChat = CChatView::Instance(); if (pChat && pTable) { CString name("unknown"); Base::Player* p = pTable->getPlayer(winner_); if (p) { name = p->getName(); pTable->showWinner(winner_, 3000); // animate 3 secs } // Replace newlines with spaces CString s(message_); for (int i = 0; i < s.GetLength(); i++) { if (s[i] == '\n' || s[i] == '\r') s.SetAt(i, ' '); } if (msgOnly) pChat->addDealerMessage(s, CChatView::CF_GameNormal); else pChat->addDealerMessage(s, CChatView::CF_Fatal); if (!msgOnly) { CChips chipsInPot = pTable->resetPot(); if (pTable->isLocalPlayer(winner_)) { if (chipsInPot > 100) SndMan::Instance()->playSound(SndMan::SM_RakeInLarge); else SndMan::Instance()->playSound(SndMan::SM_RakeInSmall); } else { SndMan::Instance()->playSound(SndMan::SM_Show); } } #ifdef SHOW_ANNOUNCEMENT_RECT_ // The announcement rectangle is not currently used. pTable->announce(message_); #endif } if (!msgOnly && GameLogic::LeaveTable()) { // User has clicked the Leave Table button // - send logout now if (pTable) Base::SetStatusText(pTable, _T("Leaving table...")); if (Global::TableServer()) Global::TableServer()->sendSetupTableLogout(); } }