ReactOS 0.4.15-dev-7681-g776c3a3
solitaire.h File Reference
#include <cardlib.h>
Include dependency graph for solitaire.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define OPTION_SHOW_STATUS   4
 
#define OPTION_THREE_CARDS   8
 
#define OPTION_SHOW_TIME   16
 
#define OPTION_KEEP_SCORE   32
 
#define OPTION_SCORE_STD   64
 
#define OPTION_SCORE_VEGAS   128
 
#define CARDBACK_START   IDC_CARDBACK1
 
#define CARDBACK_END   IDC_CARDBACK12
 
#define NUM_CARDBACKS   (CARDBACK_END - CARDBACK_START + 1)
 
#define CARDBACK_RES_START   53
 
#define CARDBACK_OPTIONS_WIDTH   72
 
#define CARDBACK_OPTIONS_HEIGHT   112
 
#define IDT_PLAYTIMER   1000
 
#define NUM_ROW_STACKS   7
 
#define DECK_ID   1
 
#define PILE_ID   2
 
#define SUIT_ID   4
 
#define ROW_ID   10
 
#define SCORE_NONE   0
 
#define SCORE_STD   1
 
#define SCORE_VEGAS   2
 
#define X_BORDER   20
 
#define X_PILE_BORDER   18
 
#define X_ROWSTACK_BORDER   10
 
#define X_SUITSTACK_BORDER   10
 
#define Y_BORDER   30
 
#define Y_BORDERWITHFRAME   20
 
#define Y_ROWSTACK_BORDER   32
 

Functions

void CreateSol (void)
 
void NewGame (void)
 
void UpdateStatusBar (void)
 
void SetPlayTimer (void)
 
int GetScoreMode (void)
 
void SetUndoMenuState (bool enable)
 
bool CARDLIBPROC RowStackDragProc (CardRegion &stackobj, int iNumCards)
 
bool CARDLIBPROC RowStackDropProc (CardRegion &stackobj, CardStack &dragcards)
 
bool CARDLIBPROC SuitStackDropProc (CardRegion &stackobj, CardStack &dragcards)
 
void CARDLIBPROC SuitStackAddProc (CardRegion &stackobj, const CardStack &added)
 
void CARDLIBPROC SuitStackClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC RowStackClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC RowStackDblClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC DeckClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC PileDblClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC PileClickProc (CardRegion &stackobj, int iNumClicked)
 
void CARDLIBPROC PileRemoveProc (CardRegion &stackobj, int iRemoved)
 
void SetUndo (int set_source_id, int set_destination_id, int set_number_of_cards, int set_prev_score, int set_prev_visible_pile_cards)
 
void ClearUndo (void)
 
void Undo (void)
 

Variables

CardWindow SolWnd
 
TCHAR szAppName []
 
bool fGameStarted
 
DWORD dwOptions
 
DWORD dwTime
 
DWORD dwWasteCount
 
DWORD dwWasteTreshold
 
DWORD dwPrevMode
 
long lScore
 
HWND hwndMain
 
UINT_PTR PlayTimer
 
int yRowStackCardOffset
 
int VisiblePileCards
 
CardRegionpDeck
 
CardRegionpPile
 
CardRegionpSuitStack []
 
CardRegionpRowStack []
 
CardStack activepile
 

Macro Definition Documentation

◆ CARDBACK_END

#define CARDBACK_END   IDC_CARDBACK12

Definition at line 17 of file solitaire.h.

◆ CARDBACK_OPTIONS_HEIGHT

#define CARDBACK_OPTIONS_HEIGHT   112

Definition at line 21 of file solitaire.h.

◆ CARDBACK_OPTIONS_WIDTH

#define CARDBACK_OPTIONS_WIDTH   72

Definition at line 20 of file solitaire.h.

◆ CARDBACK_RES_START

#define CARDBACK_RES_START   53

Definition at line 19 of file solitaire.h.

◆ CARDBACK_START

#define CARDBACK_START   IDC_CARDBACK1

Definition at line 16 of file solitaire.h.

◆ DECK_ID

#define DECK_ID   1

Definition at line 39 of file solitaire.h.

◆ IDT_PLAYTIMER

#define IDT_PLAYTIMER   1000

Definition at line 33 of file solitaire.h.

◆ NUM_CARDBACKS

#define NUM_CARDBACKS   (CARDBACK_END - CARDBACK_START + 1)

Definition at line 18 of file solitaire.h.

◆ NUM_ROW_STACKS

#define NUM_ROW_STACKS   7

Definition at line 38 of file solitaire.h.

◆ OPTION_KEEP_SCORE

#define OPTION_KEEP_SCORE   32

Definition at line 13 of file solitaire.h.

◆ OPTION_SCORE_STD

#define OPTION_SCORE_STD   64

Definition at line 14 of file solitaire.h.

◆ OPTION_SCORE_VEGAS

#define OPTION_SCORE_VEGAS   128

Definition at line 15 of file solitaire.h.

◆ OPTION_SHOW_STATUS

#define OPTION_SHOW_STATUS   4

Definition at line 10 of file solitaire.h.

◆ OPTION_SHOW_TIME

#define OPTION_SHOW_TIME   16

