예제 #1
0
void kpok::displayWin(const char *hand, int cashWon)
{
   char buf[200];

   setHand(hand);
   setCash(getCash() + cashWon);

   if (cashWon) {
      playSound("win.wav");
      sprintf(buf,"%s %d !",locale->translate("You won $"), cashWon); // locale
   } else {
      playSound("lose.wav");
      sprintf(buf,locale->translate("Game Over")); // locale
   }
   wonLabel->setText(buf);
   wonLabel->move(this->width() / 2 - wonLabel->width() / 2, wonLabelVDist);

   if (!cashWon) {
      wonLabel->show();
   }
   else {
      wonLabel->hide();
      startWave();
   }
}
예제 #2
0
void kpok::drawClick()
{
   int cardsToDraw[5];
   int w;

   drawButton->setEnabled(false);

   if (status == 0) {

      wonLabel->hide();

      cleanFoundCard();
      stopBlinking();
      stopWave();

      setCash(getCash() - cashPerRound);

      for (w=0; w<5;w++) {
         cardsToDraw[w]=0; 
         cardW[w]->setHeld(0);
      }

      for (w=0; w<highestCard;w++) done[w]=0;

      for (w=0;w<5;w++) {
         cards[w]=0;
         cardW[w]->heldLabel->hide();
         cardW[w]->show();
         cardW[w]->paintCard(cards[w],0,0);
      }

      drawCards(cardsToDraw);

      if (cardW[0]->queryHeld())
         drawTimer->start(0, TRUE);
      else
         drawTimer->start(drawDelay, TRUE);

   } else {
      clickToHold->hide();
      for (w=0; w<5;w++) cardsToDraw[w] = cardW[w]->queryHeld();

      for (w=0;w<5;w++) {
         if (!cardsToDraw[w]) {
            cards[w]=0;
            cardW[w]->show();
            cardW[w]->paintCard(cards[w],0,0);
         }
      }

      drawCards(cardsToDraw);


      if (cardW[0]->queryHeld())
         drawTimer->start(0, TRUE);
      else
         drawTimer->start(drawDelay, TRUE);

   }
}
예제 #3
0
void Player::readSave()
{
    SaveController& sc = *SharedGameDelegate::Instance().getSaveController();
    _setHighScore(sc.getHighScore());
    setCash(sc.getCash());

    m_tokenMapPosition = sc.getChipPosition();
    m_storyProgress = sc.getMapProgress();
    m_storyProgress->retain();
    if (m_storyProgress->count() == 0 || m_tokenMapPosition.empty())
    {
        _initStoryProgress();
    }
}
예제 #4
0
void kpok::initPoker()
{
   status=0;
   int w;

   for (w=0;w<5;w++) {
      cards[w]=0;
      cardW[w]->heldLabel->hide();
      cardW[w]->show();
      cardW[w]->paintCard(cards[w],0,0);
   }
   wonLabel->hide();
   clickToHold->hide();

   drawStat=0;
   cleanFoundCard();
   setCash(100);
   setHand(locale->translate("nothing"));

   waveActive = 0;
   fCount =0;

}