void PDUCommunityCard::execute(Base::GameState*) { // Note: the StateDealCommunity is not used since // if a new community card pdu is received while a // StateDealCommunity is active then the previous // community card is lost. Instead, this PDU puts // the card directly to the community player. CTableView* pView = CTableView::Instance(); ASSERT_VALID(pView); if (pView) { // Tell the current state to quit animations if any GameState* state = GameLogic::Instance().currentState(); if (state) state->onCommand(MAKEWPARAM(ID_STOPANIMATION, 0), 0); pView->endBettingRound(); // Update the screen now to make sure whatever we // were doing becomes visible pView->UpdateWindow(); Player* pCommunity = pView->getCommunity(); ASSERT(pCommunity); if (pCommunity) { // Add card directly to community's deck Card card(suit_, card_); pCommunity->addCard(card); SndMan::Instance()->playSound(SndMan::SM_Card2); if (msecs_ > 0) { // Do the "flip" animation to show the card CPoint pos = pCommunity->getCardPos(Player::LastCard); Cards::Instance().startFlip(card, pos); CDC* pDC = pView->GetDC(); if (pDC) { Cards::Instance().flip(pDC, card, pos); pView->ReleaseDC(pDC); } } else { // Just repaint it once pView->InvalidateRect(pCommunity->getCardPaintArea(Player::LastCard)); } ShowCommunityCardMessage(pCommunity); } } }
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(); } }