Definition at line 12 of file solitaire.h.

◆ OPTION_THREE_CARDS

#define OPTION_THREE_CARDS   8

Definition at line 11 of file solitaire.h.

◆ PILE_ID

#define PILE_ID   2

Definition at line 40 of file solitaire.h.

◆ ROW_ID

#define ROW_ID   10

Definition at line 42 of file solitaire.h.

◆ SCORE_NONE

#define SCORE_NONE   0

Definition at line 44 of file solitaire.h.

◆ SCORE_STD

#define SCORE_STD   1

Definition at line 45 of file solitaire.h.

◆ SCORE_VEGAS

#define SCORE_VEGAS   2

Definition at line 46 of file solitaire.h.

◆ SUIT_ID

#define SUIT_ID   4

Definition at line 41 of file solitaire.h.

◆ X_BORDER

#define X_BORDER   20

Definition at line 49 of file solitaire.h.

◆ X_PILE_BORDER

#define X_PILE_BORDER   18

Definition at line 50 of file solitaire.h.

◆ X_ROWSTACK_BORDER

#define X_ROWSTACK_BORDER   10

Definition at line 51 of file solitaire.h.

◆ X_SUITSTACK_BORDER

#define X_SUITSTACK_BORDER   10

Definition at line 52 of file solitaire.h.

◆ Y_BORDER

#define Y_BORDER   30

Definition at line 53 of file solitaire.h.

◆ Y_BORDERWITHFRAME

#define Y_BORDERWITHFRAME   20

Definition at line 54 of file solitaire.h.

◆ Y_ROWSTACK_BORDER

#define Y_ROWSTACK_BORDER   32

Definition at line 55 of file solitaire.h.

Function Documentation

◆ ClearUndo()

void ClearUndo ( void  )

Definition at line 45 of file solundo.cpp.

46{
47 source_id = -1;
48 destination_id = -1;
50 SetUndoMenuState(false);
51}
void SetUndoMenuState(bool enable)
Definition: solitaire.cpp:183
static int destination_id
Definition: solundo.cpp:16
static int number_of_cards
Definition: solundo.cpp:19
static int source_id
Definition: solundo.cpp:15

Referenced by NewGame(), RowStackClickProc(), SuitStackAddProc(), and Undo().

◆ CreateSol()

void CreateSol ( void  )

Definition at line 12 of file solcreate.cpp.

13{
14 int i;
15
16// hbmBitmap = (HBITMAP)LoadImage(0,"test.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
17// SolWnd.SetBackImage(hbmBitmap);
18
20
21 // Compute the value for yRowStackCardOffset based on the height of the card, so the card number isn't hidden on larger cards
23
32
40
41 //
42 // Create the suit stacks
43 //
44 for(i = 0; i < 4; i++)
45 {
49
53
55 }
56
57 //
58 // Create the row stacks
59 //
60 for(i = 0; i < NUM_ROW_STACKS; i++)
61 {
65
68
70
75 }
76}
int __cardwidth
Definition: cardlib.cpp:25
int __cardheight
Definition: cardlib.cpp:26
#define CS_DROP_CALLBACK
Definition: cardlib.h:35
#define CS_DEFXOFF
Definition: cardlib.h:23
#define CS_DRAG_TOP
Definition: cardlib.h:29
#define CS_XJUST_CENTER
Definition: cardlib.h:39
#define CS_EI_NONE
Definition: cardlib.h:18
#define CS_FACE_DOWN
Definition: cardlib.h:52
#define CS_EI_SUNK
Definition: cardlib.h:19
#define CS_FACE_DOWNUP
Definition: cardlib.h:53
#define CS_EI_CIRC
Definition: cardlib.h:20
#define CS_DRAG_CALLBACK
Definition: cardlib.h:31
#define CS_DROP_NONE
Definition: cardlib.h:33
#define CS_DRAG_NONE
Definition: cardlib.h:28
void SetClickProc(pClickProc proc)
Definition: cardregion.cpp:182
void SetEmptyImage(UINT uImage)
Definition: cardregion.cpp:366
bool SetDropRule(UINT uDropType, pCanDropProc proc=0)
Definition: cardregion.cpp:164
void SetRemoveCardProc(pRemoveProc proc)
Definition: cardregion.cpp:202
bool SetDragRule(UINT uDragType, pCanDragProc proc=0)
Definition: cardregion.cpp:146
void SetPlacement(UINT xJustify, UINT yJustify, int xAdjust, int yAdjust)
Definition: cardregion.cpp:250
void SetAddCardProc(pAddProc proc)
Definition: cardregion.cpp:197
bool SetThreedCount(int count)
Definition: cardregion.cpp:215
void SetFaceDirection(UINT uDirType, int nOption)
Definition: cardregion.cpp:258
void SetDblClickProc(pClickProc proc)
Definition: cardregion.cpp:192
void Clear()
Definition: cardstack.cpp:37
CardRegion * CreateRegion(int id, bool fVisible, int x, int y, int xoffset, int yoffset)
Definition: cardregion.cpp:104
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
CardRegion * pSuitStack[4]
Definition: solcreate.cpp:5
CardRegion * pDeck
Definition: solcreate.cpp:3
int yRowStackCardOffset
Definition: solcreate.cpp:10
CardRegion * pPile
Definition: solcreate.cpp:4
CardRegion * pRowStack[NUM_ROW_STACKS]
Definition: solcreate.cpp:6
void CARDLIBPROC RowStackClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:291
void CARDLIBPROC PileRemoveProc(CardRegion &stackobj, int iItems)
Definition: solgame.cpp:481
void CARDLIBPROC PileDblClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:452
void CARDLIBPROC SuitStackClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:276
bool CARDLIBPROC RowStackDragProc(CardRegion &stackobj, int iNumDragCards)
Definition: solgame.cpp:104
bool CARDLIBPROC SuitStackDropProc(CardRegion &stackobj, CardStack &dragcards)
Definition: solgame.cpp:235
bool CARDLIBPROC RowStackDropProc(CardRegion &stackobj, CardStack &dragcards)
Definition: solgame.cpp:128
void CARDLIBPROC SuitStackAddProc(CardRegion &stackobj, const CardStack &added)
Definition: solgame.cpp:346
void CARDLIBPROC RowStackDblClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:403
CardStack activepile
Definition: solgame.cpp:12
void CARDLIBPROC PileClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:438
void CARDLIBPROC DeckClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:504
CardWindow SolWnd
Definition: solitaire.cpp:34
#define PILE_ID
Definition: solitaire.h:40
#define ROW_ID
Definition: solitaire.h:42
#define SUIT_ID
Definition: solitaire.h:41
#define NUM_ROW_STACKS
Definition: solitaire.h:38
#define X_BORDER
Definition: solitaire.h:49
#define X_ROWSTACK_BORDER
Definition: solitaire.h:51
#define Y_BORDERWITHFRAME
Definition: solitaire.h:54
#define Y_ROWSTACK_BORDER
Definition: solitaire.h:55
#define X_SUITSTACK_BORDER
Definition: solitaire.h:52
#define DECK_ID
Definition: solitaire.h:39
#define X_PILE_BORDER
Definition: solitaire.h:50

