ReactOS  0.4.12-dev-51-ge94618b
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)
 
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)
 

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
 
CardRegionpDeck
 
CardRegionpPile
 
CardRegionpSuitStack []
 
CardRegionpRowStack []
 

Macro Definition Documentation

◆ CARDBACK_END

#define CARDBACK_END   IDC_CARDBACK12

Definition at line 17 of file solitaire.h.

Referenced by CardBackDlgProc().

◆ CARDBACK_OPTIONS_HEIGHT

#define CARDBACK_OPTIONS_HEIGHT   112

Definition at line 21 of file solitaire.h.

Referenced by CardImageWndProc().

◆ CARDBACK_OPTIONS_WIDTH

#define CARDBACK_OPTIONS_WIDTH   72

Definition at line 20 of file solitaire.h.

Referenced by CardImageWndProc().

◆ CARDBACK_RES_START

#define CARDBACK_RES_START   53

Definition at line 19 of file solitaire.h.

Referenced by CardBackDlgProc(), and ShowDeckOptionsDlg().

◆ CARDBACK_START

#define CARDBACK_START   IDC_CARDBACK1

Definition at line 16 of file solitaire.h.

Referenced by CardBackDlgProc().

◆ DECK_ID

#define DECK_ID   1

Definition at line 39 of file solitaire.h.

Referenced by CreateSol().

◆ IDT_PLAYTIMER

#define IDT_PLAYTIMER   1000

Definition at line 33 of file solitaire.h.

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

◆ NUM_CARDBACKS

#define NUM_CARDBACKS   (CARDBACK_END - CARDBACK_START + 1)

Definition at line 18 of file solitaire.h.

Referenced by CardBackDlgProc().

◆ NUM_ROW_STACKS

#define NUM_ROW_STACKS   7

Definition at line 38 of file solitaire.h.

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

◆ OPTION_KEEP_SCORE

#define OPTION_KEEP_SCORE   32

Definition at line 13 of file solitaire.h.

Referenced by NewGame(), and OptionsDlgProc().

◆ OPTION_SCORE_STD

#define OPTION_SCORE_STD   64

Definition at line 14 of file solitaire.h.

Referenced by GetScoreMode(), and OptionsDlgProc().

◆ OPTION_SCORE_VEGAS

#define OPTION_SCORE_VEGAS   128

Definition at line 15 of file solitaire.h.

Referenced by GetScoreMode(), and OptionsDlgProc().

◆ OPTION_SHOW_STATUS

#define OPTION_SHOW_STATUS   4

Definition at line 10 of file solitaire.h.

Referenced by OptionsDlgProc(), ShowGameOptionsDlg(), and WndProc().

◆ OPTION_SHOW_TIME

#define OPTION_SHOW_TIME   16

◆ OPTION_THREE_CARDS

#define OPTION_THREE_CARDS   8

Definition at line 11 of file solitaire.h.

Referenced by DeckClickProc(), NewGame(), OptionsDlgProc(), and ShowGameOptionsDlg().

◆ PILE_ID

#define PILE_ID   2

Definition at line 40 of file solitaire.h.

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

◆ ROW_ID

#define ROW_ID   10

Definition at line 42 of file solitaire.h.

Referenced by CreateSol(), and SuitStackDropProc().

◆ SCORE_NONE

#define SCORE_NONE   0

Definition at line 44 of file solitaire.h.

Referenced by GetScoreMode(), OptionsDlgProc(), and UpdateStatusBar().

◆ SCORE_STD

◆ SCORE_VEGAS

#define SCORE_VEGAS   2

◆ SUIT_ID

#define SUIT_ID   4

Definition at line 41 of file solitaire.h.

Referenced by CreateSol(), and RowStackDropProc().

◆ X_BORDER

#define X_BORDER   20

Definition at line 49 of file solitaire.h.

Referenced by CreateSol(), CreateSpider(), and WndProc().

◆ X_PILE_BORDER

#define X_PILE_BORDER   18

Definition at line 50 of file solitaire.h.

