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
+2 -2
View File
@@ -51,7 +51,7 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0)
if(strcmp(argv[i], "--nowriteaccess") == 0) { noWriteAccess = 1; }
}
// !!!! Revisionsnummer der Configdefaults !!!!!
configRev = 26;
configRev = 27;
//standard defaults
logOnOffDefault = "1";
@@ -145,7 +145,7 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0)
configList.push_back(ConfigInfo("ShowFadeOutCardsAnimation", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("ShowFlipCardsAnimation", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("ShowBlindButtons", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("PlaySoundEffects", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("AntiPeekMode", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("PlaySoundEffects", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("SoundVolume", CONFIG_TYPE_INT, "8"));
configList.push_back(ConfigInfo("FlipsideTux", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("FlipsideOwn", CONFIG_TYPE_INT, "0"));
+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;
};
+172 -161
View File
@@ -38,93 +38,18 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="9" column="0" >
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<string/>
<item row="11" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" >
<widget class="QCheckBox" name="checkBox_playSoundEffects" >
<property name="text" >
<string>Play sound effects</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_25" >
<property name="text" >
<string>Sound Volume:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_soundVolume" >
<property name="minimumSize" >
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>10</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider_soundVolume" >
<property name="minimum" >
<number>1</number>
</property>
<property name="maximum" >
<number>10</number>
</property>
<property name="value" >
<number>8</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="7" column="0" >
<widget class="QCheckBox" name="checkBox_showFlipCardsAnimation" >
<property name="text" >
<string>Show flip-card animation</string>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="10" column="0" >
<widget class="QGroupBox" name="groupBox" >
@@ -220,51 +145,24 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</item>
<item row="11" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="0" >
<widget class="QCheckBox" name="checkBox_showBlindButtons" >
<item row="9" column="0" >
<widget class="QCheckBox" name="checkBox_antiPeekMode" >
<property name="text" >
<string>Show buttons for small blind and big blind</string>
<string>Show own cards only on mouse click</string>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QCheckBox" name="checkBox_showFadeOutCardsAnimation" >
<item row="4" column="0" >
<widget class="QCheckBox" name="checkBox_showRightToolbox" >
<property name="text" >
<string>Show fade-out animation for non-winning cards</string>
<string>Show right toolbox (F11 to switch on/off)</string>
</property>
</widget>
</item>
<item row="5" column="0" >
<widget class="QCheckBox" name="checkBox_showStatusbarMessages" >
<item row="2" column="0" >
<widget class="QCheckBox" name="checkBox_showIntro" >
<property name="text" >
<string>Show statusbar messages</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QCheckBox" name="checkBox_showLeftToolbox" >
<property name="text" >
<string>Show left toolbox (F10 to switch on/off)</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="Line" name="line_6" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
<string>Show intro on startup</string>
</property>
</widget>
</item>
@@ -281,17 +179,141 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QCheckBox" name="checkBox_showIntro" >
<property name="text" >
<string>Show intro on startup</string>
<item row="1" column="0" >
<widget class="Line" name="line_6" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QCheckBox" name="checkBox_showRightToolbox" >
<item row="3" column="0" >
<widget class="QCheckBox" name="checkBox_showLeftToolbox" >
<property name="text" >
<string>Show right toolbox (F11 to switch on/off)</string>
<string>Show left toolbox (F10 to switch on/off)</string>
</property>
</widget>
</item>
<item row="5" column="0" >
<widget class="QCheckBox" name="checkBox_showStatusbarMessages" >
<property name="text" >
<string>Show statusbar messages</string>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QCheckBox" name="checkBox_showFadeOutCardsAnimation" >
<property name="text" >
<string>Show fade-out animation for non-winning cards</string>
</property>
</widget>
</item>
<item row="8" column="0" >
<widget class="QCheckBox" name="checkBox_showBlindButtons" >
<property name="text" >
<string>Show buttons for small blind and big blind</string>
</property>
</widget>
</item>
<item row="7" column="0" >
<widget class="QCheckBox" name="checkBox_showFlipCardsAnimation" >
<property name="text" >
<string>Show flip-card animation</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_6" >
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="0" >
<widget class="QCheckBox" name="checkBox_playSoundEffects" >
<property name="text" >
<string>Play sound effects</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_25" >
<property name="text" >
<string>Sound Volume:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_soundVolume" >
<property name="minimumSize" >
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>10</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider_soundVolume" >
<property name="minimum" >
<number>1</number>
</property>
<property name="maximum" >
<number>10</number>
</property>
<property name="value" >
<number>8</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>281</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label_26" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Sound</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="Line" name="line_8" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
@@ -2091,6 +2113,23 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QListWidget" name="listWidget" >
<property name="minimumSize" >
@@ -2110,6 +2149,11 @@ p, li { white-space: pre-wrap; }
<string>Interface</string>
</property>
</item>
<item>
<property name="text" >
<string>Sound</string>
</property>
</item>
<item>
<property name="text" >
<string>Local Game Settings</string>
@@ -2132,23 +2176,6 @@ p, li { white-space: pre-wrap; }
</item>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
@@ -2283,21 +2310,5 @@ p, li { white-space: pre-wrap; }
</hint>
</hints>
</connection>
<connection>
<sender>horizontalSlider_soundVolume</sender>
<signal>valueChanged(int)</signal>
<receiver>label_soundVolume</receiver>
<slot>setNum(int)</slot>
<hints>
<hint type="sourcelabel" >
<x>546</x>
<y>264</y>
</hint>
<hint type="destinationlabel" >
<x>501</x>
<y>260</y>
</hint>
</hints>
</connection>
</connections>
</ui>
@@ -129,6 +129,7 @@ void settingsDialogImpl::exec() {
checkBox_showFadeOutCardsAnimation->setChecked(myConfig->readConfigInt("ShowFadeOutCardsAnimation"));
checkBox_showFlipCardsAnimation->setChecked(myConfig->readConfigInt("ShowFlipCardsAnimation"));
checkBox_showBlindButtons->setChecked(myConfig->readConfigInt("ShowBlindButtons"));
checkBox_antiPeekMode->setChecked(myConfig->readConfigInt("AntiPeekMode"));
checkBox_playSoundEffects->setChecked(myConfig->readConfigInt("PlaySoundEffects"));
horizontalSlider_soundVolume->setValue(myConfig->readConfigInt("SoundVolume"));
radioButton_flipsideTux->setChecked(myConfig->readConfigInt("FlipsideTux"));
@@ -210,6 +211,7 @@ void settingsDialogImpl::isAccepted() {
myConfig->writeConfigInt("ShowFadeOutCardsAnimation", checkBox_showFadeOutCardsAnimation->isChecked());
myConfig->writeConfigInt("ShowFlipCardsAnimation", checkBox_showFlipCardsAnimation->isChecked());
myConfig->writeConfigInt("ShowBlindButtons", checkBox_showBlindButtons->isChecked());
myConfig->writeConfigInt("AntiPeekMode", checkBox_antiPeekMode->isChecked());
myConfig->writeConfigInt("PlaySoundEffects", checkBox_playSoundEffects->isChecked());
myConfig->writeConfigInt("SoundVolume", horizontalSlider_soundVolume->value());
myConfig->writeConfigInt("FlipsideTux", radioButton_flipsideTux->isChecked());