fix mido spawn for dungeon entrance rando (#2384)

This commit is contained in:
Adam Bird 2023-01-23 14:08:16 -05:00 committed by GitHub
parent 37f31116b3
commit cb5faa1ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 19 deletions

View File

@ -345,9 +345,9 @@ typedef enum {
#define EVENTCHKINF_02 0x02 #define EVENTCHKINF_02 0x02
#define EVENTCHKINF_03 0x03 #define EVENTCHKINF_03 0x03
#define EVENTCHKINF_04 0x04 #define EVENTCHKINF_SHOWED_MIDO_SWORD_SHIELD 0x04
#define EVENTCHKINF_05 0x05 #define EVENTCHKINF_05 0x05
#define EVENTCHKINF_07 0x07 #define EVENTCHKINF_OBTAINED_KOKIRI_EMERALD_DEKU_TREE_DEAD 0x07
#define EVENTCHKINF_09 0x09 #define EVENTCHKINF_09 0x09
#define EVENTCHKINF_0A 0x0A #define EVENTCHKINF_0A 0x0A
#define EVENTCHKINF_0B 0x0B #define EVENTCHKINF_0B 0x0B
@ -392,7 +392,7 @@ typedef enum {
#define EVENTCHKINF_40_MASK (1 << EVENTCHKINF_40_SHIFT) #define EVENTCHKINF_40_MASK (1 << EVENTCHKINF_40_SHIFT)
#define EVENTCHKINF_40 ((EVENTCHKINF_40_INDEX << 4) | EVENTCHKINF_40_SHIFT) #define EVENTCHKINF_40 ((EVENTCHKINF_40_INDEX << 4) | EVENTCHKINF_40_SHIFT)
#define EVENTCHKINF_41 0x41 #define EVENTCHKINF_OBTAINED_ZELDAS_LETTER 0x41
#define EVENTCHKINF_42 0x42 #define EVENTCHKINF_42 0x42
#define EVENTCHKINF_43 0x43 #define EVENTCHKINF_43 0x43
#define EVENTCHKINF_45 0x45 #define EVENTCHKINF_45 0x45

View File

@ -366,11 +366,11 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
case RO_FOREST_CLOSED: case RO_FOREST_CLOSED:
break; break;
case RO_FOREST_CLOSED_DEKU: case RO_FOREST_CLOSED_DEKU:
Flags_SetEventChkInf(7); Flags_SetEventChkInf(EVENTCHKINF_OBTAINED_KOKIRI_EMERALD_DEKU_TREE_DEAD);
break; break;
case RO_FOREST_OPEN: case RO_FOREST_OPEN:
Flags_SetEventChkInf(7); Flags_SetEventChkInf(EVENTCHKINF_OBTAINED_KOKIRI_EMERALD_DEKU_TREE_DEAD);
gSaveContext.eventChkInf[0] |= 0x10; Flags_SetEventChkInf(EVENTCHKINF_SHOWED_MIDO_SWORD_SHIELD);
break; break;
} }
@ -469,7 +469,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
gSaveContext.eventChkInf[1] |= (1 << 4); gSaveContext.eventChkInf[1] |= (1 << 4);
// Set "Got Zelda's Letter" flag. Also ensures Saria is back at SFM. TODO: Is this flag used for anything else? // Set "Got Zelda's Letter" flag. Also ensures Saria is back at SFM. TODO: Is this flag used for anything else?
gSaveContext.eventChkInf[4] |= 1; Flags_SetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER);
// Got item from impa // Got item from impa
gSaveContext.eventChkInf[5] |= 0x200; gSaveContext.eventChkInf[5] |= 0x200;

View File

@ -74,10 +74,10 @@ void BgTreemouth_Init(Actor* thisx, PlayState* play) {
if ((gSaveContext.sceneSetupIndex < 4) && !LINK_IS_ADULT) { if ((gSaveContext.sceneSetupIndex < 4) && !LINK_IS_ADULT) {
BgTreemouth_SetupAction(this, func_808BC8B8); BgTreemouth_SetupAction(this, func_808BC8B8);
// If dungeon entrance randomizer is on, keep the tree mouth open // If dungeon entrance randomizer is on, keep the tree mouth open
// when Link is adult and sword & shield have been shown to mido // when Link is adult and sword & shield have been shown to Mido
} else if ((LINK_IS_ADULT && (!gSaveContext.n64ddFlag || } else if ((LINK_IS_ADULT && (!gSaveContext.n64ddFlag ||
Randomizer_GetSettingValue(RSK_SHUFFLE_DUNGEON_ENTRANCES) == RO_DUNGEON_ENTRANCE_SHUFFLE_OFF) || Randomizer_GetSettingValue(RSK_SHUFFLE_DUNGEON_ENTRANCES) == RO_DUNGEON_ENTRANCE_SHUFFLE_OFF) ||
!Flags_GetEventChkInf(0x4)) || (gSaveContext.sceneSetupIndex == 7)) { !Flags_GetEventChkInf(EVENTCHKINF_SHOWED_MIDO_SWORD_SHIELD)) || (gSaveContext.sceneSetupIndex == 7)) {
this->unk_168 = 0.0f; this->unk_168 = 0.0f;
BgTreemouth_SetupAction(this, BgTreemouth_DoNothing); BgTreemouth_SetupAction(this, BgTreemouth_DoNothing);
} else { } else {

View File

@ -372,8 +372,8 @@ u16 EnMd_GetTextKokiriForest(PlayState* play, EnMd* this) {
this->unk_208 = 0; this->unk_208 = 0;
this->unk_209 = TEXT_STATE_NONE; this->unk_209 = TEXT_STATE_NONE;
if ((!gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) || // In rando, skip talking about the tree being dead so we can have the prompt sword and shield instead
(gSaveContext.n64ddFlag && Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_DEKU_TREE))) { if (!gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) {
return 0x1045; return 0x1045;
} }
@ -482,17 +482,25 @@ s16 func_80AAAF04(PlayState* play, Actor* thisx) {
} }
u8 EnMd_ShouldSpawn(EnMd* this, PlayState* play) { u8 EnMd_ShouldSpawn(EnMd* this, PlayState* play) {
if (play->sceneNum == SCENE_SPOT04) { // In rando, Mido's spawn logic is adjusted to support closed deku/forest options
if (gSaveContext.n64ddFlag) { // He will spawn in the forest if you haven't showed the sword and shield, and will remain
// if we have beaten deku tree or have open forest turned on // in the forest until you've obtained Zelda's letter or Deku Tree dies
// or have already shown mido we have an equipped sword/shield // This is to ensure Deku Tree can still be opened in dungeon entrance rando even if Ghoma is defeated
if (Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_DEKU_TREE) || if (gSaveContext.n64ddFlag) {
gSaveContext.eventChkInf[0] & 0x10) { if (play->sceneNum == SCENE_SPOT10) {
return 0;
}
return 1; return 1;
} }
if (Flags_GetEventChkInf(EVENTCHKINF_SHOWED_MIDO_SWORD_SHIELD) &&
(Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER) ||
Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_KOKIRI_EMERALD_DEKU_TREE_DEAD))) {
return play->sceneNum == SCENE_KOKIRI_HOME4 && !LINK_IS_ADULT;
}
return play->sceneNum == SCENE_SPOT04;
}
if (play->sceneNum == SCENE_SPOT04) {
if (!(gSaveContext.eventChkInf[1] & 0x1000) && !(gSaveContext.eventChkInf[4] & 1)) { if (!(gSaveContext.eventChkInf[1] & 0x1000) && !(gSaveContext.eventChkInf[4] & 1)) {
return 1; return 1;
} }