ReactOS 0.4.16-dev-106-g10b08aa
main.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winuser.h>
#include "resource.h"
Include dependency graph for main.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagBOARD
 
struct  tagBOARD::BOX_STRUCT
 

Macros

#define WIN32_NO_STATUS
 
#define BEGINNER_MINES   10
 
#define BEGINNER_COLS   9
 
#define BEGINNER_ROWS   9
 
#define ADVANCED_MINES   40
 
#define ADVANCED_COLS   16
 
#define ADVANCED_ROWS   16
 
#define EXPERT_MINES   99
 
#define EXPERT_COLS   30
 
#define EXPERT_ROWS   16
 
#define MAX_COLS   30
 
#define MAX_ROWS   24
 
#define BOTTOM_MARGIN   20
 
#define BOARD_WMARGIN   5
 
#define BOARD_HMARGIN   5
 
#define MINE_WIDTH   16
 
#define MINE_HEIGHT   16
 
#define LED_WIDTH   12
 
#define LED_HEIGHT   23
 
#define FACE_WIDTH   24
 
#define FACE_HEIGHT   24
 
#define MAX_PLAYER_NAME_SIZE   31
 
#define MB_NONE   0
 
#define MB_LEFTDOWN   1
 
#define MB_LEFTUP   2
 
#define MB_RIGHTDOWN   3
 
#define MB_RIGHTUP   4
 
#define MB_BOTHDOWN   5
 
#define MB_BOTHUP   6
 
#define NORMAL   0
 
#define QUESTION   1
 
#define FLAG   2
 
#define COMPLETE   3
 

Typedefs

typedef struct tagBOARD BOARD
 

Enumerations

enum  FACE_BMP {
  SPRESS_BMP , COOL_BMP , DEAD_BMP , OOH_BMP ,
  SMILE_BMP
}
 
enum  GAME_STATUS { WAITING , PLAYING , GAMEOVER , WON }
 
enum  MINEBMP_OFFSET {
  MPRESS_BMP , ONE_BMP , TWO_BMP , THREE_BMP ,
  FOUR_BMP , FIVE_BMP , SIX_BMP , SEVEN_BMP ,
  EIGHT_BMP , BOX_BMP , FLAG_BMP , QUESTION_BMP ,
  EXPLODE_BMP , WRONG_BMP , MINE_BMP , QPRESS_BMP
}
 
enum  DIFFICULTY { BEGINNER , ADVANCED , EXPERT , CUSTOM }
 

Functions

void CheckLevel (BOARD *p_board)
 
INT_PTR CALLBACK CustomDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK CongratsDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK TimesDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Macro Definition Documentation

◆ ADVANCED_COLS

#define ADVANCED_COLS   16

Definition at line 35 of file main.h.

◆ ADVANCED_MINES

#define ADVANCED_MINES   40

Definition at line 34 of file main.h.

◆ ADVANCED_ROWS

#define ADVANCED_ROWS   16

Definition at line 36 of file main.h.

◆ BEGINNER_COLS

#define BEGINNER_COLS   9

Definition at line 31 of file main.h.

◆ BEGINNER_MINES

#define BEGINNER_MINES   10

Definition at line 30 of file main.h.

◆ BEGINNER_ROWS

#define BEGINNER_ROWS   9

Definition at line 32 of file main.h.

◆ BOARD_HMARGIN

#define BOARD_HMARGIN   5

Definition at line 47 of file main.h.

◆ BOARD_WMARGIN

#define BOARD_WMARGIN   5

Definition at line 46 of file main.h.

◆ BOTTOM_MARGIN

#define BOTTOM_MARGIN   20

Definition at line 45 of file main.h.

◆ COMPLETE

#define COMPLETE   3

Definition at line 131 of file main.h.

◆ EXPERT_COLS

#define EXPERT_COLS   30

Definition at line 39 of file main.h.

◆ EXPERT_MINES

#define EXPERT_MINES   99

Definition at line 38 of file main.h.

◆ EXPERT_ROWS

#define EXPERT_ROWS   16

Definition at line 40 of file main.h.

◆ FACE_HEIGHT

#define FACE_HEIGHT   24

Definition at line 55 of file main.h.

◆ FACE_WIDTH

#define FACE_WIDTH   24

Definition at line 54 of file main.h.

◆ FLAG

#define FLAG   2

Definition at line 130 of file main.h.

◆ LED_HEIGHT

#define LED_HEIGHT   23

Definition at line 53 of file main.h.

◆ LED_WIDTH

#define LED_WIDTH   12

Definition at line 52 of file main.h.

◆ MAX_COLS

#define MAX_COLS   30

Definition at line 42 of file main.h.

◆ MAX_PLAYER_NAME_SIZE

#define MAX_PLAYER_NAME_SIZE   31

Definition at line 57 of file main.h.

