mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-26 01:58:51 -05:00
Makes freestanding items set player->getItemEntry.
This prevents freestanding items from setting the global modIndex. This is part of a larger transition that needs to happen to switch to setting getItemEntries for all of the rando items. This prevents some things that set getItemId of GI_MAX from granting a Fire Medallion when the global modIndex is MOD_RANDOMIZER.
This commit is contained in:
parent
f4a051fb90
commit
9c59624d64
@ -7,10 +7,10 @@
|
||||
#define CHEST_ANIM_LONG 1
|
||||
|
||||
#define GET_ITEM(itemId, objectId, drawId, textId, field, chestAnim, modIndex, getItemId) \
|
||||
{ itemId, field, (chestAnim != CHEST_ANIM_SHORT ? 1 : -1) * (drawId + 1), textId, objectId, modIndex, getItemId, drawId }
|
||||
{ itemId, field, (chestAnim != CHEST_ANIM_SHORT ? 1 : -1) * (drawId + 1), textId, objectId, modIndex, getItemId, drawId, true }
|
||||
|
||||
#define GET_ITEM_NONE \
|
||||
{ ITEM_NONE, 0, 0, 0, 0, 0, 0 }
|
||||
{ ITEM_NONE, 0, 0, 0, 0, 0, 0, 0, false }
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ uint16_t itemId;
|
||||
@ -20,5 +20,6 @@ typedef struct {
|
||||
/* 0x04 */ uint16_t objectId;
|
||||
/* 0x06 */ uint16_t modIndex; // 0 = Vanilla, 1 = Randomizer, future mods will increment up?
|
||||
/* 0x08 */ uint16_t getItemId;
|
||||
/* 0x10 */ uint16_t gid; // Stores the GID value unmodified for future reference.
|
||||
} GetItemEntry; // size = 0x10
|
||||
/* 0x0A */ uint16_t gid; // Stores the GID value unmodified for future reference.
|
||||
/* 0x0C */ uint16_t collectable; // determines whether the item can be collected on the overworld. Will be true in most cases.
|
||||
} GetItemEntry; // size = 0x0F
|
||||
|
@ -1610,7 +1610,8 @@ extern "C" CustomMessageEntry Randomizer_GetHintFromCheck(RandomizerCheck check)
|
||||
}
|
||||
|
||||
extern "C" GetItemEntry ItemTable_Retrieve(int16_t getItemID) {
|
||||
return ItemTableManager::Instance->RetrieveItemEntry(OTRGlobals::Instance->getItemModIndex, getItemID);
|
||||
GetItemEntry giEntry = ItemTableManager::Instance->RetrieveItemEntry(OTRGlobals::Instance->getItemModIndex, getItemID);
|
||||
return giEntry;
|
||||
}
|
||||
|
||||
extern "C" GetItemEntry ItemTable_RetrieveEntry(s16 tableID, s16 getItemID) {
|
||||
|
@ -335,6 +335,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
f32 yOffset = 980.0f;
|
||||
f32 shadowScale = 6.0f;
|
||||
s32 getItemId = GI_NONE;
|
||||
GetItemEntry getItem = (GetItemEntry)GET_ITEM_NONE;
|
||||
s16 spawnParam8000 = this->actor.params & 0x8000;
|
||||
s32 pad1;
|
||||
|
||||
@ -509,8 +510,9 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
if ((gSaveContext.n64ddFlag || getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) {
|
||||
getItemId = Randomizer_GetRandomizedItemId(getItemId, this->actor.id, this->ogParams, globalCtx->sceneNum);
|
||||
func_8002F554(&this->actor, globalCtx, getItemId);
|
||||
getItem = Randomizer_GetRandomizedItem(getItemId, this->actor.id, this->ogParams, globalCtx->sceneNum);
|
||||
func_8002F554(&this->actor, globalCtx, getItem.getItemId);
|
||||
GET_PLAYER(globalCtx)->getItemEntry = getItem;
|
||||
}
|
||||
|
||||
EnItem00_SetupAction(this, func_8001E5C8);
|
||||
@ -702,6 +704,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s16* params;
|
||||
Actor* dynaActor;
|
||||
s32 getItemId = GI_NONE;
|
||||
GetItemEntry getItem = (GetItemEntry)GET_ITEM_NONE;
|
||||
s16 sp3A = 0;
|
||||
s16 i;
|
||||
u32* temp;
|
||||
@ -881,9 +884,10 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) {
|
||||
if (gSaveContext.n64ddFlag) {
|
||||
getItemId = Randomizer_GetRandomizedItemId(getItemId, this->actor.id, this->ogParams, globalCtx->sceneNum);
|
||||
getItem = Randomizer_GetRandomizedItem(getItemId, this->actor.id, this->ogParams, globalCtx->sceneNum);
|
||||
GET_PLAYER(globalCtx)->getItemEntry = getItem;
|
||||
}
|
||||
func_8002F554(&this->actor, globalCtx, getItemId);
|
||||
func_8002F554(&this->actor, globalCtx, getItem.getItemId);
|
||||
}
|
||||
|
||||
switch (*params) {
|
||||
|
@ -6110,8 +6110,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) {
|
||||
} else {
|
||||
giEntry = this->getItemEntry;
|
||||
}
|
||||
if ((giEntry.modIndex == MOD_NONE && this->getItemId < GI_MAX) ||
|
||||
(giEntry.modIndex == MOD_RANDOMIZER && this->getItemId < RG_MAX)) {
|
||||
if (giEntry.collectable) {
|
||||
if ((interactedActor != &this->actor) && !iREG(67)) {
|
||||
interactedActor->parent = &this->actor;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user