From 7fa63244e4d2f1dbfab9babeb9ddd670f57fbc60 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Sun, 3 Nov 2024 14:26:39 -0600 Subject: PoC glitchless playthrough implementation --- mm/src/code/z_parameter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'mm/src/code/z_parameter.c') 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; -- cgit v1.2.3