mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-16 23:30:15 -05:00
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:
parent
8f0f8c7644
commit
c146ca4aa5
@ -194,26 +194,6 @@ void RegisterSwitchAge() {
|
|||||||
|
|
||||||
/// Switches Link's age and respawns him at the last entrance he entered.
|
/// Switches Link's age and respawns him at the last entrance he entered.
|
||||||
void RegisterOcarinaTimeTravel() {
|
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>([]() {
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnOcarinaSongAction>([]() {
|
||||||
if (!gPlayState) {
|
if (!gPlayState) {
|
||||||
@ -233,6 +213,7 @@ void RegisterOcarinaTimeTravel() {
|
|||||||
if (CVarGetInteger("gTimeTravel", 0) && hasOcarinaOfTime && hasMasterSword &&
|
if (CVarGetInteger("gTimeTravel", 0) && hasOcarinaOfTime && hasMasterSword &&
|
||||||
gPlayState->msgCtx.lastPlayedSong == OCARINA_SONG_TIME && !nearbyTimeBlockEmpty && !nearbyTimeBlock &&
|
gPlayState->msgCtx.lastPlayedSong == OCARINA_SONG_TIME && !nearbyTimeBlockEmpty && !nearbyTimeBlock &&
|
||||||
!nearbyOcarinaSpot && !nearbyFrogs) {
|
!nearbyOcarinaSpot && !nearbyFrogs) {
|
||||||
|
|
||||||
if (gSaveContext.n64ddFlag) {
|
if (gSaveContext.n64ddFlag) {
|
||||||
CVarSetInteger("gSwitchTimeline", 1);
|
CVarSetInteger("gSwitchTimeline", 1);
|
||||||
} else if (!gSaveContext.n64ddFlag && !nearbyDoorOfTime) {
|
} 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
|
// Temple of Time scene where the only object present is the Door of Time
|
||||||
CVarSetInteger("gSwitchTimeline", 1);
|
CVarSetInteger("gSwitchTimeline", 1);
|
||||||
}
|
}
|
||||||
|
ReloadSceneTogglingLinkAge();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1417,7 +1417,7 @@ void Inventory_SwapAgeEquipment(void) {
|
|||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
gSaveContext.childEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
|
gSaveContext.childEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
|
||||||
} else {
|
} else {
|
||||||
if (CVarGetInteger("gSwitchAge", 0) &&
|
if ((CVarGetInteger("gSwitchAge", 0) || CVarGetInteger("gSwitchTimeline", 0)) &&
|
||||||
(gSaveContext.infTable[29] & 1)) {
|
(gSaveContext.infTable[29] & 1)) {
|
||||||
gSaveContext.childEquips.buttonItems[i] = ITEM_NONE;
|
gSaveContext.childEquips.buttonItems[i] = ITEM_NONE;
|
||||||
} else {
|
} else {
|
||||||
@ -1501,7 +1501,8 @@ void Inventory_SwapAgeEquipment(void) {
|
|||||||
gSaveContext.adultEquips.equipment = gSaveContext.equips.equipment;
|
gSaveContext.adultEquips.equipment = gSaveContext.equips.equipment;
|
||||||
|
|
||||||
if (gSaveContext.childEquips.buttonItems[0] != ITEM_NONE ||
|
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++) {
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||||
gSaveContext.equips.buttonItems[i] = gSaveContext.childEquips.buttonItems[i];
|
gSaveContext.equips.buttonItems[i] = gSaveContext.childEquips.buttonItems[i];
|
||||||
|
|
||||||
@ -1542,7 +1543,7 @@ void Inventory_SwapAgeEquipment(void) {
|
|||||||
gSaveContext.equips.equipment = 0x1111;
|
gSaveContext.equips.equipment = 0x1111;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVarGetInteger("gSwitchAge", 0) &&
|
if ((CVarGetInteger("gSwitchAge", 0) || CVarGetInteger("gSwitchTimeline", 0)) &&
|
||||||
(gSaveContext.equips.buttonItems[0] == ITEM_NONE)) {
|
(gSaveContext.equips.buttonItems[0] == ITEM_NONE)) {
|
||||||
gSaveContext.infTable[29] |= 1;
|
gSaveContext.infTable[29] |= 1;
|
||||||
if (gSaveContext.childEquips.equipment == 0) {
|
if (gSaveContext.childEquips.equipment == 0) {
|
||||||
@ -1552,7 +1553,7 @@ void Inventory_SwapAgeEquipment(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CVarSetInteger("gSwitchTimeline", 0);
|
||||||
temp = gEquipMasks[EQUIP_SHIELD] & gSaveContext.equips.equipment;
|
temp = gEquipMasks[EQUIP_SHIELD] & gSaveContext.equips.equipment;
|
||||||
if (temp != 0) {
|
if (temp != 0) {
|
||||||
temp >>= gEquipShifts[EQUIP_SHIELD];
|
temp >>= gEquipShifts[EQUIP_SHIELD];
|
||||||
|
Loading…
Reference in New Issue
Block a user