… | |
… | |
313 | if (x > 0 && get_wall (map, x - 1, y)) connect |= 1; |
313 | if (x > 0 && get_wall (map, x - 1, y)) connect |= 1; |
314 | if (x < map->width - 1 && get_wall (map, x + 1, y)) connect |= 2; |
314 | if (x < map->width - 1 && get_wall (map, x + 1, y)) connect |= 2; |
315 | if (y > 0 && get_wall (map, x, y - 1)) connect |= 4; |
315 | if (y > 0 && get_wall (map, x, y - 1)) connect |= 4; |
316 | if (y < map->height - 1 && get_wall (map, x, y + 1)) connect |= 8; |
316 | if (y < map->height - 1 && get_wall (map, x, y + 1)) connect |= 8; |
317 | |
317 | |
318 | // one bit per dir, 1 left, 2 right, 4 up, 8 down |
|
|
319 | static const char *walltype[16] = { |
|
|
320 | "0", |
|
|
321 | "1_3", |
|
|
322 | "1_4", |
|
|
323 | "2_1_2", |
|
|
324 | "1_2", |
|
|
325 | "2_2_4", |
|
|
326 | "2_2_1", |
|
|
327 | "3_1", |
|
|
328 | "1_1", |
|
|
329 | "2_2_3", |
|
|
330 | "2_2_2", |
|
|
331 | "3_3", |
|
|
332 | "2_1_1", |
|
|
333 | "3_4", |
|
|
334 | "3_2", |
|
|
335 | "4" |
|
|
336 | }; |
|
|
337 | |
|
|
338 | strcat (archetype, walltype [connect]); |
318 | strcat (archetype, wall_suffix [connect]); |
339 | |
319 | |
340 | /* |
320 | /* |
341 | * Before anything, make sure the archetype does exist... |
321 | * Before anything, make sure the archetype does exist... |
342 | * If not, prolly an error... |
322 | * If not, prolly an error... |
343 | */ |
323 | */ |