Adds OnTransitionEnd hook to GameInteractor, called at the end of a transition after all mid-transition setup is called. (#2635)

Transitions final autosave location to `OnTransitionEnd`.

Adds functionality to autosave to set a delayed save flag if AutoSave is set to Major or All Items and one is obtained in a grotto, to avoid grotto autosaving but still provide for the autosave when location-based saving is off.

Fixes small bug with item lookup where sometimes an item's `modIndex` would sometimes be reported one way, but the way Randomizer does things it would be in a the other `modIndex`, and the lookup would fail.

Minor variable name clarification in ItemTableManager.

Modifies AutoSave to account for item ID overlap from `MOD_RANDOMIZER` table (all items in the randomizer table is considered major for AutoSave purposes except ice traps).
This commit is contained in:
Malkierian 2023-04-02 01:47:23 -07:00 committed by GitHub
commit 04d0cd8532
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 237 additions and 70 deletions

View file

@ -1704,8 +1704,13 @@ u8 Return_Item_Entry(GetItemEntry itemEntry, ItemID returnItem ) {
}
// Processes Item_Give returns
u8 Return_Item(u8 item, ModIndex modId, ItemID returnItem) {
return Return_Item_Entry(ItemTable_RetrieveEntry(modId, item), returnItem);
u8 Return_Item(u8 itemID, ModIndex modId, ItemID returnItem) {
uint32_t get = GetGIID(itemID);
if (get == -1) {
modId = MOD_RANDOMIZER;
get = itemID;
}
return Return_Item_Entry(ItemTable_RetrieveEntry(modId, get), returnItem);
}
/**
@ -2313,7 +2318,7 @@ u8 Item_Give(PlayState* play, u8 item) {
}
u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {
uint16_t item = giEntry.itemId;
uint16_t item = giEntry.getItemId;
uint16_t temp;
uint16_t i;
uint16_t slot;
@ -6196,11 +6201,16 @@ void Interface_Update(PlayState* play) {
Audio_PlaySoundGeneral(NA_SE_SY_RUPY_COUNT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
if (gSaveContext.rupeeAccumulator == 0) {
u16 tempSaleItem = gSaveContext.pendingSale;
u16 tempSaleMod = gSaveContext.pendingSaleMod;
gSaveContext.pendingSale = ITEM_NONE;
gSaveContext.pendingSaleMod = MOD_NONE;
GameInteractor_ExecuteOnSaleEndHooks(ItemTable_RetrieveEntry(tempSaleMod,tempSaleItem));
if (gSaveContext.pendingSale != ITEM_NONE) {
u16 tempSaleItem = gSaveContext.pendingSale;
u16 tempSaleMod = gSaveContext.pendingSaleMod;
gSaveContext.pendingSale = ITEM_NONE;
gSaveContext.pendingSaleMod = MOD_NONE;
if (tempSaleMod == 0) {
tempSaleItem = GetGIID(tempSaleItem);
}
GameInteractor_ExecuteOnSaleEndHooks(ItemTable_RetrieveEntry(tempSaleMod, tempSaleItem));
}
}
} else {
gSaveContext.rupeeAccumulator = 0;