Referenced by WndProc().

◆ DeckClickProc()

void CARDLIBPROC DeckClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 504 of file solgame.cpp.

505{
506 TRACE("ENTER DeckClickProc()\n");
507
508 SetPlayTimer();
509
510 CardStack cardstack = stackobj.GetCardStack();
511 CardStack pile = pPile->GetCardStack();
512
513 fGameStarted = true;
514 SetPlayTimer();
515
516 //reset the face-up pile to represent 3 cards
519
520 if(cardstack.NumCards() == 0)
521 {
522 if (GetScoreMode() == SCORE_VEGAS)
523 {
525 {
526 pile.Clear();
527
529 cardstack.Push(activepile);
533 }
534 }
535 else if (GetScoreMode() == SCORE_STD)
536 {
538 if ((dwWasteCount >= dwWasteTreshold) && (activepile.NumCards() != 0))
539 {
541 lScore = lScore >= 20 ? lScore - 20 : 0;
542 else
543 lScore = lScore >= 100 ? lScore - 100 : 0;
544 }
545
546 pile.Clear();
547
549 cardstack.Push(activepile);
552
554 }
555 else
556 {
557 pile.Clear();
558
560 cardstack.Push(activepile);
564 }
565
566 dwWasteCount++;
567 }
568 else
569 {
570 int numcards = min((dwOptions & OPTION_THREE_CARDS) ? 3 : 1, cardstack.NumCards());
571
573
574 //make a "visible" copy of these cards
576 temp = cardstack.Pop(numcards);
577 temp.Reverse();
578
580 pile.Clear();
581
582 pile.Push(temp);
583
584 //remove the top 3 from deck
586
587 VisiblePileCards = numcards;
588 }
589
591
592 pDeck->SetCardStack(cardstack);
593 pPile->SetCardStack(pile);
594
596
597 SolWnd.Redraw();
598 TRACE("EXIT DeckClickProc()\n");
599}
void SetCardStack(const CardStack &cs)
Definition: cardregion.cpp:390
const CardStack & GetCardStack()
Definition: cardregion.cpp:399
void SetOffsets(int x, int y)
Definition: cardregion.cpp:228
int NumCards() const
Definition: cardstack.h:14
void Push(const Card card)
Definition: cardstack.cpp:83
void Print()
Definition: cardstack.cpp:222
void Reverse()
Definition: cardstack.cpp:73
Card Pop()
Definition: cardstack.cpp:127
void Redraw(void)
Definition: cardwindow.cpp:553
#define min(a, b)
Definition: monoChain.cc:55
static calc_node_t temp
Definition: rpn_ieee.c:38
#define TRACE(s)
Definition: solgame.cpp:4
int VisiblePileCards
Definition: solgame.cpp:13
bool fGameStarted
Definition: solgame.cpp:15
void FixIfOneCardLeft(void)
Definition: solgame.cpp:465
DWORD dwWasteCount
Definition: solitaire.cpp:28
DWORD dwWasteTreshold
Definition: solitaire.cpp:29
void SetPlayTimer(void)
Definition: solitaire.cpp:172
DWORD dwOptions
Definition: solitaire.cpp:25
void UpdateStatusBar(void)
Definition: solitaire.cpp:150
int GetScoreMode(void)
Definition: solitaire.cpp:130
long lScore
Definition: solitaire.cpp:31
#define OPTION_THREE_CARDS
Definition: solitaire.h:11
#define SCORE_STD
Definition: solitaire.h:45
#define SCORE_VEGAS
Definition: solitaire.h:46
void SetUndo(int set_source_id, int set_destination_id, int set_number_of_cards, int set_prev_score, int set_prev_visible_pile_cards)
Definition: solundo.cpp:27

