anti-peek feature

This commit is contained in:
doitux
2007-08-19 23:19:30 +00:00
parent 1d1d6480a9
commit 7a1c1188b8
6 changed files with 214 additions and 180 deletions
+25 -10
View File
@@ -1093,7 +1093,7 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) {
if (playerAction == 1) { // FOLD
if (playerID == 0) {
if (playerID == 0 && !myConfig->readConfigInt("AntiPeekMode")) {
holeCardsArray[0][0]->startFadeOut(10);
holeCardsArray[0][1]->startFadeOut(10);
}
@@ -1311,9 +1311,15 @@ void mainWindowImpl::dealHoleCards() {
for(j=0; j<2; j++) {
if(currentGame->getPlayerArray()[i]->getMyActiveStatus()) {
if ((i == 0) || DEBUG_MODE) {
tempCardsPixmapArray[j].load(":/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");
holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j],FALSE);
if(myConfig->readConfigInt("AntiPeekMode")) {
holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
tempCardsPixmapArray[j].load(":/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");
holeCardsArray[i][j]->setFrontPixmap(tempCardsPixmapArray[j]);
}
else {
tempCardsPixmapArray[j].load(":/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");
holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j],FALSE);
}
}
else {
holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
@@ -1327,6 +1333,8 @@ void mainWindowImpl::dealHoleCards() {
}
}
}
//fix press mouse button during bankrupt with anti-peek-mode
this->mouseOverFlipCards(FALSE);
}
void mainWindowImpl::dealBeRoCards(int myBeRoID) {
@@ -1885,7 +1893,7 @@ void mainWindowImpl::postRiverRunAnimation2() {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
if(i) {
if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
for(j=0; j<2; j++) {
holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(":/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
@@ -1910,7 +1918,7 @@ void mainWindowImpl::postRiverRunAnimation2() {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
if(i) {
if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
for(j=0; j<2; j++) {
tempCardsPixmapArray[j].load(":/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");
holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
@@ -2171,7 +2179,7 @@ void mainWindowImpl::flipHolecardsAllIn() {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
if(i) {
if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
for(j=0; j<2; j++) {
holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(":/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
}
@@ -2196,7 +2204,7 @@ void mainWindowImpl::flipHolecardsAllIn() {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
currentHand->getPlayerArray()[i]->getMyCards(temp2CardsIntArray);
if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
if(i) {
if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
for(j=0; j<2; j++) {
tempCardsPixmapArray[j].load(":/cards/resources/graphics/cards/"+QString::number(temp2CardsIntArray[j], 10)+".png");
@@ -2314,6 +2322,9 @@ void mainWindowImpl::nextRoundCleanGui() {
//Clear Statusbarmessage
statusBar()->clearMessage();
//fix press mouse button during bankrupt with anti-peek-mode
this->mouseOverFlipCards(FALSE);
}
void mainWindowImpl::stopTimer() {
@@ -2685,8 +2696,12 @@ void mainWindowImpl::networkGameModification() {
void mainWindowImpl::mouseOverFlipCards(bool front) {
holeCardsArray[0][0]->signalFastFlipCards(front);
holeCardsArray[0][1]->signalFastFlipCards(front);
if(mySession->getCurrentGameID()) {
if(myConfig->readConfigInt("AntiPeekMode") && mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[0]->getMyActiveStatus() && mySession->getCurrentGame()->getPlayerArray()[0]->getMyAction() != PLAYER_ACTION_FOLD) {
holeCardsArray[0][0]->signalFastFlipCards(front);
holeCardsArray[0][1]->signalFastFlipCards(front);
}
}
}
void mainWindowImpl::closeEvent(QCloseEvent *event) { quitPokerTH(); }
+10 -6
View File
@@ -147,6 +147,11 @@ void MyCardsPixmapLabel::setPixmap(const QPixmap &pic, const bool flipsideIs) {
}
void MyCardsPixmapLabel::setFrontPixmap ( const QPixmap &pic ) {
myHiddenFront = pic;
}
void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) {
if (!(flipCardsAction1 || flipCardsAction2)) {
@@ -193,13 +198,12 @@ void MyCardsPixmapLabel::paintEvent(QPaintEvent * event) {
painter3.drawPixmap(0,0, tmpFront);
}
if (fastFlipCardsFront) { QPainter painter(this);
painter.setBrush(QColor(0,0,0));
if(objectName().contains("pixmapLabel_card0")) {
painter.drawRect(10,10,20,20);
}
if (fastFlipCardsFront && !fadeOutAction && !flipCardsAction1 && !flipCardsAction2) {
if(objectName().contains("pixmapLabel_card0")) {
QPainter painter4(this);
painter4.drawPixmap(0,0, myHiddenFront.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
}
}
}
void MyCardsPixmapLabel::fastFlipCards(bool front){
+3 -1
View File
@@ -51,7 +51,7 @@ signals:
public slots:
void setPixmap ( const QPixmap &, const bool );
// void setFrontPixmap ( const QPixmap & );
void setFrontPixmap ( const QPixmap & );
void nextFadeOutFrame();
void nextFlipCardsFrame();
@@ -86,6 +86,8 @@ private:
bool mousePress;
bool fastFlipCardsFront;
QPixmap myHiddenFront;
friend class mainWindowImpl;
};