diff options
Diffstat (limited to 'apps/plugins/puzzles/src/nullgame.c')
-rw-r--r-- | apps/plugins/puzzles/src/nullgame.c | 263 |
1 files changed, 0 insertions, 263 deletions
diff --git a/apps/plugins/puzzles/src/nullgame.c b/apps/plugins/puzzles/src/nullgame.c deleted file mode 100644 index c1c2ed18fd..0000000000 --- a/apps/plugins/puzzles/src/nullgame.c +++ /dev/null | |||
@@ -1,263 +0,0 @@ | |||
1 | /* | ||
2 | * nullgame.c [FIXME]: Template defining the null game (in which no | ||
3 | * moves are permitted and nothing is ever drawn). This file exists | ||
4 | * solely as a basis for constructing new game definitions - it | ||
5 | * helps to have something which will compile from the word go and | ||
6 | * merely doesn't _do_ very much yet. | ||
7 | * | ||
8 | * Parts labelled FIXME actually want _removing_ (e.g. the dummy | ||
9 | * field in each of the required data structures, and this entire | ||
10 | * comment itself) when converting this source file into one | ||
11 | * describing a real game. | ||
12 | */ | ||
13 | |||
14 | #include <stdio.h> | ||
15 | #include <stdlib.h> | ||
16 | #include <string.h> | ||
17 | #include <assert.h> | ||
18 | #include <ctype.h> | ||
19 | #ifdef NO_TGMATH_H | ||
20 | # include <math.h> | ||
21 | #else | ||
22 | # include <tgmath.h> | ||
23 | #endif | ||
24 | |||
25 | #include "puzzles.h" | ||
26 | |||
27 | enum { | ||
28 | COL_BACKGROUND, | ||
29 | NCOLOURS | ||
30 | }; | ||
31 | |||
32 | struct game_params { | ||
33 | int FIXME; | ||
34 | }; | ||
35 | |||
36 | struct game_state { | ||
37 | int FIXME; | ||
38 | }; | ||
39 | |||
40 | static game_params *default_params(void) | ||
41 | { | ||
42 | game_params *ret = snew(game_params); | ||
43 | |||
44 | ret->FIXME = 0; | ||
45 | |||
46 | return ret; | ||
47 | } | ||
48 | |||
49 | static bool game_fetch_preset(int i, char **name, game_params **params) | ||
50 | { | ||
51 | return false; | ||
52 | } | ||
53 | |||
54 | static void free_params(game_params *params) | ||
55 | { | ||
56 | sfree(params); | ||
57 | } | ||
58 | |||
59 | static game_params *dup_params(const game_params *params) | ||
60 | { | ||
61 | game_params *ret = snew(game_params); | ||
62 | *ret = *params; /* structure copy */ | ||
63 | return ret; | ||
64 | } | ||
65 | |||
66 | static void decode_params(game_params *params, char const *string) | ||
67 | { | ||
68 | } | ||
69 | |||
70 | static char *encode_params(const game_params *params, bool full) | ||
71 | { | ||
72 | return dupstr("FIXME"); | ||
73 | } | ||
74 | |||
75 | static const char *validate_params(const game_params *params, bool full) | ||
76 | { | ||
77 | return NULL; | ||
78 | } | ||
79 | |||
80 | static char *new_game_desc(const game_params *params, random_state *rs, | ||
81 | char **aux, bool interactive) | ||
82 | { | ||
83 | return dupstr("FIXME"); | ||
84 | } | ||
85 | |||
86 | static const char *validate_desc(const game_params *params, const char *desc) | ||
87 | { | ||
88 | return NULL; | ||
89 | } | ||
90 | |||
91 | static game_state *new_game(midend *me, const game_params *params, | ||
92 | const char *desc) | ||
93 | { | ||
94 | game_state *state = snew(game_state); | ||
95 | |||
96 | state->FIXME = 0; | ||
97 | |||
98 | return state; | ||
99 | } | ||
100 | |||
101 | static game_state *dup_game(const game_state *state) | ||
102 | { | ||
103 | game_state *ret = snew(game_state); | ||
104 | |||
105 | ret->FIXME = state->FIXME; | ||
106 | |||
107 | return ret; | ||
108 | } | ||
109 | |||
110 | static void free_game(game_state *state) | ||
111 | { | ||
112 | sfree(state); | ||
113 | } | ||
114 | |||
115 | static game_ui *new_ui(const game_state *state) | ||
116 | { | ||
117 | return NULL; | ||
118 | } | ||
119 | |||
120 | static void free_ui(game_ui *ui) | ||
121 | { | ||
122 | } | ||
123 | |||
124 | static void game_changed_state(game_ui *ui, const game_state *oldstate, | ||
125 | const game_state *newstate) | ||
126 | { | ||
127 | } | ||
128 | |||
129 | struct game_drawstate { | ||
130 | int tilesize; | ||
131 | int FIXME; | ||
132 | }; | ||
133 | |||
134 | static char *interpret_move(const game_state *state, game_ui *ui, | ||
135 | const game_drawstate *ds, | ||
136 | int x, int y, int button) | ||
137 | { | ||
138 | return NULL; | ||
139 | } | ||
140 | |||
141 | static game_state *execute_move(const game_state *state, const char *move) | ||
142 | { | ||
143 | return NULL; | ||
144 | } | ||
145 | |||
146 | /* ---------------------------------------------------------------------- | ||
147 | * Drawing routines. | ||
148 | */ | ||
149 | |||
150 | static void game_compute_size(const game_params *params, int tilesize, | ||
151 | const game_ui *ui, int *x, int *y) | ||
152 | { | ||
153 | *x = *y = 10 * tilesize; /* FIXME */ | ||
154 | } | ||
155 | |||
156 | static void game_set_size(drawing *dr, game_drawstate *ds, | ||
157 | const game_params *params, int tilesize) | ||
158 | { | ||
159 | ds->tilesize = tilesize; | ||
160 | } | ||
161 | |||
162 | static float *game_colours(frontend *fe, int *ncolours) | ||
163 | { | ||
164 | float *ret = snewn(3 * NCOLOURS, float); | ||
165 | |||
166 | frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]); | ||
167 | |||
168 | *ncolours = NCOLOURS; | ||
169 | return ret; | ||
170 | } | ||
171 | |||
172 | static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state) | ||
173 | { | ||
174 | struct game_drawstate *ds = snew(struct game_drawstate); | ||
175 | |||
176 | ds->tilesize = 0; | ||
177 | ds->FIXME = 0; | ||
178 | |||
179 | return ds; | ||
180 | } | ||
181 | |||
182 | static void game_free_drawstate(drawing *dr, game_drawstate *ds) | ||
183 | { | ||
184 | sfree(ds); | ||
185 | } | ||
186 | |||
187 | static void game_redraw(drawing *dr, game_drawstate *ds, | ||
188 | const game_state *oldstate, const game_state *state, | ||
189 | int dir, const game_ui *ui, | ||
190 | float animtime, float flashtime) | ||
191 | { | ||
192 | } | ||
193 | |||
194 | static float game_anim_length(const game_state *oldstate, | ||
195 | const game_state *newstate, int dir, game_ui *ui) | ||
196 | { | ||
197 | return 0.0F; | ||
198 | } | ||
199 | |||
200 | static float game_flash_length(const game_state *oldstate, | ||
201 | const game_state *newstate, int dir, game_ui *ui) | ||
202 | { | ||
203 | return 0.0F; | ||
204 | } | ||
205 | |||
206 | static void game_get_cursor_location(const game_ui *ui, | ||
207 | const game_drawstate *ds, | ||
208 | const game_state *state, | ||
209 | const game_params *params, | ||
210 | int *x, int *y, int *w, int *h) | ||
211 | { | ||
212 | } | ||
213 | |||
214 | static int game_status(const game_state *state) | ||
215 | { | ||
216 | return 0; | ||
217 | } | ||
218 | |||
219 | #ifdef COMBINED | ||
220 | #define thegame nullgame | ||
221 | #endif | ||
222 | |||
223 | const struct game thegame = { | ||
224 | "Null Game", NULL, NULL, | ||
225 | default_params, | ||
226 | game_fetch_preset, NULL, | ||
227 | decode_params, | ||
228 | encode_params, | ||
229 | free_params, | ||
230 | dup_params, | ||
231 | false, NULL, NULL, /* configure, custom_params */ | ||
232 | validate_params, | ||
233 | new_game_desc, | ||
234 | validate_desc, | ||
235 | new_game, | ||
236 | dup_game, | ||
237 | free_game, | ||
238 | false, NULL, /* solve */ | ||
239 | false, NULL, NULL, /* can_format_as_text_now, text_format */ | ||
240 | NULL, NULL, /* get_prefs, set_prefs */ | ||
241 | new_ui, | ||
242 | free_ui, | ||
243 | NULL, /* encode_ui */ | ||
244 | NULL, /* decode_ui */ | ||
245 | NULL, /* game_request_keys */ | ||
246 | game_changed_state, | ||
247 | NULL, /* current_key_label */ | ||
248 | interpret_move, | ||
249 | execute_move, | ||
250 | 20 /* FIXME */, game_compute_size, game_set_size, | ||
251 | game_colours, | ||
252 | game_new_drawstate, | ||
253 | game_free_drawstate, | ||
254 | game_redraw, | ||
255 | game_anim_length, | ||
256 | game_flash_length, | ||
257 | game_get_cursor_location, | ||
258 | game_status, | ||
259 | false, false, NULL, NULL, /* print_size, print */ | ||
260 | false, /* wants_statusbar */ | ||
261 | false, NULL, /* timing_state */ | ||
262 | 0, /* flags */ | ||
263 | }; | ||