Skip to content
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

Merged
merged 14 commits into from
Apr 7, 2024
Merged

Support for 1.9 maps #71

merged 14 commits into from
Apr 7, 2024

Conversation

ghassanpl
Copy link

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.

@baylej
Copy link
Owner

baylej commented Mar 13, 2023

Hi Ghassan,
Thanks for this PR, and sorry for the delay, I work on this project only a few days per year...
I will give you my input soon.
I fixed the build&test pipeline, so I rebased your work onto the latest commit on master.

Copy link
Owner

@baylej baylej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Documentation is missing.
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;
}
Copy link
Owner

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;
Copy link
Owner

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 */
}
Copy link
Owner

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 */
Copy link
Owner

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;
Copy link
Owner

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 */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to width, height

@baylej baylej force-pushed the master branch 12 times, most recently from cff450c to 3032fe4 Compare March 11, 2024 21:22
Ghassan and others added 13 commits March 26, 2024 14:02
…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
@baylej baylej merged commit 3d16ceb into baylej:master Apr 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants