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> |
18 | #include <math.h> |
19 | |
20 | #include "puzzles.h" |
21 | |
22 | const char *const game_name = "Null Game"; |
c8230524 |
23 | const int game_can_configure = FALSE; |
699b896a |
24 | |
25 | enum { |
26 | COL_BACKGROUND, |
27 | NCOLOURS |
28 | }; |
29 | |
30 | struct game_params { |
31 | int FIXME; |
32 | }; |
33 | |
34 | struct game_state { |
35 | int FIXME; |
36 | }; |
37 | |
38 | game_params *default_params(void) |
39 | { |
40 | game_params *ret = snew(game_params); |
41 | |
42 | ret->FIXME = 0; |
43 | |
44 | return ret; |
45 | } |
46 | |
47 | int game_fetch_preset(int i, char **name, game_params **params) |
48 | { |
49 | return FALSE; |
50 | } |
51 | |
52 | void free_params(game_params *params) |
53 | { |
54 | sfree(params); |
55 | } |
56 | |
57 | game_params *dup_params(game_params *params) |
58 | { |
59 | game_params *ret = snew(game_params); |
60 | *ret = *params; /* structure copy */ |
61 | return ret; |
62 | } |
63 | |
c8230524 |
64 | config_item *game_configure(game_params *params) |
65 | { |
66 | return NULL; |
67 | } |
68 | |
69 | game_params *custom_params(config_item *cfg) |
70 | { |
71 | return NULL; |
72 | } |
73 | |
74 | char *validate_params(game_params *params) |
75 | { |
76 | return NULL; |
77 | } |
78 | |
48d70ca9 |
79 | char *new_game_seed(game_params *params, random_state *rs) |
699b896a |
80 | { |
81 | return dupstr("FIXME"); |
82 | } |
83 | |
5928817c |
84 | char *validate_seed(game_params *params, char *seed) |
85 | { |
86 | return NULL; |
87 | } |
88 | |
699b896a |
89 | game_state *new_game(game_params *params, char *seed) |
90 | { |
91 | game_state *state = snew(game_state); |
92 | |
93 | state->FIXME = 0; |
94 | |
95 | return state; |
96 | } |
97 | |
98 | game_state *dup_game(game_state *state) |
99 | { |
100 | game_state *ret = snew(game_state); |
101 | |
102 | ret->FIXME = state->FIXME; |
103 | |
104 | return ret; |
105 | } |
106 | |
107 | void free_game(game_state *state) |
108 | { |
109 | sfree(state); |
110 | } |
111 | |
112 | game_state *make_move(game_state *from, int x, int y, int button) |
113 | { |
114 | return NULL; |
115 | } |
116 | |
117 | /* ---------------------------------------------------------------------- |
118 | * Drawing routines. |
119 | */ |
120 | |
121 | struct game_drawstate { |
122 | int FIXME; |
123 | }; |
124 | |
125 | void game_size(game_params *params, int *x, int *y) |
126 | { |
127 | *x = *y = 200; /* FIXME */ |
128 | } |
129 | |
130 | float *game_colours(frontend *fe, game_state *state, int *ncolours) |
131 | { |
132 | float *ret = snewn(3 * NCOLOURS, float); |
133 | |
134 | frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]); |
135 | |
136 | *ncolours = NCOLOURS; |
137 | return ret; |
138 | } |
139 | |
140 | game_drawstate *game_new_drawstate(game_state *state) |
141 | { |
142 | struct game_drawstate *ds = snew(struct game_drawstate); |
143 | |
144 | ds->FIXME = 0; |
145 | |
146 | return ds; |
147 | } |
148 | |
149 | void game_free_drawstate(game_drawstate *ds) |
150 | { |
151 | sfree(ds); |
152 | } |
153 | |
154 | void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate, |
155 | game_state *state, float animtime, float flashtime) |
156 | { |
157 | } |
158 | |
159 | float game_anim_length(game_state *oldstate, game_state *newstate) |
160 | { |
161 | return 0.0F; |
162 | } |
163 | |
164 | float game_flash_length(game_state *oldstate, game_state *newstate) |
165 | { |
166 | return 0.0F; |
167 | } |
fd1a1a2b |
168 | |
169 | int game_wants_statusbar(void) |
170 | { |
171 | return FALSE; |
172 | } |