-
Notifications
You must be signed in to change notification settings - Fork 491
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: Minimap dungeon entrance placement #2958
Fix: Minimap dungeon entrance placement #2958
Conversation
502fa34
to
0f6748b
Compare
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.
overall this looks great! thanks for fixing/cleaning this up!
left a few comments about places where adding a comment might help make the logic clearer, and one little question
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.
one last little question, this looks pretty much good to go!
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.
beautiful
This PR accomplishes a few goals around the minimap dungeon entrance icon:
The first issue I noticed when working on the Mirror World PR was that all the dungeon entrance icons (except for ice cavern) never appeared. Digging into it I found the issue is that the games data uses large negative values for the Y pos values here:
Shipwright/soh/src/code/z_map_data.c
Lines 227 to 229 in 7e1ee6e
In hardware this is fine as the game uses
gSPTextureRectangle
which truncates the number and only keeps 12 bits (U10.2). The issue is after we introduced and switched togSPWideTextureRectangle
the value was now only truncated at 24 bits, meaning the icon would now be placed off screen. Early cosmetic editor days shows that we were applying an arbitrary+ 1024
which pushed the authentic value back to a positive number in the range that it should have been, but after a later cosmetic editor change, this "fix" was running after all the checks and was effectively dead code.To address this I am reapplying this fix at the beginning of all the logic to bitwise AND with
0x3FF
to keep only the first 10 bits (and later will be shifted by 2 for the U10.2 value). I opted for the bitwise over the 1024 cause it felt more clear why it was happening.The second issue I noticed is that all the cosmetic margin/anchor logic was essentially broken for the icon, so I've refactored it following the pattern used for the minimap itself.
Other refactorings I did was merge duplicate code paths under a single branch and apply the
gAlwaysShowDungeonMinimapIcon
in the right spot (where the entrance flag is checked).The other fix I added was to display the correct minimap in randomizer:
Let me know if we want to reduce the scope of this PR
Build Artifacts