summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
authorMalkierian <malkierian@gmail.com>2023-05-24 13:00:35 -0700
committerMalkierian <malkierian@gmail.com>2023-05-24 13:00:35 -0700
commit1fa99fd50aa0dddaf7f2dbb6a83cf54afe5606b6 (patch)
treeaf8f91d8ddd0e8ea87b430244af9e03da3514967 /soh/src/code
parent8d0b83b691f828d5e84484ce02fd9688e3e0ccc0 (diff)
parentfe6705cc4da109b2971fbb19fc7fb5d6cec21682 (diff)
What a nightmare that was.
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/z_parameter.c17
-rw-r--r--soh/src/code/z_play.c17
2 files changed, 31 insertions, 3 deletions
diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c
index 954ce1190..410fd22a4 100644
--- a/soh/src/code/z_parameter.c
+++ b/soh/src/code/z_parameter.c
@@ -15,6 +15,7 @@
#endif
#include "soh/Enhancements/game-interactor/GameInteractor.h"
+#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define DO_ACTION_TEX_WIDTH() 48
@@ -1706,7 +1707,12 @@ u8 Return_Item_Entry(GetItemEntry itemEntry, ItemID returnItem ) {
// Processes Item_Give returns
u8 Return_Item(u8 itemID, ModIndex modId, ItemID returnItem) {
- uint32_t get = GetGIID(itemID);
+ // ITEM_SOLD_OUT doesn't have an ItemTable entry, so pass custom entry instead
+ if (itemID == ITEM_SOLD_OUT) {
+ GetItemEntry gie = { ITEM_SOLD_OUT, 0, 0, 0, 0, 0, 0, 0, false, ITEM_FROM_NPC, ITEM_CATEGORY_LESSER, NULL };
+ return Return_Item_Entry(gie, returnItem);
+ }
+ int32_t get = GetGIID(itemID);
if (get == -1) {
modId = MOD_RANDOMIZER;
get = itemID;
@@ -6158,8 +6164,13 @@ void Interface_Update(PlayState* play) {
u16 tempSaleMod = gSaveContext.pendingSaleMod;
gSaveContext.pendingSale = ITEM_NONE;
gSaveContext.pendingSaleMod = MOD_NONE;
- if (tempSaleMod == 0) {
- tempSaleItem = GetGIID(tempSaleItem);
+ if (tempSaleMod == MOD_NONE) {
+ s16 giid = GetGIID(tempSaleItem);
+ if (giid == -1) {
+ tempSaleMod = MOD_RANDOMIZER;
+ } else {
+ tempSaleItem = giid;
+ }
}
GameInteractor_ExecuteOnSaleEndHooks(ItemTable_RetrieveEntry(tempSaleMod, tempSaleItem));
}
diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c
index 9ac45cdcc..7a9d568bc 100644
--- a/soh/src/code/z_play.c
+++ b/soh/src/code/z_play.c
@@ -604,6 +604,15 @@ void Play_Init(GameState* thisx) {
(s32)(zAllocAligned + zAllocSize) - (s32)(zAllocAligned - zAlloc));
Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL);
+ // In order to keep bunny hood equipped on first load, we need to pre-set the age reqs for the item and slot
+ if (CVarGetInteger("gMMBunnyHood", 0) || CVarGetInteger("gTimelessEquipment", 0)) {
+ gItemAgeReqs[ITEM_MASK_BUNNY] = 9;
+ if(INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY)
+ gSlotAgeReqs[SLOT_TRADE_CHILD] = 9;
+ }
+ else {
+ gItemAgeReqs[ITEM_MASK_BUNNY] = gSlotAgeReqs[SLOT_TRADE_CHILD] = 1;
+ }
func_800304DC(play, &play->actorCtx, play->linkActorEntry);
while (!func_800973FC(play, &play->roomCtx)) {
@@ -751,6 +760,14 @@ void Play_Update(PlayState* play) {
if (CHECK_BTN_ALL(input[0].press.button, BTN_R)) {gSaveContext.sohStats.count[COUNT_BUTTON_PRESSES_R]++;}
if (CHECK_BTN_ALL(input[0].press.button, BTN_Z)) {gSaveContext.sohStats.count[COUNT_BUTTON_PRESSES_Z]++;}
if (CHECK_BTN_ALL(input[0].press.button, BTN_START)) {gSaveContext.sohStats.count[COUNT_BUTTON_PRESSES_START]++;}
+
+ // Start RTA timing on first non-c-up input after intro cutscene
+ if (
+ !gSaveContext.sohStats.fileCreatedAt && !Player_InCsMode(play) &&
+ ((input[0].press.button && input[0].press.button != 0x8) || input[0].rel.stick_x != 0 || input[0].rel.stick_y != 0)
+ ) {
+ gSaveContext.sohStats.fileCreatedAt = GetUnixTimestamp();
+ }
}
if (gTrnsnUnkState != 0) {