1 /* 2000-04-19T13:26:05Z
3 * construct some tables to be included directly in emerald mine source.
4 * i made this because dynamically building the tables every time sucks and i
5 * need to be able to easily modify tile definitions.
7 * this is key data which almost everything depends on.
9 * this is supposed to be fairly easy to read and modify. the tab values
10 * are still hard coded constants but that should be less of a problem to
17 /* ------------------------------------------------------------------------- */
61 /* 0=stop 1=fake_acid */
62 int tile_fake_acid[] =
92 int tile_android_move[] =
110 /* ------------------------------------------------------------------------- */
112 /* explosions: special format */
113 /* everything is initially filled with Xboom_1 */
166 TILE_MAX, /* up till here are indestructable */
177 Xbomb_pause, Xboom_bomb,
178 Xbomb_fall, Xboom_bomb,
179 TILE_MAX, /* up till here are special explosions */
181 Xandroid, Xboom_android,
182 Xandroid_1_n, Xboom_android,
183 Xandroid_2_n, Xboom_android,
184 Xandroid_1_e, Xboom_android,
185 Xandroid_2_e, Xboom_android,
186 Xandroid_1_s, Xboom_android,
187 Xandroid_2_s, Xboom_android,
188 Xandroid_1_w, Xboom_android,
189 Xandroid_2_w, Xboom_android,
190 TILE_MAX /* up until here are dynamite explosions */
194 /* ------------------------------------------------------------------------- */
198 unsigned char tab_blank[TILE_MAX];
201 unsigned char tab_acid[TILE_MAX];
203 /* 0=stop 1=fake_acid */
204 unsigned char tab_fake_acid[TILE_MAX];
206 /* 0=stop 1=amoeba */
207 unsigned char tab_amoeba[TILE_MAX];
210 unsigned char tab_android_move[TILE_MAX];
212 /* normal explosion */
213 unsigned short tab_explode_normal[TILE_MAX];
215 /* dynamite explosion */
216 unsigned short tab_explode_dynamite[TILE_MAX];
218 static void create_tab(int *invert, unsigned char *array)
221 int buffer[TILE_MAX];
223 for (i = 0; i < TILE_MAX; i++)
226 for (;invert[0] < TILE_MAX; invert += 2)
227 buffer[invert[0]] = invert[1];
229 for (i = 0; i < TILE_MAX; i++)
230 array[i] = buffer[i];
233 static void create_explode(void)
236 int *tile = tile_explode;
237 int buffer[TILE_MAX];
239 for (i = 0; i < TILE_MAX; i++)
241 while ((i = *tile++) < TILE_MAX)
242 buffer[i] = i; /* these tiles are indestructable */
243 while ((i = *tile++) < TILE_MAX)
244 buffer[i] = *tile++; /* these tiles are special */
246 for (i = 0; i < TILE_MAX; i++)
247 tab_explode_normal[i] = buffer[i];
249 while ((i = *tile++) < TILE_MAX)
250 buffer[i] = *tile++; /* these tiles for dynamite */
252 for (i = 0; i < TILE_MAX; i++)
253 tab_explode_dynamite[i] = buffer[i];
256 void tab_generate(void)
258 create_tab(tile_blank, tab_blank);
259 create_tab(tile_acid, tab_acid);
260 create_tab(tile_fake_acid, tab_fake_acid);
261 create_tab(tile_amoeba, tab_amoeba);
262 create_tab(tile_android_move, tab_android_move);