Fix ice traps locking magic if casting#2556
Open
djevangelia wants to merge 3 commits into
Open
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.
Reset the magic state upon getting hit by something that freezes or electrifies. Fixes #752.
If
Player_Action_CastMagicSpellis interrupted (with a change in action function) beforemagicStateis changed from pre-consume stateMAGIC_STATE_METER_FLASH_2toMAGIC_STATE_CONSUME_SETUP, player is stuck in this magic pre-consume state which prevents using magic but also cannot continue to a consume state by itself.This is vanilla, but not noticed because it's difficult or maybe impossible to get interrupted. By sending an ice trap to another player who is casting, the player gets interrupted and may get stuck in this magic state. This is also true for eletric hit.
It is solved here by adding a function to call vanilla function
Magic_Resetupon receiving a frozen or eletric hit (underPlayer_SetupActionin https://github.com/djevangelia/oot/blob/oot-docu/src/overlays/actors/ovl_player_actor/z_player.c#L5135, lines 5164 and 5174). However, some extra notes:magicStateisMAGIC_STATE_METER_FLASH_1because if it is Nayru's love, player will now be able to cast during Nayru and crash.MAGIC_STATE_METER_FLASH_2because it's the problematic one here.magicStatechange on line 16208 is now in the end of 16231 for Farore.)player->actionFuncand thenplayer->av1.actionVar1for which spell andplayer->av2.actionVar2to find out where the player is in the casting sequence. For that you would need to do the check beforePlayer_SetupActionis called, however.Testing
Tested in Ares 1.47, Project64 3.0.1 and Mupen64plus 2.8. Calling same function as ice trap on button press (
z64_LinkDamage(&z64_game, &z64_link, 0x03, 0, 0, 0x14)).https://www.youtube.com/watch?v=jToBDh4jGis (ignore that the Farore's pointer flies away, it's because I'm using the debug menu)
Also tested getting electrified. Spin attack doesn't seem affected by this in the first place but seems to work too.