mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-12 12:18:32 -04:00
Fix problems with Zelda's Letter & Weird Egg hatching (#6962)
This commit is contained in:
@@ -1080,6 +1080,7 @@ bool Inventory_HasEmptyBottleSlot(void);
|
||||
s32 Inventory_HasSpecificBottle(u8 bottleItem);
|
||||
void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 cButton);
|
||||
s32 Inventory_ConsumeFairy(PlayState* play);
|
||||
bool Inventory_HatchWeirdEgg(PlayState* play);
|
||||
bool Inventory_HatchPocketCucco(PlayState* play);
|
||||
void Interface_SetDoAction(PlayState* play, u16 action);
|
||||
void Interface_SetNaviCall(PlayState* play, u16 naviCallState);
|
||||
|
||||
@@ -30,7 +30,6 @@ DEFINE_HOOK(OnSetDoAction, (uint16_t action));
|
||||
DEFINE_HOOK(OnPlayerSfx, (u16 sfxId));
|
||||
DEFINE_HOOK(OnOcarinaSongAction, ());
|
||||
DEFINE_HOOK(OnOcarinaNote, (uint8_t note, float modulator, int8_t bend));
|
||||
DEFINE_HOOK(OnCuccoOrChickenHatch, ());
|
||||
DEFINE_HOOK(OnShopSlotChange, (uint8_t cursorIndex, int16_t price));
|
||||
DEFINE_HOOK(OnDungeonKeyUsed, (uint16_t mapIndex));
|
||||
DEFINE_HOOK(ShouldActorInit, (void* actor, bool* result));
|
||||
|
||||
@@ -118,10 +118,6 @@ void GameInteractor_ExecuteOnOcarinaNote(uint8_t note, float modulator, int8_t b
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnOcarinaNote>(note, modulator, bend);
|
||||
}
|
||||
|
||||
void GameInteractor_ExecuteOnCuccoOrChickenHatch() {
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnCuccoOrChickenHatch>();
|
||||
}
|
||||
|
||||
void GameInteractor_ExecuteOnShopSlotChangeHooks(uint8_t cursorIndex, int16_t price) {
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnShopSlotChange>(cursorIndex, price);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ void GameInteractor_ExecuteOnSetDoAction(uint16_t action);
|
||||
void GameInteractor_ExecuteOnPlayerSfx(u16 sfxId);
|
||||
void GameInteractor_ExecuteOnOcarinaSongAction();
|
||||
void GameInteractor_ExecuteOnOcarinaNote(uint8_t note, float modulator, int8_t bend);
|
||||
void GameInteractor_ExecuteOnCuccoOrChickenHatch();
|
||||
bool GameInteractor_ShouldActorInit(void* actor);
|
||||
void GameInteractor_ExecuteOnActorInit(void* actor);
|
||||
void GameInteractor_ExecuteOnActorSpawn(void* actor);
|
||||
|
||||
@@ -297,11 +297,6 @@ void RandomizerOnFlagSetHandler(int16_t flagType, int16_t flag) {
|
||||
Flags_UnsetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_CHICKEN);
|
||||
}
|
||||
|
||||
if (flagType == FLAG_EVENT_CHECK_INF && flag == EVENTCHKINF_OBTAINED_ZELDAS_LETTER &&
|
||||
!RAND_GET_OPTION(RSK_SHUFFLE_ZELDAS_LETTER)) {
|
||||
Flags_SetRandomizerInf(RAND_INF_ZELDAS_LETTER);
|
||||
}
|
||||
|
||||
if (flagType == FLAG_EVENT_CHECK_INF && flag == EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) {
|
||||
if (Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_POCKET_EGG)) {
|
||||
Flags_SetRandomizerInf(RAND_INF_TALON_SENT_MALON_HOME);
|
||||
@@ -2913,13 +2908,6 @@ void RandomizerOnKaleidoscopeUpdateHandler(int16_t inDungeonScene) {
|
||||
prevKaleidoState = gPlayState->pauseCtx.state;
|
||||
}
|
||||
|
||||
void RandomizerOnCuccoOrChickenHatch() {
|
||||
if (LINK_IS_CHILD) {
|
||||
Flags_UnsetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_WEIRD_EGG);
|
||||
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_CHICKEN);
|
||||
}
|
||||
}
|
||||
|
||||
static void RandomizerRegisterHooks() {
|
||||
static uint32_t onFlagSetHook = 0;
|
||||
static uint32_t onSceneFlagSetHook = 0;
|
||||
@@ -2938,7 +2926,6 @@ static void RandomizerRegisterHooks() {
|
||||
static uint32_t onPlayDestroyHook = 0;
|
||||
static uint32_t onExitGameHook = 0;
|
||||
static uint32_t onKaleidoUpdateHook = 0;
|
||||
static uint32_t onCuccoOrChickenHatchHook = 0;
|
||||
|
||||
// register this outside OnLoadGame as VB is invoked before OnLoadGame
|
||||
COND_VB_SHOULD(VB_REVERT_SPOILING_ITEMS, true, {
|
||||
@@ -2971,7 +2958,6 @@ static void RandomizerRegisterHooks() {
|
||||
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnPlayDestroy>(onPlayDestroyHook);
|
||||
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnExitGame>(onExitGameHook);
|
||||
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnKaleidoscopeUpdate>(onKaleidoUpdateHook);
|
||||
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnCuccoOrChickenHatch>(onCuccoOrChickenHatchHook);
|
||||
|
||||
onFlagSetHook = 0;
|
||||
onSceneFlagSetHook = 0;
|
||||
@@ -2990,7 +2976,6 @@ static void RandomizerRegisterHooks() {
|
||||
onPlayDestroyHook = 0;
|
||||
onExitGameHook = 0;
|
||||
onKaleidoUpdateHook = 0;
|
||||
onCuccoOrChickenHatchHook = 0;
|
||||
|
||||
if (!IS_RANDO)
|
||||
return;
|
||||
@@ -3038,8 +3023,6 @@ static void RandomizerRegisterHooks() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnExitGame>(RandomizerOnExitGameHandler);
|
||||
onKaleidoUpdateHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnKaleidoscopeUpdate>(
|
||||
RandomizerOnKaleidoscopeUpdateHandler);
|
||||
onCuccoOrChickenHatchHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnCuccoOrChickenHatch>(
|
||||
RandomizerOnCuccoOrChickenHatch);
|
||||
|
||||
if (RAND_GET_OPTION(RSK_FISHSANITY).IsNot(RO_FISHSANITY_OFF)) {
|
||||
OTRGlobals::Instance->gRandoContext->GetFishsanity()->InitializeFromSave();
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/Enhancements/savestate_serialize.h"
|
||||
|
||||
typedef enum {
|
||||
@@ -2097,9 +2095,8 @@ void func_80075B44(PlayState* play) {
|
||||
gSaveContext.bgsDayCount++;
|
||||
gSaveContext.dogIsLost = true;
|
||||
Sfx_PlaySfxCentered(NA_SE_EV_CHICKEN_CRY_M);
|
||||
if ((Inventory_ReplaceItem(play, ITEM_WEIRD_EGG, ITEM_CHICKEN) || Inventory_HatchPocketCucco(play)) &&
|
||||
play->csCtx.state == 0 && !Player_InCsMode(play)) {
|
||||
GameInteractor_ExecuteOnCuccoOrChickenHatch();
|
||||
if ((Inventory_HatchWeirdEgg(play) || Inventory_HatchPocketCucco(play)) && play->csCtx.state == 0 &&
|
||||
!Player_InCsMode(play)) {
|
||||
Message_StartTextbox(play, 0x3066, NULL);
|
||||
}
|
||||
play->envCtx.unk_E0++;
|
||||
|
||||
@@ -2721,6 +2721,23 @@ s32 Inventory_ConsumeFairy(PlayState* play) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// SOH helper
|
||||
bool Inventory_HatchWeirdEgg(PlayState* play) {
|
||||
if (!IS_RANDO) {
|
||||
return Inventory_ReplaceItem(play, ITEM_WEIRD_EGG, ITEM_CHICKEN);
|
||||
}
|
||||
|
||||
if (!LINK_IS_CHILD || !Flags_GetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_WEIRD_EGG)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Flags_UnsetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_WEIRD_EGG);
|
||||
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_CHICKEN);
|
||||
Inventory_ReplaceItem(play, ITEM_WEIRD_EGG, ITEM_CHICKEN);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// SOH helper
|
||||
bool Inventory_HatchPocketCucco(PlayState* play) {
|
||||
if (!IS_RANDO) {
|
||||
return Inventory_ReplaceItem(play, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO);
|
||||
|
||||
@@ -500,8 +500,7 @@ void Play_Init(GameState* thisx) {
|
||||
gSaveContext.bgsDayCount++;
|
||||
gSaveContext.dogIsLost = true;
|
||||
|
||||
if (Inventory_ReplaceItem(play, ITEM_WEIRD_EGG, ITEM_CHICKEN) || Inventory_HatchPocketCucco(play)) {
|
||||
GameInteractor_ExecuteOnCuccoOrChickenHatch();
|
||||
if (Inventory_HatchWeirdEgg(play) || Inventory_HatchPocketCucco(play)) {
|
||||
Message_StartTextbox(play, 0x3066, NULL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user