From f874d83432562dab085ab2a9c64925eaec8a2874 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Mon, 15 Aug 2022 22:59:42 -0500 Subject: [PATCH] Add a few missing cases --- soh/src/code/z_en_item00.c | 7 ++++++- soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c | 9 +++++++-- soh/src/overlays/actors/ovl_En_Go2/z_en_go2.h | 1 + soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c | 14 +++++++++----- soh/src/overlays/actors/ovl_En_Hy/z_en_hy.h | 1 + soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c | 7 ++++++- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/soh/src/code/z_en_item00.c b/soh/src/code/z_en_item00.c index 6713a537d5..478ce891e0 100644 --- a/soh/src/code/z_en_item00.c +++ b/soh/src/code/z_en_item00.c @@ -671,10 +671,15 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); + GetItemEntry getItemEntry = Randomizer_GetRandomizedItem(this->getItemId, this->actor.id, this->ogParams, globalCtx->sceneNum); if (this->getItemId != GI_NONE) { if (!Actor_HasParent(&this->actor, globalCtx)) { - func_8002F434(&this->actor, globalCtx, this->getItemId, 50.0f, 80.0f); + if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) { + func_8002F434(&this->actor, globalCtx, getItemEntry.getItemId, 50.0f, 80.0f); + } else { + GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 50.0f, 80.0f); + } this->unk_15A++; } else { this->getItemId = GI_NONE; diff --git a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c index a3b10dc302..c9b97c8a9e 100644 --- a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -288,6 +288,7 @@ void EnGo2_GetItem(EnGo2* this, GlobalContext* globalCtx, s32 getItemId) { void EnGo2_GetItemEntry(EnGo2* this, GlobalContext* globalCtx, GetItemEntry getItemEntry) { this->getItemId = getItemEntry.getItemId; + this->getItemEntry = getItemEntry; GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } @@ -1572,6 +1573,7 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_216 = this->actor.shape.rot.z; this->unk_26E = 1; this->path = Path_GetByIndex(globalCtx, (this->actor.params & 0x3E0) >> 5, 0x1F); + this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; switch (this->actor.params & 0x1F) { case GORON_CITY_ENTRANCE: case GORON_CITY_ISLAND: @@ -1811,8 +1813,11 @@ void EnGo2_SetupGetItem(EnGo2* this, GlobalContext* globalCtx) { this->actor.parent = NULL; this->actionFunc = EnGo2_SetGetItem; } else { - func_8002F434(&this->actor, globalCtx, this->getItemId, this->actor.xzDistToPlayer + 1.0f, - fabsf(this->actor.yDistToPlayer) + 1.0f); + if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) { + func_8002F434(&this->actor, globalCtx, this->getItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); + } else { + GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); + } } } diff --git a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.h index d31eb76787..1618005f9b 100644 --- a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -104,6 +104,7 @@ typedef struct EnGo2 { /* 0x0598 */ char unk_598[0x02]; /* 0x059A */ s16 camId; /* 0x059C */ s16 unk_59C; + /* */ GetItemEntry getItemEntry; } EnGo2; // size = 0x05A0 #endif diff --git a/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 9f49b12b2a..5c2340ce7f 100644 --- a/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -665,10 +665,10 @@ s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) { if (!gSaveContext.n64ddFlag) { func_80A6F7CC(this, globalCtx, GI_HEART_PIECE); } else { - GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_LOST_DOG, GI_HEART_PIECE); + this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_LOST_DOG, GI_HEART_PIECE); // The follownig line and last arguments of GiveItemEntryFromActor are copied from func_80A6F7CC - this->unkGetItemId = getItemEntry.getItemId; - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); + this->unkGetItemId = this->getItemEntry.getItemId; + GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } } this->actionFunc = func_80A714C4; @@ -894,6 +894,7 @@ void EnHy_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } + this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; this->actionFunc = EnHy_InitImpl; } @@ -1061,8 +1062,11 @@ void func_80A714C4(EnHy* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actionFunc = func_80A71530; } else { - func_8002F434(&this->actor, globalCtx, this->unkGetItemId, this->actor.xzDistToPlayer + 1.0f, - fabsf(this->actor.yDistToPlayer) + 1.0f); + if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) { + func_8002F434(&this->actor, globalCtx, this->unkGetItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); + } else { + GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); + } } } diff --git a/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.h b/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.h index f7e66544da..253d8df7db 100644 --- a/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.h +++ b/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.h @@ -59,6 +59,7 @@ typedef struct EnHy { /* 0x0270 */ Vec3s jointTable[16]; /* 0x02D0 */ Vec3s morphTable[16]; /* 0x0330 */ u16 unk_330; + /* */ GetItemEntry getItemEntry; } EnHy; // size = 0x0334 #endif diff --git a/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 3b9cf80bd7..b7b964272c 100644 --- a/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -876,7 +876,12 @@ void func_80B15E80(EnTa* this, GlobalContext* globalCtx) { } else if (this->unk_2E0 & 2) { func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 50.0f); } else { - func_8002F434(&this->actor, globalCtx, GI_MILK_BOTTLE, 10000.0f, 50.0f); + if (!gSaveContext.n64ddFlag) { + func_8002F434(&this->actor, globalCtx, GI_MILK_BOTTLE, 10000.0f, 50.0f); + } else { + GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LLR_TALONS_CHICKENS, GI_MILK_BOTTLE); + GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); + } } this->unk_2E0 |= 1; }