◆ GetScoreMode()

int GetScoreMode ( void  )

Definition at line 130 of file solitaire.cpp.

131{
133 {
134 return SCORE_NONE;
135 }
136
138 {
139 return SCORE_STD;
140 }
141
143 {
144 return SCORE_VEGAS;
145 }
146
147 return 0;
148}
#define SCORE_NONE
Definition: solitaire.h:44
#define OPTION_SCORE_STD
Definition: solitaire.h:14
#define OPTION_SCORE_VEGAS
Definition: solitaire.h:15

Referenced by _tWinMain(), DeckClickProc(), NewGame(), OptionsDlgProc(), RowStackClickProc(), RowStackDropProc(), ShowGameOptionsDlg(), SuitStackAddProc(), SuitStackDropProc(), Undo(), UpdateStatusBar(), and WndProc().

◆ NewGame()

void NewGame ( void  )

Definition at line 18 of file solgame.cpp.

19{
20 TRACE("ENTER NewGame()\n");
21 int i, j;
22
24 {
26 lScore = lScore - 52;
27 else
28 lScore = -52;
29
32 else
34
35 }
36 else
37 {
40 else
42
43 lScore = 0;
44 }
45
46 dwTime = 0;
47 dwWasteCount = 0;
48 LastId = 0;
49
51
52 //create a new card-stack
54 deck.NewDeck();
55 deck.Shuffle();
58
59 //deal to each row stack..
60 for(i = 0; i < NUM_ROW_STACKS; i++)
61 {
63 temp.Clear();
64
66
67 for(j = 0; j <= i; j++)
68 {
69 temp.Push(deck.Pop());
70 }
71
73 }
74
75 //put the other cards onto the deck
77 pDeck->Update();
78
79 // For the 1-card-mode, all cards need to be completely overlapped
81 pPile->SetOffsets(0, 0);
82
83 SolWnd.Redraw();
84
85 fGameStarted = false;
86
88
90 ClearUndo();
91
92 TRACE("EXIT NewGame()\n");
93
94}
void Update()
Definition: cardregion.cpp:207
void NewDeck()
Definition: cardstack.cpp:42
void Shuffle()
Definition: cardstack.cpp:50
void EmptyStacks(void)
Definition: cardwindow.cpp:607
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
int LastId
Definition: solgame.cpp:14
DWORD dwTime
Definition: solitaire.cpp:27
DWORD dwPrevMode
Definition: solitaire.cpp:30
#define OPTION_KEEP_SCORE
Definition: solitaire.h:13
void ClearUndo(void)
Definition: solundo.cpp:45
CardStack deck
Definition: spigame.cpp:18

◆ PileClickProc()

void CARDLIBPROC PileClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 438 of file solgame.cpp.

439{
440 TRACE("ENTER SuitStackClickProc()\n");
441
442 fGameStarted = true;
443
444 LastId = stackobj.Id();
445
446 TRACE("EXIT SuitStackClickProc()\n");
447}

Referenced by CreateSol().

◆ PileDblClickProc()

void CARDLIBPROC PileDblClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 452 of file solgame.cpp.

453{
454 TRACE("ENTER PileDblClickProc()\n");
455
456 SetPlayTimer();
457
458 RowStackDblClickProc(stackobj, iNumClicked);
459 TRACE("EXIT PileDblClickProc()\n");
460}

◆ PileRemoveProc()

void CARDLIBPROC PileRemoveProc ( CardRegion stackobj,
int  iRemoved 
)

Definition at line 481 of file solgame.cpp.

482{
483 TRACE("ENTER PileRemoveProc()\n");
484
485 SetPlayTimer();
486
487 //modify our "virtual" pile by removing the same card
488 //that was removed from the physical card stack
489 activepile.Pop(iItems);
491 {
493 }
494
496
497 TRACE("EXIT PileRemoveProc()\n");
498}

◆ RowStackClickProc()

void CARDLIBPROC RowStackClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 291 of file solgame.cpp.

292{
293 TRACE("ENTER RowStackClickProc()\n");
294 int numfacedown;
295
296 stackobj.GetFaceDirection(&numfacedown);
297
298 //if all face-down, then make top card face-up
299 if(stackobj.NumCards() == numfacedown)
300 {
301 if(numfacedown > 0) numfacedown--;
302 stackobj.SetFaceDirection(CS_FACE_DOWNUP, numfacedown);
303 stackobj.Redraw();
304
305 if (GetScoreMode() == SCORE_STD)
306 {
307 lScore = lScore + 5;
309 }
310 ClearUndo();
311 }
312
313 LastId = stackobj.Id();
314
315 fGameStarted = true;
316
317 TRACE("EXIT RowStackClickProc()\n");
318}
void Redraw()
int NumCards() const
Definition: cardregion.cpp:544
UINT GetFaceDirection(int *pnOption)
Definition: cardregion.cpp:273

