Fix: SoT Time Travel B-Button Behaviour (#2720)

* time travel allows fishing rod + fixes vanilla ToT age change behaviour

* oops removed too much
This commit is contained in:
inspectredc 2023-04-21 02:53:56 +01:00 committed by GitHub
parent 8f0f8c7644
commit c146ca4aa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 24 deletions

View File

@ -194,26 +194,6 @@ void RegisterSwitchAge() {
/// Switches Link's age and respawns him at the last entrance he entered.
void RegisterOcarinaTimeTravel() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!gPlayState) return;
// For the gTimeTravel: Don't give child Link a Kokiri Sword if we don't have one
if (LINK_AGE_IN_YEARS == 5 && CVarGetInteger("gTimeTravel", 0)) {
uint32_t kokiriSwordBitMask = 1 << 0;
if (!(gSaveContext.inventory.equipment & kokiriSwordBitMask)) {
Player* player = GET_PLAYER(gPlayState);
player->currentSwordItemId = ITEM_NONE;
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_NONE);
}
}
// Switches Link's age and respawns him at the last entrance he entered.
if (CVarGetInteger("gTimeTravel", 0) && CVarGetInteger("gSwitchTimeline", 0)) {
CVarSetInteger("gSwitchTimeline", 0);
ReloadSceneTogglingLinkAge();
}
});
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnOcarinaSongAction>([]() {
if (!gPlayState) {
@ -233,6 +213,7 @@ void RegisterOcarinaTimeTravel() {
if (CVarGetInteger("gTimeTravel", 0) && hasOcarinaOfTime && hasMasterSword &&
gPlayState->msgCtx.lastPlayedSong == OCARINA_SONG_TIME && !nearbyTimeBlockEmpty && !nearbyTimeBlock &&
!nearbyOcarinaSpot && !nearbyFrogs) {
if (gSaveContext.n64ddFlag) {
CVarSetInteger("gSwitchTimeline", 1);
} else if (!gSaveContext.n64ddFlag && !nearbyDoorOfTime) {
@ -240,6 +221,7 @@ void RegisterOcarinaTimeTravel() {
// Temple of Time scene where the only object present is the Door of Time
CVarSetInteger("gSwitchTimeline", 1);
}
ReloadSceneTogglingLinkAge();
}
});
}

View File

@ -1417,7 +1417,7 @@ void Inventory_SwapAgeEquipment(void) {
if (i != 0) {
gSaveContext.childEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
} else {
if (CVarGetInteger("gSwitchAge", 0) &&
if ((CVarGetInteger("gSwitchAge", 0) || CVarGetInteger("gSwitchTimeline", 0)) &&
(gSaveContext.infTable[29] & 1)) {
gSaveContext.childEquips.buttonItems[i] = ITEM_NONE;
} else {
@ -1501,7 +1501,8 @@ void Inventory_SwapAgeEquipment(void) {
gSaveContext.adultEquips.equipment = gSaveContext.equips.equipment;
if (gSaveContext.childEquips.buttonItems[0] != ITEM_NONE ||
CVarGetInteger("gSwitchAge", 0)) {
CVarGetInteger("gSwitchAge", 0) ||
CVarGetInteger("gSwitchTimeline", 0)) {
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
gSaveContext.equips.buttonItems[i] = gSaveContext.childEquips.buttonItems[i];
@ -1542,7 +1543,7 @@ void Inventory_SwapAgeEquipment(void) {
gSaveContext.equips.equipment = 0x1111;
}
if (CVarGetInteger("gSwitchAge", 0) &&
if ((CVarGetInteger("gSwitchAge", 0) || CVarGetInteger("gSwitchTimeline", 0)) &&
(gSaveContext.equips.buttonItems[0] == ITEM_NONE)) {
gSaveContext.infTable[29] |= 1;
if (gSaveContext.childEquips.equipment == 0) {
@ -1552,7 +1553,7 @@ void Inventory_SwapAgeEquipment(void) {
}
}
}
CVarSetInteger("gSwitchTimeline", 0);
temp = gEquipMasks[EQUIP_SHIELD] & gSaveContext.equips.equipment;
if (temp != 0) {
temp >>= gEquipShifts[EQUIP_SHIELD];