fix medi goron not selling randomized item and continuously selling knifes (#2206)

This commit is contained in:
Adam Bird 2022-12-18 20:07:35 -05:00 committed by GitHub
parent c4b077d83b
commit 51f3e37010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,13 +93,13 @@ void EnGm_Destroy(Actor* thisx, PlayState* play) {
s32 func_80A3D7C8(void) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
return 0;
} else if (!(gBitFlags[2] & gSaveContext.inventory.equipment)) {
return 1;
} else if (gBitFlags[3] & gSaveContext.inventory.equipment) {
return 2;
} else if ((gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MERCHANTS) != RO_SHUFFLE_MERCHANTS_OFF) &&
(gBitFlags[2] & gSaveContext.inventory.equipment)) {
!Flags_GetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON)) {
return 1;
} else if (!(gBitFlags[2] & gSaveContext.inventory.equipment)) { // Don't have giant's knife
return 1;
} else if (gBitFlags[3] & gSaveContext.inventory.equipment) { // Have broken giant's knife
return 2;
} else {
return 3;
}
@ -256,7 +256,6 @@ void EnGm_ProcessChoiceIndex(EnGm* this, PlayState* play) {
GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_GC_MEDIGORON, GI_SWORD_KNIFE);
gSaveContext.pendingSale = itemEntry.itemId;
GiveItemEntryFromActor(&this->actor, play, itemEntry, 415.0f, 10.0f);
Flags_SetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON);
gSaveContext.infTable[11] |= 2;
this->actionFunc = func_80A3DF00;
} else {
@ -276,6 +275,11 @@ void EnGm_ProcessChoiceIndex(EnGm* this, PlayState* play) {
void func_80A3DF00(EnGm* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MERCHANTS) != RO_SHUFFLE_MERCHANTS_OFF &&
!Flags_GetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON)) {
Flags_SetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON);
}
this->actor.parent = NULL;
this->actionFunc = func_80A3DF60;
} else {
@ -284,14 +288,12 @@ void func_80A3DF00(EnGm* this, PlayState* play) {
GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_GC_MEDIGORON, GI_SWORD_KNIFE);
gSaveContext.pendingSale = itemEntry.itemId;
GiveItemEntryFromActor(&this->actor, play, itemEntry, 415.0f, 10.0f);
Flags_SetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON);
gSaveContext.infTable[11] |= 2;
}
else {
gSaveContext.pendingSale = ItemTable_Retrieve(GI_SWORD_KNIFE).itemId;
func_8002F434(&this->actor, play, GI_SWORD_KNIFE, 415.0f, 10.0f);
}
}
}