Referenced by CreateSol().

◆ X_ROWSTACK_BORDER

#define X_ROWSTACK_BORDER   10

Definition at line 51 of file solitaire.h.

Referenced by CreateSol(), and WndProc().

◆ X_SUITSTACK_BORDER

#define X_SUITSTACK_BORDER   10

Definition at line 52 of file solitaire.h.

Referenced by CreateSol().

◆ Y_BORDER

#define Y_BORDER   30

Definition at line 53 of file solitaire.h.

Referenced by CreateSpider(), and WndProc().

◆ Y_BORDERWITHFRAME

#define Y_BORDERWITHFRAME   20

Definition at line 54 of file solitaire.h.

Referenced by CreateSol().

◆ Y_ROWSTACK_BORDER

#define Y_ROWSTACK_BORDER   32

Definition at line 55 of file solitaire.h.

Referenced by CreateSol(), and WndProc().

Function Documentation

◆ CreateSol()

void CreateSol ( void  )

Definition at line 14 of file solcreate.cpp.

Referenced by WndProc().

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

◆ DeckClickProc()

void CARDLIBPROC DeckClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 482 of file solgame.cpp.

483 {
484  TRACE("ENTER DeckClickProc()\n");
485 
486  SetPlayTimer();
487 
488  CardStack cardstack = stackobj.GetCardStack();
489  CardStack pile = pPile->GetCardStack();
490 
491  fGameStarted = true;
492  SetPlayTimer();
493 
494  //reset the face-up pile to represent 3 cards
497 
498  if(cardstack.NumCards() == 0)
499  {
500  if (GetScoreMode() == SCORE_VEGAS)
501  {
503  {
504  pile.Clear();
505 
507  cardstack.Push(activepile);
508  activepile.Clear();
509  }
510  }
511  else if (GetScoreMode() == SCORE_STD)
512  {
513  if ((dwWasteCount >= dwWasteTreshold) && (activepile.NumCards() != 0))
514  {
515  if (dwOptions & OPTION_THREE_CARDS)
516  lScore = lScore >= 20 ? lScore - 20 : 0;
517  else
518  lScore = lScore >= 100 ? lScore - 100 : 0;
519  }
520 
521  pile.Clear();
522 
524  cardstack.Push(activepile);
525  activepile.Clear();
526 
527  UpdateStatusBar();
528  }
529  else
530  {
531  pile.Clear();
532 
534  cardstack.Push(activepile);
535  activepile.Clear();
536  }
537 
538  dwWasteCount++;
539  }
540  else
541  {
542  int numcards = min((dwOptions & OPTION_THREE_CARDS) ? 3 : 1, cardstack.NumCards());
543 
544  //make a "visible" copy of these cards
545  CardStack temp;
546  temp = cardstack.Pop(numcards);
547  temp.Reverse();
548 
549  if(dwOptions & OPTION_THREE_CARDS)
550  pile.Clear();
551 
552  pile.Push(temp);
553 
554  //remove the top 3 from deck
555  activepile.Push(temp);
556  }
557 
558  activepile.Print();
559 
560  pDeck->SetCardStack(cardstack);
561  pPile->SetCardStack(pile);
562 
563  SolWnd.Redraw();
564  TRACE("EXIT DeckClickProc()\n");
565 }
void Print()
Definition: cardstack.cpp:222
DWORD dwOptions
Definition: solitaire.cpp:23
long lScore
Definition: solitaire.cpp:29
const CardStack & GetCardStack()
Definition: cardregion.cpp:399
void Clear()
Definition: cardstack.cpp:37
void Push(const Card card)
Definition: cardstack.cpp:83
CardRegion * pDeck
Definition: solcreate.cpp:3
void Redraw(void)
Definition: cardwindow.cpp:553
int GetScoreMode(void)
Definition: solitaire.cpp:128
void Reverse()
Definition: cardstack.cpp:73
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:170
#define CS_DEFXOFF
Definition: cardlib.h:23
Card Pop()
Definition: cardstack.cpp:127
#define OPTION_THREE_CARDS
Definition: solitaire.h:11
CardStack activepile
Definition: solgame.cpp:12
static stack_node_t temp
Definition: rpn.c:18
void SetCardStack(const CardStack &cs)
Definition: cardregion.cpp:390
void SetOffsets(int x, int y)
Definition: cardregion.cpp:228
bool fGameStarted
Definition: solgame.cpp:14
#define min(a, b)
Definition: monoChain.cc:55
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:262
DWORD dwWasteCount
Definition: solitaire.cpp:26
#define SCORE_STD
Definition: solitaire.h:45
#define SCORE_VEGAS
Definition: solitaire.h:46
int NumCards() const
Definition: cardstack.h:14
DWORD dwWasteTreshold
Definition: solitaire.cpp:27
CardWindow SolWnd
Definition: solitaire.cpp:32
CardRegion * pPile
Definition: solcreate.cpp:4

