- int i;
- char *path;
- const char *str;
- struct ts_node *node;
- struct tile *tile;
-
- node = tsn->child_list;
- while(node) {
- if(strcmp(node->name, "tile") == 0) {
- if(!(tile = calloc(1, sizeof *tile))) {
- fprintf(stderr, "failed to allocate tile\n");
- return -1;
- }
- if((str = ts_get_attr_str(node, "name", 0))) {
- tile->name = strdup(str);
- }
- if((str = ts_get_attr_str(node, "type", 0))) {
- for(i=0; tile_types[i]; i++) {
- if(strcmp(str, tile_types[i]) == 0) {
- tile->type = i;
- break;
- }
- }
- }
- if((str = ts_get_attr_str(node, "scene", 0))) {
- if(lvl->dirname) {
- path = alloca(strlen(lvl->dirname) + strlen(str) + 2);
- combine_path(lvl->dirname, str, path);
- } else {
- path = (char*)str;
- }
- load_scenefile(&tile->scn, path);
- }
+static int detect_cell_tile(struct level *lvl, int x, int y, int *rot)
+{
+ int i, j, bit;
+ unsigned int adj = 0;