Fixes chests by allowing for negative getItemIds

This commit is contained in:
Christopher Leggett 2022-08-16 20:28:24 -04:00
parent 1ef08a7325
commit 3bc67ef1eb
No known key found for this signature in database
GPG Key ID: 7093AE5FF7037D79
2 changed files with 9 additions and 10 deletions

View File

@ -19,7 +19,7 @@ typedef struct {
/* 0x03 */ uint16_t textId;
/* 0x04 */ uint16_t objectId;
/* 0x06 */ uint16_t modIndex; // 0 = Vanilla, 1 = Randomizer, future mods will increment up?
/* 0x08 */ uint16_t getItemId;
/* 0x08 */ int16_t getItemId;
/* 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

View File

@ -4530,11 +4530,12 @@ void func_8083A434(GlobalContext* globalCtx, Player* this) {
if (this->getItemId == GI_HEART_CONTAINER_2) {
this->unk_850 = 20;
}
else if (this->getItemId >= 0) {
else if (this->getItemId >= 0 || this->getItemEntry.getItemId >= 0) {
this->unk_850 = 1;
}
else {
this->getItemId = -this->getItemId;
this->getItemEntry.getItemId = -this->getItemEntry.getItemId;
}
}
@ -6064,7 +6065,7 @@ void func_8083E4C4(GlobalContext* globalCtx, Player* this, GetItemEntry* giEntry
Item_Give(globalCtx, giEntry->itemId);
}
func_80078884((this->getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM);
func_80078884((this->getItemId < 0 || this->getItemEntry.getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM);
}
// Sets a flag according to which type of flag is specified in player->pendingFlag.flagType
@ -9685,14 +9686,12 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) {
else if ((!(this->stateFlags1 & PLAYER_STATE1_11) || (heldActor == NULL)) &&
(interactRangeActor != NULL) &&
((!sp1C && (this->getItemId == GI_NONE)) ||
((this->getItemId < 0) && !(this->stateFlags1 & PLAYER_STATE1_27)))) {
if (this->getItemId < 0) {
((this->getItemId < 0 || this->getItemEntry.getItemId < 0) && !(this->stateFlags1 & PLAYER_STATE1_27)))) {
if (this->getItemId < 0 || this->getItemEntry.getItemId < 0) {
doAction = DO_ACTION_OPEN;
}
else if ((interactRangeActor->id == ACTOR_BG_TOKI_SWD) && LINK_IS_ADULT) {
} else if ((interactRangeActor->id == ACTOR_BG_TOKI_SWD) && LINK_IS_ADULT) {
doAction = DO_ACTION_DROP;
}
else {
} else {
doAction = DO_ACTION_GRAB;
}
}
@ -9744,7 +9743,7 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) {
}
}
else if (!(this->stateFlags1 & PLAYER_STATE1_27) && func_8083A0D4(this) &&
(this->getItemId < GI_MAX)) {
((!gSaveContext.n64ddFlag && this->getItemId < GI_MAX) || (gSaveContext.n64ddFlag && this->getItemEntry.getItemId < RG_MAX))) {
doAction = DO_ACTION_GRAB;
}
else if (this->stateFlags2 & PLAYER_STATE2_11) {