[YAROTOWS] Reintegrate the branch. For a brighter future.
[reactos.git] / reactos / base / applications / games / winmine / main.h
1 /*
2 * Copyright 2000 Joshua Thielen
3 *
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.
8 *
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.
13 *
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 St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 #include <windows.h>
20
21 #define BEGINNER_MINES 10
22 #define BEGINNER_COLS 9
23 #define BEGINNER_ROWS 9
24
25 #define ADVANCED_MINES 40
26 #define ADVANCED_COLS 16
27 #define ADVANCED_ROWS 16
28
29 #define EXPERT_MINES 99
30 #define EXPERT_COLS 30
31 #define EXPERT_ROWS 16
32
33 #define MAX_COLS 30
34 #define MAX_ROWS 24
35
36 #define BOTTOM_MARGIN 20
37 #define BOARD_WMARGIN 5
38 #define BOARD_HMARGIN 5
39
40 /* mine defines */
41 #define MINE_WIDTH 16
42 #define MINE_HEIGHT 16
43 #define LED_WIDTH 12
44 #define LED_HEIGHT 23
45 #define FACE_WIDTH 24
46 #define FACE_HEIGHT 24
47
48 #define MAX_PLAYER_NAME_SIZE 31
49
50 typedef enum { SPRESS_BMP, COOL_BMP, DEAD_BMP, OOH_BMP, SMILE_BMP } FACE_BMP;
51
52 typedef enum { WAITING, PLAYING, GAMEOVER, WON } GAME_STATUS;
53
54 typedef enum {
55 MPRESS_BMP, ONE_BMP, TWO_BMP, THREE_BMP, FOUR_BMP, FIVE_BMP, SIX_BMP,
56 SEVEN_BMP, EIGHT_BMP, BOX_BMP, FLAG_BMP, QUESTION_BMP, EXPLODE_BMP,
57 WRONG_BMP, MINE_BMP, QPRESS_BMP
58 } MINEBMP_OFFSET;
59
60 typedef enum { BEGINNER, ADVANCED, EXPERT, CUSTOM } DIFFICULTY;
61
62 typedef struct tagBOARD
63 {
64 BOOL IsMarkQ;
65 HDC hdc;
66 HINSTANCE hInst;
67 HWND hWnd;
68 HBITMAP hMinesBMP;
69 HBITMAP hFacesBMP;
70 HBITMAP hLedsBMP;
71 RECT mines_rect;
72 RECT face_rect;
73 RECT timer_rect;
74 RECT counter_rect;
75
76 unsigned width;
77 unsigned height;
78 POINT pos;
79
80 unsigned time;
81 unsigned num_flags;
82 unsigned boxes_left;
83 unsigned num_mines;
84
85 /* difficulty info */
86 unsigned rows;
87 unsigned cols;
88 unsigned mines;
89 char best_name [3][MAX_PLAYER_NAME_SIZE+1];
90 DWORD best_time [3];
91 DIFFICULTY difficulty;
92
93 POINT press;
94
95 /* defines for mb */
96 #define MB_NONE 0
97 #define MB_LEFTDOWN 1
98 #define MB_LEFTUP 2
99 #define MB_RIGHTDOWN 3
100 #define MB_RIGHTUP 4
101 #define MB_BOTHDOWN 5
102 #define MB_BOTHUP 6
103 unsigned mb;
104
105 FACE_BMP face_bmp;
106 GAME_STATUS status;
107 struct BOX_STRUCT
108 {
109 unsigned IsMine : 1;
110 unsigned IsPressed : 1;
111 unsigned FlagType : 2;
112 unsigned NumMines : 4;
113 } box [MAX_COLS + 2] [MAX_ROWS + 2];
114
115 /* defines for FlagType */
116 #define NORMAL 0
117 #define QUESTION 1
118 #define FLAG 2
119 #define COMPLETE 3
120
121 } BOARD;
122
123 void CheckLevel( BOARD *p_board );
124
125 INT_PTR CALLBACK CustomDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
126
127 INT_PTR CALLBACK CongratsDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
128
129 INT_PTR CALLBACK TimesDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
130
131
132 /* end of header */