mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 19:02:19 -05:00
limit entrance discovered saving to end of operation (#3459)
This commit is contained in:
parent
d523b104d8
commit
dd5e72a023
@ -76,7 +76,7 @@ static s16 newIceCavernEntrance = ICE_CAVERN_ENTRANCE;
|
||||
static s8 hasCopiedEntranceTable = 0;
|
||||
static s8 hasModifiedEntranceTable = 0;
|
||||
|
||||
void Entrance_SetEntranceDiscovered(u16 entranceIndex);
|
||||
void Entrance_SetEntranceDiscovered(u16 entranceIndex, u8 isReversedEntrance);
|
||||
|
||||
u8 Entrance_EntranceIsNull(EntranceOverride* entranceOverride) {
|
||||
return entranceOverride->index == 0 && entranceOverride->destination == 0 && entranceOverride->blueWarp == 0
|
||||
@ -276,13 +276,13 @@ s16 Entrance_OverrideNextIndex(s16 nextEntranceIndex) {
|
||||
return nextEntranceIndex;
|
||||
}
|
||||
|
||||
Entrance_SetEntranceDiscovered(nextEntranceIndex);
|
||||
Entrance_SetEntranceDiscovered(nextEntranceIndex, false);
|
||||
EntranceTracker_SetLastEntranceOverride(nextEntranceIndex);
|
||||
return Grotto_OverrideSpecialEntrance(Entrance_GetOverride(nextEntranceIndex));
|
||||
}
|
||||
|
||||
s16 Entrance_OverrideDynamicExit(s16 dynamicExitIndex) {
|
||||
Entrance_SetEntranceDiscovered(dynamicExitList[dynamicExitIndex]);
|
||||
Entrance_SetEntranceDiscovered(dynamicExitList[dynamicExitIndex], false);
|
||||
EntranceTracker_SetLastEntranceOverride(dynamicExitList[dynamicExitIndex]);
|
||||
return Grotto_OverrideSpecialEntrance(Entrance_GetOverride(dynamicExitList[dynamicExitIndex]));
|
||||
}
|
||||
@ -784,7 +784,7 @@ u8 Entrance_GetIsEntranceDiscovered(u16 entranceIndex) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Entrance_SetEntranceDiscovered(u16 entranceIndex) {
|
||||
void Entrance_SetEntranceDiscovered(u16 entranceIndex, u8 isReversedEntrance) {
|
||||
// Skip if already set to save time from setting the connected entrance or
|
||||
// if this entrance is outside of the randomized entrance range (i.e. is a dynamic entrance)
|
||||
if (entranceIndex > MAX_ENTRANCE_RANDO_USED_INDEX || Entrance_GetIsEntranceDiscovered(entranceIndex)) {
|
||||
@ -796,14 +796,20 @@ void Entrance_SetEntranceDiscovered(u16 entranceIndex) {
|
||||
if (idx < SAVEFILE_ENTRANCES_DISCOVERED_IDX_COUNT) {
|
||||
u32 entranceBit = 1 << (entranceIndex - (idx * bitsPerIndex));
|
||||
gSaveContext.sohStats.entrancesDiscovered[idx] |= entranceBit;
|
||||
// Set connected
|
||||
|
||||
// Set reverse entrance when not decoupled
|
||||
if (!Randomizer_GetSettingValue(RSK_DECOUPLED_ENTRANCES) && !isReversedEntrance) {
|
||||
for (size_t i = 0; i < ENTRANCE_OVERRIDES_MAX_COUNT; i++) {
|
||||
if (entranceIndex == gSaveContext.entranceOverrides[i].index) {
|
||||
Entrance_SetEntranceDiscovered(gSaveContext.entranceOverrides[i].overrideDestination);
|
||||
Entrance_SetEntranceDiscovered(gSaveContext.entranceOverrides[i].overrideDestination, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Save entrancesDiscovered
|
||||
}
|
||||
|
||||
// Save entrancesDiscovered when it is not the reversed entrance
|
||||
if (!isReversedEntrance) {
|
||||
Save_SaveSection(SECTION_ID_ENTRANCES);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void Entrance_OverrideSpawnScene(int32_t sceneNum, int32_t spawn);
|
||||
int32_t Entrance_OverrideSpawnSceneRoom(int32_t sceneNum, int32_t spawn, int32_t room);
|
||||
void Entrance_EnableFW(void);
|
||||
uint8_t Entrance_GetIsEntranceDiscovered(uint16_t entranceIndex);
|
||||
void Entrance_SetEntranceDiscovered(uint16_t entranceIndex);
|
||||
void Entrance_SetEntranceDiscovered(uint16_t entranceIndex, uint8_t isReversedEntrance);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -140,7 +140,7 @@ s16 Grotto_OverrideSpecialEntrance(s16 nextEntranceIndex) {
|
||||
// If Link hits a grotto exit, load the entrance index from the grotto exit list
|
||||
// based on the current grotto ID
|
||||
if (nextEntranceIndex == 0x7FFF) {
|
||||
Entrance_SetEntranceDiscovered(ENTRANCE_RANDO_GROTTO_EXIT_START + grottoId);
|
||||
Entrance_SetEntranceDiscovered(ENTRANCE_RANDO_GROTTO_EXIT_START + grottoId, false);
|
||||
EntranceTracker_SetLastEntranceOverride(ENTRANCE_RANDO_GROTTO_EXIT_START + grottoId);
|
||||
nextEntranceIndex = grottoExitList[grottoId];
|
||||
}
|
||||
@ -211,7 +211,7 @@ void Grotto_OverrideActorEntrance(Actor* thisx) {
|
||||
|
||||
if (grottoContent == grottoLoadTable[index].content && gPlayState->sceneNum == grottoLoadTable[index].scene) {
|
||||
// Find the override for the matching index from the grotto Load List
|
||||
Entrance_SetEntranceDiscovered(ENTRANCE_RANDO_GROTTO_LOAD_START + index);
|
||||
Entrance_SetEntranceDiscovered(ENTRANCE_RANDO_GROTTO_LOAD_START + index, false);
|
||||
EntranceTracker_SetLastEntranceOverride(ENTRANCE_RANDO_GROTTO_LOAD_START + index);
|
||||
index = grottoLoadList[index];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user