◆ MAX_ROWS

#define MAX_ROWS   24

Definition at line 43 of file main.h.

◆ MB_BOTHDOWN

#define MB_BOTHDOWN   5

Definition at line 113 of file main.h.

◆ MB_BOTHUP

#define MB_BOTHUP   6

Definition at line 114 of file main.h.

◆ MB_LEFTDOWN

#define MB_LEFTDOWN   1

Definition at line 109 of file main.h.

◆ MB_LEFTUP

#define MB_LEFTUP   2

Definition at line 110 of file main.h.

◆ MB_NONE

#define MB_NONE   0

Definition at line 108 of file main.h.

◆ MB_RIGHTDOWN

#define MB_RIGHTDOWN   3

Definition at line 111 of file main.h.

◆ MB_RIGHTUP

#define MB_RIGHTUP   4

Definition at line 112 of file main.h.

◆ MINE_HEIGHT

#define MINE_HEIGHT   16

Definition at line 51 of file main.h.

◆ MINE_WIDTH

#define MINE_WIDTH   16

Definition at line 50 of file main.h.

◆ NORMAL

#define NORMAL   0

Definition at line 128 of file main.h.

◆ QUESTION

#define QUESTION   1

Definition at line 129 of file main.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 24 of file main.h.

Typedef Documentation

◆ BOARD

Enumeration Type Documentation

◆ DIFFICULTY

Enumerator
BEGINNER 
ADVANCED 
EXPERT 
CUSTOM 

Definition at line 69 of file main.h.

DIFFICULTY
Definition: main.h:69
@ ADVANCED
Definition: main.h:69
@ EXPERT
Definition: main.h:69
@ BEGINNER
Definition: main.h:69
@ CUSTOM
Definition: main.h:69

◆ FACE_BMP

Enumerator
SPRESS_BMP 
COOL_BMP 
DEAD_BMP 
OOH_BMP 
SMILE_BMP 

Definition at line 59 of file main.h.

FACE_BMP
Definition: main.h:59
@ DEAD_BMP
Definition: main.h:59
@ SPRESS_BMP
Definition: main.h:59
@ OOH_BMP
Definition: main.h:59
@ SMILE_BMP
Definition: main.h:59
@ COOL_BMP
Definition: main.h:59

◆ GAME_STATUS

Enumerator
WAITING 
PLAYING 
GAMEOVER 
WON 

Definition at line 61 of file main.h.

GAME_STATUS
Definition: main.h:61
@ GAMEOVER
Definition: main.h:61
@ WON
Definition: main.h:61
@ WAITING
Definition: main.h:61
@ PLAYING
Definition: main.h:61

◆ MINEBMP_OFFSET

Enumerator
MPRESS_BMP 
ONE_BMP 
TWO_BMP 
THREE_BMP 
FOUR_BMP 
FIVE_BMP 
SIX_BMP 
SEVEN_BMP 
EIGHT_BMP 
BOX_BMP 
FLAG_BMP 
QUESTION_BMP 
EXPLODE_BMP 
WRONG_BMP 
MINE_BMP 
QPRESS_BMP 

Definition at line 63 of file main.h.

