diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index f90bc4350..a9e162742 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -1667,7 +1667,13 @@ extern "C" bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetIte return gSaveContext.n64ddFlag && Randomizer_GetItemIdFromKnownCheck(randomizerCheck, ogId) == GI_ICE_TRAP; } -extern "C" CustomMessageEntry Randomizer_GetCustomGetItemMessage(GetItemID giid, char* buffer, const int maxBufferSize) { +extern "C" CustomMessageEntry Randomizer_GetCustomGetItemMessage(Player* player) { + s16 giid; + if (player->getItemEntry.objectId != OBJECT_INVALID) { + giid = player->getItemEntry.getItemId; + } else { + giid = player->getItemId; + } const CustomMessageEntry getItemText = CustomMessageManager::Instance->RetrieveMessage(Randomizer::getItemMessageTableID, giid); return getItemText; } @@ -1682,7 +1688,7 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) { if (gSaveContext.n64ddFlag) { if (textId == TEXT_RANDOMIZER_CUSTOM_ITEM) { messageEntry = - Randomizer_GetCustomGetItemMessage((GetItemID)GET_PLAYER(globalCtx)->getItemId, buffer, maxBufferSize); + Randomizer_GetCustomGetItemMessage(GET_PLAYER(globalCtx)); } else if (textId == TEXT_RANDOMIZER_GOSSIP_STONE_HINTS && Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) != 0 && (Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) == 1 || (Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) == 2 && diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index f29d7dc97..d4e63eb79 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -108,6 +108,7 @@ bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, Get bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId); int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx); GetItemEntry ItemTable_Retrieve(int16_t getItemID); +GetItemEntry ItemTable_RetrieveEntry(s16 modIndex, s16 getItemId); #endif #endif diff --git a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c index b6c110581..b4ee8ec93 100644 --- a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -70,7 +70,7 @@ static InitChainEntry sInitChain[] = { }; static UNK_TYPE sUnused; -int32_t sItem; +GetItemEntry sItem; void EnBox_SetupAction(EnBox* this, EnBoxActionFunc actionFunc) { this->actionFunc = actionFunc; @@ -446,40 +446,42 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { func_8002DBD0(&this->dyna.actor, &sp4C, &player->actor.world.pos); if (sp4C.z > -50.0f && sp4C.z < 0.0f && fabsf(sp4C.y) < 10.0f && fabsf(sp4C.x) < 20.0f && Player_IsFacingActor(&this->dyna.actor, 0x3000, globalCtx)) { - sItem = Randomizer_GetRandomizedItemId(this->dyna.actor.params >> 5 & 0x7F, this->dyna.actor.id, this->dyna.actor.params, globalCtx->sceneNum); + sItem = Randomizer_GetRandomizedItem(this->dyna.actor.params >> 5 & 0x7F, this->dyna.actor.id, this->dyna.actor.params, globalCtx->sceneNum); + GetItemEntry blueRupeeEntry = ItemTable_RetrieveEntry(MOD_NONE, GI_RUPEE_BLUE); // RANDOTODO treasure chest game rando if (Randomizer_GetSettingValue(RSK_SHUFFLE_CHEST_MINIGAME)) { if (gSaveContext.n64ddFlag && globalCtx->sceneNum == 16 && (this->dyna.actor.params & 0x60) != 0x20) { if((this->dyna.actor.params & 0xF) < 2) { if(Flags_GetCollectible(globalCtx, 0x1B)) { - sItem = GI_RUPEE_BLUE; + sItem = blueRupeeEntry; } } if((this->dyna.actor.params & 0xF) >= 2 && (this->dyna.actor.params & 0xF) < 4) { if(Flags_GetCollectible(globalCtx, 0x1C)) { - sItem = GI_RUPEE_BLUE; + sItem = blueRupeeEntry; } } if((this->dyna.actor.params & 0xF) >= 4 && (this->dyna.actor.params & 0xF) < 6) { if(Flags_GetCollectible(globalCtx, 0x1D)) { - sItem = GI_RUPEE_BLUE; + sItem = blueRupeeEntry; } } if((this->dyna.actor.params & 0xF) >= 6 && (this->dyna.actor.params & 0xF) < 8) { if(Flags_GetCollectible(globalCtx, 0x1E)) { - sItem = GI_RUPEE_BLUE; + sItem = blueRupeeEntry; } } if((this->dyna.actor.params & 0xF) >= 8 && (this->dyna.actor.params & 0xF) < 10) { if(Flags_GetCollectible(globalCtx, 0x1F)) { - sItem = GI_RUPEE_BLUE; + sItem = blueRupeeEntry; } } } } - func_8002F554(&this->dyna.actor, globalCtx, 0 - sItem); + func_8002F554(&this->dyna.actor, globalCtx, 0 - sItem.getItemId); + player->getItemEntry = sItem; } if (Flags_GetTreasure(globalCtx, this->dyna.actor.params & 0x1F)) { EnBox_SetupAction(this, EnBox_Open); @@ -591,7 +593,7 @@ void EnBox_Update(Actor* thisx, GlobalContext* globalCtx) { } if (((!gSaveContext.n64ddFlag && ((this->dyna.actor.params >> 5 & 0x7F) == 0x7C)) || - (gSaveContext.n64ddFlag && sItem == GI_ICE_TRAP)) && + (gSaveContext.n64ddFlag && sItem.getItemId == RG_ICE_TRAP)) && this->actionFunc == EnBox_Open && this->skelanime.curFrame > 45 && this->iceSmokeTimer < 100) EnBox_SpawnIceSmoke(this, globalCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c index 75d518be7..f73107110 100644 --- a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -113,7 +113,7 @@ void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { } } player->getItemEntry = getItem; - player->getItemId = getItemId; + //player->getItemId = getItemId; } else { Item_Give(globalCtx, giveItemId); } @@ -160,7 +160,7 @@ void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) { Randomizer_Item_Give(globalCtx, getItem); } } - player->getItemId = getItemId; + //player->getItemId = getItemId; player->getItemEntry = getItem; } else { Item_Give(globalCtx, giveItemId);