Skip to content

Conversation

GriffinRichards
Copy link
Member

@GriffinRichards GriffinRichards commented Nov 24, 2024

At the moment, the 128th map in any map group will be treated as MAP_DYNAMIC because it's read using only MAP_NUM. Because MAP_DYNAMIC is in the middle of the map value range we can alleviate this problem a little by automatically increasing its value if there are sufficient maps in any map group. Although MAP_GROUP isn't used in isolation to read MAP_DYNAMIC, we can do the same if there are sufficient map groups just in case. MAP_UNDEFINED is read with MAP_GROUP in isolation, but it's already at the end of the value range.

Also added error messages to mapjson if the number of maps or map groups exceeds the value range (including the space reserved for MAP_DYNAMIC and MAP_UNDEFINED). Frustratingly the data type for map groups / map numbers is treated inconsistently and sometimes uses s8, so although these values are allowed to reach 255, there can be value range errors for values > 127. This problem is left unchanged by this PR. (Addressed, see comment below)

@GriffinRichards GriffinRichards deleted the branch pret:master May 27, 2025 14:53
@GriffinRichards GriffinRichards changed the base branch from porymap-6 to master May 27, 2025 15:02
@GriffinRichards
Copy link
Member Author

Updated to add a UBFIX that removes the cast for MAP_NUM/MAP_GROUP values from u8 to s8. Without this, if a map exceeds 127 on either value it will almost certainly softlock or crash the game on load when it's later cast to u16 to read gMapGroups

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.

1 participant