63 {
MINEBMP_OFFSET
Definition: main.h:63
@ TWO_BMP
Definition: main.h:64
@ SEVEN_BMP
Definition: main.h:65
@ MPRESS_BMP
Definition: main.h:64
@ EIGHT_BMP
Definition: main.h:65
@ QUESTION_BMP
Definition: main.h:65
@ BOX_BMP
Definition: main.h:65
@ THREE_BMP
Definition: main.h:64
@ MINE_BMP
Definition: main.h:66
@ FOUR_BMP
Definition: main.h:64
@ WRONG_BMP
Definition: main.h:66
@ FIVE_BMP
Definition: main.h:64
@ EXPLODE_BMP
Definition: main.h:65
@ ONE_BMP
Definition: main.h:64
@ SIX_BMP
Definition: main.h:64
@ QPRESS_BMP
Definition: main.h:66
@ FLAG_BMP
Definition: main.h:65

Function Documentation

◆ CheckLevel()

void CheckLevel ( BOARD p_board)

Definition at line 52 of file main.c.

53{
54 if( p_board->rows < BEGINNER_ROWS )
55 p_board->rows = BEGINNER_ROWS;
56
57 if( p_board->rows > MAX_ROWS )
58 p_board->rows = MAX_ROWS;
59
60 if( p_board->cols < BEGINNER_COLS )
61 p_board->cols = BEGINNER_COLS;
62
63 if( p_board->cols > MAX_COLS )
64 p_board->cols = MAX_COLS;
65
66 if( p_board->mines < BEGINNER_MINES )
67 p_board->mines = BEGINNER_MINES;
68
69 if( p_board->mines > ( p_board->cols - 1 ) * ( p_board->rows - 1 ) )
70 p_board->mines = ( p_board->cols - 1 ) * ( p_board->rows - 1 );
71}
#define BEGINNER_ROWS
Definition: main.h:32
#define BEGINNER_COLS
Definition: main.h:31
#define BEGINNER_MINES
Definition: main.h:30
#define MAX_COLS
Definition: main.h:42
#define MAX_ROWS
Definition: map.c:19
unsigned cols
Definition: main.h:99
unsigned mines
Definition: main.h:100
unsigned rows
Definition: main.h:98

Referenced by CustomDlgProc(), and InitBoard().

◆ CongratsDlgProc()

INT_PTR CALLBACK CongratsDlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 55 of file dialog.c.

56{
57 static BOARD *p_board;
58
59 switch( uMsg ) {
60 case WM_INITDIALOG:
61 p_board = (BOARD*) lParam;
62 SetDlgItemTextW( hDlg, IDC_EDITNAME, p_board->best_name[p_board->difficulty] );
63 return TRUE;
64
65 case WM_COMMAND:
66 switch( LOWORD( wParam ) ) {
67 case IDOK:
69 p_board->best_name[p_board->difficulty],
70 sizeof( p_board->best_name[p_board->difficulty] ) / sizeof(WCHAR) );
71 EndDialog( hDlg, 0 );
72 return TRUE;
73
74 case IDCANCEL:
75 EndDialog( hDlg, 0 );
76 return TRUE;
77 }
78 break;
79 }
80 return FALSE;
81}
#define IDC_EDITNAME
Definition: resource.h:46
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define LOWORD(l)
Definition: pedump.c:82
Definition: main.h:72
DIFFICULTY difficulty
Definition: main.h:103
WCHAR best_name[3][MAX_PLAYER_NAME_SIZE+1]
Definition: main.h:101
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define IDCANCEL
Definition: winuser.h:834
#define WM_COMMAND
Definition: winuser.h:1743
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1742
#define IDOK
Definition: winuser.h:833
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by TestBoard().

◆ CustomDlgProc()

INT_PTR CALLBACK CustomDlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 23 of file dialog.c.

24{
25 BOOL IsRet;
26 static BOARD *p_board;
27
28 switch( uMsg ) {
29 case WM_INITDIALOG:
30 p_board = (BOARD*) lParam;
31 SetDlgItemInt( hDlg, IDC_EDITROWS, p_board->rows, FALSE );
32 SetDlgItemInt( hDlg, IDC_EDITCOLS, p_board->cols, FALSE );
33 SetDlgItemInt( hDlg, IDC_EDITMINES, p_board->mines, FALSE );
34 return TRUE;
35
36 case WM_COMMAND:
37 switch( LOWORD( wParam ) ) {
38 case IDOK:
39 p_board->rows = GetDlgItemInt( hDlg, IDC_EDITROWS, &IsRet, FALSE );
40 p_board->cols = GetDlgItemInt( hDlg, IDC_EDITCOLS, &IsRet, FALSE );
41 p_board->mines = GetDlgItemInt( hDlg, IDC_EDITMINES, &IsRet, FALSE );
42 CheckLevel( p_board );
43 EndDialog( hDlg, 0 );
44 return TRUE;
45
46 case IDCANCEL:
47 EndDialog( hDlg, 1 );
48 return TRUE;
49 }
50 break;
51 }
52 return FALSE;
53}
void CheckLevel(BOARD *p_board)
Definition: main.c:52
#define IDC_EDITCOLS
Definition: resource.h:48
#define IDC_EDITMINES
Definition: resource.h:50
#define IDC_EDITROWS
Definition: resource.h:49
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)

Referenced by SetDifficulty().

◆ TimesDlgProc()

INT_PTR CALLBACK TimesDlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 83 of file dialog.c.

84{
85 static BOARD *p_board;
86 unsigned i;
87
88 switch( uMsg ) {
89 case WM_INITDIALOG:
90 p_board = (BOARD*) lParam;
91
92 /* set best names */
93 for( i = 0; i < 3; i++ )
94 SetDlgItemTextW( hDlg, (IDC_NAME1) + i, p_board->best_name[i] );
95
96 /* set best times */
97 for( i = 0; i < 3; i++ )
98 SetDlgItemInt( hDlg, (IDC_TIME1) + i, p_board->best_time[i], FALSE );
99 return TRUE;
100
101 case WM_COMMAND:
102 switch( LOWORD( wParam ) ) {
103 case IDOK:
104 case IDCANCEL:
105 EndDialog( hDlg, 0 );
106 return TRUE;
107 }
108 break;
109 }
110 return FALSE;
111}
#define IDC_NAME1
Definition: resource.h:42
#define IDC_TIME1
Definition: resource.h:39
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD best_time[3]
Definition: main.h:102

Referenced by MainProc(), and TestBoard().