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