mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-21 05:43:42 -07:00
[GameInteractor] Game Hooks (#2481)
This commit is contained in:
parent
2c10bca615
commit
8934274c67
10 changed files with 230 additions and 121 deletions
|
@ -1738,7 +1738,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
func_8006D0AC(play);
|
||||
}
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_SONG_MINUET) && (item <= ITEM_SONG_STORMS)) {
|
||||
gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_SONG_MINUET + QUEST_SONG_MINUET];
|
||||
|
@ -1750,7 +1750,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
gBitFlags[item - ITEM_SONG_MINUET + QUEST_SONG_MINUET], gBitFlags[item - ITEM_SONG_MINUET]);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_KOKIRI_EMERALD) && (item <= ITEM_ZORA_SAPPHIRE)) {
|
||||
gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_KOKIRI_EMERALD + QUEST_KOKIRI_EMERALD];
|
||||
|
@ -1759,7 +1759,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
osSyncPrintf("精霊石 = %x\n", gSaveContext.inventory.questItems); // "Spiritual Stones = %x"
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if ((item == ITEM_STONE_OF_AGONY) || (item == ITEM_GERUDO_CARD)) {
|
||||
gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_STONE_OF_AGONY + QUEST_STONE_OF_AGONY];
|
||||
|
@ -1768,7 +1768,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
osSyncPrintf("アイテム = %x\n", gSaveContext.inventory.questItems); // "Items = %x"
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_SKULL_TOKEN) {
|
||||
gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_SKULL_TOKEN + QUEST_SKULL_TOKEN];
|
||||
|
@ -1779,7 +1779,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
osSyncPrintf("Nコイン = %x(%d)\n", gSaveContext.inventory.questItems, gSaveContext.inventory.gsTokens);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) {
|
||||
gSaveContext.inventory.equipment |= gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD];
|
||||
|
@ -1811,19 +1811,19 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
}
|
||||
}
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) {
|
||||
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) {
|
||||
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) {
|
||||
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if ((item == ITEM_KEY_BOSS) || (item == ITEM_COMPASS) || (item == ITEM_DUNGEON_MAP)) {
|
||||
// Boss Key, Compass, and Dungeon Map exceptions for rando.
|
||||
|
@ -1840,7 +1840,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
} else {
|
||||
gSaveContext.inventory.dungeonItems[gSaveContext.mapIndex] |= gBitFlags[item - ITEM_KEY_BOSS];
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_KEY_SMALL) {
|
||||
// Small key exceptions for rando with keysanity off.
|
||||
|
@ -1851,11 +1851,11 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
gSaveContext.sohStats.dungeonKeys[13]++;
|
||||
if (gSaveContext.inventory.dungeonKeys[13] < 0) {
|
||||
gSaveContext.inventory.dungeonKeys[13] = 1;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else {
|
||||
gSaveContext.inventory.dungeonKeys[13]++;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -1864,11 +1864,11 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
gSaveContext.sohStats.dungeonKeys[6]++;
|
||||
if (gSaveContext.inventory.dungeonKeys[6] < 0) {
|
||||
gSaveContext.inventory.dungeonKeys[6] = 1;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else {
|
||||
gSaveContext.inventory.dungeonKeys[6]++;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -1876,11 +1876,11 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
gSaveContext.sohStats.dungeonKeys[gSaveContext.mapIndex]++;
|
||||
if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] < 0) {
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = 1;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else {
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]++;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
} else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) {
|
||||
|
@ -1888,7 +1888,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
Inventory_ChangeUpgrade(UPG_QUIVER, 1);
|
||||
INV_CONTENT(ITEM_BOW) = ITEM_BOW;
|
||||
AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 1);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else {
|
||||
AMMO(ITEM_BOW)++;
|
||||
|
@ -1899,29 +1899,29 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
} else if (item == ITEM_QUIVER_40) {
|
||||
Inventory_ChangeUpgrade(UPG_QUIVER, 2);
|
||||
AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 2);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_QUIVER_50) {
|
||||
Inventory_ChangeUpgrade(UPG_QUIVER, 3);
|
||||
AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 3);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_BULLET_BAG_40) {
|
||||
Inventory_ChangeUpgrade(UPG_BULLET_BAG, 2);
|
||||
AMMO(ITEM_SLINGSHOT) = CAPACITY(UPG_BULLET_BAG, 2);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_BULLET_BAG_50) {
|
||||
Inventory_ChangeUpgrade(UPG_BULLET_BAG, 3);
|
||||
AMMO(ITEM_SLINGSHOT) = CAPACITY(UPG_BULLET_BAG, 3);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_BOMB_BAG_20) {
|
||||
if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) {
|
||||
Inventory_ChangeUpgrade(UPG_BOMB_BAG, 1);
|
||||
INV_CONTENT(ITEM_BOMB) = ITEM_BOMB;
|
||||
AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 1);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else {
|
||||
AMMO(ITEM_BOMB)++;
|
||||
|
@ -1932,46 +1932,46 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
} else if (item == ITEM_BOMB_BAG_30) {
|
||||
Inventory_ChangeUpgrade(UPG_BOMB_BAG, 2);
|
||||
AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 2);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_BOMB_BAG_40) {
|
||||
Inventory_ChangeUpgrade(UPG_BOMB_BAG, 3);
|
||||
AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 3);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_BRACELET) {
|
||||
Inventory_ChangeUpgrade(UPG_STRENGTH, 1);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_GAUNTLETS_SILVER) {
|
||||
Inventory_ChangeUpgrade(UPG_STRENGTH, 2);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_GAUNTLETS_GOLD) {
|
||||
Inventory_ChangeUpgrade(UPG_STRENGTH, 3);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_SCALE_SILVER) {
|
||||
Inventory_ChangeUpgrade(UPG_SCALE, 1);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_SCALE_GOLDEN) {
|
||||
Inventory_ChangeUpgrade(UPG_SCALE, 2);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_WALLET_ADULT) {
|
||||
Inventory_ChangeUpgrade(UPG_WALLET, 1);
|
||||
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_FULL_WALLETS)) {
|
||||
Rupees_ChangeBy(200);
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_WALLET_GIANT) {
|
||||
Inventory_ChangeUpgrade(UPG_WALLET, 2);
|
||||
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_FULL_WALLETS)) {
|
||||
Rupees_ChangeBy(500);
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_STICK_UPGRADE_20) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
|
@ -1979,7 +1979,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
}
|
||||
Inventory_ChangeUpgrade(UPG_STICKS, 2);
|
||||
AMMO(ITEM_STICK) = CAPACITY(UPG_STICKS, 2);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_STICK_UPGRADE_30) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
|
@ -1987,7 +1987,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
}
|
||||
Inventory_ChangeUpgrade(UPG_STICKS, 3);
|
||||
AMMO(ITEM_STICK) = CAPACITY(UPG_STICKS, 3);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_NUT_UPGRADE_30) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
|
@ -1995,7 +1995,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
}
|
||||
Inventory_ChangeUpgrade(UPG_NUTS, 2);
|
||||
AMMO(ITEM_NUT) = CAPACITY(UPG_NUTS, 2);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_NUT_UPGRADE_40) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
|
@ -2003,7 +2003,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
}
|
||||
Inventory_ChangeUpgrade(UPG_NUTS, 3);
|
||||
AMMO(ITEM_NUT) = CAPACITY(UPG_NUTS, 3);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_LONGSHOT) {
|
||||
INV_CONTENT(item) = item;
|
||||
|
@ -2037,7 +2037,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
}
|
||||
}
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_STICK) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
|
@ -2090,40 +2090,40 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
if ((AMMO(ITEM_BOMB) += 1) > CUR_CAPACITY(UPG_BOMB_BAG)) {
|
||||
AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG);
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if ((item >= ITEM_BOMBS_5) && (item <= ITEM_BOMBS_30)) {
|
||||
if ((AMMO(ITEM_BOMB) += sAmmoRefillCounts[item - ITEM_BOMBS_5]) > CUR_CAPACITY(UPG_BOMB_BAG)) {
|
||||
AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG);
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_BOMBCHU) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU;
|
||||
AMMO(ITEM_BOMBCHU) = 10;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else {
|
||||
AMMO(ITEM_BOMBCHU) += 10;
|
||||
if (AMMO(ITEM_BOMBCHU) > 50) {
|
||||
AMMO(ITEM_BOMBCHU) = 50;
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
} else if ((item == ITEM_BOMBCHUS_5) || (item == ITEM_BOMBCHUS_20)) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU;
|
||||
AMMO(ITEM_BOMBCHU) += sAmmoRefillCounts[item - ITEM_BOMBCHUS_5 + 8];
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else {
|
||||
AMMO(ITEM_BOMBCHU) += sAmmoRefillCounts[item - ITEM_BOMBCHUS_5 + 8];
|
||||
if (AMMO(ITEM_BOMBCHU) > 50) {
|
||||
AMMO(ITEM_BOMBCHU) = 50;
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
} else if ((item >= ITEM_ARROWS_SMALL) && (item <= ITEM_ARROWS_LARGE)) {
|
||||
|
@ -2135,13 +2135,13 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
|
||||
osSyncPrintf("%d本 Item_MaxGet=%d\n", AMMO(ITEM_BOW), CUR_CAPACITY(UPG_QUIVER));
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_BOW;
|
||||
} else if (item == ITEM_SLINGSHOT) {
|
||||
Inventory_ChangeUpgrade(UPG_BULLET_BAG, 1);
|
||||
INV_CONTENT(ITEM_SLINGSHOT) = ITEM_SLINGSHOT;
|
||||
AMMO(ITEM_SLINGSHOT) = 30;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_SEEDS) {
|
||||
AMMO(ITEM_SLINGSHOT) += 5;
|
||||
|
@ -2152,11 +2152,11 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
|
||||
if (!(gSaveContext.itemGetInf[1] & 8)) {
|
||||
gSaveContext.itemGetInf[1] |= 8;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_SEEDS;
|
||||
} else if (item == ITEM_SEEDS_30) {
|
||||
AMMO(ITEM_SLINGSHOT) += 30;
|
||||
|
@ -2167,15 +2167,15 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
|
||||
if (!(gSaveContext.itemGetInf[1] & 8)) {
|
||||
gSaveContext.itemGetInf[1] |= 8;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_SEEDS;
|
||||
} else if (item == ITEM_OCARINA_FAIRY) {
|
||||
INV_CONTENT(ITEM_OCARINA_FAIRY) = ITEM_OCARINA_FAIRY;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_OCARINA_TIME) {
|
||||
INV_CONTENT(ITEM_OCARINA_TIME) = ITEM_OCARINA_TIME;
|
||||
|
@ -2208,7 +2208,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
}
|
||||
}
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_BEAN) {
|
||||
if (gSaveContext.inventory.items[slot] == ITEM_NONE) {
|
||||
|
@ -2219,25 +2219,25 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
AMMO(ITEM_BEAN)++;
|
||||
BEANS_BOUGHT++;
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if ((item == ITEM_HEART_PIECE_2) || (item == ITEM_HEART_PIECE)) {
|
||||
gSaveContext.inventory.questItems += 1 << (QUEST_HEART_PIECE + 4);
|
||||
gSaveContext.sohStats.heartPieces++;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_HEART_CONTAINER) {
|
||||
gSaveContext.healthCapacity += 0x10;
|
||||
gSaveContext.health += 0x10;
|
||||
gSaveContext.sohStats.heartContainers++;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_HEART) {
|
||||
osSyncPrintf("回復ハート回復ハート回復ハート\n"); // "Recovery Heart"
|
||||
if (play != NULL) {
|
||||
Health_ChangeBy(play, 0x10);
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return item;
|
||||
} else if (item == ITEM_MAGIC_SMALL) {
|
||||
if (gSaveContext.magicState != 10) {
|
||||
|
@ -2252,11 +2252,11 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
|
||||
if (!(gSaveContext.infTable[25] & 0x100)) {
|
||||
gSaveContext.infTable[25] |= 0x100;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return item;
|
||||
} else if (item == ITEM_MAGIC_LARGE) {
|
||||
if (gSaveContext.magicState != 10) {
|
||||
|
@ -2270,15 +2270,15 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
|
||||
if (!(gSaveContext.infTable[25] & 0x100)) {
|
||||
gSaveContext.infTable[25] |= 0x100;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return item;
|
||||
} else if ((item >= ITEM_RUPEE_GREEN) && (item <= ITEM_INVALID_8)) {
|
||||
Rupees_ChangeBy(sAmmoRefillCounts[item - ITEM_RUPEE_GREEN + 10]);
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_BOTTLE) {
|
||||
temp = SLOT(item);
|
||||
|
@ -2286,7 +2286,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
for (i = 0; i < 4; i++) {
|
||||
if (gSaveContext.inventory.items[temp + i] == ITEM_NONE) {
|
||||
gSaveContext.inventory.items[temp + i] = item;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -2318,7 +2318,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
}
|
||||
|
||||
gSaveContext.inventory.items[temp + i] = item;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -2326,7 +2326,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
for (i = 0; i < 4; i++) {
|
||||
if (gSaveContext.inventory.items[temp + i] == ITEM_NONE) {
|
||||
gSaveContext.inventory.items[temp + i] = item;
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -2354,13 +2354,13 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
} else {
|
||||
gSaveContext.equips.buttonItems[i] = ITEM_NONE;
|
||||
}
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return ITEM_NONE;
|
||||
}
|
||||
|
||||
|
@ -2368,7 +2368,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
osSyncPrintf("Item_Register(%d)=%d %d\n", slot, item, temp);
|
||||
INV_CONTENT(item) = item;
|
||||
|
||||
PerformAutosave(play, item);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(item);
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
@ -2721,60 +2721,6 @@ u8 Item_CheckObtainability(u8 item) {
|
|||
return gSaveContext.inventory.items[slot];
|
||||
}
|
||||
|
||||
// Save when receiving an item, unless it's purchased from a shop
|
||||
void PerformAutosave(PlayState* play, u8 item) {
|
||||
if (CVarGetInteger("gAutosave", 0) && (play != NULL) && (play->sceneNum != SCENE_KENJYANOMA) && (gSaveContext.pendingSale == ITEM_NONE) && (play->sceneNum != SCENE_GANON_DEMO)) {
|
||||
if (CVarGetInteger("gAutosaveAllItems", 0)) {
|
||||
Play_PerformSave(play);
|
||||
} else if (CVarGetInteger("gAutosaveMajorItems", 1)) {
|
||||
switch (item) {
|
||||
case ITEM_STICK:
|
||||
case ITEM_NUT:
|
||||
case ITEM_BOMB:
|
||||
case ITEM_BOW:
|
||||
case ITEM_SEEDS:
|
||||
case ITEM_FISHING_POLE:
|
||||
case ITEM_MAGIC_SMALL:
|
||||
case ITEM_MAGIC_LARGE:
|
||||
case ITEM_INVALID_4:
|
||||
case ITEM_INVALID_5:
|
||||
case ITEM_INVALID_6:
|
||||
case ITEM_INVALID_7:
|
||||
case ITEM_HEART:
|
||||
case ITEM_RUPEE_GREEN:
|
||||
case ITEM_RUPEE_BLUE:
|
||||
case ITEM_RUPEE_RED:
|
||||
case ITEM_RUPEE_PURPLE:
|
||||
case ITEM_RUPEE_GOLD:
|
||||
case ITEM_INVALID_8:
|
||||
case ITEM_STICKS_5:
|
||||
case ITEM_STICKS_10:
|
||||
case ITEM_NUTS_5:
|
||||
case ITEM_NUTS_10:
|
||||
case ITEM_BOMBS_5:
|
||||
case ITEM_BOMBS_10:
|
||||
case ITEM_BOMBS_20:
|
||||
case ITEM_BOMBS_30:
|
||||
case ITEM_ARROWS_SMALL:
|
||||
case ITEM_ARROWS_MEDIUM:
|
||||
case ITEM_ARROWS_LARGE:
|
||||
case ITEM_SEEDS_30:
|
||||
break;
|
||||
case ITEM_BOMBCHU:
|
||||
case ITEM_BOMBCHUS_5:
|
||||
case ITEM_BOMBCHUS_20:
|
||||
if (!CVarGetInteger("gBombchuDrops", 0)) {
|
||||
Play_PerformSave(play);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Play_PerformSave(play);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Inventory_DeleteItem(u16 item, u16 invSlot) {
|
||||
s16 i;
|
||||
|
||||
|
@ -6300,7 +6246,7 @@ void Interface_Update(PlayState* play) {
|
|||
if (gSaveContext.rupeeAccumulator == 0) {
|
||||
u16 tempSaleItem = gSaveContext.pendingSale;
|
||||
gSaveContext.pendingSale = ITEM_NONE;
|
||||
PerformAutosave(play, tempSaleItem);
|
||||
GameInteractor_ExecuteOnReceiveItemHooks(tempSaleItem);
|
||||
}
|
||||
} else {
|
||||
gSaveContext.rupeeAccumulator = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue