From dad51638250fae3bc26e67b671d5ce9721e1f7a5 Mon Sep 17 00:00:00 2001 From: MelonSpeedruns Date: Tue, 31 May 2022 21:10:19 -0400 Subject: [PATCH] LH sun check done --- soh/soh/Enhancements/randomizer.cpp | 6 ++++ .../ovl_Item_Etcetera/z_item_etcetera.c | 29 +++++++++++++++++-- .../overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 3 +- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/randomizer.cpp b/soh/soh/Enhancements/randomizer.cpp index 6b32c286d..046b272e7 100644 --- a/soh/soh/Enhancements/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer.cpp @@ -1242,6 +1242,8 @@ GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId) return GI_BOMBCHUS_5; case BOMBCHUS_20: return GI_BOMBCHUS_20; + case POCKET_EGG: + return GI_POCKET_EGG; case ICE_TRAP: return GI_ICE_TRAP; case PIECE_OF_HEART: @@ -2048,6 +2050,10 @@ RandomizerCheck Randomizer::GetCheckFromActor(s16 sceneNum, s16 actorId, s16 act return GANONS_TOWER_BOSS_KEY_CHEST; } case 87: + switch (actorId) { + case 271: + return LH_SUN; + } switch(actorParams) { case 7686: return LH_FREESTANDING_POH; diff --git a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index e66d38632..dd04fcbcb 100644 --- a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -125,7 +125,14 @@ void func_80B85824(ItemEtcetera* this, GlobalContext* globalCtx) { } Actor_Kill(&this->actor); } else { - func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f); + if (gSaveContext.n64ddFlag) { + s32 getItemId = GetRandomizedItemId(GI_ARROW_FIRE, this->actor.id, this->actor.params, globalCtx->sceneNum); + if (func_8002F434(&this->actor, globalCtx, getItemId, 30.0f, 50.0f)) { + Flags_SetTreasure(globalCtx, 0x1F); + } + } else { + func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f); + } } } @@ -138,7 +145,17 @@ void func_80B858B4(ItemEtcetera* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } else { if (0) {} // Necessary to match - func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f); + + if (gSaveContext.n64ddFlag) { + s32 getItemId = + GetRandomizedItemId(GI_ARROW_FIRE, this->actor.id, this->actor.params, globalCtx->sceneNum); + if (func_8002F434(&this->actor, globalCtx, getItemId, 30.0f, 50.0f)) { + Flags_SetTreasure(globalCtx, 0x1F); + } + } else { + func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f); + } + if ((globalCtx->gameplayFrames & 0xD) == 0) { EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f); } @@ -211,8 +228,14 @@ void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx) { void ItemEtcetera_Draw(Actor* thisx, GlobalContext* globalCtx) { ItemEtcetera* this = (ItemEtcetera*)thisx; + s32 type = this->actor.params & 0xFF; + + if (gSaveContext.n64ddFlag && type == ITEM_ETC_ARROW_FIRE) { + this->giDrawId = GetItemModelFromId( + GetRandomizedItemId(this->getItemId, this->actor.id, this->actor.params, globalCtx->sceneNum)); + } func_8002EBCC(&this->actor, globalCtx, 0); func_8002ED80(&this->actor, globalCtx, 0); GetItem_Draw(globalCtx, this->giDrawId); -} +} \ No newline at end of file diff --git a/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 5d3f27cc4..849559328 100644 --- a/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -162,7 +162,8 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) { if (this->collider.base.acFlags & AC_HIT) { func_80078884(NA_SE_SY_CORRECT_CHIME); osSyncPrintf(VT_FGCOL(CYAN) "SHOT_SUN HIT!!!!!!!\n" VT_RST); - if (INV_CONTENT(ITEM_ARROW_FIRE) == ITEM_NONE) { + if ((INV_CONTENT(ITEM_ARROW_FIRE) == ITEM_NONE && !gSaveContext.n64ddFlag) || + !Flags_GetTreasure(globalCtx, 0x1F)) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_ETCETERA, 700.0f, -800.0f, 7261.0f, 0, 0, 0, 7); globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gLakeHyliaFireArrowsCS); if (1) {}