Skip to content

Conversation

GriffinRichards
Copy link
Member

  • Adds packing/unpacking macros for map data and metatile attribute data. There were 2 intentions here:
    • At the moment it's difficult to reassign bits on the right side of MAPGRID_METATILE_ID_MASK / METATILE_ATTR_BEHAVIOR_MASK because they have no shift value to update, and adding a shift value makes some simple code uglier. This adds a shift value for them and hides the extra complication behind the macros.
    • This should hopefully make it easier for someone downstream to utilize something like __builtin_clz to get rid of the explicitly-defined shifts altogether.
  • Adds MAPGRID_IMPASSABLE as an alias for MAPGRID_COLLISION_MASK when it's used to set impassability for a map space.
  • Adds a BUGFIX in decoration.c related to layer type usage (arguably not a bug, but a pitfall we have that would only be fixed by making the documentation worse)

@mrgriffin
Copy link
Collaborator

Great change! Just one comment, GetLayerType implicitly adds NUM_TILES_IN_PRIMARY because the decoration tiles are always in reference to the secondary tileset's tiles... But I think that fact might be too subtle in this code:

layerType = GetLayerType(decoration->tiles[(mapY - 1 - i) * mapX + j]);

My weakly-held opinion is that maybe the NUM_TILES_IN_PRIMARY + part could come back, or perhaps renaming decoration->tiles to something like decoration->secondaryTiles?

@mrgriffin mrgriffin merged commit 6f8a1bb into pret:master Jul 23, 2025
1 check passed
github-actions bot pushed a commit that referenced this pull request Jul 23, 2025
github-actions bot pushed a commit to GriffinRichards/pokeemerald that referenced this pull request Jul 25, 2025
ShinyDragonHunter pushed a commit to ShinyDragonHunter/pokeemerald that referenced this pull request Jul 31, 2025
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.

2 participants