]> git.gir.st - minesVIiper.git/blob - mines.h
restructure mines.c (renamed from mines_2017.c)
[minesVIiper.git] / mines.h
1 #ifndef __MINES_H__
2 #define __MINES_H
3 struct minefield {
4 struct minecell {
5 unsigned m:2; /* mine?1:killmine?2:0 */
6 unsigned o:1; /* open?1:0 */
7 unsigned f:2; /* flagged?1:questioned?2:0 */
8 unsigned n:4; /* 0<= neighbours <=8 */
9 } **c;
10 int w; /* width */
11 int h; /* height */
12 int m; /* number of mines */
13 };
14
15 struct game {
16 int f; /* flags counter */
17 int t; /* time of game start */
18 int p[2]; /* cursor position {line, col} */
19 int s; /* space mode */
20 int o; /* mode */
21 };
22
23 struct opt {
24 struct minescheme* scheme;
25 int mode; /* allow flags? quesm? */
26 };
27
28 struct line_col {
29 int l;
30 int c;
31 };
32
33 void fill_minefield (int, int);
34 void move_ph (int, int);
35 void move_hi (int, int);
36 void to_next_boundary (int l, int c, char direction);
37 int getch (unsigned char*);
38 int getctrlseq (unsigned char*);
39 int everything_opened (void);
40 int wait_mouse_up (int, int);
41 void partial_show_minefield (int, int, int);
42 void show_minefield (int);
43 int get_neighbours (int, int, int);
44 int uncover_square (int, int);
45 void flag_square (int, int);
46 void quesm_square (int, int);
47 int choord_square (int, int);
48 int do_uncover (int*);
49 struct minecell** alloc_array (int, int);
50 void free_field (void);
51 char* get_emoticon(void);
52 int screen2field_l (int);
53 int screen2field_c (int);
54 int field2screen_c (int);
55 int clicked_emoticon (unsigned char*);
56 void quit(void);
57 void signal_handler (int signum);
58 void timer_setup (int);
59 void raw_mode(int mode);
60
61 enum modes {
62 NORMAL,
63 REDUCED,
64 SHOWMINES,
65 HIGHLIGHT,
66 };
67 enum flagtypes {
68 NOFLAG,
69 FLAG,
70 QUESM,
71 };
72 enum fieldopenstates {
73 CLOSED,
74 OPENED,
75 };
76 enum game_states {
77 GAME_INPROGRESS,
78 GAME_NEW,
79 GAME_WON,
80 GAME_LOST,
81 };
82 enum space_modes {
83 MODE_OPEN,
84 MODE_FLAG,
85 MODE_QUESM,
86 };
87 enum event {
88 /* for getctrlseq() */
89 CTRSEQ_NULL = 0,
90 CTRSEQ_EOF = -1,
91 CTRSEQ_INVALID = -2,
92 CTRSEQ_MOUSE = -3,
93 /* for getch() */
94 CTRSEQ_MOUSE_LEFT = -4,
95 CTRSEQ_MOUSE_MIDDLE = -5,
96 CTRSEQ_MOUSE_RIGHT = -6,
97 CTRSEQ_CURSOR_LEFT = -7,
98 CTRSEQ_CURSOR_DOWN = -8,
99 CTRSEQ_CURSOR_UP = -9,
100 CTRSEQ_CURSOR_RIGHT = -10,
101 };
102 enum mine_types {
103 NO_MINE,
104 STD_MINE,
105 DEATH_MINE,
106 };
107 #endif
Imprint / Impressum