diff options
| author | Garrett Cox <garrettjcox@gmail.com> | 2024-11-03 14:26:39 -0600 |
|---|---|---|
| committer | Garrett Cox <garrettjcox@gmail.com> | 2024-11-03 14:26:39 -0600 |
| commit | 7fa63244e4d2f1dbfab9babeb9ddd670f57fbc60 (patch) | |
| tree | 7bb4b4be25b8c8a12e7b74a9e68487fcec87a16c /mm/src/code/z_parameter.c | |
| parent | 0e4a2e9fc8ca15a046c81a460b9716028f6dece6 (diff) | |
PoC glitchless playthrough implementation
Diffstat (limited to 'mm/src/code/z_parameter.c')
| -rw-r--r-- | mm/src/code/z_parameter.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/src/code/z_parameter.c b/mm/src/code/z_parameter.c index 13c5e2901..dc6a46866 100644 --- a/mm/src/code/z_parameter.c +++ b/mm/src/code/z_parameter.c @@ -3551,7 +3551,6 @@ s16 sRupeeRefillCounts[] = { 1, 5, 10, 20, 50, 100, 200 }; // 2S2H [Enhancements] This was originally Item_Give, we wrapped it for hooking purposes u8 Item_GiveImpl(PlayState* play, u8 item) { - Player* player = GET_PLAYER(play); u8 i; u8 temp; u8 slot; @@ -3605,7 +3604,11 @@ u8 Item_GiveImpl(PlayState* play, u8 item) { } else if ((item >= ITEM_SHIELD_HERO) && (item <= ITEM_SHIELD_MIRROR)) { if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) != (u16)(item - ITEM_SHIELD_HERO + EQUIP_VALUE_SHIELD_HERO)) { SET_EQUIP_VALUE(EQUIP_TYPE_SHIELD, item - ITEM_SHIELD_HERO + EQUIP_VALUE_SHIELD_HERO); - Player_SetEquipmentData(play, player); + // 2S2H [Randomizer] Added a nullptr check so that we can call this function outside of gameplay for logic + if (gPlayState != NULL) { + Player* player = GET_PLAYER(play); + Player_SetEquipmentData(play, player); + } return ITEM_NONE; } return item; |
