Author: cfinck Date: Fri Oct 19 01:54:39 2007 New Revision: 29663
URL: http://svn.reactos.org/svn/reactos?rev=29663&view=rev Log: - Fix a bug in Solitaire: When you used the 1-card-mode before, there never was a card behind the one, which you drag from the pile. Now Solitaire collects all the cards from the deck in the 1-card-mode like Windows Solitaire does. - Make it possible to use CS_EI_CIRC (the O sign) and CS_EI_X (the X sign) as empty images for a deck. Actually make use of CS_EI_CIRC for the Solitaire deck.
Modified: trunk/reactos/base/applications/games/solitaire/cardlib/cardlib.h trunk/reactos/base/applications/games/solitaire/cardlib/cardregion.cpp trunk/reactos/base/applications/games/solitaire/cardlib/cardrgndraw.cpp trunk/reactos/base/applications/games/solitaire/solcreate.cpp trunk/reactos/base/applications/games/solitaire/solgame.cpp
Modified: trunk/reactos/base/applications/games/solitaire/cardlib/cardlib.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/games/sol... ============================================================================== --- trunk/reactos/base/applications/games/solitaire/cardlib/cardlib.h (original) +++ trunk/reactos/base/applications/games/solitaire/cardlib/cardlib.h Fri Oct 19 01:54:39 2007 @@ -8,14 +8,13 @@
#define CS_EI_NONE 0 #define CS_EI_SUNK 1 +#define CS_EI_CIRC 67 +#define CS_EI_X 66
#define CS_DEFXOFF 12 //x-offset #define CS_DEFYOFF 18 //y-offset #define CS_NO3D 1 //default 3d counts (recommened) #define CS_DEF3D 10 //(best for decks) - -//#define CS_EI_CIRC 2 -//#define CS_EI_X 3
#define CS_DRAG_NONE 0 #define CS_DRAG_TOP 1
Modified: trunk/reactos/base/applications/games/solitaire/cardlib/cardregion.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/games/sol... ============================================================================== --- trunk/reactos/base/applications/games/solitaire/cardlib/cardregion.cpp (original) +++ trunk/reactos/base/applications/games/solitaire/cardlib/cardregion.cpp Fri Oct 19 01:54:39 2007 @@ -365,7 +365,10 @@ { switch(uImage) { - case CS_EI_NONE: case CS_EI_SUNK: + case CS_EI_NONE: + case CS_EI_SUNK: + case CS_EI_CIRC: + case CS_EI_X: uEmptyImage = uImage; break;
Modified: trunk/reactos/base/applications/games/solitaire/cardlib/cardrgndraw.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/games/sol... ============================================================================== --- trunk/reactos/base/applications/games/solitaire/cardlib/cardrgndraw.cpp (original) +++ trunk/reactos/base/applications/games/solitaire/cardlib/cardrgndraw.cpp Fri Oct 19 01:54:39 2007 @@ -347,15 +347,21 @@
switch(uEmptyImage) { - default: case CS_EI_NONE: + default: + case CS_EI_NONE: //this wipes the RECT variable, so watch out! //SetRect(&rect, x, y, x+__cardwidth, y+__cardheight); //PaintRect(hdc, &rect, MAKE_PALETTERGB(crBackgnd)); parentWnd.PaintCardRgn(hdc, x, y, __cardwidth, __cardheight, x, y); break;
- case CS_EI_SUNK: //case CS_EI_CIRC: case CS_EI_X: + case CS_EI_SUNK: DrawCard(hdc, x, y, __hdcPlaceHolder, __cardwidth, __cardheight); + break; + + case CS_EI_CIRC: + case CS_EI_X: + CardBlt(hdc, x, y, uEmptyImage); break; }
@@ -466,6 +472,11 @@ case CS_EI_SUNK: DrawCard(hdcBackGnd, xoff, yoff, __hdcPlaceHolder, __cardwidth, __cardheight); break; + + case CS_EI_CIRC: + case CS_EI_X: + CardBlt(hdc, xoff, yoff, uEmptyImage); + break; } }
@@ -559,7 +570,7 @@ // // If there are no cards under this one, just draw the place holder // - if(numcards == 0) + if(numcards == 0) { switch(uEmptyImage) { @@ -573,7 +584,11 @@ case CS_EI_SUNK: DrawCard(hdcBackGnd, 0, 0, __hdcPlaceHolder, __cardwidth, __cardheight); break; - + + case CS_EI_CIRC: + case CS_EI_X: + CardBlt(hdc, 0, 0, uEmptyImage); + break; } }
Modified: trunk/reactos/base/applications/games/solitaire/solcreate.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/games/sol... ============================================================================== --- trunk/reactos/base/applications/games/solitaire/solcreate.cpp (original) +++ trunk/reactos/base/applications/games/solitaire/solcreate.cpp Fri Oct 19 01:54:39 2007 @@ -30,7 +30,7 @@ yRowStackCardOffset = (int)(__cardheight / 6.7);
pDeck = SolWnd.CreateRegion(DECK_ID, true, X_BORDER, Y_BORDER, 2, 1); - pDeck->SetEmptyImage(CS_EI_SUNK); + pDeck->SetEmptyImage(CS_EI_CIRC); pDeck->SetThreedCount(6); pDeck->SetDragRule(CS_DRAG_NONE, 0); pDeck->SetDropRule(CS_DROP_NONE, 0);
Modified: trunk/reactos/base/applications/games/solitaire/solgame.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/games/sol... ============================================================================== --- trunk/reactos/base/applications/games/solitaire/solgame.cpp (original) +++ trunk/reactos/base/applications/games/solitaire/solgame.cpp Fri Oct 19 01:54:39 2007 @@ -50,7 +50,11 @@ //put the other cards onto the deck pDeck->SetCardStack(deck); pDeck->Update(); - + + // For the 1-card-mode, all cards need to be completely overlapped + if(!(dwOptions & OPTION_THREE_CARDS)) + pPile->SetOffsets(0, 0); + SolWnd.Redraw();
fGameStarted = false; @@ -331,7 +335,8 @@ fGameStarted = true;
//reset the face-up pile to represent 3 cards - pPile->SetOffsets(CS_DEFXOFF, 1); + if(dwOptions & OPTION_THREE_CARDS) + pPile->SetOffsets(CS_DEFXOFF, 1);
if(cardstack.NumCards() == 0) { @@ -350,7 +355,9 @@ temp = cardstack.Pop(numcards); temp.Reverse();
- pile.Clear(); + if(dwOptions & OPTION_THREE_CARDS) + pile.Clear(); + pile.Push(temp);
//remove the top 3 from deck