void Stacker::keepPlaying() { // Check for victory if (currY > 15) { displayWin(); } // Check timer to see if next frame yet if (timer.read_ms() > (250-40*(levelSpeeds[currY]))) { nextState(); // Go to next state timer.reset(); // Reset timer to 0 } }
void CursWin::ShowStream() { /* bool expectingStreamParam; int precision; bool left_justified; int field_width; bool field_enabled; CursWinStreamCommand last; int paramNum; bool invalid_input; bool immErrorHandling; double min_filter, max_filter; bool min_active, max_active; bool force_range; int filter_active; double fail_value; */ CursWin displayWin(0,0,20,79,true); const char* TF[2] = {"FALSE","TRUE"}; char buf[100]; displayWin << "Current stream: " << InputStream << cnl << "Stream values:" << cnl << Csetw(4) << " " << "Flags:" << cnl << Csetw(8) << " " << "expectingStreamParam: " <<(sv.expectingStreamParam?TF[1]:TF[0]) << cnl << Csetw(8) << " " << "left_justified: " <<(sv.left_justified?TF[1]:TF[0]) << cnl << Csetw(8) << " " << "field_enabled: " <<(sv.field_enabled?TF[1]:TF[0]) << cnl << Csetw(8) << " " << "invalid_input: " <<(sv.invalid_input?TF[1]:TF[0]) << cnl << Csetw(8) << " " << "immErrorHandling: " <<(sv.immErrorHandling?TF[1]:TF[0]) << cnl << Csetw(8) << " " << "min_active: " <<(sv.min_active?TF[1]:TF[0]) << cnl << Csetw(8) << " " << "max_active: " <<(sv.max_active?TF[1]:TF[0]) << cnl << Csetw(8) << " " << "force_range: " <<(sv.force_range?TF[1]:TF[0]) << cnl << Csetw(4) << " " << "Numerical values:" << cnl << Csetw(8) << " " << "precision: " << sv.precision << cnl << Csetw(8) << " " << "field_width: " << sv.field_width << cnl << Csetw(8) << " " << "paramNum: " << sv.paramNum << cnl << Csetw(8) << " " << "min_filter: " << sv.min_filter << cnl << Csetw(8) << " " << "max_filter: " << sv.max_filter << cnl << Csetw(8) << " " << "filter_active: " << sv.filter_active << cnl << Csetw(8) << " " << "fail_value: " << sv.fail_value << cnl; displayWin.GetStr(buf); }
void kpok::result() { int testResult = m_game.getActivePlayer(0)->testHand(); switch (testResult) { case Pair: if (m_game.getActivePlayer(0)->getHand().get_firstRank() < JACK) { displayWin(i18n("Nothing"), 0); break; } displayWin(i18n("One Pair"), 5); break; case TwoPairs: displayWin(i18n("Two Pairs"), 10); break; case ThreeOfAKind: displayWin(i18n("3 of a Kind"), 15); break; case Straight: displayWin(i18n("Straight"), 20); break; case Flush: displayWin(i18n("Flush"), 25); break; case FullHouse: displayWin(i18n("Full House"), 40); break; case FourOfAKind: displayWin(i18n("4 of a Kind"), 125); break; case StraightFlush: displayWin(i18n("Straight Flush"), 250); break; case RoyalFlush: displayWin(i18n("Royal Flush"), 2000); break; default: displayWin(i18n("Nothing"), 0); break; } startBlinking(); m_game.setState(StateStartRound); if (m_game.getActivePlayer(0)->getCash() < cashPerRound) noMoney(); }
void kpok::drawCardsEvent() { int testResult; cardW[drawStat]->show(); cardW[drawStat]->paintCard(cards[drawStat],0,0); if (!cardW[drawStat]->queryHeld()) playSound("cardflip.wav"); if (drawStat == 4) { /* just did last card */ drawButton->setEnabled(true); drawStat=0; if (status == 1) { testResult=testHand(); switch (testResult) { case 1 : if (foundCards[0].cardType >= 17) { foundCards[0].cardType=0; foundCards[1].cardType=0; displayWin(locale->translate("nothing"),0); break; } displayWin(locale->translate("One Pair"),5); break; case 2 : displayWin(locale->translate("Two Pairs"), 10); break; case 3 : displayWin(locale->translate("3 of a kind"), 15); break; case 4 : displayWin(locale->translate("Full House"), 40); break; case 6 : displayWin(locale->translate("4 of a kind"), 125); break; case 7 : displayWin(locale->translate("Straight"),20); break; case 8 : displayWin(locale->translate("Flush"),25); break; case 9 : displayWin(locale->translate("Straight Flush"),250); break; case 10 : displayWin(locale->translate("Royal Flush"),2000); break; default: displayWin(locale->translate("nothing"),0); break; } startBlinking(); status = 0; if (getCash() < cashPerRound) { KMsgBox::message(0,locale->translate("You Lost"), locale->translate("Oops - you went bankrupt.\n"), KMsgBox::EXCLAMATION,locale->translate("New game")); initPoker(); } } else { clickToHold->show(); status =1; } } else { /* only inc drawStat if not done with displaying */ drawStat++; /* look at next card and if it is held instantly call drawCardEvent again */ if (cardW[drawStat]->queryHeld()) drawTimer->start(0,TRUE); else drawTimer->start(drawDelay,TRUE); } }