]> git.gir.st - minesVIiper.git/blob - mines.h
help text into header
[minesVIiper.git] / mines.h
1 #ifndef __MINES_H__
2 #define __MINES_H
3
4 #define SHORTHELP "%s [OPTIONS] [FIELDSPEC]\n"
5 #define LONGHELP \
6 "OPTIONS:\n" \
7 " -n(o flagging)\n" \
8 " -f(lagging)\n" \
9 " -q(uestion marks)\n" \
10 " -c(olored symbols)\n" \
11 " -d(ec charset symbols)\n" \
12 "FIELDSPEC:\n" \
13 " WxH[xM] (width 'x' height 'x' mines)\n" \
14 " defaults to 30x16x99; mines default to ~20%%\n" \
15 "\n" \
16 "Keybindings:\n" \
17 " hjkl: move left/down/up/right\n" \
18 " bduw: move to next boundary\n" \
19 " ^Gg$: move to the left/bottom/top/right\n" \
20 " z: center cursor on minefield\n" \
21 " o: open/choord\n" \
22 " i: flag/unflag\n" \
23 " space:modeful cursor (either open or flag)\n" \
24 " a: toggle mode for space (open/flag)\n" \
25 " mX: set a mark for letter X\n" \
26 " `X: move to mark X (aliased to ')\n" \
27 " r: start a new game\n" \
28 " q: quit\n"
29
30 struct minefield {
31 struct minecell {
32 unsigned m:2; /* mine?1:killmine?2:0 */
33 unsigned o:1; /* open?1:0 */
34 unsigned f:2; /* flagged?1:questioned?2:0 */
35 unsigned n:4; /* 0<= neighbours <=8 */
36 } **c;
37 int w; /* width */
38 int h; /* height */
39 int m; /* number of mines */
40 };
41
42 struct game {
43 int f; /* flags counter */
44 int t; /* time of game start */
45 int p[2]; /* cursor position {line, col} */
46 int s; /* space mode */
47 int o; /* mode */
48 };
49
50 struct opt {
51 struct minescheme* scheme;
52 int mode; /* allow flags? quesm? */
53 };
54
55 struct line_col {
56 int l;
57 int c;
58 };
59
60 void fill_minefield (int, int);
61 void move_ph (int, int);
62 void move_hi (int, int);
63 void to_next_boundary (int l, int c, char direction);
64 int getch (unsigned char*);
65 int getctrlseq (unsigned char*);
66 int everything_opened (void);
67 int wait_mouse_up (int, int);
68 void partial_show_minefield (int, int, int);
69 void show_minefield (int);
70 int get_neighbours (int, int, int);
71 int uncover_square (int, int);
72 void flag_square (int, int);
73 void quesm_square (int, int);
74 int choord_square (int, int);
75 int do_uncover (int*);
76 struct minecell** alloc_array (int, int);
77 void free_field (void);
78 char* get_emoticon(void);
79 int screen2field_l (int);
80 int screen2field_c (int);
81 int field2screen_c (int);
82 int clicked_emoticon (unsigned char*);
83 void quit(void);
84 void print_help(char*);
85 int parse_fieldspec(char*);
86 void signal_handler (int signum);
87 void signal_setup (void);
88 void timer_setup (int);
89 void raw_mode(int mode);
90
91 enum modes {
92 NORMAL,
93 REDUCED,
94 SHOWMINES,
95 HIGHLIGHT,
96 };
97 enum flagtypes {
98 NOFLAG,
99 FLAG,
100 QUESM,
101 };
102 enum fieldopenstates {
103 CLOSED,
104 OPENED,
105 };
106 enum game_states {
107 GAME_INPROGRESS,
108 GAME_NEW,
109 GAME_WON,
110 GAME_LOST,
111 };
112 enum space_modes {
113 MODE_OPEN,
114 MODE_FLAG,
115 MODE_QUESM,
116 };
117 enum event {
118 /* for getctrlseq() */
119 CTRSEQ_NULL = 0,
120 CTRSEQ_EOF = -1,
121 CTRSEQ_INVALID = -2,
122 CTRSEQ_MOUSE = -3,
123 /* for getch() */
124 CTRSEQ_MOUSE_LEFT = -4,
125 CTRSEQ_MOUSE_MIDDLE = -5,
126 CTRSEQ_MOUSE_RIGHT = -6,
127 CTRSEQ_CURSOR_LEFT = -7,
128 CTRSEQ_CURSOR_DOWN = -8,
129 CTRSEQ_CURSOR_UP = -9,
130 CTRSEQ_CURSOR_RIGHT = -10,
131 };
132 enum mine_types {
133 NO_MINE,
134 STD_MINE,
135 DEATH_MINE,
136 };
137 #endif
Imprint / Impressum