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

Fix metatile label saving #531

Merged
merged 4 commits into from
Dec 17, 2023

Conversation

GriffinRichards
Copy link
Collaborator

The old process for saving metatile labels goes like this:

  • Parse metatile_labels.h
  • Find and discard any existing defines for the tilesets being saved
  • Build and insert the new labels into the list of defines.
  • Regenerate metatile_labels.h, using a regex to determine which tileset each set of defines belongs to

We have a map of metatile labels from when metatile_labels.h was first parsed, so parsing it again is unnecessary. We also don't need to try and determine which tileset each belongs to when saving (we already know at this point). Now we just refresh this map with the defines for the tilesets being saved, then use this map to regenerate metatile_labels.h. This would discard any definitions that don't belong to an existing tileset, so we now save those separately (this has the added benefit of not printing // gTileset_Name comments in this file for non-existent tilesets). Closes #530

Note: Porymap (as before) does not prevent users from naming tilesets in a way that can cause metatile labels to collide (e.g. if we have gTileset_Foo and gTileset_Foo_Bar, the ownership of METATILE_Foo_Bar_Baz is ambiguous).

@GriffinRichards GriffinRichards merged commit 144b835 into huderlem:master Dec 17, 2023
3 checks passed
@GriffinRichards GriffinRichards deleted the fix-label-saving branch December 17, 2023 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: metatile label generation doesn't take into account full tileset name
1 participant