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"; |
23 | |
24 | enum { |
25 | COL_BACKGROUND, |
26 | NCOLOURS |
27 | }; |
28 | |
29 | struct game_params { |
30 | int FIXME; |
31 | }; |
32 | |
33 | struct game_state { |
34 | int FIXME; |
35 | }; |
36 | |
37 | game_params *default_params(void) |
38 | { |
39 | game_params *ret = snew(game_params); |
40 | |
41 | ret->FIXME = 0; |
42 | |
43 | return ret; |
44 | } |
45 | |
46 | int game_fetch_preset(int i, char **name, game_params **params) |
47 | { |
48 | return FALSE; |
49 | } |
50 | |
51 | void free_params(game_params *params) |
52 | { |
53 | sfree(params); |
54 | } |
55 | |
56 | game_params *dup_params(game_params *params) |
57 | { |
58 | game_params *ret = snew(game_params); |
59 | *ret = *params; /* structure copy */ |
60 | return ret; |
61 | } |
62 | |
63 | char *new_game_seed(game_params *params) |
64 | { |
65 | return dupstr("FIXME"); |
66 | } |
67 | |
68 | game_state *new_game(game_params *params, char *seed) |
69 | { |
70 | game_state *state = snew(game_state); |
71 | |
72 | state->FIXME = 0; |
73 | |
74 | return state; |
75 | } |
76 | |
77 | game_state *dup_game(game_state *state) |
78 | { |
79 | game_state *ret = snew(game_state); |
80 | |
81 | ret->FIXME = state->FIXME; |
82 | |
83 | return ret; |
84 | } |
85 | |
86 | void free_game(game_state *state) |
87 | { |
88 | sfree(state); |
89 | } |
90 | |
91 | game_state *make_move(game_state *from, int x, int y, int button) |
92 | { |
93 | return NULL; |
94 | } |
95 | |
96 | /* ---------------------------------------------------------------------- |
97 | * Drawing routines. |
98 | */ |
99 | |
100 | struct game_drawstate { |
101 | int FIXME; |
102 | }; |
103 | |
104 | void game_size(game_params *params, int *x, int *y) |
105 | { |
106 | *x = *y = 200; /* FIXME */ |
107 | } |
108 | |
109 | float *game_colours(frontend *fe, game_state *state, int *ncolours) |
110 | { |
111 | float *ret = snewn(3 * NCOLOURS, float); |
112 | |
113 | frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]); |
114 | |
115 | *ncolours = NCOLOURS; |
116 | return ret; |
117 | } |
118 | |
119 | game_drawstate *game_new_drawstate(game_state *state) |
120 | { |
121 | struct game_drawstate *ds = snew(struct game_drawstate); |
122 | |
123 | ds->FIXME = 0; |
124 | |
125 | return ds; |
126 | } |
127 | |
128 | void game_free_drawstate(game_drawstate *ds) |
129 | { |
130 | sfree(ds); |
131 | } |
132 | |
133 | void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate, |
134 | game_state *state, float animtime, float flashtime) |
135 | { |
136 | } |
137 | |
138 | float game_anim_length(game_state *oldstate, game_state *newstate) |
139 | { |
140 | return 0.0F; |
141 | } |
142 | |
143 | float game_flash_length(game_state *oldstate, game_state *newstate) |
144 | { |
145 | return 0.0F; |
146 | } |