Skip to content

Commit

Permalink
Restore temp B when B item is none, bow, slingshot, bombchu, or fishi…
Browse files Browse the repository at this point in the history
…ng rod, on save (affecting only local SaveContext in SaveBase). Should be swordless safe.
  • Loading branch information
Malkierian committed Nov 12, 2023
1 parent 9b4da0e commit 17a7f33
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions soh/soh/SaveManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,25 @@ void SaveManager::LoadBaseVersion4() {
SaveManager::Instance->LoadData("dogParams", gSaveContext.dogParams);
}

#define SWORDLESS_STATUS ITEM_NONE_FE

void SaveManager::SaveBase(SaveContext* saveContext, int sectionID, bool fullSave) {
// Restore temp B on local context before saving
if ((saveContext->equips.buttonItems[0] == ITEM_SLINGSHOT) ||
(saveContext->equips.buttonItems[0] == ITEM_BOW) ||
(saveContext->equips.buttonItems[0] == ITEM_BOMBCHU) ||
(saveContext->equips.buttonItems[0] == ITEM_FISHING_POLE) ||
(saveContext->equips.buttonItems[0] == ITEM_NONE)) {
if ((saveContext->equips.buttonItems[0] != ITEM_NONE) || (saveContext->infTable[29] == 0) ||
IS_RANDO && saveContext->buttonStatus[0] == SWORDLESS_STATUS) {
saveContext->equips.buttonItems[0] = saveContext->buttonStatus[0];

if (IS_RANDO && gSaveContext.buttonStatus[0] == SWORDLESS_STATUS) {
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
gSaveContext.buttonStatus[0] = BTN_ENABLED;
}
}
}
SaveManager::Instance->SaveData("entranceIndex", saveContext->entranceIndex);
SaveManager::Instance->SaveData("linkAge", saveContext->linkAge);
SaveManager::Instance->SaveData("cutsceneIndex", saveContext->cutsceneIndex);
Expand Down

0 comments on commit 17a7f33

Please sign in to comment.