◆ RowStackDblClickProc()

void CARDLIBPROC RowStackDblClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 403 of file solgame.cpp.

404{
405 TRACE("ENTER RowStackDblClickProc()\n");
406
407 SetPlayTimer();
408
409 //can only move 1 card at a time
410 if(iNumClicked != 1)
411 {
412 TRACE("EXIT RowStackDblClickProc()\n");
413 return;
414 }
415
416 //find a suit-stack to move the card to...
417 const CardStack &cardstack = stackobj.GetCardStack();
418 CardRegion *pDest = FindSuitStackFromCard(cardstack[0]);
419
420 if(pDest != 0)
421 {
422 fGameStarted = true;
423 SetPlayTimer();
424
425 //stackobj.MoveCards(pDest, 1, true);
426 //use the SimulateDrag function, because we get the
427 //AddProc callbacks called for us on the destination stacks...
428 bAutoroute = true;
429 stackobj.SimulateDrag(pDest, 1, true);
430 bAutoroute = false;
431 }
432 TRACE("EXIT RowStackDblClickProc()\n");
433}
bool SimulateDrag(CardRegion *pDestStack, int nNumCards, bool fAnimate)
Definition: cardregion.cpp:636
CardRegion * FindSuitStackFromCard(Card card)
Definition: solgame.cpp:323
bool bAutoroute
Definition: solgame.cpp:16

Referenced by CreateSol(), and PileDblClickProc().

◆ RowStackDragProc()

bool CARDLIBPROC RowStackDragProc ( CardRegion stackobj,
int  iNumCards 
)

Definition at line 104 of file solgame.cpp.

105{
106 TRACE("ENTER RowStackDragProc()\n");
107 int numfacedown;
108 int numcards;
109
110 SetPlayTimer();
111
112 stackobj.GetFaceDirection(&numfacedown);
113
114 numcards = stackobj.NumCards();
115
116 TRACE("EXIT RowStackDragProc()\n");
117 if(iNumDragCards <= numcards-numfacedown)
118 return true;
119 else
120 return false;
121
122}

◆ RowStackDropProc()

bool CARDLIBPROC RowStackDropProc ( CardRegion stackobj,
CardStack dragcards 
)

Definition at line 128 of file solgame.cpp.

129{
130 TRACE("ENTER RowStackDropProc()\n");
131 Card dragcard = dragcards[dragcards.NumCards() - 1];
132
133 SetPlayTimer();
134
135 //if we are empty, can only drop a stack with a King at bottom
136 if(stackobj.NumCards() == 0)
137 {
138 if(dragcard.LoVal() != 13)
139 {
140 TRACE("EXIT RowStackDropProc(false)\n");
141 return false;
142 }
143 }
144 else
145 {
146 const CardStack &mystack = stackobj.GetCardStack();
147
148 //can only drop if card is 1 less
149 if(mystack[0].LoVal() != dragcard.LoVal() + 1)
150 {
151 TRACE("EXIT RowStackDropProc(false)\n");
152 return false;
153 }
154
155 //can only drop if card is different colour
156 if( (mystack[0].IsBlack() && !dragcard.IsRed()) ||
157 (!mystack[0].IsBlack() && dragcard.IsRed()) )
158 {
159 TRACE("EXIT RowStackDropProc(false)\n");
160 return false;
161 }
162 }
163
164 fGameStarted = true;
165
166 SetUndo(LastId, stackobj.Id(), dragcards.NumCards(), lScore, VisiblePileCards);
167
168 if (LastId == PILE_ID)
169 {
170 if (GetScoreMode() == SCORE_STD)
171 {
172 lScore = lScore + 5;
173 }
174 }
175 else if ((LastId >= SUIT_ID) && (LastId <= SUIT_ID + 3))
176 {
177 if (GetScoreMode() == SCORE_STD)
178 {
179 lScore = lScore >= 15 ? lScore - 15 : 0;
180 }
181 else if (GetScoreMode() == SCORE_VEGAS)
182 {
183 lScore = lScore >= -47 ? lScore - 5 : -52;
184 }
185 }
186
188
189 TRACE("EXIT RowStackDropProc(true)\n");
190 return true;
191}
Definition: card.h:28
bool IsRed() const
Definition: card.h:94
int LoVal() const
Definition: card.h:59

Referenced by CreateSol().

◆ SetPlayTimer()

void SetPlayTimer ( void  )

Definition at line 172 of file solitaire.cpp.

173{
175 {
176 if (!PlayTimer)
177 {
179 }
180 }
181}
#define NULL
Definition: types.h:112
HWND hwndMain
Definition: solitaire.cpp:13
UINT_PTR PlayTimer
Definition: solitaire.cpp:32
#define IDT_PLAYTIMER
Definition: solitaire.h:33
#define OPTION_SHOW_TIME
Definition: solitaire.h:12
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)

Referenced by CanDrop(), DeckClickProc(), PileDblClickProc(), PileRemoveProc(), RowStackDblClickProc(), RowStackDragProc(), RowStackDropProc(), SuitStackAddProc(), and SuitStackDropProc().

