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