-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for 1.9 maps #71
Conversation
Hi Ghassan, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent contribution, thanks for following the style.
I need to check a few things, I'll do my best to merge it soon.
src/tmx_err.c
Outdated
|
||
void tmx_set_err(tmx_error_codes err) { | ||
tmx_errno = err; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is unnecessary, a watch on the global can be used instead of adding a function to put a single breakpoint.
src/tmx.h
Outdated
@@ -219,7 +225,7 @@ struct _tmx_layer { /* <layer> or <imagelayer> or <objectgroup> */ | |||
union layer_content { | |||
uint32_t *gids; | |||
tmx_object_group *objgr; | |||
tmx_image *image; | |||
tmx_image_layer *image_layer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change breaks the API!
src/tmx_utils.c
Outdated
@@ -312,6 +312,9 @@ void map_post_parsing(tmx_map **map) { | |||
*map = NULL; | |||
} | |||
} | |||
if (*map) { | |||
/* TODO: Resolve object property references to tmx_object pointers */ | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to look into this.
src/tmx.h
Outdated
typedef union { | ||
int integer, boolean, id; /* type = int or bool or object */ | ||
float decimal; /* type = float */ | ||
char *string, *file; /* default and type = string or file */ | ||
uint32_t color; /* type = color, bytes : ARGB */ | ||
tmx_custom_property custom; /* type = custom */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to further review this change:
- how this new class thing works
- new union member doe snot have the same the size as the other members
src/tmx.h
Outdated
unsigned int ul_x, ul_y; /* upper-left coordinate of this tile */ | ||
unsigned int tw, th; /* the width and height of this tile inside the source image */ | ||
|
||
double probability; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The probability of a tile is only to be used by the Terrain tool, it is unlikely to have a use case game side.
src/tmx.h
Outdated
unsigned int ul_x, ul_y; /* upper-left coordinate of this tile */ | ||
unsigned int tw, th; /* the width and height of this tile inside the source image */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to width, height
cff450c
to
3032fe4
Compare
…o just object IDs, in future may change this to pointers to tmx_object)
…f `tmx_image* image` due to 1.8 adding repeatx and repeaty attributes to the image layer, which are independent from the image stored; tmx_image_layer just stores the `image` and the repeatx/repeaty for now * setting tmx_errno now happens in a function, for ease of debugging * fixed a bug where empty group layers would crash the parser
…not loaded from the project, but their values in maps are parsed correctly and acessible (PT_CUSTOM type, ->value.custom stores value)
…storing as `type` field for backwards compatibility) * added 1.9 "class" attribute support to maps, tilesets and layers (stored as `class_name` field)
* tile probabilities are now loaded as well * 1.9 tile image subrects are now loaded properly
I've added support for a lot of the 1.2-1.9 features missing from the master branch. They were tested (probably not perfectly) but not documented. Any feedback would be appreciated.