Add a `jumble' key (`J') to Net, which scrambles the positions of all unlocked
[sgt/puzzles] / nullgame.c
CommitLineData
699b896a 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>
b0e26073 18#include <ctype.h>
699b896a 19#include <math.h>
20
21#include "puzzles.h"
22
23const char *const game_name = "Null Game";
e91825f8 24const char *const game_winhelp_topic = NULL;
c8230524 25const int game_can_configure = FALSE;
699b896a 26
27enum {
28 COL_BACKGROUND,
29 NCOLOURS
30};
31
32struct game_params {
33 int FIXME;
34};
35
36struct game_state {
37 int FIXME;
38};
39
40game_params *default_params(void)
41{
42 game_params *ret = snew(game_params);
43
44 ret->FIXME = 0;
45
46 return ret;
47}
48
49int game_fetch_preset(int i, char **name, game_params **params)
50{
51 return FALSE;
52}
53
54void free_params(game_params *params)
55{
56 sfree(params);
57}
58
59game_params *dup_params(game_params *params)
60{
61 game_params *ret = snew(game_params);
62 *ret = *params; /* structure copy */
63 return ret;
64}
65
b0e26073 66game_params *decode_params(char const *string)
67{
68 game_params *ret = snew(game_params);
69
70 ret->FIXME = 0;
71
72 return ret;
73}
74
75char *encode_params(game_params *params)
76{
77 return dupstr("FIXME");
78}
79
c8230524 80config_item *game_configure(game_params *params)
81{
82 return NULL;
83}
84
85game_params *custom_params(config_item *cfg)
86{
87 return NULL;
88}
89
90char *validate_params(game_params *params)
91{
92 return NULL;
93}
94
48d70ca9 95char *new_game_seed(game_params *params, random_state *rs)
699b896a 96{
97 return dupstr("FIXME");
98}
99
5928817c 100char *validate_seed(game_params *params, char *seed)
101{
102 return NULL;
103}
104
699b896a 105game_state *new_game(game_params *params, char *seed)
106{
107 game_state *state = snew(game_state);
108
109 state->FIXME = 0;
110
111 return state;
112}
113
114game_state *dup_game(game_state *state)
115{
116 game_state *ret = snew(game_state);
117
118 ret->FIXME = state->FIXME;
119
120 return ret;
121}
122
123void free_game(game_state *state)
124{
125 sfree(state);
126}
127
74a4e547 128game_ui *new_ui(game_state *state)
129{
130 return NULL;
131}
132
133void free_ui(game_ui *ui)
134{
135}
136
137game_state *make_move(game_state *from, game_ui *ui, int x, int y, int button)
699b896a 138{
139 return NULL;
140}
141
142/* ----------------------------------------------------------------------
143 * Drawing routines.
144 */
145
146struct game_drawstate {
147 int FIXME;
148};
149
150void game_size(game_params *params, int *x, int *y)
151{
152 *x = *y = 200; /* FIXME */
153}
154
155float *game_colours(frontend *fe, game_state *state, int *ncolours)
156{
157 float *ret = snewn(3 * NCOLOURS, float);
158
159 frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]);
160
161 *ncolours = NCOLOURS;
162 return ret;
163}
164
165game_drawstate *game_new_drawstate(game_state *state)
166{
167 struct game_drawstate *ds = snew(struct game_drawstate);
168
169 ds->FIXME = 0;
170
171 return ds;
172}
173
174void game_free_drawstate(game_drawstate *ds)
175{
176 sfree(ds);
177}
178
179void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
c822de4a 180 game_state *state, int dir, game_ui *ui,
74a4e547 181 float animtime, float flashtime)
699b896a 182{
1d30357e 183 /*
184 * The initial contents of the window are not guaranteed and
185 * can vary with front ends. To be on the safe side, all games
186 * should start by drawing a big background-colour rectangle
187 * covering the whole window.
188 */
189 draw_rect(fe, 0, 0, 200, 200, COL_BACKGROUND);
699b896a 190}
191
c822de4a 192float game_anim_length(game_state *oldstate, game_state *newstate, int dir)
699b896a 193{
194 return 0.0F;
195}
196
c822de4a 197float game_flash_length(game_state *oldstate, game_state *newstate, int dir)
699b896a 198{
199 return 0.0F;
200}
fd1a1a2b 201
202int game_wants_statusbar(void)
203{
204 return FALSE;
205}