]> git.gir.st - minesVIiper.git/blob - mines.h
move fieldspec parsing into function
[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 int parse_fieldspec(char*);
58 void signal_handler (int signum);
59 void signal_setup (void);
60 void timer_setup (int);
61 void raw_mode(int mode);
62
63 enum modes {
64 NORMAL,
65 REDUCED,
66 SHOWMINES,
67 HIGHLIGHT,
68 };
69 enum flagtypes {
70 NOFLAG,
71 FLAG,
72 QUESM,
73 };
74 enum fieldopenstates {
75 CLOSED,
76 OPENED,
77 };
78 enum game_states {
79 GAME_INPROGRESS,
80 GAME_NEW,
81 GAME_WON,
82 GAME_LOST,
83 };
84 enum space_modes {
85 MODE_OPEN,
86 MODE_FLAG,
87 MODE_QUESM,
88 };
89 enum event {
90 /* for getctrlseq() */
91 CTRSEQ_NULL = 0,
92 CTRSEQ_EOF = -1,
93 CTRSEQ_INVALID = -2,
94 CTRSEQ_MOUSE = -3,
95 /* for getch() */
96 CTRSEQ_MOUSE_LEFT = -4,
97 CTRSEQ_MOUSE_MIDDLE = -5,
98 CTRSEQ_MOUSE_RIGHT = -6,
99 CTRSEQ_CURSOR_LEFT = -7,
100 CTRSEQ_CURSOR_DOWN = -8,
101 CTRSEQ_CURSOR_UP = -9,
102 CTRSEQ_CURSOR_RIGHT = -10,
103 };
104 enum mine_types {
105 NO_MINE,
106 STD_MINE,
107 DEATH_MINE,
108 };
109 #endif
Imprint / Impressum