2 * Copyright 2000 Joshua Thielen <jt85296@ltu.edu>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 static const TCHAR szWineMineRegKey
[] = TEXT("Software\\Microsoft\\WinMine");
23 // Common Controls 6.0 for MSVC 2005 or later
25 # pragma comment(linker, "/manifestdependency:\"type='win32' " \
26 "name='Microsoft.Windows.Common-Controls' " \
27 "version='6.0.0.0' " \
28 "processorArchitecture='x86' " \
29 "publicKeyToken='6595b64144ccf1df' " \
35 #define BEGINNER_MINES 10
36 #define BEGINNER_COLS 9
37 #define BEGINNER_ROWS 9
39 #define ADVANCED_MINES 40
40 #define ADVANCED_COLS 16
41 #define ADVANCED_ROWS 16
43 #define EXPERT_MINES 99
44 #define EXPERT_COLS 30
45 #define EXPERT_ROWS 16
50 #define BOTTOM_MARGIN 20
51 #define BOARD_WMARGIN 5
52 #define BOARD_HMARGIN 5
56 #define MINE_HEIGHT 16
60 #define FACE_HEIGHT 24
62 typedef enum { SPRESS_BMP
, COOL_BMP
, DEAD_BMP
, OOH_BMP
, SMILE_BMP
} FACE_BMP
;
64 typedef enum { WAITING
, PLAYING
, GAMEOVER
, WON
} GAME_STATUS
;
68 MPRESS_BMP
, ONE_BMP
, TWO_BMP
, THREE_BMP
, FOUR_BMP
, FIVE_BMP
, SIX_BMP
,
69 SEVEN_BMP
, EIGHT_BMP
, BOX_BMP
, FLAG_BMP
, QUESTION_BMP
, EXPLODE_BMP
,
70 WRONG_BMP
, MINE_BMP
, QPRESS_BMP
73 typedef enum { BEGINNER
, ADVANCED
, EXPERT
, CUSTOM
} DIFFICULTY
;
75 typedef struct tagBOARD
100 TCHAR szBestName
[3][16];
102 DIFFICULTY Difficulty
;
115 } Box
[MAX_COLS
+ 2] [MAX_ROWS
+ 2];
117 /* defines for uFlagType */
125 void ExitApp( int error
);
126 void InitBoard( BOARD
*pBoard
);
127 void LoadBoard( BOARD
*pBoard
);
128 void SaveBoard( BOARD
*pBoard
);
129 void DestroyBoard( BOARD
*pBoard
);
130 void SetDifficulty( BOARD
*pBoard
, DIFFICULTY difficulty
);
131 void CheckLevel( BOARD
*pBoard
);
132 void CreateBoard( BOARD
*pBoard
);
133 void CreateBoxes( BOARD
*pBoard
);
134 void TestBoard( HWND hWnd
, BOARD
*pBoard
, LONG x
, LONG y
, int msg
);
135 void TestMines( BOARD
*pBoard
, POINT pt
, int msg
);
136 void TestFace( BOARD
*pBoard
, POINT pt
, int msg
);
137 void DrawBoard( HDC hdc
, HDC hMemDC
, PAINTSTRUCT
*ps
, BOARD
*pBoard
);
138 void DrawMines( HDC hdc
, HDC hMemDC
, BOARD
*pBoard
);
139 void DrawMine( HDC hdc
, HDC hMemDC
, BOARD
*pBoard
, ULONG uCol
, ULONG uRow
, BOOL IsPressed
);
140 void AddFlag( BOARD
*pBoard
, ULONG uCol
, ULONG uRow
);
141 void CompleteBox( BOARD
*pBoard
, ULONG uCol
, ULONG uRow
);
142 void CompleteBoxes( BOARD
*pBoard
, ULONG uCol
, ULONG uRow
);
143 void PressBox( BOARD
*pBoard
, ULONG uCol
, ULONG uRow
);
144 void PressBoxes( BOARD
*pBoard
, ULONG uCol
, ULONG uRow
);
145 void UnpressBox( BOARD
*pBoard
, ULONG uCol
, ULONG uRow
);
146 void UnpressBoxes( BOARD
*pBoard
, ULONG uCol
, ULONG uRow
);
147 void UpdateTimer( BOARD
*pBoard
);
148 void DrawLeds( HDC hdc
, HDC hMemDC
, BOARD
*pBoard
, LONG nNumber
, LONG x
, LONG y
);
149 void DrawFace( HDC hdc
, HDC hMemDC
, BOARD
*pBoard
);
150 LRESULT WINAPI
MainProc( HWND hWnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
);
151 INT_PTR CALLBACK
CustomDlgProc( HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
152 INT_PTR CALLBACK
CongratsDlgProc( HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
153 INT_PTR CALLBACK
TimesDlgProc( HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);