◆ SetUndo()

void SetUndo ( int  set_source_id,
int  set_destination_id,
int  set_number_of_cards,
int  set_prev_score,
int  set_prev_visible_pile_cards 
)

Definition at line 27 of file solundo.cpp.

33{
34 if ((set_source_id == set_destination_id) || (set_number_of_cards == 0))
35 return;
36
37 source_id = set_source_id;
38 destination_id = set_destination_id;
39 number_of_cards = set_number_of_cards;
40 prev_score = set_prev_score;
41 prev_visible_pile_cards = set_prev_visible_pile_cards;
42 SetUndoMenuState(true);
43}
static int prev_score
Definition: solundo.cpp:22
static int prev_visible_pile_cards
Definition: solundo.cpp:25

Referenced by DeckClickProc(), RowStackDropProc(), and SuitStackDropProc().

◆ SetUndoMenuState()

void SetUndoMenuState ( bool  enable)

Definition at line 183 of file solitaire.cpp.

184{
185 if (enable)
186 {
188 }
189 else
190 {
192 }
193}
#define IDM_GAME_UNDO
Definition: resource.h:11
GLboolean enable
Definition: glext.h:11120
HMENU hGameMenu
Definition: solitaire.cpp:16
#define MF_BYCOMMAND
Definition: winuser.h:202
#define MF_ENABLED
Definition: winuser.h:128
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MF_GRAYED
Definition: winuser.h:129

Referenced by ClearUndo(), and SetUndo().

◆ SuitStackAddProc()

void CARDLIBPROC SuitStackAddProc ( CardRegion stackobj,
const CardStack added 
)

Definition at line 346 of file solgame.cpp.

347{
348 TRACE("ENTER SuitStackAddProc()\n");
349 bool fGameOver = true;
350
351 SetPlayTimer();
352
353 for(int i = 0; i < 4; i++)
354 {
355 if(pSuitStack[i]->NumCards() != 13)
356 {
357 fGameOver = false;
358
359 break;
360 }
361 }
362
363 if(fGameOver)
364 {
366 PlayTimer = 0;
367
369 {
370 lScore = lScore + (700000 / dwTime);
371 }
372
374 ClearUndo();
375
377
378 for(int i = 0; i < 4; i++)
379 {
380 pSuitStack[i]->Flash(11, 100);
381 }
382
384 {
385 NewGame();
386 }
387 else
388 {
390
391 fGameStarted = false;
392 }
393 }
394
395 TRACE("EXIT SuitStackAddProc()\n");
396}
void Flash(int count, int timeout)
Definition: cardregion.cpp:322
TCHAR MsgDeal[128]
Definition: solitaire.cpp:24
TCHAR MsgWin[128]
Definition: solitaire.cpp:23
void NewGame(void)
Definition: solgame.cpp:18
TCHAR szAppName[128]
Definition: solitaire.cpp:18
#define MB_YESNO
Definition: winuser.h:816
#define MB_OK
Definition: winuser.h:789
#define MB_ICONQUESTION
Definition: winuser.h:788
#define MessageBox
Definition: winuser.h:5821
#define MB_ICONINFORMATION
Definition: winuser.h:801
#define IDYES
Definition: winuser.h:834
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Referenced by CreateSol().

◆ SuitStackClickProc()

void CARDLIBPROC SuitStackClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 276 of file solgame.cpp.

277{
278 TRACE("ENTER SuitStackClickProc()\n");
279
280 fGameStarted = true;
281
282 LastId = stackobj.Id();
283
284 TRACE("EXIT SuitStackClickProc()\n");
285}

Referenced by CreateSol().

◆ SuitStackDropProc()

bool CARDLIBPROC SuitStackDropProc ( CardRegion stackobj,
CardStack dragcards 
)

Definition at line 235 of file solgame.cpp.

236{
237 TRACE("ENTER SuitStackDropProc()\n");
238
239 SetPlayTimer();
240
241 //only drop 1 card at a time
242 if (!bAutoroute && dragcards.NumCards() != 1)
243 {
244 TRACE("EXIT SuitStackDropProc()\n");
245 return false;
246 }
247
248 bool b = CanDrop(stackobj, dragcards[0]);
249 TRACE("EXIT SuitStackDropProc()\n");
250
251 if (b)
252 {
253 SetUndo(LastId, stackobj.Id(), 1, lScore, VisiblePileCards);
254
255 if ((LastId == PILE_ID) || (LastId >= ROW_ID))
256 {
257 if (GetScoreMode() == SCORE_VEGAS)
258 {
259 lScore = lScore + 5;
260 }
261 else if (GetScoreMode() == SCORE_STD)
262 {
263 lScore = lScore + 10;
264 }
265
267 }
268 }
269
270 return b;
271}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
bool CanDrop(CardRegion &stackobj, Card card)
Definition: solgame.cpp:197

Referenced by CreateSol().

◆ Undo()

void Undo ( void  )

Definition at line 53 of file solundo.cpp.

