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