Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
5.0 KiB

  1. //#ifdef WIN
  2. /* BabakJ: The stuff in this ifdef is hack for using \\popcorn env */
  3. //#define NOCOMM
  4. /* #define _NTDEF_ to get NT defs, i.e. WORD unsigned short, not int */
  5. #include <windows.h>
  6. #include <port1632.h>
  7. // Babakj: Set DEBUG based on DBG (1 or 0) to do FREE or CHECKED builds of Solitaire
  8. #if DBG
  9. #define DEBUG
  10. #endif
  11. /* #include <winkrnl.h> To define OFSTRUCT */
  12. /* OpenFile() Structure */
  13. //typedef struct tagOFSTRUCT
  14. // {
  15. // BYTE cBytes;
  16. // BYTE fFixedDisk;
  17. // WORD nErrCode;
  18. // BYTE reserved[4];
  19. // BYTE szPathName[128];
  20. // } OFSTRUCT;
  21. //typedef OFSTRUCT *POFSTRUCT;
  22. //typedef OFSTRUCT NEAR *NPOFSTRUCT;
  23. //typedef OFSTRUCT FAR *LPOFSTRUCT;
  24. //#define OF_CREATE 0x1000
  25. //#define OF_WRITE 0x0001
  26. /* End if stuff taken from Winkrnl.h */
  27. //#endif
  28. #include <stdlib.h>
  29. #include <time.h>
  30. #include "std.h"
  31. #include "crd.h"
  32. #include "col.h"
  33. #include "undo.h"
  34. #include "solid.h"
  35. #include "game.h"
  36. #include "soldraw.h"
  37. #include "back.h"
  38. #include "stat.h"
  39. #include "klond.h"
  40. #include "debug.h"
  41. // key in the registry to store the solitaire settings.
  42. #define SOLKEYNAME TEXT("Software\\Microsoft\\Solitaire")
  43. VOID ChangeBack( INT );
  44. VOID WriteIniFlags( INT );
  45. BOOL FYesNoAlert( INT );
  46. VOID DoOptions( VOID );
  47. VOID DoBacks( VOID );
  48. VOID NewGame( BOOL, BOOL );
  49. BOOL APIENTRY cdtDraw( HDC, INT, INT, INT, INT, DWORD );
  50. BOOL APIENTRY cdtDrawExt(HDC, INT, INT, INT, INT, INT, INT, DWORD);
  51. BOOL FCreateStat( VOID );
  52. BOOL FSetDrag( BOOL );
  53. BOOL FInitGm( VOID );
  54. BOOL APIENTRY cdtInit( INT FAR *, INT FAR * );
  55. typedef INT (*COLCLSCREATEFUNC)();
  56. COLCLS *PcolclsCreate(INT tcls, COLCLSCREATEFUNC lpfnColProc,
  57. DX dxUp, DY dyUp, DX dxDn, DY dyDn,
  58. INT dcrdUp, INT dcrdDn);
  59. COL *PcolCreate(COLCLS *pcolcls, X xLeft, Y yTop, X xRight, Y yBot, INT icrdMax);
  60. VOID SwapCards(CRD *pcrd1, CRD *pcrd2);
  61. BOOL FCrdRectIsect(CRD *pcrd, RC *prc);
  62. BOOL FRectIsect(RC *prc1, RC *prc2);
  63. BOOL FPtInCrd(CRD *pcrd, PT pt);
  64. VOID DrawCard(CRD *pcrd);
  65. VOID DrawCardPt(CRD *pcrd, PT *ppt);
  66. VOID DrawBackground(X xLeft, Y yTop, X xRight, Y yBot);
  67. VOID DrawBackExcl(COL *pcol, PT *ppt);
  68. VOID EraseScreen(VOID);
  69. VOID OOM( VOID );
  70. HDC HdcSet(HDC hdc, X xOrg, Y yOrg);
  71. extern X xOrgCur;
  72. extern Y yOrgCur;
  73. #define AssertHdcCur() Assert(hdcCur != NULL)
  74. BOOL FGetHdc( VOID );
  75. VOID ReleaseHdc( VOID );
  76. typedef union
  77. {
  78. struct _ini
  79. {
  80. BOOL fStatusBar : 1;
  81. BOOL fTimedGame : 1;
  82. BOOL fOutlineDrag : 1;
  83. BOOL fDrawThree : 1;
  84. unsigned fSMD: 2;
  85. BOOL fKeepScore : 1;
  86. BOOL unused:8;
  87. } grbit;
  88. DWORD w;
  89. } INI;
  90. /* WriteIniFlags flags */
  91. #define wifOpts 0x01
  92. #define wifBitmap 0x02
  93. #define wifBack 0x04
  94. #define wifAll wifOpts|wifBitmap|wifBack
  95. /* externals */
  96. /* sol.c */
  97. extern TCHAR szAppName[]; // name of this application (solitaire)
  98. extern TCHAR szScore[]; // title 'score:' for internationalization
  99. extern HWND hwndApp; // handle to main window of app
  100. extern HANDLE hinstApp; // handle to instance of app
  101. extern BOOL fBW; // true if on monochrome video (not NT!)
  102. extern HBRUSH hbrTable; // handle to brush of table top
  103. extern LONG rgbTable; // RGB value of table top
  104. extern INT modeFaceDown; // back of cards bmp id
  105. extern BOOL fIconic; // true if app is iconic
  106. extern INT dyChar; // tmHeight for textout
  107. extern INT dxChar; // tmMaxCharWidth for textout
  108. extern GM* pgmCur; // current game
  109. extern DEL delCrd;
  110. extern DEL delScreen;
  111. extern PT ptNil; // no previous pt (nil)
  112. #define dxCrd delCrd.dx
  113. #define dyCrd delCrd.dy
  114. #define dxScreen delScreen.dx
  115. #define dyScreen delScreen.dy
  116. extern RC rcClient; // client rectangle after resize
  117. extern INT igmCur; // the current game #, srand seeded with this
  118. #ifdef DEBUG
  119. extern BOOL fScreenShots; // ???
  120. #endif
  121. extern HDC hdcCur; // current HDC to draw on (!)
  122. extern INT usehdcCur; // hdcCur use count
  123. extern X xOrgCur;
  124. extern Y yOrgCur;
  125. extern TCHAR szOOM[50]; // "out of memory" error message
  126. extern BOOL fStatusBar; // true if we are to show status
  127. extern BOOL fTimedGame; // true if we are to time game
  128. extern BOOL fKeepScore; // true if keeping score (vegas only)
  129. extern SMD smd; // Score MoDe (std, vegas, none)
  130. extern INT ccrdDeal;
  131. extern BOOL fOutlineDrag;
  132. extern BOOL fHalfCards;
  133. extern int xCardMargin;
  134. /* stat.c */
  135. extern HWND hwndStat; // hwnd of status window
  136. /* col.c */
  137. extern BOOL fMegaDiscardHack; // true if called from DiscardMove
  138. extern MOVE move; // move data
  139. /* klond.c */
  140. BOOL PositionCols(void);
  141. extern BOOL fKlondWinner; // true if we needn't round card corners
  142. #ifdef DEBUG
  143. WORD ILogMsg( VOID *, INT, WPARAM, LPARAM, BOOL );
  144. VOID LogMsgResult( INT, LRESULT );
  145. #endif