54{
56 CardRegion *destination = NULL;
57
58 if ((source_id < 1) ||
59 (source_id > (ROW_ID + NUM_ROW_STACKS - 1)) ||
60 (destination_id < 1) ||
62 (number_of_cards < 1))
63 {
64 ClearUndo();
65 return;
66 }
67
68 if (source_id >= ROW_ID)
70 else if ((source_id >= SUIT_ID) && (source_id < SUIT_ID + 4))
72 else if (source_id == PILE_ID)
73 source = pPile;
74 else if (source_id == DECK_ID)
75 source = pDeck;
76
78 destination = pRowStack[destination_id - ROW_ID];
79 else if ((destination_id >= SUIT_ID) && (destination_id < SUIT_ID + 4))
80 destination = pSuitStack[destination_id - SUIT_ID];
81 else if (destination_id == PILE_ID)
82 destination = pPile;
83 else if (destination_id == DECK_ID)
84 destination = pDeck;
85
86 if (destination == NULL || source == NULL)
87 {
88 ClearUndo();
89 return;
90 }
91
92 // If the player clicked on the deck.
93 if (destination == pPile && source == pDeck)
94 {
95 // Put back the cards on the deck in reversed order.
97 tmp.Reverse();
98 source->Push(tmp);
99 // Restore the pile to be the top cards in the active pile.
100 destination->Clear();
102 {
103 destination->SetOffsets(0,0);
104 destination->SetCardStack(activepile);
105 }
106 else
107 {
109 destination->SetOffsets(CS_DEFXOFF, 1);
110 destination->Push(tmp);
111 }
113 }
114
115 // If the player clicked on the empty deck.
116 else if (source == pPile && destination == pDeck)
117 {
118 // Put back all the cards from the deck to the active pile in reversed order.
119 destination->Reverse();
120 activepile.Push(destination->GetCardStack());
121 destination->Clear();
123 {
124 source->SetOffsets(0,0);
125 source->SetCardStack(activepile);
126 }
127 else
128 {
130 source->SetOffsets(CS_DEFXOFF, 1);
131 source->Push(tmp);
132 }
134 }
135
136 // If the player moved one card from the pile.
137 else if (source == pPile)
138 {
139 CardStack tmp = destination->Pop(1);
140 activepile.Push(tmp);
142 {
143 source->Push(tmp);
144 }
145 else
146 {
147 source->Clear();
149 source->Push(tmp);
150 source->SetOffsets(CS_DEFXOFF, 1);
151 }
153 }
154
155 // If the player moved cards between row stacks / suit stacks.
156 else
157 {
158 destination->MoveCard(source, number_of_cards, false);
159 }
160
162
163 // -2 points for the undo in standard score mode.
164 if (GetScoreMode() == SCORE_STD)
165 lScore = lScore >= 2 ? lScore - 2 : 0;
166
168
169 SolWnd.Redraw();
170 ClearUndo();
171}
void Push(const Card card)
Definition: cardregion.h:88
bool MoveCard(CardRegion *pDestStack, int nNumCards, bool fAnimate)
Definition: cardregion.cpp:477
void Reverse()
Definition: cardregion.h:86
void Clear()
Definition: cardregion.h:84
Card Pop()
Definition: cardregion.h:91
Card Top()
Definition: cardstack.cpp:151
void ClearUndo(void)
Definition: solundo.cpp:45

Referenced by WndProc().

◆ UpdateStatusBar()

void UpdateStatusBar ( void  )

Definition at line 150 of file solitaire.cpp.

151{
152 TCHAR szStatusText[128];
153 TCHAR szTempText[64];
154
155 ZeroMemory(szStatusText, sizeof(szStatusText));
156
157 if (GetScoreMode() != SCORE_NONE)
158 {
159 _stprintf(szStatusText, szScore, lScore);
160 _tcscat(szStatusText, _T(" "));
161 }
162
164 {
165 _stprintf(szTempText, szTime, dwTime);
166 _tcscat(szStatusText, szTempText);
167 }
168
170}
#define _tcscat
Definition: tchar.h:622
#define _stprintf
Definition: utility.h:124
#define SBT_NOBORDERS
Definition: commctrl.h:1971
#define SB_SETTEXT
Definition: commctrl.h:1949
HWND hwndStatus
Definition: solitaire.cpp:14
TCHAR szScore[64]
Definition: solitaire.cpp:19
TCHAR szTime[64]
Definition: solitaire.cpp:20
#define _T(x)
Definition: vfdio.h:22
#define ZeroMemory
Definition: winbase.h:1712
LONG_PTR LPARAM
Definition: windef.h:208
#define SendMessage
Definition: winuser.h:5842
char TCHAR
Definition: xmlstorage.h:189
CHAR * LPTSTR
Definition: xmlstorage.h:192

Variable Documentation

◆ activepile

CardStack activepile
extern

Definition at line 12 of file solgame.cpp.

Referenced by CreateSol(), DeckClickProc(), FixIfOneCardLeft(), NewGame(), PileRemoveProc(), and Undo().

◆ dwOptions

DWORD dwOptions
extern

Definition at line 25 of file solitaire.cpp.