◆ GetScoreMode()

int GetScoreMode ( void  )

Definition at line 128 of file solitaire.cpp.

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

129 {
131  {
132  return SCORE_NONE;
133  }
134 
135  if (dwOptions & OPTION_SCORE_STD)
136  {
137  return SCORE_STD;
138  }
139 
140  if (dwOptions & OPTION_SCORE_VEGAS)
141  {
142  return SCORE_VEGAS;
143  }
144 
145  return 0;
146 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define OPTION_SCORE_VEGAS
Definition: solitaire.h:15
#define SCORE_NONE
Definition: solitaire.h:44
#define OPTION_SCORE_STD
Definition: solitaire.h:14
#define SCORE_STD
Definition: solitaire.h:45
#define SCORE_VEGAS
Definition: solitaire.h:46

◆ NewGame()

void NewGame ( void  )

Definition at line 17 of file solgame.cpp.

18 {
19  TRACE("ENTER NewGame()\n");
20  int i, j;
21 
22  if (GetScoreMode() == SCORE_VEGAS)
23  {
25  lScore = lScore - 52;
26  else
27  lScore = -52;
28 
30  dwWasteTreshold = 2;
31  else
32  dwWasteTreshold = 0;
33 
34  }
35  else
36  {
38  dwWasteTreshold = 3;
39  else
40  dwWasteTreshold = 0;
41 
42  lScore = 0;
43  }
44 
45  dwTime = 0;
46  dwWasteCount = 0;
47  LastId = 0;
48 
50 
51  //create a new card-stack
53  deck.NewDeck();
54  deck.Shuffle();
55  activepile.Clear();
56 
57  //deal to each row stack..
58  for(i = 0; i < NUM_ROW_STACKS; i++)
59  {
61  temp.Clear();
62 
64 
65  for(j = 0; j <= i; j++)
66  {
67  temp.Push(deck.Pop());
68  }
69 
70  pRowStack[i]->SetCardStack(temp);
71  }
72 
73  //put the other cards onto the deck
74  pDeck->SetCardStack(deck);
75  pDeck->Update();
76 
77  // For the 1-card-mode, all cards need to be completely overlapped
79  pPile->SetOffsets(0, 0);
80 
81  SolWnd.Redraw();
82 
83  fGameStarted = false;
84 
86 
88 
89  TRACE("EXIT NewGame()\n");
90 
91 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define OPTION_KEEP_SCORE
Definition: solitaire.h:13
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
void SetFaceDirection(UINT uDirType, int nOption)
Definition: cardregion.cpp:258
long lScore
Definition: solitaire.cpp:29
void EmptyStacks(void)
Definition: cardwindow.cpp:607
void Clear()
Definition: cardstack.cpp:37
void Push(const Card card)
Definition: cardstack.cpp:83
CardRegion * pDeck
Definition: solcreate.cpp:3
void Redraw(void)
Definition: cardwindow.cpp:553
int GetScoreMode(void)
Definition: solitaire.cpp:128
void NewDeck()
Definition: cardstack.cpp:42
GLenum GLclampf GLint i
Definition: glfuncs.h:14
void Update()
Definition: cardregion.cpp:207
DWORD dwTime
Definition: solitaire.cpp:25
#define NUM_ROW_STACKS
Definition: solitaire.h:38
#define TRACE(s)
Definition: solgame.cpp:4
void Shuffle()
Definition: cardstack.cpp:50
DWORD dwPrevMode
Definition: solitaire.cpp:28
Card Pop()
Definition: cardstack.cpp:127
#define OPTION_THREE_CARDS
Definition: solitaire.h:11
CardStack activepile
Definition: solgame.cpp:12
static stack_node_t temp
Definition: rpn.c:18
int LastId
Definition: solgame.cpp:13
void SetCardStack(const CardStack &cs)
Definition: cardregion.cpp:390
void SetOffsets(int x, int y)
Definition: cardregion.cpp:228
bool fGameStarted
Definition: solgame.cpp:14
#define CS_FACE_DOWNUP
Definition: cardlib.h:53
CardStack deck
Definition: spigame.cpp:18
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:262
DWORD dwWasteCount
Definition: solitaire.cpp:26
#define SCORE_VEGAS
Definition: solitaire.h:46
CardRegion * pRowStack[NUM_ROW_STACKS]
Definition: solcreate.cpp:6
DWORD dwWasteTreshold
Definition: solitaire.cpp:27
CardWindow SolWnd
Definition: solitaire.cpp:32
CardRegion * pPile
Definition: solcreate.cpp:4

◆ PileClickProc()

void CARDLIBPROC PileClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 429 of file solgame.cpp.

Referenced by CreateSol().

430 {
431  TRACE("ENTER SuitStackClickProc()\n");
432 
433  fGameStarted = true;
434 
435  LastId = stackobj.Id();
436 
437  TRACE("EXIT SuitStackClickProc()\n");
438 }
#define TRACE(s)
Definition: solgame.cpp:4
int LastId
Definition: solgame.cpp:13
bool fGameStarted
Definition: solgame.cpp:14

◆ PileDblClickProc()

void CARDLIBPROC PileDblClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 443 of file solgame.cpp.

444 {
445  TRACE("ENTER PileDblClickProc()\n");
446 
447  SetPlayTimer();
448 
449  RowStackDblClickProc(stackobj, iNumClicked);
450  TRACE("EXIT PileDblClickProc()\n");
451 }
#define TRACE(s)
Definition: solgame.cpp:4
void CARDLIBPROC RowStackDblClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:394
void SetPlayTimer(void)
Definition: solitaire.cpp:170

◆ PileRemoveProc()

void CARDLIBPROC PileRemoveProc ( CardRegion stackobj,
int  iRemoved 
)

Definition at line 456 of file solgame.cpp.

457 {
458  TRACE("ENTER PileRemoveProc()\n");
459 
460  SetPlayTimer();
461 
462  //modify our "virtual" pile by removing the same card
463  //that was removed from the physical card stack
464  activepile.Pop(iItems);
465 
466  //if there is just 1 card left, then modify the
467  //stack to contain ALL the face-up cards..the effect
468  //will be, the next time a card is dragged, all the
469  //previous card-triplets will be available underneath
470  if(stackobj.NumCards() == 1)
471  {
472  stackobj.SetOffsets(0,0);
473  stackobj.SetCardStack(activepile);
474  }
475  TRACE("EXIT PileRemoveProc()\n");
476 }
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:170
int NumCards() const
Definition: cardregion.cpp:544
Card Pop()
Definition: cardstack.cpp:127
CardStack activepile
Definition: solgame.cpp:12
void SetCardStack(const CardStack &cs)
Definition: cardregion.cpp:390
void SetOffsets(int x, int y)
Definition: cardregion.cpp:228

◆ RowStackClickProc()

void CARDLIBPROC RowStackClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 284 of file solgame.cpp.

285 {
286  TRACE("ENTER RowStackClickProc()\n");
287  int numfacedown;
288 
289  stackobj.GetFaceDirection(&numfacedown);
290 
291  //if all face-down, then make top card face-up
292  if(stackobj.NumCards() == numfacedown)
293  {
294  if(numfacedown > 0) numfacedown--;
295  stackobj.SetFaceDirection(CS_FACE_DOWNUP, numfacedown);
296  stackobj.Redraw();
297 
298  if (GetScoreMode() == SCORE_STD)
299  {
300  lScore = lScore + 5;
301  UpdateStatusBar();
302  }
303  }
304 
305  LastId = stackobj.Id();
306 
307  fGameStarted = true;
308 
309  TRACE("EXIT RowStackClickProc()\n");
310 }
void SetFaceDirection(UINT uDirType, int nOption)
Definition: cardregion.cpp:258
long lScore
Definition: solitaire.cpp:29
void Redraw()
int GetScoreMode(void)
Definition: solitaire.cpp:128
#define TRACE(s)
Definition: solgame.cpp:4
int NumCards() const
Definition: cardregion.cpp:544
int LastId
Definition: solgame.cpp:13
bool fGameStarted
Definition: solgame.cpp:14
#define CS_FACE_DOWNUP
Definition: cardlib.h:53
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:262
#define SCORE_STD
Definition: solitaire.h:45
UINT GetFaceDirection(int *pnOption)
Definition: cardregion.cpp:273

◆ RowStackDblClickProc()

void CARDLIBPROC RowStackDblClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 394 of file solgame.cpp.

Referenced by CreateSol(), and PileDblClickProc().

395 {
396  TRACE("ENTER RowStackDblClickProc()\n");
397 
398  SetPlayTimer();
399 
400  //can only move 1 card at a time
401  if(iNumClicked != 1)
402  {
403  TRACE("EXIT RowStackDblClickProc()\n");
404  return;
405  }
406 
407  //find a suit-stack to move the card to...
408  const CardStack &cardstack = stackobj.GetCardStack();
409  CardRegion *pDest = FindSuitStackFromCard(cardstack[0]);
410 
411  if(pDest != 0)
412  {
413  fGameStarted = true;
414  SetPlayTimer();
415 
416  //stackobj.MoveCards(pDest, 1, true);
417  //use the SimulateDrag function, because we get the
418  //AddProc callbacks called for us on the destination stacks...
419  bAutoroute = true;
420  stackobj.SimulateDrag(pDest, 1, true);
421  bAutoroute = false;
422  }
423  TRACE("EXIT RowStackDblClickProc()\n");
424 }
const CardStack & GetCardStack()
Definition: cardregion.cpp:399
CardRegion * FindSuitStackFromCard(Card card)
Definition: solgame.cpp:315
bool SimulateDrag(CardRegion *pDestStack, int nNumCards, bool fAnimate)
Definition: cardregion.cpp:636
bool bAutoroute
Definition: solgame.cpp:15
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:170
bool fGameStarted
Definition: solgame.cpp:14

◆ RowStackDragProc()

bool CARDLIBPROC RowStackDragProc ( CardRegion stackobj,
int  iNumCards 
)

Definition at line 101 of file solgame.cpp.

102 {
103  TRACE("ENTER RowStackDragProc()\n");
104  int numfacedown;
105  int numcards;
106 
107  SetPlayTimer();
108 
109  stackobj.GetFaceDirection(&numfacedown);
110 
111  numcards = stackobj.NumCards();
112 
113  TRACE("EXIT RowStackDragProc()\n");
114  if(iNumDragCards <= numcards-numfacedown)
115  return true;
116  else
117  return false;
118 
119 }
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:170
int NumCards() const
Definition: cardregion.cpp:544
UINT GetFaceDirection(int *pnOption)
Definition: cardregion.cpp:273

◆ RowStackDropProc()

bool CARDLIBPROC RowStackDropProc ( CardRegion stackobj,
CardStack dragcards 
)

Definition at line 125 of file solgame.cpp.

Referenced by CreateSol().

126 {
127  TRACE("ENTER RowStackDropProc()\n");
128  Card dragcard = dragcards[dragcards.NumCards() - 1];
129 
130  SetPlayTimer();
131 
132  //if we are empty, can only drop a stack with a King at bottom
133  if(stackobj.NumCards() == 0)
134  {
135  if(dragcard.LoVal() != 13)
136  {
137  TRACE("EXIT RowStackDropProc(false)\n");
138  return false;
139  }
140  }
141  else
142  {
143  const CardStack &mystack = stackobj.GetCardStack();
144 
145  //can only drop if card is 1 less
146  if(mystack[0].LoVal() != dragcard.LoVal() + 1)
147  {
148  TRACE("EXIT RowStackDropProc(false)\n");
149  return false;
150  }
151 
152  //can only drop if card is different colour
153  if( (mystack[0].IsBlack() && !dragcard.IsRed()) ||
154  (!mystack[0].IsBlack() && dragcard.IsRed()) )
155  {
156  TRACE("EXIT RowStackDropProc(false)\n");
157  return false;
158  }
159  }
160 
161  fGameStarted = true;
162 
163  if (LastId == PILE_ID)
164  {
165  if (GetScoreMode() == SCORE_STD)
166  {
167  lScore = lScore + 5;
168  }
169  }
170  else if ((LastId >= SUIT_ID) && (LastId <= SUIT_ID + 3))
171  {
172  if (GetScoreMode() == SCORE_STD)
173  {
174  lScore = lScore >= 15 ? lScore - 15 : 0;
175  }
176  else if (GetScoreMode() == SCORE_VEGAS)
177  {
178  lScore = lScore >= -47 ? lScore - 5 : -52;
179  }
180  }
181 
182  UpdateStatusBar();
183 
184  TRACE("EXIT RowStackDropProc(true)\n");
185  return true;
186 }
long lScore
Definition: solitaire.cpp:29
const CardStack & GetCardStack()
Definition: cardregion.cpp:399
#define SUIT_ID
Definition: solitaire.h:41
int GetScoreMode(void)
Definition: solitaire.cpp:128
#define PILE_ID
Definition: solitaire.h:40
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:170
int NumCards() const
Definition: cardregion.cpp:544
bool IsRed() const
Definition: card.h:94
int LastId
Definition: solgame.cpp:13
Definition: card.h:27
bool fGameStarted
Definition: solgame.cpp:14
int LoVal() const
Definition: card.h:59
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:262
#define SCORE_STD
Definition: solitaire.h:45
#define SCORE_VEGAS
Definition: solitaire.h:46
int NumCards() const
Definition: cardstack.h:14

◆ SetPlayTimer()

void SetPlayTimer ( void  )

Definition at line 170 of file solitaire.cpp.

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

171 {
173  {
174  if (!PlayTimer)
175  {
177  }
178  }
179 }
DWORD dwOptions
Definition: solitaire.cpp:23
HWND hwndMain
Definition: solitaire.cpp:12
UINT_PTR PlayTimer
Definition: solitaire.cpp:30
#define IDT_PLAYTIMER
Definition: solitaire.h:33
smooth NULL
Definition: ftsmooth.c:416
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define OPTION_SHOW_TIME
Definition: solitaire.h:12

◆ SuitStackAddProc()

void CARDLIBPROC SuitStackAddProc ( CardRegion stackobj,
const CardStack added 
)

Definition at line 338 of file solgame.cpp.

Referenced by CreateSol().

339 {
340  TRACE("ENTER SuitStackAddProc()\n");
341  bool fGameOver = true;
342 
343  SetPlayTimer();
344 
345  for(int i = 0; i < 4; i++)
346  {
347  if(pSuitStack[i]->NumCards() != 13)
348  {
349  fGameOver = false;
350 
351  break;
352  }
353  }
354 
355  if(fGameOver)
356  {
358  PlayTimer = 0;
359 
361  {
362  lScore = lScore + (700000 / dwTime);
363  }
364 
365  UpdateStatusBar();
366 
368 
369  for(int i = 0; i < 4; i++)
370  {
371  pSuitStack[i]->Flash(11, 100);
372  }
373 
375  {
376  NewGame();
377  }
378  else
379  {
381 
382  fGameStarted = false;
383  }
384  }
385 
386  TRACE("EXIT SuitStackAddProc()\n");
387 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define IDYES
Definition: winuser.h:829
HWND hwndMain
Definition: solitaire.cpp:12
long lScore
Definition: solitaire.cpp:29
void EmptyStacks(void)
Definition: cardwindow.cpp:607
CardRegion * pSuitStack[4]
Definition: solcreate.cpp:5
UINT_PTR PlayTimer
Definition: solitaire.cpp:30
void Flash(int count, int timeout)
Definition: cardregion.cpp:322
void NewGame(void)
Definition: solgame.cpp:17
int GetScoreMode(void)
Definition: solitaire.cpp:128
TCHAR MsgWin[128]
Definition: solitaire.cpp:21
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define IDT_PLAYTIMER
Definition: solitaire.h:33
#define MB_YESNO
Definition: winuser.h:811
#define MB_ICONQUESTION
Definition: winuser.h:783
DWORD dwTime
Definition: solitaire.cpp:25
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:170
#define MB_ICONINFORMATION
Definition: winuser.h:796
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define MessageBox
Definition: winuser.h:5688
TCHAR szAppName[128]
Definition: solitaire.cpp:16
bool fGameStarted
Definition: solgame.cpp:14
#define MB_OK
Definition: winuser.h:784
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:262
TCHAR MsgDeal[128]
Definition: solitaire.cpp:22
#define SCORE_STD
Definition: solitaire.h:45
#define OPTION_SHOW_TIME
Definition: solitaire.h:12
CardWindow SolWnd
Definition: solitaire.cpp:32

◆ SuitStackClickProc()

void CARDLIBPROC SuitStackClickProc ( CardRegion stackobj,
int  iNumClicked 
)

Definition at line 269 of file solgame.cpp.

Referenced by CreateSol().

270 {
271  TRACE("ENTER SuitStackClickProc()\n");
272 
273  fGameStarted = true;
274 
275  LastId = stackobj.Id();
276 
277  TRACE("EXIT SuitStackClickProc()\n");
278 }
#define TRACE(s)
Definition: solgame.cpp:4
int LastId
Definition: solgame.cpp:13
bool fGameStarted
Definition: solgame.cpp:14

◆ SuitStackDropProc()

bool CARDLIBPROC SuitStackDropProc ( CardRegion stackobj,
CardStack dragcards 
)

Definition at line 230 of file solgame.cpp.

Referenced by CreateSol().

231 {
232  TRACE("ENTER SuitStackDropProc()\n");
233 
234  SetPlayTimer();
235 
236  //only drop 1 card at a time
237  if (!bAutoroute && dragcards.NumCards() != 1)
238  {
239  TRACE("EXIT SuitStackDropProc()\n");
240  return false;
241  }
242 
243  bool b = CanDrop(stackobj, dragcards[0]);
244  TRACE("EXIT SuitStackDropProc()\n");
245 
246  if (b)
247  {
248  if ((LastId == PILE_ID) || (LastId >= ROW_ID))
249  {
250  if (GetScoreMode() == SCORE_VEGAS)
251  {
252  lScore = lScore + 5;
253  }
254  else if (GetScoreMode() == SCORE_STD)
255  {
256  lScore = lScore + 10;
257  }
258 
259  UpdateStatusBar();
260  }
261  }
262 
263  return b;
264 }
long lScore
Definition: solitaire.cpp:29
#define ROW_ID
Definition: solitaire.h:42
int GetScoreMode(void)
Definition: solitaire.cpp:128
#define b
Definition: ke_i.h:79
#define PILE_ID
Definition: solitaire.h:40
bool bAutoroute
Definition: solgame.cpp:15
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
void SetPlayTimer(void)
Definition: solitaire.cpp:170
int LastId
Definition: solgame.cpp:13
bool CanDrop(CardRegion &stackobj, Card card)
Definition: solgame.cpp:192
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:262
#define SCORE_STD
Definition: solitaire.h:45
#define SCORE_VEGAS
Definition: solitaire.h:46
int NumCards() const
Definition: cardstack.h:14

◆ UpdateStatusBar()

void UpdateStatusBar ( void  )

Definition at line 148 of file solitaire.cpp.

149 {
150  TCHAR szStatusText[128];
151  TCHAR szTempText[64];
152 
153  ZeroMemory(szStatusText, sizeof(szStatusText));
154 
155  if (GetScoreMode() != SCORE_NONE)
156  {
157  _stprintf(szStatusText, szScore, lScore);
158  _tcscat(szStatusText, _T(" "));
159  }
160 
162  {
163  _stprintf(szTempText, szTime, dwTime);
164  _tcscat(szStatusText, szTempText);
165  }
166 
168 }
DWORD dwOptions
Definition: solitaire.cpp:23
TCHAR szTime[64]
Definition: solitaire.cpp:18
long lScore
Definition: solitaire.cpp:29
#define ZeroMemory
Definition: winbase.h:1635
CHAR * LPTSTR
Definition: xmlstorage.h:192
int GetScoreMode(void)
Definition: solitaire.cpp:128
#define SCORE_NONE
Definition: solitaire.h:44
LONG_PTR LPARAM
Definition: windef.h:208
HWND hwndStatus
Definition: solitaire.cpp:13
DWORD dwTime
Definition: solitaire.cpp:25
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define SB_SETTEXT
Definition: commctrl.h:1919
#define _stprintf
Definition: utility.h:124
TCHAR szScore[64]
Definition: solitaire.cpp:17
#define SendMessage
Definition: winuser.h:5709
_TCHAR * _tcscat(_TCHAR *s, const _TCHAR *append)
Definition: tcscat.h:8
#define OPTION_SHOW_TIME
Definition: solitaire.h:12
#define SBT_NOBORDERS
Definition: commctrl.h:1941

Variable Documentation

◆ dwOptions

◆ dwPrevMode

DWORD dwPrevMode

Definition at line 28 of file solitaire.cpp.

Referenced by _tWinMain(), and NewGame().

◆ dwTime

◆ dwWasteCount

DWORD dwWasteCount

Definition at line 26 of file solitaire.cpp.

Referenced by DeckClickProc(), and NewGame().

◆ dwWasteTreshold

DWORD dwWasteTreshold

Definition at line 27 of file solitaire.cpp.

Referenced by DeckClickProc(), and NewGame().

◆ fGameStarted

bool fGameStarted

Definition at line 14 of file solgame.cpp.

◆ hwndMain

HWND hwndMain

Definition at line 12 of file solitaire.cpp.

◆ lScore

◆ pDeck

CardRegion* pDeck

Definition at line 3 of file solcreate.cpp.

Referenced by DeckClickProc(), and NewGame().

◆ PlayTimer

UINT_PTR PlayTimer

Definition at line 30 of file solitaire.cpp.

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

◆ pPile

CardRegion* pPile

Definition at line 4 of file solcreate.cpp.

Referenced by DeckClickProc(), and NewGame().

◆ pRowStack

CardRegion* pRowStack[]

Definition at line 6 of file solcreate.cpp.

Referenced by NewGame().

◆ pSuitStack

CardRegion* pSuitStack[]

Definition at line 5 of file solcreate.cpp.

Referenced by FindSuitStackFromCard(), and SuitStackAddProc().

◆ SolWnd

CardWindow SolWnd

Definition at line 32 of file solitaire.cpp.

Referenced by CreateSol(), DeckClickProc(), NewGame(), and SuitStackAddProc().

◆ szAppName

TCHAR szAppName[]

Definition at line 16 of file solitaire.cpp.

◆ yRowStackCardOffset

int yRowStackCardOffset

Definition at line 12 of file solcreate.cpp.