diff options
author | P. J. McDermott <pjm@nac.net> | 2013-02-17 16:20:48 (EST) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-02-17 16:20:48 (EST) |
commit | e5b4399a3cdbb259236e6d98896abc706fc93c1d (patch) | |
tree | 2d60d2f0ce604b50006b5aded727fd91fe8063c7 | |
parent | b32bffdf8fc10db7875ce1bbf4fed2a23a160653 (diff) | |
download | overworld-rpg-e5b4399a3cdbb259236e6d98896abc706fc93c1d.zip overworld-rpg-e5b4399a3cdbb259236e6d98896abc706fc93c1d.tar.gz overworld-rpg-e5b4399a3cdbb259236e6d98896abc706fc93c1d.tar.bz2 |
Divide map exit dimensions by map tile dimensions.
-rw-r--r-- | src/main.c | 5 | ||||
-rw-r--r-- | src/resources/map.c | 4 |
2 files changed, 8 insertions, 1 deletions
@@ -22,7 +22,10 @@ main(void) debug("Tileset firstgid: %d", ts->firstgid); } for (e = map->map_exits_head; e != NULL; e = e->next) { - debug("Exit target: map %s (size %dx%d) at (%d,%d)", + debug("Exit target (size %dx%d) at (%d,%d) " + "to map %s (size %dx%d) at (%d,%d)", + e->width, e->height, + e->x, e->y, e->target_map_name, e->target_map->width, e->target_map->height, e->target_x_coord, e->target_y_coord); diff --git a/src/resources/map.c b/src/resources/map.c index 800a272..c1a33bf 100644 --- a/src/resources/map.c +++ b/src/resources/map.c @@ -615,6 +615,10 @@ tmx_objectgroup_el_start(void *pv, const char * name, const char **attr) xml_get_int_attr(p, attr, "y", &e->y, 1); xml_get_int_attr(p, attr, "width", &e->width, 1); xml_get_int_attr(p, attr, "height", &e->height, 1); + e->x /= m->tilewidth; + e->y /= m->tileheight; + e->width /= m->tilewidth; + e->height /= m->tileheight; xml_node_push(p, e, tmx_object_exit_el_start, tmx_object_exit_end, NULL); } else if (strcmp(type, "spawn") == 0) { |