Referenced by AboutProtocol_Abort(), AboutProtocol_LockRequest(), AboutProtocol_Terminate(), BindProtocol_Abort(), BindProtocol_LockRequest(), BindProtocol_Terminate(), ATL::CRegKey::Create(), CreateHKCRKey(), CreateNestedKey(), DeckClickProc(), DuplicateConsoleHandle(), DuplicateHandle(), FileProtocol_Abort(), FileProtocol_LockRequest(), FileProtocol_Terminate(), FilterConnectCommunicationPort(), FixIfOneCardLeft(), FtpProtocol_Abort(), FtpProtocol_LockRequest(), FtpProtocol_Terminate(), GetScoreMode(), GopherProtocol_Abort(), GopherProtocol_LockRequest(), GopherProtocol_Terminate(), GUIDisplayStatusMessage(), HitTestThemeBackground(), HttpProtocol_Abort(), HttpProtocol_LockRequest(), HttpProtocol_Terminate(), ITSProtocol_Abort(), ITSProtocol_LockRequest(), ITSProtocol_Terminate(), IUnknown_AddOptions(), LoadSettings(), MimeFilterProtocol_Abort(), MimeFilterProtocol_LockRequest(), MimeFilterProtocol_Terminate(), MimeHtmlProtocol_Abort(), MimeHtmlProtocol_LockRequest(), MimeHtmlProtocol_Terminate(), MimeProtocol_LockRequest(), MimeProtocol_Terminate(), MkProtocol_Abort(), MkProtocol_LockRequest(), MkProtocol_Terminate(), MSI_OpenPackageW(), MsiAdvertiseProductExA(), MsiAdvertiseProductExW(), MsiGetFileHashA(), MsiGetFileHashW(), MsiOpenPackageExA(), MsiOpenPackageExW(), MsiSourceListAddMediaDiskA(), MsiSourceListAddMediaDiskW(), MsiSourceListAddSourceExA(), MsiSourceListAddSourceExW(), MsiSourceListClearAllExA(), MsiSourceListClearAllExW(), MsiSourceListClearSourceA(), MsiSourceListClearSourceW(), MsiSourceListEnumMediaDisksA(), MsiSourceListEnumMediaDisksW(), MsiSourceListEnumSourcesA(), MsiSourceListEnumSourcesW(), MsiSourceListGetInfoA(), MsiSourceListGetInfoW(), MsiSourceListSetInfoA(), MsiSourceListSetInfoW(), NewGame(), OpenSourceKey(), OptionsDlgProc(), PileRemoveProc(), Protocol_Abort(), Protocol_Terminate(), ProtocolEmul_LockRequest(), ProtocolEmul_Terminate(), ProtocolHandler_Abort(), ProtocolHandler_LockRequest(), ProtocolHandler_Terminate(), RefreshPolicyEx(), RegCreateKeyExA(), RegCreateKeyExW(), RegOpenUserClassesRoot(), ResProtocol_Abort(), ResProtocol_LockRequest(), ResProtocol_Terminate(), SaveSettings(), SetPlayTimer(), SHMapHandle(), ShowGameOptionsDlg(), SuitStackAddProc(), test_CopyBindInfo(), test_pack_INTERNET_AUTH_NOTIFY_DATA(), test_pack_RemBINDINFO(), TUIDisplayStatusMessage(), UpdateStatusBar(), WlxDisplayStatusMessage(), and WndProc().

◆ dwPrevMode

DWORD dwPrevMode
extern

Definition at line 30 of file solitaire.cpp.

Referenced by _tWinMain(), and NewGame().

◆ dwTime

◆ dwWasteCount

DWORD dwWasteCount
extern

Definition at line 28 of file solitaire.cpp.

Referenced by DeckClickProc(), and NewGame().

◆ dwWasteTreshold

DWORD dwWasteTreshold
extern

Definition at line 29 of file solitaire.cpp.

Referenced by DeckClickProc(), and NewGame().

◆ fGameStarted

bool fGameStarted
extern

Definition at line 15 of file solgame.cpp.

◆ hwndMain

HWND hwndMain
extern

Definition at line 13 of file solitaire.cpp.

◆ lScore

◆ pDeck

CardRegion* pDeck
extern

Definition at line 3 of file solcreate.cpp.

Referenced by CreateSol(), CreateSpider(), DeckClickProc(), NewGame(), and Undo().

◆ PlayTimer

UINT_PTR PlayTimer
extern

Definition at line 32 of file solitaire.cpp.

Referenced by SetPlayTimer(), SuitStackAddProc(), and WndProc().

◆ pPile

CardRegion* pPile
extern

Definition at line 4 of file solcreate.cpp.

Referenced by CreateSol(), DeckClickProc(), FixIfOneCardLeft(), NewGame(), and Undo().

◆ pRowStack

CardRegion* pRowStack[]
extern

Definition at line 6 of file solcreate.cpp.

Referenced by CreateSol(), NewGame(), and Undo().

◆ pSuitStack

CardRegion* pSuitStack[]
extern

Definition at line 5 of file solcreate.cpp.

Referenced by CreateSol(), FindSuitStackFromCard(), SuitStackAddProc(), and Undo().

◆ SolWnd

◆ szAppName

TCHAR szAppName[]
extern

Definition at line 18 of file solitaire.cpp.

◆ VisiblePileCards

int VisiblePileCards
extern

◆ yRowStackCardOffset

int yRowStackCardOffset
extern

Definition at line 10 of file solcreate.cpp.