Fix magicFillTarget getting lowered if dying during refill#2577
Open
djevangelia wants to merge 4 commits into
Open
Fix magicFillTarget getting lowered if dying during refill#2577djevangelia wants to merge 4 commits into
djevangelia wants to merge 4 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Don't change
magicFillTargetif player dies during magic fill. Fixes #1618.When player dies, the magic fill target when respawning is set to current magic, and current magic is then set to 0. If player respawns and dies before magic is fully refilled, the fill target will be changed to player's current magic again, i.e. less than previous target.
This fix checks on game over if player is currently in a refill state: either
FILLstate, drawing the magic bar extending (STEP_CAPACITY), or has amagicLevelof 0 (set when dying, reset early when starting magic refill). If so, it does not overwrite the old fill target.The assembly should roughly be equal to:
where the
gSaveContext.magicFillTargetwas previously always set.Disassembly
Part of matching Kaleidoscope_Update disassembly here (it's 2500+ lines long in full)
Decomp C code here
Testing
Tested in Ares recently nightly build and Project64 3.0.1.
Looks like this: https://www.youtube.com/watch?v=s4WrGXN75-E
Instant death function for testing: