diff --git a/README.md b/README.md index 884710e1f1..e17045a209 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ This is a modding fork of https://github.com/zeldaret/oot, which includes many Q - **Aegiker:** Mirror mode concept - **CYB3RTR0N & ShadowOne333:** JPEG widescreen backgrounds - **Nicko (Airi):** DK64 Expansion Pak warning display -- **Nokaubure:** autosave concept, Gohma debris +- **Nokaubure:** autosave concept, Gohma debris, ISG fix - **OoT Randomizer:** Key chest textures - **Skawo:** Font preloading, Fixes: Kakariko Gate Guard, Stalfos lag, Ingo text - **spaztron64:** Hires mode concept diff --git a/include/save.h b/include/save.h index ef79bf62b5..e6e9f41a1a 100644 --- a/include/save.h +++ b/include/save.h @@ -501,7 +501,7 @@ typedef enum LinkAge { #define BOW_AIMING_RETICLE ((gSaveContext.options[0] >> 14) & 1) // Bits: 14 #define NO_LOW_HEALTH_BEEP ((gSaveContext.options[0] >> 15) & 1) // Bits: 15 #define UNINVERTED_AIMING ((gSaveContext.options[0] >> 16) & 1) // Bits: 16 -#define FIX_POWER_CROUCH_STAB ((gSaveContext.options[0] >> 17) & 1) // Bits: 17 +#define FIX_USEFUL_GLITCHES ((gSaveContext.options[0] >> 17) & 1) // Bits: 17 #define REFLECT_CHEST_CONTENTS ((gSaveContext.options[0] >> 18) & 1) // Bits: 18 #define EASIER_FISHING ((gSaveContext.options[0] >> 19) & 1) // Bits: 19 #define USE_YOUNG_LINK ((gSaveContext.options[0] >> 20) & 1) // Bits: 20 diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 6619908d01..6a97c3ca35 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2490,12 +2490,15 @@ s32 Inventory_HasSpecificBottle(u8 bottleItem) { void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 button) { u8 i; - + PRINTF("item_no=%x, c_no=%x, Pt=%x Item_Register=%x\n", item, button, gSaveContext.save.info.equips.cButtonSlots[button - 1], gSaveContext.save.info.inventory.items[gSaveContext.save.info.equips.cButtonSlots[button - 1]]); if (button >= 4) { + if (FIX_USEFUL_GLITCHES && GET_PLAYER(play)->heldItemAction == PLAYER_IA_BOTTLE && gSaveContext.save.info.inventory.items[DPAD_BUTTON(button-4)] != ITEM_BOTTLE_EMPTY) + return; + if (gSaveContext.save.info.inventory.items[DPAD_BUTTON(button-4)] == ITEM_BOTTLE_MILK_FULL && item == ITEM_BOTTLE_EMPTY) item = ITEM_BOTTLE_MILK_HALF; @@ -2512,6 +2515,9 @@ void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 button) { return; } + if (FIX_USEFUL_GLITCHES && GET_PLAYER(play)->heldItemAction == PLAYER_IA_BOTTLE && gSaveContext.save.info.inventory.items[gSaveContext.save.info.equips.cButtonSlots[button-1]] != ITEM_BOTTLE_EMPTY) + return; + // Special case to only empty half of a Lon Lon Milk Bottle if ((gSaveContext.save.info.inventory.items[gSaveContext.save.info.equips.cButtonSlots[button - 1]] == ITEM_BOTTLE_MILK_FULL) && @@ -4405,7 +4411,7 @@ void Interface_Draw(PlayState* play) { case TIMER_STATE_ENV_HAZARD_INIT: sTimerStateTimer = 20; sTimerNextSecondTimer = 20; - gSaveContext.timerSeconds = gSaveContext.save.info.playerData.health >> 1; + gSaveContext.timerSeconds = gSaveContext.save.info.playerData.health <= 1 ? 1 : (gSaveContext.save.info.playerData.health >> 1); gSaveContext.timerState = TIMER_STATE_ENV_HAZARD_PREVIEW; break; @@ -5140,7 +5146,7 @@ void Interface_Update(PlayState* play) { if (((sEnvHazard == PLAYER_ENV_HAZARD_HOTROOM) || (sEnvHazard == PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) || (sEnvHazard == PLAYER_ENV_HAZARD_UNDERWATER_FREE)) && - ((gSaveContext.save.info.playerData.health >> 1) != 0)) { + (((gSaveContext.save.info.playerData.health >> 1) != 0 && !FIX_USEFUL_GLITCHES) || FIX_USEFUL_GLITCHES)) { gSaveContext.timerState = TIMER_STATE_ENV_HAZARD_INIT; gSaveContext.timerX[TIMER_ID_MAIN] = 140 + WS_SHIFT_HALF; gSaveContext.timerY[TIMER_ID_MAIN] = 80; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 5945a102ff..e35a26eb34 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -3972,6 +3972,9 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { ((itemAction == PLAYER_IA_HOOKSHOT) || (itemAction == PLAYER_IA_LONGSHOT))) || ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && itemAction >= PLAYER_IA_MASK_KEATON && itemAction <= PLAYER_IA_MASK_TRUTH)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && itemAction >= PLAYER_IA_BOTTLE && itemAction <= PLAYER_IA_ZELDAS_LETTER && FIX_USEFUL_GLITCHES) + return; + if ((play->bombchuBowlingStatus == 0) && (((itemAction == PLAYER_IA_DEKU_STICK) && (AMMO(ITEM_DEKU_STICK) == 0)) || ((itemAction == PLAYER_IA_MAGIC_BEAN) && (AMMO(ITEM_MAGIC_BEAN) == 0)) || @@ -7892,6 +7895,8 @@ s32 Player_ActionHandler_2(Player* this, PlayState* play) { } if ((this->heldActor == NULL) || Player_HoldsHookshot(this)) { + if (FIX_USEFUL_GLITCHES) + this->meleeWeaponState = 0; if ((interactedActor->id == ACTOR_BG_TOKI_SWD) && LINK_IS_ADULT) { s32 sp24 = this->itemAction; @@ -9463,7 +9468,7 @@ s32 func_808428D8(Player* this, PlayState* play) { this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H; this->yaw = this->actor.shape.rot.y + this->upperLimbRot.y; - if (FIX_POWER_CROUCH_STAB) { + if (FIX_USEFUL_GLITCHES) { if (Player_HoldsBrokenKnife(this)) swordId = 1; else swordId = Player_GetMeleeWeaponHeld2(this) - 1; @@ -10641,6 +10646,9 @@ void Player_Action_WaitForPutAway(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6; LinkAnimation_Update(play, &this->skelAnime); + if (FIX_USEFUL_GLITCHES) + this->meleeWeaponState = 0; + // Wait for the held item put away process to complete. // Determining if the put away process is complete is a bit complicated: // `Player_UpdateUpperBody` will only return false if the current UpperAction returns false. @@ -13167,6 +13175,9 @@ void Player_Action_Talk(Player* this, PlayState* play) { return; } + if (FIX_USEFUL_GLITCHES) + this->meleeWeaponState = 0; + if (this->stateFlags1 & PLAYER_STATE1_23) { Player_Action_8084CC98(this, play); } else if (func_808332B8(this)) { diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_options.c b/src/overlays/gamestates/ovl_file_choose/z_file_options.c index e641afcfea..b785d66261 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_options.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_options.c @@ -121,7 +121,7 @@ static FileSelectOptionsEntry sFileOptionsEntries[] = { { 0, "Bow Aiming Reticle", FileSelectOptions_ToggleOption, FileSelectOptions_GetOption, 0, 14 }, { 0, "No Low Health Beep", FileSelectOptions_ToggleOption, FileSelectOptions_GetOption, 0, 15 }, { 0, "Uninverted Aiming", FileSelectOptions_ToggleOption, FileSelectOptions_GetOption, 0, 16 }, - { 0, "Fix Power Crouch Stab", FileSelectOptions_ToggleOption, FileSelectOptions_GetOption, 0, 17 }, + { 0, "Fix Useful Glitches", FileSelectOptions_ToggleOption, FileSelectOptions_GetOption, 0, 17 }, { 0, "Reflect Chest Contents", FileSelectOptions_ToggleOption, FileSelectOptions_GetOption, 0, 18 }, { 0, "Easier Fishing", FileSelectOptions_ToggleOption, FileSelectOptions_GetOption, 0, 19 }, { 0, "Use MM Young Link", FileSelectOptions_ToggleOption, FileSelectOptions_GetOption, 0, 20 }, diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 1c1a5bc26f..709ae95734 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -383,6 +383,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { } if (cursorItem != PAUSE_ITEM_NONE) { + bool canSelectItem = true; index = cursorSlot * 4; // required to match? KaleidoScope_SetCursorPos(pauseCtx, index, pauseCtx->itemVtx); @@ -394,7 +395,10 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { KaleidoScope_DrawSwapItemIcons(play, gSaveContext.save.info.inventory.items[SLOT_TRADE_CHILD], KaleidoScope_GetNextMask(), pauseCtx->alpha); } - if (CHECK_BTN_ANY(input->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) { + if (FIX_USEFUL_GLITCHES && pauseCtx->mainState != PAUSE_MAIN_STATE_IDLE) + canSelectItem = false;; + + if (CHECK_BTN_ANY(input->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT) && canSelectItem) { if (CHECK_AGE_REQ_SLOT(cursorSlot) && (cursorItem != ITEM_SOLD_OUT)) { if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { pauseCtx->equipTargetCBtn = 0; @@ -439,7 +443,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } - else if (CHECK_BTN_ANY(input->press.button, BTN_DUP | BTN_DRIGHT | BTN_DDOWN | BTN_DLEFT)) { + else if (CHECK_BTN_ANY(input->press.button, BTN_DUP | BTN_DRIGHT | BTN_DDOWN | BTN_DLEFT) && canSelectItem) { if (CHECK_AGE_REQ_SLOT(cursorSlot) && (cursorItem != ITEM_SOLD_OUT)) { u8 button;